Repository navigation
feat(finalize-pr): run the reviews together, gate once, and skip opted-out generated files - #313
Conversation
A generatedFiles entry opts out of review with "review": "skip". Being generated is not enough: the edit guard also lists SahajAtlasWeb's lockfile, which its security trigger exists to review, and the plugin's hand-vendored vendor/ code. A path the security trigger names is never skipped, and both config files are read from the base, so a branch cannot widen its own skip list. The script also prints TINY or FULL against review.skipWhen, over the paths kept in review, and fails toward FULL when it cannot read either config. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Steps 1-3 skip the paths review-scope.mjs lists as skip: a generated file whose entry sets "review": "skip", unless the security trigger names it. Five SahajCloud PRs carried a ~29,600-line migration snapshot into every review lens. Nothing is skipped until each repo opts entries in, in its own config PR. Co-Authored-By: Claude Opus 5.5 <[email protected]>
/simplify, /code-review high and /security-review ran one after another, each fanning out its own agents. /simplify's agents run in the background and only /simplify edits, so the two report-only reviews start straight after it, and triage waits for every report. No reviewer then sees /simplify's own commit, so the run reads it for bugs and sends it to /security-review when it touches a trigger path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The gate ran after /simplify, after each fixed finding and after the security review: three to six runs at a median 26 to 54 seconds each. The fixes stay separate commits, so one gate after triage still names a failing fix quickly, and CI gates the pushed branch in full. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When review-scope.mjs says TINY, at or under review.skipWhen over the paths kept in review, finalize skips /simplify and the step 2 review and reads that diff itself. The security review and the comment check still run, and the PR body says the diff was read inline, so the critic and the reviewer know which review it had. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Most of finalize is mechanical, and max effort priced each of those turns at the rate of the triage. Shipped as its own commit, with no measured baseline, so it can be reverted alone if triage quality drops. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- An opt-out entry with a missing or empty pattern no longer skips every path: it compiled to a regex that matches anything. - A diff whose every path would be skipped now skips nothing, so a regenerated-only branch is still read. - A failed git diff prints FULL and skips nothing, instead of a stack. - The parallel /code-review takes the branch as its target, so it reads commits and never /simplify's half-applied working tree. - /simplify's own commit goes to /security-review on step 3's content check too, not only its path check. - A run without loop-config.json, such as a member's installed plugin, gets FULL, and the skill says how to pass --config. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Each of the five behaviours is the right size for the problem and separately revertable. The opt-in key is the right shape: the whole generatedFiles list would have dropped a lockfile and vendored code.
One thing is not closed. review.skipWhen now gates two skips that stack, and the note on the divergent counts stops a step short of the overlap. When finalize prints TINY with nothing skipped, the dispatcher skips the critic too, so the PR reaches the reviewer having had no agent read it.
Keeping effort: high here also spends the one measurement the other four commits share.
Findings
should-fix— TINY and the critic skip compound to no agent review —finalize-pr/SKILL.md:103should-fix—/security-reviewreads the worktree/simplifyis editing —SKILL.md:109should-fix— StreamlinereviewSkipPatternsintogeneratedPatterns—config.mjs:68should-fix— StreamlinetriggerFromintomain—review-scope.mjs:80consider— the effort commit cannot be attributed —SKILL.md:4consider— a generated-only diff swaps back to the full fan-out —review-scope.mjs:73
What was checked
11 files, +353/−18, 9 commits, read whole. On the branch: review-scope.mjs, its test, config.mjs, finalize-pr/SKILL.md, the why.md additions. On main: dispatcher/decide.mjs (underThreshold, criticSkipped), base-ref.mjs (baseline is the branch point, so the two-dot diff is right), the three generatedPatterns callers.
Verified, not read from the body: the branch's 6 review-scope tests pass from a copy outside the checkout, and parseNumstat matches --numstat -z --no-renames record order.
Ladder walked on the pieces new-pieces.mjs skipped: no dependency, none nested. Streamliner: 6 covered, 4 kept, both findings held. No question threads. Profile read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The TINY tier skipped `/simplify` and step 2's review. The dispatcher's `underThreshold` (dispatcher/decide.mjs) skips the critic on the same `review.skipWhen`, over GitHub's totals, which never fall below the count finalize-pr makes over the paths it keeps in review. So the two skips agree whenever nothing is skipped, and a two-file, forty-line PR reached the reviewer with no `/simplify`, no `/code-review` and no critic — less review than it got before this branch. The tier now skips `/simplify` and nothing else. The why.md entry carried the divergent counts but stopped short of that overlap; it now names it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWxFZSXaRfdTsQZznT
Step 2's review was given the branch as its target so it reads commits only. `/security-review` takes no target: it reads the worktree, which `/simplify` is editing at that moment, so a parallel start risks a torn read in the one lens whose misses are worst. Step 1 already re-ran it over `/simplify`'s commit on a match, so running it in parallel bought nothing there either. It now runs once, after that commit, over the whole diff — which covers the commit too, so step 1's extra run goes. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWxFZSXaRfdTsQZznT
`reviewSkipPatterns` was `generatedPatterns` plus one filter. The streamliner
asked for the parameter instead: `generatedPatterns(text, { review: 'skip' })`
gives the same skip set, five lines shorter, with one docstring to keep true.
The fold also moves the new function's per-entry care onto the three existing
callers, which is a fix, not a side effect. `new RegExp(undefined)` compiles to
`/(?:)/`, so an entry with no `pattern` made comment-fingerprint, doc-weight
and new-pieces treat every path as generated; one uncompilable pattern voided
the whole list for them. A new test locks both, filtered and unfiltered.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjWxFZSXaRfdTsQZznT
A private nine-line wrapper with one caller, and no second in sight: step 3 reads `triggerPattern` with `jq`, not through here. It now sits beside the `workflow` text it parses, three lines shorter, with the same null for a trigger that is absent, unparseable or uncompilable. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWxFZSXaRfdTsQZznT
Reverts 32e250b. The critic and the altitude reviewer before it made the same point: the other four behaviours on this branch are judged by one measurement, the run's duration, and this one moves that number too. Shipped together, a faster run cannot say which did it, and a prose change cannot be re-run to find out — the failure the repo's skill/ceiling split exists to stop. Its own why.md entry admitted it had no measured baseline. It costs one frontmatter line to redo. Cherry-pick 32e250b into its own PR once this branch's duration is measured, against that baseline. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWxFZSXaRfdTsQZznT
`git diff --numstat -z` deliberately drops git's own C-quoting, so a changed path may carry a newline, and `parseNumstat` splits only on NUL and tab. The printed `review:`/`skip:` lines are what the skill tells each review to skip, step 3's `/security-review` included, so one oddly-named path could inject a `skip:` line for a path `securityReview.triggerPattern` exists to protect — the override `classify` is written to guarantee. Found by this round's `/security-review` and reproduced in a scratch repo: a directory named `docs\n skip: src/auth/keys.ts` printed that forged line. Odd paths now print as JSON, the way git quotes them without `-z`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWxFZSXaRfdTsQZznT
b4d05bc moved the iteration outside the `try`, so a `generatedFiles` that parses but is not an array threw a TypeError where the old `.map` inside the `try` returned `[]`. review-scope.mjs would have exited on a stack instead of printing FULL. An `Array.isArray` guard restores the fail-safe, with a test. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjWxFZSXaRfdTsQZznT
|
Five of six critic findings adopted, one rebutted.
This round's own Base was current. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. 🤖 Written by the sydevs autonomous loop — see what this is
Summary
/simplifyand/code-review highstart together. The lean gate runs once. A tiny diff skips the/simplifypass and is read inline instead."review": "skip". A path the security trigger names is always reviewed.Change outline
Flow — finalize-pr steps 0 to 4
The three reviews used to run one after another, with a gate after each fix. A new script now decides the scope and the tier before step 1.
Behaviour — what review-scope.mjs skips and how it counts
classify(files, { skip, trigger, skipWhen }) workflow/lib/review-scope.mjs + skip a path only if its generatedFiles entry has review: "skip" config.mjs generatedPatterns(review) + an entry with no usable pattern skips nothing + never skip a path securityReview.triggerPattern matches + every path would be skipped → skip nothing + TINY when the review: paths are within review.skipWhen, else FULL + no loop-config.json, no base workflow.json, or a failed git diff → FULL, skip nothing + workflow.json is read from the base, so a branch cannot widen its own skip listContract —
generatedFilesentries in each repo's.claude/workflow.json{ "pattern": "^src/migrations/.+\\.json$", "reason": "…" +, "review": "skip" }The edit guard ignores the new key. Until a repo sets it, nothing is skipped.
Contract impact
The new optional
reviewkey ongeneratedFilesentries. Each repo opts in with its own config PR, listed under Notes. Each needs an attended edit, because.claude/is a protected path. Merge order does not matter: the old skill and the edit hook ignore the key, and the script reads it from the base.Test results
claude plugin validate ./workflow --strict, plus 171 lib tests passing (9 new inreview-scope.test.mjs), from the checkout and from a.claude/worktrees/worktreerule-delta.mjs: 93 → 93 directives, none removedcomment-lint.mjs: no findingspayload-types.tsskipped. The migration.tsstays in review (4 files, 91 lines).Manual verification
docs/routine-setup.md§6). Check three things:review-scope.mjsran,/code-reviewstarted before/simplify's report came back,skip:.Notes for reviewer
Sibling config PRs, any order:
payload-types.ts.types/payload/anddist/.src/types/payload/anddist/.Lockfiles and SahajCloud's
importMap.jsstay reviewed, as do its migration.tsand the WordPress plugin'svendor/.One PR, one commit per behaviour. Each behaviour is a separate revert, but they share one measurement: the run's duration. The commits are scope, together, gate-once and tiny, then a rewrap and a review-fix commit, then this round's seven: the tiny-tier fix, the security-review ordering, two streamline folds, the effort revert, and two fixes the round's own
/security-reviewand triage found.Reverted after review:
effort: max→high, in 32e250b. The altitude reviewer and then the critic made the same case: it moves the one measurement the other four behaviours share, and has no baseline of its own. Cherry-pick 32e250b into its own PR once this branch's duration is measured.Check most closely: the TINY tier. It now skips
/simplifyonly, because the dispatcher skips the critic on the samereview.skipWhenand dropping step 2's review as well left a small PR with no agent read at all.Not closed here: the critic (
review-pr) still reads the whole diff, snapshot included, and the dispatcher'sskipWhencount still includes skipped files. A contract-sync PR is the sharpest case: every path is areview: "skip"path, so the swap that keeps something readable puts them all back and the verdict is FULL, whilecontractSyncOnlymeans no critic either. All three are one change in the dispatcher.Latent, named rather than built:
review-scope.mjscompilessecurityReview.triggerPatternwithnew RegExp, while step 3's own gate isgrep -E, so a pattern only POSIXgrepaccepts leaves the override off while the skip patterns still apply. And the override reads only the path arm of step 3's gate, notcontentPattern/contentPaths. Neither bites today: every repo's trigger compiles identically under both engines, and no repo setscontentPattern.Dismissed findings:
pr-test-analyzer.implement-ticketstep 9 owns coverage.skipWheninto its own key: that is a ceiling change, and the repo's rule keeps it out of this PR. The$commentand why.md now name both readers.Detail
Measurements behind each change:
/code-review high: median 6 minutes over 11 runs, 42 at worst.Changed after review: this branch's first version reused the whole
generatedFileslist as "skip in review". Two problems came out of review:pnpm-lock.yaml, which that repo's own security trigger exists to review, and the WordPress plugin's hand-vendoredvendor/, which runs on 13 sites and controls their updates..ts. That made schema PRs count as tiny, and the count failed open, printing0 0, when it could not read the config.The opt-in key and the tested script replace both.
Review passes run on this branch:
/simplify: four lenses./code-review high: twice, once per version./security-review: on the first version. The second version adds one script, which runsgitwith fixed arguments throughexecFileSync, with no shell, and adds no new sink.review-pr) on 5ce8671: six findings, five adopted, one rebutted. The rebutted one is the all-generated diff, now under Not closed here./security-reviewa third time, over the round's commits. It found one medium:--numstat -zdrops git's path quoting, so a changed path carrying a newline printed extraskip:lines — forging an instruction to skip a path the security trigger protects. Reproduced in a scratch repo, fixed in 3d7610c. Triage of its lower-confidence notes found one more: the streamline fold had moved atryand turned a non-listgeneratedFilesfrom[]into a throw (3522e97).🤖 Generated with Claude Code