Skip to content

feat(final-review): ship only changes that meet the standard, with independent reviews and a workaround scan - #40

Merged
andeeplus merged 24 commits into
mainfrom
feat/final-review-workarounds
Nov 29, 2026
Merged

andeeplus merged 24 commits into
mainfrom
feat/final-review-workarounds

Conversation

@andeeplus

@andeeplus andeeplus commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Why

A multi-PR program passed this gate with workarounds stamped ready to ship. A separate audit caught them only later:

  • an observer rewrote state that another component kept writing, so one piece of state had two owners;
  • code parsed and rewrote a bundler's private output by matching its internal helper names;
  • a readiness probe modified user files every 20 ms;
  • lazy getters in config objects did their work whenever an object was copied;
  • tests were made "stable" by giving them longer deadlines.

One change was correct, tested and green, yet it added about 1,300 lines and slowed every cold start by 40% to avoid a rare event. Nothing checked proportionality.

Three parts of the gate let this happen:

  • Anchored reviews. Builders briefed their own reviewers with an account of what they had done, found, fixed and left.
  • Deferred rework. ready to ship could stand with rework deferred, and "do not start rework unless asked" let the deferred list keep growing.
  • Design decisions. The builder or the second opinion decided design forks that belonged to the user.

What

  • code-quality: an ordered standard (references/standards.md). It has eight principles, applied top to bottom:

    1. correctness first;
    2. long-term vision;
    3. no workarounds;
    4. no unneeded complexity, which includes proportionality;
    5. easy to change, and solid;
    6. independent modules;
    7. soft domain-driven design;
    8. orthogonality whenever possible, which blocks only when a change couples concerns the code already keeps apart or gives one piece of state two owners.

    Each principle has a definition, how a reviewer spots a violation, and its usual class.

    • Scope. The standard applies to:

      • what the change adds or rewrites, meaning the lines it changes and what they now do;
      • code added by its unreleased workstream (program, stack or series of changes) in earlier commits or PRs the caller names, which the change may fix;
      • any regression it causes in existing code.

      Code that existed before the workstream never blocks, and nothing asks a change to retrofit it. Bringing an area up to the standard is an audit's job.

    • Postures. balanced applies principles 1, 3 and 4, and applies 5 to 8 only where the change adds a module or contract, then as nit unless the design gets clearly worse. strict applies all eight.

    • SKILL.md carries an 8-line summary and a pointer to the reference. The vendored rules are bounded by scope and posture.

    • audit, define, debug and deliver point at the standard.

  • code-quality: a workaround checklist (references/workarounds.md). It names ten concepts, with no API or language in them. "Two owners of one piece of state" lives in principle 8, and the checklist links to it.

    • It judges intent, not the construct. A timer, retry, catch, cast or ignore comment is a workaround only when it masks a defect: an ordering problem, a race, flakiness, a bug elsewhere or an unclear contract.
    • Real behaviour is fine. Debounce, a deadline on a remote call, backoff against an unreliable service, animation timing, and a boundary catch that returns a meaningful result are all no finding.
    • When the intent is unclear, the reviewer asks for a short doc remark naming the requirement; it does not ask for the construct to be removed.
    • Classes. A masked defect is rework, or easy when the fix is local. A cited external cause, with the workaround minimal and in one place, is no finding.
  • final-review: verdict. ready to ship requires green checks, no design decision left open, and no counted easy or rework finding left open.

    • Clear findings are fixed in the change, not reported back.
    • A design decision ends the gate not ready, with the options on a Decide: line.
    • The deferred-rework path is removed.
    • Out-of-scope findings get their own line and never block.
    • Only a ready to ship stamp is reused.
  • final-review: independent reviewers. Each reviewer gets the scope commands, the issue, spec or request, the posture, the project instructions, its own skill file, and the workstream's earlier unreleased work when the caller names it. The second opinion's round 1 gets the same. Rounds 2 and 3 get only the earlier findings and where each was fixed.

  • final-review: bounded steps. See below.

  • final-review: gate.mts scan --base <ref>. It lists each added line that matches a workaround pattern, as file:line, cut to 200 characters.

    • Defaults target TypeScript and JavaScript. Projects in other languages add their own patterns.
    • It skips lockfiles, prose and its own config file, and pins the diff options that user configuration could change.
    • Projects tune it with a committed .final-review-scan file, read at the merge base. The scan prints a note when the change edits that file.
    • Hits are leads. Most will be legitimate, and only the reviewer's reading of the code decides.
  • final-review: --posture on read and write. The posture is stamped with the verdict. A balanced stamp never satisfies a strict run.

  • final-review: fixes to collect, the code behind facts, read and write. Each fix has a failing test written first.

    • Run from a subdirectory, it used to reuse a stale stamp. It now reads paths from the repository root; a subdirectory run is documented as a gate scoped to that subtree.
    • An untracked link or nested repository no longer crashes it.
    • A deleted tracked file is still measured.
    • A tracked directory that became a file is still measured.
    • facts no longer counts lockfiles. The stamp still covers them, so a lockfile-only change runs the checks again.
    • Worktrees on a detached HEAD keep separate stamps, under a .detached/ key that no branch name can match.
    • One prose predicate serves both facts and scan.
    • Each branch's stamp is a flat file under a hashed key, so a branch named like an earlier branch's folder (fix after fix/thing) gets its own stamp.
    • Special files such as pipes are never read.
    • The script runs in the directory it starts in, not in an inherited INIT_CWD.
    • One lockfile list, scripts/lockfiles.mts, serves gate.mts, run-review.mts and the scope commands, through gate.mts locks.
    • A review runs again once the change has changed since it last ran, so deliver's second gate run re-checks the fixes.
  • second-opinion.

    • Round 1 notes hold the issue, spec or request, the settled decisions and the paths to the instructions.
    • The brief uses final-review's classes and looks for symptoms hidden instead of fixed.
    • --notes is still required.
  • deliver. A design decision parks the issue as a drafted decision. Out-of-scope findings become drafts, and other open findings go in the PR body. A track's gate gets the posture, the second-opinion harness and, as its workstream, the program's earlier unreleased PRs (with issue gates, also the track's earlier issues).

  • audit. It passes its posture on to deliver.

  • create-pr. A stack's second opinion is briefed with each layer's issue. Each changed layer's gate re-runs with the layers below it as its workstream.

Why the gate cannot loop

  • Each step runs once or a fixed number of times.
    • There is one fix pass.
    • There is one re-check, run only by the reviewers whose findings were fixed.
    • The second opinion runs at most three rounds; rounds 2 and 3 check only the fixes.
    • "No step starts another round."
  • What counts at the re-check. scan runs again. A finding counts only if the fixes introduced it, or if it is an easy or rework finding still unfixed from the first review; nits never block. The exceptions are correctness bugs and workarounds in the change's scope. Either blocks whenever it is noticed, is fixed then (unless the fix needs a design decision), and the checks run once more with no further review. Any other late finding is listed and does not block.
  • Scope. Only the change and its named unreleased workstream are judged. Code from before the workstream never blocks, and nothing asks for a retrofit.
  • Posture. balanced (the default) holds design principles 5 to 8 to new modules or contracts.
  • Deliver. It re-runs the gate at most once, then parks the issue.

How the skills follow the same principles

  • One owner each. code-quality owns the standard, the checklist and proportionality. final-review owns the flow, the classes and the verdict. second-opinion owns the cross-model run. Each links to the others rather than restating them.
  • One exception. The second opinion's brief repeats the three class definitions, because the external reviewer cannot read files outside the repository.
  • One idea per place. Each principle and checklist lives in one file. The scan does one thing.
  • Shared words. The skills use the repository's terms: gate, review, finding, verdict, stamp, decision.

Settled by the maintainer

  • Scan config. .final-review-scan is committed and read at the merge base.
  • Out of scope. These findings go on their own Output line.
  • Second opinion. It stays focused on defects.
  • Orthogonality. It blocks only when a change couples concerns the code already keeps apart.
  • Late findings. A late correctness bug or workaround blocks, and is fixed once in the same step.
  • Scope. It extends to the unreleased workstream.
  • Posture. audit passes it on.
  • Later second-opinion rounds. Rounds 2 and 3 see only where each finding was fixed.
  • Two owners of one piece of state. This lives in principle 8.
  • Where to run. From the repository root.

Open decision

Cross-skill import. run-review.mts now imports the lockfile list from final-review/scripts/lockfiles.mts, the first script to import from another skill.

  • It works with every install method the README documents, since each ships the whole plugin.
  • A setup that copies second-opinion on its own would break.
  • The alternative: two copies of the list, kept equal by a check in pnpm check.

Out of scope

  • Test-file recognition for Python and Java (test_*.py, *Test.java, tests/) is out of scope for this PR, by the maintainer's ruling. isTestPath is unchanged, and no follow-up issue is planned.
  • Five other scripts still read INIT_CWD: handoff, deliver, github, audit and atlassian. This predates the workstream.

Reviews

  • Checks. pnpm check is green: prettier, tsc, 125 tests, check-skills and sync-version. CI is green.
  • Reviewers. The tests, quality and docs reviewers ran four times, each briefed from the spec alone. The last run covered the newest commits, with the rest of the branch as workstream context. Every easy finding is fixed.
  • Independent review. The maintainer ran a full GLM 5.3 Flash review. It found 13 easy findings; 12 are fixed, and 1 was ruled out of scope (test files in other languages).
  • Second opinion. GLM 5.3 Flash ran through OpenCode, round 2 on each set of fixes, and found nothing each time.
  • Stamp. ready to ship.
  • Out of scope (older than this workstream). gate.mts reads INIT_CWD when present. That value is inherited from any enclosing pnpm or npm process.
  • skill-creator. Four realistic prompts were run against the old and new skills: assertions passed 94% of the time with the new skills and 62% with the old.

…eviewers from the source, and send design decisions to the user
… untracked links without a stale stamp or a crash
… and say when a new scan file leaves the defaults in use
…karounds, and give later second-opinion rounds only where each finding was fixed
…rktree's stamp so no branch can collide with it
…special files, recognise more test files, and run in the starting directory
… early-exit stamps, and rescan at the re-check
… guard, and pin special files and renames through the CLI
…or reviewers, and let the posture shape the second opinion
@andeeplus
andeeplus merged commit 113b31b into main Nov 29, 2026
1 check passed
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.

1 participant