Repository navigation
chore(agents): measured review and test strategy — mutation by tool, a self-filling ledger, fewer notes and tests - #739
Conversation
…a self-filling ledger, fewer notes and tests - pnpm mutate runs a near pass (tests that import a changed file, through their module's barrel, or that the branch changed), then a wide related pass only for survivors: 122-273 s down to 16-21 s on #682, #669, #674. - The implementer's audit runs pnpm mutate instead of probing every test by hand; survivors and reasons go under ## Mutants, which the code review checks. The tool guard lets only the implementer run it. - review-metrics.mjs reads usage and cost from Claude Code transcripts, found by a ledger tag line every stage and lens prompt starts with; reproduces #683's recorded costs to the cent. - Lenses write notes only for an unproven secret leak or data loss, and at most 400 words; the spec review leaves test strength and unnamed behaviour to the code review. - Testing rules: a spec Tests line is one test, a claim is proved at one seam, a review fix that adds a test names the one it could not extend. - New weekly routine recurring-findings: classes fixed in 3+ PRs become draft tasks for a check or rule line.
…omplexity audit passes
Agentic code review: what others do, how we compare, and what PR #739 ships2026-10-19. Goal: fewer tokens and less time per review, same or better quality.
TL;DR
What we will shipSix changes, in this order. The ledger goes first, so every later change can
How we judge it: compare 10 PRs before and 10 after on tokens, cost, Not shipping: more parallel finders or voting, and replacing Opus on Verification on real data (2026-10-19)Every change above was checked against real PRs and transcripts before it
What the sources sayAnthropic
OpenAI
Addy Osmani
Matt Pocock
Testing: what each source saysChecked a second time against the sources' own words.
#739 follows Pocock: build mode, tracer bullet, no refactor in the loop, Others
No source recommends agents mutating code by hand, test by test. The common How we compare
Checks done more than once today
Also a docs mismatch: REVIEW.md sends docs-only diffs to spec and claims, but Proposed changes (ordered by saving / effort)
Not recommended: more parallel finders or voting. Bugbot moved away from Sources
Not opened: Osmani's "70% problem", Kent Beck's own essay, Greptile and |
…which a cloud routine allows
Test redundancy, measured on
|
| Measure | Count |
|---|---|
| Mutants killed / timed out / survived / no coverage | 1,672 / 555 / 319 / 97 |
| Tests whose kills another test also makes, every one (subsumed) | 228 (36%) |
| … by a test in the same file | 213 |
| … only by a test in another file (same claim at two seams) | 15 |
| Smallest set of tests that still kills every killed mutant | 207 (33%) |
| Tests that kill nothing | 28, mostly lease-request-book.test.ts, whose code sits in the registry, outside this run |
What it says:
- Most redundancy is sibling tests in one file that split the cases of one behaviour (e.g. "41.7 is sent as 41" and "a percentage reported twice", identical kill sets). That is the pattern the new rule targets: a spec Tests line is one test, its cases a table. Merging keeps every case and drops the per-test setup.
- Same claim at two seams is small here (15), but real (
lease-release-coordinator→create-leasing). - Subsumed is not deletable: equal kill sets mean mutation cannot tell the tests apart, not that a case is worthless; the 555 timeouts have no killer recorded. Treat the list as candidates for merging, for
audit-tests, not as a delete list.
Written by an agent.
…ery blocking weak-test finding in a replay of 8
Mutation recall, replayed on 8 past weak-test findings (2026-10-19)Would
2 of 8, none of the 3 blocking. Runs took under 1 min on small PRs, 5–9 min mid-size, 33 min on a 1,345-line PR, with 1–140 survivors unrelated to the finding. So this PR keeps the hand probes (audit and tests lens) and adds Written by an agent. |
…d green, each Tests line a failing test commit then its code
…est per commit, and names built-ahead lines
…r, no tautological expected value, reviews ask only for required tests, internal-file tests give a reason
Testing changes, each measured before it was written (2026-10-19)Build mode (Pocock-style), replayed on #491 in an isolated clone — one failing
The agent still writes the whole feature in the first green step; partly natural here (one matcher covers the later cases). Watch over the next 3 deliveries: share of Rules:
Written by an agent. |
…tate caught 2 of 3 blocking weak tests at about 15 min a file; hand probes stay, pnpm mutate stays weekly
Mutation in delivery: dropped (2026-10-19)A prototype added the probes reviewers use (delete a call, move a number by one) on changed lines, replayed on the 3 blocking weak-test findings:
About 15 minutes a file and 20–40 survivors to explain, to catch what a hand probe catches in seconds. Mutation leaves delivery; the hand probes stay; the faster Written by an agent. |
…mit add the stub it calls, and names Fallow as the refactoring check Replayed on #491: the stub let the first test fail on its assertion; the first green shrank from 66 to 39 lines. Built-ahead lines stayed at 8 of 10.
…or an unasserted field; the audit's surface check covers a test importing an internal file that index.ts also exports Measured: #408 and #411 shipped a hard-coded 0 for a field no test asserted; 73 of 572 new tests in 20 PRs imported an internal file, mostly for a name index.ts exports, and the audit's narrower wording passed them.
… a rule for a near one; a red by timeout does not count Measured on 20 verified weak-test findings review raised after an audit: 5 needed a near-rule swap (another sort key, no tie-break, first not lowest, one side of ||), 2 a second claim in the title, 1 a timeout-only red.
…ocol bump go together, on push and in CI Replayed: it flags all 7 past misses (#394, #494, #495, #499, #563, #567, #736) and passes their fixes; on the main merges touching src/contract since the rule (#390) it flags only #524 and #528, the stack that bumped once. CI runs on the PR's merge commit, so two PRs taking the same number fail there.
…r review round runs only the lenses its fix touched; audit breaks fail loudly Measured: 31 fixed stale-claim findings since 2026-10-11 were a copied value (protocol range, counts of commands and routes); 17 later-round lens runs whose input the fix never touched found nothing; 14 audit breaks never applied (BSD sed -i).
…types, 15 s to 6 s e2e imports types from dist/client, dist/core and dist/ports, which build:daemon writes; the UI and capture builds added 9 s per push and nothing the typecheck reads. typecheck:e2e keeps the full build for pnpm check and CI. Measured: about 9 pushes per task.
Benchmarks, round 3 (2026-10-19)Each idea was measured on past PRs and transcripts before deciding.
Model replays (12 lens runs re-run on the other model)
Code lenses stay on Opus. The spec lens stays on Sonnet. 3 of the 4 spec findings Sonnet missed were about test strength, and #739 moves that to the Opus code lens. On the four recent PRs, Opus added nothing for its higher cost. The one remaining miss was a design point: #462's refusal decided in two places. Watch for that kind of finding in the next deliveries. Written by an agent. |
Conflicts in src/contract/AGENTS.md and src/daemon/AGENTS.md: main updated the copied protocol range to 48; this branch replaces the copy with a pointer to PROTOCOL_VERSION_RANGE (documentation rule 8), so the pointer is kept.
Reviews and tests cost too much: ledgers nobody fills, notes nobody acts on, and specs whose Tests lines turn into 2–13 tests each. Each change was checked on real PRs.
pnpm mutate: fix(gateway): a lone refusal after an aged-out window omits count (#677) #682 122→16 s, fix(cli): wait 20 s for a daemon a command auto-launched (#663) #674 265→21 s. Kept out of delivery: too slow for what it finds.test:commit per spec line, then its code; observed for 3 deliveries.ledger:tag;review-metrics.mjsreads tokens and cost from Claude Code's transcripts. It reproduces fix(cli): the auto-launch startup timeout reports DAEMON_STARTUP_FAILED, not INTERNAL (#672) #683's costs to the cent.recurring-findingsroutine. Classes fixed in 3+ PRs become draft tasks for a check.Not included: the risk gate, which would have missed 21 fixed findings in 10 PRs.
Review
Spec review: skipped. Code review: 0 blocking, 0 fixed, 0 notes. Claims review: 0 blocking, 0 fixed, 0 notes.
Rounds: 0. Tokens: n/a.
Assessment: incomplete — not reviewed yet.
Written by an agent.