Repository navigation
docs: document verify-workflow, pilot-packet, validate-specs and telemetry - #153
Conversation
…metry (DiffCI#128) Signed-off-by: sarankumar1325 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01ae6fb482
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| npx @diffci.com/diffci@latest verify-workflow --repo . | ||
| ``` | ||
|
|
||
| `verify-workflow` reads the YAML files in `.github/workflows` and finds the jobs that run the DiffCI action as an observer. It then checks that these jobs can't change what the rest of CI does. Findings are marked `[BLOCKING]` or `[WARNING]` and have stable codes. For example: |
There was a problem hiding this comment.
Limit the audit claim to blocking interference
When the audit finds only warnings such as JOB_SHARES_CONCURRENCY_GROUP (whose message says one job can cancel another) or JOB_HAS_WRITE_PERMISSIONS, runVerifyWorkflow still exits 0 because only BLOCKING findings fail. Saying these jobs "can't change" CI overstates what a successful exit proves; describe the command as checking for blocking interference or make these cases blocking.
Useful? React with 👍 / 👎.
| `verify-workflow --enforce [--default-branch main] [--full-command "<cmd>"]` checks the opposite for enforce mode. It confirms three things: | ||
|
|
||
| - a job runs `diffci verify --policy enforce` as a gate (a `continue-on-error` dry run doesn't count); | ||
| - that job is switched on and off by the `vars.DIFFCI_ENFORCE` repository variable; |
There was a problem hiding this comment.
Check the job condition before claiming it is switched off
An enforce workflow that passes DIFFCI_ENFORCE: ${{ vars.DIFFCI_ENFORCE }} to verify --policy enforce but has no job-level if still passes auditEnforceWorkflows: it checks the variable's environment wiring, not the job condition. When the variable is off, verify still runs and falls back to the full suite rather than switching the job off. Clarify that the variable disables selective enforcement, or make the audit check the job condition.
Useful? React with 👍 / 👎.
| - `diffci-observe.json`: the raw observation report. | ||
| - `diffci-observe.yml`: a non-blocking observation workflow for you to review. It isn't installed. | ||
|
|
||
| `--label` names the repository in the packet (default: the checkout's folder name). `--repository-url` adds a link and must be `https://`. `--redact-paths` keeps file paths out of the report. |
There was a problem hiding this comment.
Redact every report path before promising a shareable packet
With --redact-paths, observe() hashes result paths but still embeds workflow findings from safeAuditWorkflows(repoPath) and passes fallbackDetails through unchanged. A report with a workflow finding or fallback can therefore still expose raw names such as .github/workflows/ci.yml despite this promise. Redact all path-bearing report fields or narrow the claim before users share the packet.
Useful? React with 👍 / 👎.
| npx @diffci.com/diffci@latest telemetry --mode count-only # count runs without the repository name | ||
| ``` | ||
|
|
||
| Usage counting is **on by default**. After each `plan`, `check`, `observe` and `verify` run, DiffCI sends a small count. It includes the command, the outcome, the version, where it ran, a random installation ID and the repository name (host/owner/repo). It never sends code, paths, commits, test names or reports. [Usage counting](telemetry.md) has the full field list. |
There was a problem hiding this comment.
Correct the default installation-ID claim
On a fresh install, readTelemetryPreference() returns the default repo mode without an installation ID, and recordUsage() sends the ID only when one is already present; an ID is created by explicitly running telemetry --mode repo. Thus default counts can include a recognizable repository name but do not include the random installation ID claimed here, so install-level usage metrics are missing it. Generate and save the ID for the default mode or qualify this statement.
Useful? React with 👍 / 👎.
…n-ID claims to what the code does Signed-off-by: sarankumar1325 <[email protected]>
adityankale190895
left a comment
There was a problem hiding this comment.
Thanks, this is a thorough write-up. I checked the finding codes and severities, the --enforce flags, the pilot-packet defaults and the telemetry env vars against the code, and they all match.
One sentence needs fixing. The telemetry section says:
On the command line,
--modetakes onlyrepoorcount-only; anything else exits 1.
configureTelemetry runs --mode through normaliseMode too, so the CLI also accepts off and anonymous (both become count-only) and installations (becomes repo). Only an unknown value like bogus exits 1. You noted this in the PR description, so the doc should match. Something like: "--mode takes repo or count-only; the older names are still accepted and mapped the same way, and any other value exits 1."
Once that's in, this is ready to merge.
Signed-off-by: sarankumar1325 <[email protected]>
adityankale190895
left a comment
There was a problem hiding this comment.
The --mode sentence is fixed in ac24c55. Thanks, merging.
The tool description promised digests for every path in the report. Workflow findings and some fallback details still name files, as the #153 review found and docs/using-diffci.md already says. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adityankale190895 <[email protected]>
Closes #128.
Adds a "More commands" section to
docs/using-diffci.md, just before "Interpret the result", with a short index and one subsection per command. Each subsection says what the command does, gives an example and explains the exit codes. It also says what the command reads, writes and sends. Docs only.I ran every example on a small synthetic TypeScript repository (one source file, one
node:testfile, one observer workflow), using the CLI from this branch (tsx packages/diffci-cli/src/client/cli.ts). The outputs and exit codes quoted come from those runs:verify-workflow:
ACTION_NOT_PINNEDwarning;continue-on-error, with theJOB_NOT_CONTINUE_ON_ERRORoutput shown in the doc;--enforceexits 1 withENFORCE_JOB_MISSINGandFULL_SUITE_NOT_ON_DEFAULT_BRANCH.The finding codes come from
workflow-guard.ts.pilot-packet:
OBSERVED), writing the three files to../diffci-output;REFUSED) on a plain-JS repo with no tsconfig;git statusin the checkout was clean afterwards.The exit-2 cases come from
runPilotPacket.validate-specs: conflict exits 1, clean exits 0,
--jsonprints the report, and a wrong file shape or a missing--fileexits 1. The input rules come fromspec-conflicts.ts.telemetry: shows the choice;
--mode count-only/reporewritetelemetry.json(count-only drops the installation ID);--mode offis still accepted and maps to count-only;--mode bogusexits 1. The section links todocs/telemetry.mdfor the field list instead of copying it.Two places where the issue no longer matches the code, so the docs follow the code:
off|anonymous|installations. Since then, usage counting is on by default, the modes arerepo|count-only, and the old names are mapped. OnlyDO_NOT_TRACK=1,DIFFCI_NO_SEND=1orDIFFCI_SHARE_USAGE=0stop it;--no-sendstops report uploads only. The doc says this plainly.--share-usagestill appears in the usage text forverify,checkandobserve, but nothing inpackages/diffci-cli/srcreads it any more, so I left it out of the doc. You may want to drop it from the usage text, or tell me what it should say.npm test(1100 pass),npm run typecheckandnpm run audit:boundarypass.Written with an AI coding assistant; I reviewed and checked every statement against the code and the runs above.
Update (32fa0da): I checked the four Codex findings against the code, and all four were right. The doc now says:
verify-workflowpassing means no blocking interference, and each listed code shows its severity. AddedJOB_SHARES_CONCURRENCY_GROUP.--enforcechecks thatDIFFCI_ENFORCEis wired tovars.DIFFCI_ENFORCE, not a job-levelif:.--redact-pathshashes result paths, but workflow findings and some fallback details can still name files.telemetry --mode repohas saved one; a never-configured default sends none.Related, not changed here:
docs/telemetry.mdsays the installation ID is "created locally" as if that always happens, and has the same gap.