Skip to content

fix(cli): plan verify --redact-paths with real paths, redact the receipt - #276

Merged
adityankale190895 merged 4 commits into
DiffCI:mainfrom
FredApps:fix/verify-redact-paths-selection
Nov 18, 2026
Merged

adityankale190895 merged 4 commits into
DiffCI:mainfrom
FredApps:fix/verify-redact-paths-selection

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #275

Changed behavior

verify --redact-paths (--changed, --staged, --paths and commit-range) now plans with the real paths, so the selected tests run as they do without redaction. Only the receipt is redacted, after the run.

The receipt (which is also what goes to --json, the receipt file and the local outcome log) carries the same sha256-12 digests the observation report uses:

  • selected_tests, and the selection_reasons keys and changed_file values;
  • the selected, outside-suite and changed paths wherever command, commands, first_pass.commands, execution.command, reason and required_actions name them.

What stays as it was under redaction:

  • The coverage map and the first pass stay off.
  • Enforce still treats the paths as redacted, so it keeps its global-risk fallback, and its detail never names a real path.
  • Fields that were not redacted before are unchanged: runner output tails, gate check commands and the analyzer's fallback reasons.
  • No other output is uploaded by verify. The usage signal carries no paths.

Without --redact-paths, nothing changes.

Fallback if the widening is intended: if maintainers prefer redacted runs to keep running the full suite, I will reduce this PR to a message fix. The full suite would still run, but the reason would say it was widened because --redact-paths hides the selected paths, instead of the current "selected verification was not executable … would not match … such as ".

Validation

  • New tests/client/verify-redact-paths.test.ts:
    • With redactPaths, the run is selected, selected_tests and selection_reasons hold digests, and the receipt names neither the selected test nor the changed file. On main this fails: selection is full, with the "broadened to full verification" reason.
    • Without redaction, the real paths are kept.
  • node --import tsx --test tests/client/verify-*.test.ts tests/client/enforce*.test.ts tests/client/observe.test.ts tests/client/agent*.test.ts tests/client/outcome*.test.ts: 132 passed.
  • tsc --noEmit -p packages/diffci-cli: clean.
  • The new test file is listed in release-files.json.

More paths redacted (follow-up)

  • snapshot.written_during_verification, changed_during_verification and line_ending_only_changes were raw on main too. They are now digests on every --redact-paths receipt, including the ones returned before the run. The reason that names a file the run changed uses the digest.
  • Two leaks this PR had introduced by planning with real paths are fixed:
    • A selected test that node --test gets as a glob (test/a[1].test.js runs as "test/a@([[])1@([]]).test.js") did not match the literal scrub. Each path is now also scrubbed in its glob and shell-escaped forms.
    • The outside-suite reason named the separate project's directory (apps/desk is a separate project ...). That directory is now a digest, as in the observation report.
  • Three cases are added to tests/client/verify-redact-paths.test.ts. Each fails without this change.

Still raw, as on main: repository paths that the runner prints in the output tails and that DiffCI does not know (other files in a stack trace).

Conflict with #260: resolved on #260's side (it moved its helper), so the two merge in either order.

The analysis returned digests in place of the selected test paths, so
the selected command never matched them and every redacted run widened
to the full suite with a misleading reason. Plan with the real paths and
put digests only in the receipt.

Fixes DiffCI#275

Signed-off-by: FredApps <[email protected]>
…dact-paths receipt

The receipt still named the selected and changed files in checks[].reason and a NARROWED check's
command, in execution.testResults[].file and failingTests, in the output tails and in the failure
baseline. They now carry the same digests, and the regression test checks the whole receipt.

Refs DiffCI#275

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

Cross-review (FredApps, head 50bd0e6). Not an approval.

Checked

Fixed: 50bd0e6

  • The redacted receipt still named the changed and selected files in:
    • checks[].reason ("src/a.js changed, and the check runs it") and a NARROWED check's command.
    • execution.testResults[].file and execution.failingTests.
    • The output tails.
    • failure_baseline.
  • The original test hid this by blanking the tails and testResults before checking.
  • redactReceipt now scrubs those fields too, and the test checks the whole receipt.
  • Added a failing-run test with a gate check. Both fail without the fix.
  • Several of these leaks already existed on main.

