test(cli): cover the tested/failed/refused split on a mixed verify/test run - #307
Conversation
|
@claude /review |
|
Claude finished @thecodedrift's task in 4m 59s —— View job ReviewReview mode: incremental — read 0 prior review thread(s) before reviewing. Todo list
Assessment This PR adds no production code ( I independently verified the new fixtures against the current production code paths, not just the PR's own mutation-check table:
I did not find any correctness bugs in the new tests, and no production code is touched. One non-blocking organizational note posted as an inline comment: the new No changeset is correctly omitted here — this ships no user-visible behavior. |
0764f4f to
de9be87
Compare
…st run packages/cli/src/commands/verify.ts computes tested = results.length - refused.length, and derives both the human summary and the --json ok field from failed, which excludes refused rules. Every existing test runs exactly one rule per invocation, so neither arithmetic operation was ever exercised: with one rule, results.length and results.length - refused.length agree, and a refused rule leaking into failed is invisible without a genuine, non-refused failure to compare it against. Adds two tests to verify.test.ts that spawn the built CLI's `test` command (refused only comes from testOneRule on a runtime rule denied --dangerously-run-scripts; verify never refuses, so it can't exercise this).
de9be87 to
18f8463
Compare
|
No blocker, and the summary reads clean. The one inline note about a second CLI-spawn harness is with the author as a low-priority call. Incidentally this review is a useful data point for #303: our own bucketing filed this entirely positive summary as — AI Coding Agent |
Stack (root → tip):
Summary
packages/cli/src/commands/verify.ts:127-176computestested = results.length - refused.length, and derives both the human summary and the--jsonokfield fromfailed, which excludes anythingisRefused. Every existing test in the suite runs exactly one rule per invocation, so neither arithmetic operation was ever exercised: with one rule,results.lengthandresults.length - refused.lengthagree, and a refused rule "leaking" intofailedis invisible unless something else in the run is a genuine, non-refused failure to compare it against.Adds two tests to
packages/cli/test/verify.test.tsthat spawn the built CLI'stestcommand (notverify—refusedis only ever set bytestOneRuleon a runtime rule denied--dangerously-run-scripts;verifynever produces a refusal, so it cannot exercise this split at all).results.lengthis 3,testedmust read 2,failedmust read 1. Asserts the per-ruleok/refusedfields via--json, plus the human summary text"1 of 2 rule(s) failed. 1 rule(s) did not run.".--jsonok: trueand exit code 0, plus the human summary"1 rule(s) tested. 1 rule(s) did not run."with no"failed"anywhere in the output.Mutation-check table
Each test was verified to fail against the corresponding regression, then the source was reverted (confirmed via
git diffshowing no change) and both tests passed again.tested = results.length(drop the- refused.length)"1 of 3 rule(s) failed."instead of the expected"1 of 2 rule(s) failed."failed = results.filter((r) => !r.ok)(drop the!isRefused(result)exclusion)"2 of 2 rule(s) failed."instead of"1 of 2 rule(s) failed."tested = results.length"2 rule(s) tested."instead of"1 rule(s) tested."failed = results.filter((r) => !r.ok)--jsonokreadfalseinstead of the expectedtrueNo production code was changed;
git diffonpackages/cli/src/commands/verify.tsis empty on this branch.Test plan
NODE_OPTIONS= pnpm test— 82 files, 1327 tests, all green (fresh run,--no-file-parallelism)NODE_OPTIONS= pnpm typecheck— cleanNODE_OPTIONS= pnpm lint— clean (eslint +taskless check)No changeset: this PR ships no user-visible behaviour, only test coverage.
Refs #284