Open

  • snapshot.written_during_verification, changed_during_verification and line_ending_only_changes still hold raw paths. Repository paths outside the known set (e.g. other files in a stack trace) can also appear in the tails. Both are pre-existing.
  • Under redaction the outcome log stores digests, so a later redacted run never reuses a pass. That's safe, but it means no reuse.
  • verify.ts conflicts with fix(cli): fail verify when the time limit leaves gate checks unrun #260. Whichever lands second needs main merged in.

…act-paths receipt

The receipt still listed raw paths in snapshot.written_during_verification,
changed_during_verification and line_ending_only_changes (as on main),
and the reason naming a changed file kept it. These are now digests, on
every receipt including the ones returned before the run.

Planning with real paths also let two paths through that main hid: a
selected test passed to node --test as a glob ("test/a@([[])1@([]]).test.js")
did not match the literal scrub, and the outside-suite reason named the
separate project's directory. Both are now digests.

Fixes DiffCI#275

Signed-off-by: FredApps <[email protected]>
@FredApps

Copy link
Copy Markdown
Contributor Author

Follow-up on the open points in the cross-review.

Real. Fixed in 1c3d290

  • Raw paths already raw on main. snapshot.written_during_verification, changed_during_verification and line_ending_only_changes are now digests on every --redact-paths receipt. That includes the receipts returned before the run, which stamped covers. The reason naming a file the run changed (modified src/b.js) now uses the digest.
  • Two more leaks, found while checking this. This PR introduced both by planning with real paths:
    • A selected test that node --test gets as a glob was left raw: test/a[1].test.js ran as node --test ... "test/a@([[])1@([]]).test.js", which the literal scrub missed. Each known path is now also scrubbed in its nodeTestGlobForPath form and in the shell-escaped form of both.
    • The outside-suite reason named the separate project's directory raw (apps/desk is a separate project with its own lockfile ...). On main the observation hashed it. It is now the digest (separateProjectReason with the digest).
  • Tests. Three new cases in tests/client/verify-redact-paths.test.ts cover the snapshot lists, the bracketed test and the separate project. Each fails without the fix and passes with it.
  • Validation. verify-*, enforce*, observe, agent* and outcome* tests: 136 passed. Typecheck and package:check pass.

Still open (not changed)

  • The runner can print repository paths DiffCI doesn't know, such as other files in a stack trace, in the output tails. These stay raw, as on main. Only known paths can be matched, so this is best effort.
  • Under redaction, no pass is reused. That is safe as designed.
  • verify.ts still conflicts with fix(cli): fail verify when the time limit leaves gate checks unrun #260. Whichever lands second needs main merged in.

CI: all checks pass on 5a44c61, an empty re-run commit. The first run on 1c3d290 hit a Windows EPERM while removing a Go fixture temp dir (diffci-go-replace-*), which is unrelated to this change.

FredApps added a commit to FredApps/core that referenced this pull request Nov 18, 2026
… cleanly with DiffCI#276

No behavior change. DiffCI#276 adds redactReceipt at the same spot after verifyCommitRange, which made the two PRs conflict.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:55
@adityankale190895
adityankale190895 merged commit 9275a0c into DiffCI:main Nov 18, 2026
13 checks passed
adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
)

* fix(cli): fail verify when the time limit leaves gate checks unrun

runChecks marks checks not_run when the budget is used up, but verify
ignored outOfTime, ran the tests with no limit and reported the checks
as skipped. Stop before the tests and fail the verdict instead.

Fixes #259

Signed-off-by: FredApps <[email protected]>

* fix(cli): stop verify when gate checks use the whole time limit

Every check could run and still use the whole --timeout-ms budget, for
example a failing check whose base rerun shows it also fails at the base.
The tests then started with a 0ms limit, which means no limit. They now do
not start and the verdict fails. A base rerun with no time left is
reported as unknown instead of running with no limit.

Fixes #259

Signed-off-by: FredApps <[email protected]>

* refactor(cli): move checksOutOfTime next to checkSummary so it merges cleanly with #276

No behavior change. #276 adds redactReceipt at the same spot after verifyCommitRange, which made the two PRs conflict.

Signed-off-by: FredApps <[email protected]>

---------

Signed-off-by: FredApps <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

verify: --redact-paths always widens to the full suite, with a misleading reason

2 participants