mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-29 19:34:29 +01:00
/ship reviews fixes with full rounds instead of narrow re-checks (GST-3562) (#4741)
/ship no longer plans a narrow re-check after a fix: a fix after round 1 gets a full round 2, and a fix in round 2 gets one read-only full review of the whole PR, so fixed code never ships unread. Why: the narrow re-check read only the fixed lines, and each round now keeps at least one full-effort reviewer, the one the re-check was. Part 1 of the /ship simplification Garry approved, rebuilt after #4737; nothing for readers to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/outside-voice#1 reader=outside-voice Review-Finding: p1/outside-voice#2 reader=outside-voice Review-Finding: p1/red-team#1 reader=red-team Review-Finding: p1/targeted#1 reader=targeted
This commit is contained in:
1 parent
c4cfe6d1c9
commit
1cb0a3e36a
34 files changed
+564
-187
No files matched your search
@@ -417,7 +417,7 @@ function pass(): number {
|
||||
const j = runPlan('gstack-review-dispatch pass', base, planArgs, true);
|
||||
if (j.stopLine) { process.stderr.write(j.stopLine + '\n'); return EXIT.fail; }
|
||||
if (j.status !== 0) { process.stderr.write(j.stderr ?? ''); return EXIT.fail; }
|
||||
const p = JSON.parse(j.stdout) as { next: { step: string }; dispatches: Dispatch[]; targeted?: { classes: string[] }; fix_range?: { base: string } | null; review_exclude?: Record<string, unknown> & { state: string; excluded?: number; kept_files?: unknown; references?: unknown }; readers?: EffectiveReaders };
|
||||
const p = JSON.parse(j.stdout) as { next: { step: string; readOnly?: true }; dispatches: Dispatch[]; targeted?: { classes: string[] }; fix_range?: { base: string } | null; review_exclude?: Record<string, unknown> & { state: string; excluded?: number; kept_files?: unknown; references?: unknown }; readers?: EffectiveReaders };
|
||||
const step = p.next.step;
|
||||
const fixChecks = step === 'fix-check' ? [] : p.dispatches.filter(d => d.role === 'fix-check');
|
||||
const planLines = [...text.stdout.trimEnd().split('\n'), ...fixChecks.map(d => `FIX_CHECK: planned effort=${d.effort} (Step 3.5 runs it on its own; not in this manifest)`)];
|
||||
@@ -425,7 +425,9 @@ function pass(): number {
|
||||
const rangeBase = step === 'scoped' ? git(['rev-parse', '--verify', '--quiet', `${p.fix_range?.base ?? ''}^{commit}`])?.trim() : undefined;
|
||||
if (step === 'scoped' && !rangeBase) throw new BriefError('a scoped plan names no readable fix range base');
|
||||
const mergeBase = mergeBaseWith(base);
|
||||
const diffBase = flag('--diff-base') ?? (planArgs.includes('--adversarial-ran') ? rangeBase : undefined) ?? mergeBase;
|
||||
const explicitBase = p.next.readOnly ? undefined : flag('--diff-base');
|
||||
if (p.next.readOnly) planLines.push(`READ_ONLY: the final review reads the whole PR diff from the merge base${flag('--diff-base') ? ` (--diff-base ${flag('--diff-base')} ignored)` : ''}; no fix round follows it`);
|
||||
const diffBase = explicitBase ?? (planArgs.includes('--adversarial-ran') ? rangeBase : undefined) ?? mergeBase;
|
||||
if (!diffBase) throw new BriefError(`no merge base between ${base} and HEAD`);
|
||||
const root = git(['rev-parse', '--show-toplevel'])?.trim() ?? process.cwd();
|
||||
const extrasFile = flag('--extras');
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
**/ship no longer plans narrow re-checks after a fix.** A fix after the first review round gets a full second round on the fixed range, and a fix in the last allowed round gets one read-only full review of the whole PR, so changed code never ships unread (a light diff's below-floor fixes that change no runtime lines still ship as notes). Each of those rounds keeps at least one full-effort reviewer, the one the narrow re-check was, even on a docs-only change. An approval no longer swaps that final review for a narrow re-check. docs/review-policy.md, docs/ship-policy.md (GST-3562)
|
||||
+33
-27
@@ -97,18 +97,17 @@ incomplete coverage, which blocks until the reviewer is rerun.
|
||||
changed as no round, so it shows as `fix_checks=`. After round 2 the run
|
||||
finishes with its open notes listed in the PR body and receipt (an owner-ruled
|
||||
note is closed and listed: [ruled notes](ship-policy.md#ruled-notes)), or stops for
|
||||
the owner when a blocking finding is open, or was fixed in round 2 and is
|
||||
unverified, or a round-2 fix edited a gate-class path, naming it (path,
|
||||
severity, problem). The cap limits fix rounds, not Step 11's voices: on gate
|
||||
the owner when a blocking finding is open, naming it (path, severity,
|
||||
problem); a round-2 fix, blocking, gate-class or below the floor, first gets
|
||||
the read-only full review described below. The cap limits fix rounds, not Step 11's voices: on gate
|
||||
class a stop waits for Step 11's adversarial, outside and targeted voices
|
||||
(`NEXT: voices`), so gate code never reaches the owner's "ship with open
|
||||
notes" without them (GST-967). A third round is the owner's
|
||||
grant of one scoped fix-check (recorded in `review_loop_exception`), never the
|
||||
loop's: once `gstack-approvals add` records the grant (its ask or scope
|
||||
naming `review_loop_grant` and the stop head's sha),
|
||||
`gstack-review-plan --grant <approval id> --range-base <round 2's PASS_HEAD>`
|
||||
plans that fix-check in place of the stop after a round-2 full pass, or after
|
||||
a round-2 fix-check that was the run's only one (`--fix-checks 1`, GEVA-223),
|
||||
notes" without them (GST-967). A fix in round 2 gets one read-only full
|
||||
review, never a fix-check (GST-3562 A). For one release, a grant recorded in
|
||||
`review_loop_exception` (its ask or scope naming `review_loop_grant` and the
|
||||
stop head's sha) still answers one row: `gstack-review-plan --grant <approval
|
||||
id> --range-base <round 2's PASS_HEAD>` plans one more fix-check after a
|
||||
round-2 fix-check that was the run's only one (`--fix-checks 1`, GEVA-223),
|
||||
with a fixed blocking finding or a gate-class edit, and refuses any other row,
|
||||
including a grant for a stop head before `--range-base` (an earlier /ship).
|
||||
A fix-check never earns another, so the grant cannot repeat, and a stop after
|
||||
@@ -192,14 +191,17 @@ caught on another crew's PRs.
|
||||
show in neither,
|
||||
because each run's own fix round is the in-run table's call. A full pass past two
|
||||
stops with `PR_ROUND_CAP` and says how to record the stop and its grant
|
||||
(item 6); a below-floor fix at the cap finishes with its notes listed. The stop is the lane's or Captain's call, never an owner ask
|
||||
(item 6); a fix at the cap gets one read-only full review of the final head
|
||||
(GST-3562 A), and a fix after that review stops for the lane's Captain. The stop is the lane's or Captain's call, never an owner ask
|
||||
([troubleshooting](troubleshooting.md#pr-round-cap)).
|
||||
5. **Read-only final review.** A PR that already had two full rounds and whose
|
||||
own code changed since still gets one full review of its final head. It has
|
||||
no fix round: below-floor findings ship as notes, and a blocker (open or
|
||||
fixed) or a gate-class edit stops with `PR_ROUND_CAP` for the lane's Captain
|
||||
to decide: ship with the note, park, or buy that review's fix round with a
|
||||
fix-check grant (item 6). The count does not reopen.
|
||||
to decide: ship with the note, park, or keep the fix and run /ship again for
|
||||
one more read-only full review of the final head. A below-floor fix applied
|
||||
after that review also stops for the Captain (GST-3562 A). The count does not
|
||||
reopen.
|
||||
6. **Round grants.** Two kinds, each recorded with `gstack-approvals round-grant
|
||||
--pr <n> --head <sha> --reason <why> --by <lane or Captain>`, and each spent
|
||||
by the one run that claims it.
|
||||
@@ -338,20 +340,24 @@ the same grant, whichever row records it:
|
||||
| a full pass that fixed a blocking finding, below the cap, on a diff below full depth with a fix range of at most 150 runtime lines | scoped pass on the range |
|
||||
| a full pass that fixed a blocking finding, below the cap (full depth, a larger range, or a range or depth it could not read) | full pass on the range |
|
||||
| a full pass whose fix touched a gate-class path, below the cap | full pass on the range |
|
||||
| a full pass that fixed only below-floor findings | one fix-check (round 2) |
|
||||
| a full pass that fixed only below-floor findings | full pass on the range (round 2; GST-3562 A plans no new fix-check) |
|
||||
| a light pass 1 whose below-floor fixes change no runtime lines | done |
|
||||
| round 2 (a full pass or a fix-check) that fixed a blocking finding or edited a gate-class path | stop: name it for the owner, who may grant one scoped fix-check |
|
||||
| round 2 (a full pass or a fix-check) that fixed only below-floor findings | done: notes in the PR body |
|
||||
| round 2 that fixed anything, blocking or below the floor | one read-only full review of the final head, with no fix round (R51) |
|
||||
| round 2 on a light diff whose below-floor fixes change no runtime lines | done: notes in the PR body |
|
||||
| a fix after that read-only review | stop: the lane's Captain rules it a note, or the fix goes to a new /ship run's read-only full review |
|
||||
| a full pass that leaves a blocking finding open (fixed or not) | stop: name it for the owner |
|
||||
| a fix-check that found nothing blocking | done |
|
||||
| a fix-check that found a blocking finding | stop: name it for the owner |
|
||||
| a fix-check (granted before GST-3562) that found nothing blocking | done |
|
||||
| a fix-check (granted before GST-3562) that found a blocking finding | stop: name it for the owner |
|
||||
| a stop (any row above) on gate class before Step 11's voices ran | Step 11's voices (adversarial, outside, targeted), then ask again with `--adversarial-ran` |
|
||||
| a round-2 full pass that stops for a fixed blocking finding or a gate-class edit, with the owner's recorded grant (`--grant <approval id>`) | one scoped fix-check (round 3), after Step 11 on gate class |
|
||||
| the stop after a fix-check (granted before GST-3562) that was the run's only one, with the owner's recorded grant (`--grant <approval id>`) | one more scoped fix-check, after Step 11 on gate class, until a later release removes it; a grant after a round-2 full pass buys nothing, because the read-only full review replaces it |
|
||||
| a round-2 fix-check that stops the same way, with the owner's recorded grant and `--fix-checks 1` | one scoped fix-check (round 3), after Step 11 on gate class |
|
||||
| `--post-review` after a fix-check whose later edits are only release stamps and docs (`docsChangeSince`) | done, or the one targeted reader when a docs claim on a targeted-class diff needs it |
|
||||
| `--post-review` after a fix-check (edits after the review bound), with a new recorded grant at a stop head after the last fix-check's commit | one scoped fix-check, the next link of the fix-check chain, after Step 11 on gate class |
|
||||
| a fix-check that stops in the loop, with a new recorded grant naming its own commit (`--range-base`, the stop it answers), after any number of fix-checks | one scoped fix-check, the next link of the fix-check chain, after Step 11 on gate class |
|
||||
|
||||
GST-3562 A retires the fix-check: `nextStep` plans none, and the rows that name
|
||||
one serve grants recorded before it, for one release. Its 3,932,160-case replay
|
||||
against main's table is `test/fixtures/review-pins/replays/GST-3562-A.json`.
|
||||
A **fix-check** is one reviewer reading the touched hunks, the fix list, the
|
||||
test results and the callers of every changed symbol, at full effort. It is
|
||||
logged as a `review-fix-check` row, so it never counts as a pass. No army, no
|
||||
@@ -433,11 +439,11 @@ Under the opt-in `review.panel risk` (and `review.platform on` under any panel):
|
||||
|
||||
| Diff | Pass 1 | After fixes (never more than 2 rounds) |
|
||||
|---|---|---|
|
||||
| Risk class: gate class, an R51 class (money, auth, secret, security, data), `eval` (scorer, judge and grader paths) or `policy` (`review.risk_paths`) | The full-depth plan as printed: the batched specialist, Red Team, native adversarial, outside voice and the targeted reader | A fixed blocker re-runs the printed plan on the fixed head as round 2; below-floor fixes get one fix-check |
|
||||
| Non-risk code | One native adversarial reader (`DISPATCH: adversarial-native single`) at the lane's reasoning, on `review.reader_model` (`lane` by default), carrying the code checklists and the Red Team checklist; it also carries the targeted brief when the diff has a targeted class | A fixed blocker or a gate-class edit gets one fix-check on the touched hunks; below-floor fixes ship as notes |
|
||||
| Docs | The core read; the outside voice only when the diff publishes numbers | One fix-check after a fixed blocker |
|
||||
| Tests, or code with no runtime lines (only registered outputs) | One batched reader on the class's checklists (Testing for tests, which leaves docs and registered outputs out of its diff); the outside voice only when the diff publishes numbers | One fix-check after a fixed blocker |
|
||||
| Docs or tests with no numeric, results or prereg claims, under `review.platform on`, with capy-ai[bot]'s review on the PR at HEAD | No reader: `NEXT: platform` and a planned `SKIP:` for every reader, the core read included | none |
|
||||
| Risk class: gate class, an R51 class (money, auth, secret, security, data), `eval` (scorer, judge and grader paths) or `policy` (`review.risk_paths`) | The full-depth plan as printed: the batched specialist, Red Team, native adversarial, outside voice and the targeted reader | Any fix re-runs the printed plan on the fixed range as round 2 (GST-3562 A); a fix in round 2 gets one read-only full review |
|
||||
| Non-risk code | One native adversarial reader (`DISPATCH: adversarial-native single`) at the lane's reasoning, on `review.reader_model` (`lane` by default), carrying the code checklists and the Red Team checklist; it also carries the targeted brief when the diff has a targeted class | A fixed blocker, a gate-class edit or a below-floor fix that changes runtime lines gets the one reader's full pass on the range as round 2, adding the outside voice when the fix changed a published number (GST-3562 A); below-floor fixes with no runtime lines ship as notes |
|
||||
| Docs | The core read; the outside voice only when the diff publishes numbers | A full pass on the range after a fixed blocker, with the Red Team reader at full effort on the whole fix range, the reader main's fix-check was (GST-3562 A) |
|
||||
| Tests, or code with no runtime lines (only registered outputs) | One batched reader on the class's checklists (Testing for tests, which leaves docs and registered outputs out of its diff); the outside voice only when the diff publishes numbers | A full pass on the range after a fixed blocker: the batched reader plus the Red Team reader at full effort on the whole fix range (GST-3562 A) |
|
||||
| Docs or tests with no numeric, results or prereg claims, under `review.platform on`, with capy-ai[bot]'s review on the PR at HEAD | No reader: `NEXT: platform` and a planned `SKIP:` for every reader, the core read included; first review only (GST-3562 A) | The class's row above: a later round never takes the platform skip |
|
||||
|
||||
`review.panel all`, the default, keeps today's panel and loop on every class. `risk` is
|
||||
opt-in because its one-reader shape has not passed its no-loss replay: build C's replay
|
||||
@@ -707,9 +713,9 @@ the specialists, audits and watchers at the host default too
|
||||
- Standard reads thresholds on runtime lines, not the whole diff, so a test-heavy
|
||||
diff with few runtime lines dispatches fewer specialists.
|
||||
- R51: size never raises the depth; non-risky code is light at any size, and a risk
|
||||
class makes it full. Two rounds is the cap, a fix-check
|
||||
included: a blocker fixed in round 2 stops for the owner instead of earning a
|
||||
fix-check, and a light pass 1 whose below-floor fixes change no runtime lines is done.
|
||||
class makes it full. Two rounds is the cap: a fix made in round 2 gets one
|
||||
read-only full review of the whole PR diff with no fix round (GST-3562 A), and a
|
||||
light pass whose below-floor fixes change no runtime lines is done.
|
||||
- A JSON, CSV, TSV or raster data file no code names is docs, not runtime (GSTA-167
|
||||
part 4a). A binary image no code names is no longer a `binary_code_path` error
|
||||
that forces full depth; one that code names still is.
|
||||
|
||||
+7
-3
@@ -1806,7 +1806,10 @@ construction:
|
||||
continues to Step 10: the loop ships with its deferred and noted items named in
|
||||
the PR body. A blocking finding still open after the last allowed step stops
|
||||
the run and names the finding (path, severity, problem) for the owner instead
|
||||
of a third round; the owner may grant one scoped fix-check.
|
||||
of a third round. A fix applied in the last allowed round gets one read-only
|
||||
full review of the final head with no fix round (GST-3562 A); a fix after it
|
||||
stops for the owner. A grant no longer buys a fix-check at the cap; one
|
||||
answering the stop after a round-2 fix-check still does, until a later release.
|
||||
|
||||
<a id="what-ends-a-run"></a>
|
||||
**What ends a /ship run (GST-3260).** Preflight opens the run in the checkout's
|
||||
@@ -2219,8 +2222,9 @@ as a note. The exception is a range after the last fix-check whose edits are
|
||||
only release stamps and docs (`docsChangeSince`): it plans `NEXT: done`, or
|
||||
`NEXT: targeted` for a docs claim on a targeted-class diff, with no grant
|
||||
([review-policy.md](review-policy.md#transitions), GST-1702). Below the round cap that's a pass on the range (a fix-check under
|
||||
the lean panel). At the cap it stops for the owner, whose recorded grant
|
||||
(`--grant`) adds one scoped fix-check, never `done`. When the last step was a
|
||||
the lean panel before GST-3562; a full pass on the range since). At the cap it gets
|
||||
one read-only full review of the whole PR diff (GST-3562 A), never `done`, and a
|
||||
grant buys no fix-check there. When the last step was a
|
||||
fix-check, pass `--range-base` at that fix-check's commit: a new grant at a
|
||||
stop head after it plans the next link of the chain below (GST-1676), and the
|
||||
last link's own grant is refused. So `finish` never asks for a step the
|
||||
|
||||
@@ -7941,8 +7941,9 @@ request already had its two full review rounds (R51), counted across every head
|
||||
round. A PR at the cap whose own code changed gets one read-only full review of its
|
||||
final head; this stop then means that review found a blocker or a gate-class edit.
|
||||
`/ship` Step 1 prints the count as `PR_REVIEW_HISTORY:` and passes it on from
|
||||
`PR_REVIEW_FLAGS:`. A fix below the blocking floor finishes with its notes
|
||||
listed instead of stopping.
|
||||
`PR_REVIEW_FLAGS:`. Below-floor findings that review leaves unfixed ship as
|
||||
notes; a fix applied after it, even below the floor, stops for the lane's
|
||||
Captain (GST-3562 A).
|
||||
|
||||
**Fix.** The lane's Captain decides. Ship with the open notes listed, park, or,
|
||||
when a finding above the floor is open in this PR's own change, buy the stopped
|
||||
|
||||
+50
-21
@@ -407,19 +407,24 @@ export interface History {
|
||||
/** A fix-check round grant that answers the stop record at --stop (GST-2968): the stopped review's fix round, one scoped fix-check of the PR's own change since the stop's head, in this run or a new one. */
|
||||
grantedStop?: string;
|
||||
}
|
||||
export interface NextStep { step: Step; reason: string }
|
||||
/**
|
||||
* keepReader (GST-3562 A): this step stands where main's table planned a fix-check, or is the read-only final review, so its
|
||||
* dispatch keeps one full-effort reader that excludes nothing (the reader the fix-check was). The table sets it; prCapped's
|
||||
* spreads carry it; the dispatch reads it, never the reason text. readOnly marks the read-only final review: the dispatcher
|
||||
* stages it on the PR's merge base whatever --diff-base the driver passes, and Step 3's edit guard applies no fix on it.
|
||||
*/
|
||||
export interface NextStep { step: Step; reason: string; keepReader?: true; readOnly?: true }
|
||||
|
||||
/**
|
||||
* The transition table (docs/review-policy.md#transitions). Pass 1 is full. A fixed
|
||||
* blocking finding earns a second full pass on the range, scoped when `depth` (known
|
||||
* only to planReview) is below full and the fix range has at most SCOPED_RANGE_LINES
|
||||
* runtime lines; any other fix earns one fix-check, except a light pass whose fix range
|
||||
* changes no runtime lines; two rounds is the cap (R51: a scoped pass or a fix-check is
|
||||
* one): after round 2, below-floor fixes finish with notes, and a blocker open or fixed
|
||||
* there, or a gate-class edit there, stops for the owner, whose grant may add one scoped fix-check.
|
||||
* runtime lines; any other fix earns a full second pass on the range too, except a light pass whose fix range
|
||||
* changes no runtime lines (GST-3562 A: no new fix-check is planned, and the step's keepReader keeps the full-effort reader
|
||||
* the fix-check was); two rounds is the cap (R51), and capStep says what a fix after the cap gets.
|
||||
* The cap limits fix rounds, not Step 11's voices: on gate class any stop waits for them (GST-967),
|
||||
* and the owner's recorded grant (`granted`) turns the stop after a round-2 full pass with a fixed finding, or after a round-2
|
||||
* fix-check when `fixChecks` says it was the only one (GEVA-223), into its one fix-check; a fix-check never earns another, so
|
||||
* and the owner's recorded grant (`granted`) turns the stop after a round-2 fix-check that was the run's only one
|
||||
* (`fixChecks`, GEVA-223) into one more fix-check, for one release; a fix-check never earns another, so
|
||||
* the grant cannot repeat. Edits after the review bound (`postReview`) that follow a fix-check are a new stop, and a new grant
|
||||
* there adds one fix-check, the next link of the chain finish counts (GST-1676, docs/ship-policy.md#fix-check-chain). In the
|
||||
* loop, a grant the CLI bound to the last fix-check's own stop head (`chained`) adds one more the same way (GST-1681).
|
||||
@@ -434,7 +439,7 @@ export function nextStep(h: History, depth?: Depth): NextStep {
|
||||
const afterFixCheck = h.last === 'fix-check' && h.fullPasses === FULL_PASS_CAP - 1 && h.fixChecks === 1;
|
||||
if (h.postReview && h.last === 'fix-check' && h.granted && !h.blockingOpen) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check for the edits after the last fix-check, a new link of the fix-check chain (docs/ship-policy.md#fix-check-chain); a later post-review edit needs a grant of its own` };
|
||||
if (h.chained && h.last === 'fix-check' && h.granted && !h.blockingOpen) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check at the last fix-check's stop, a new link of the fix-check chain (docs/ship-policy.md#fix-check-chain); another stop needs a grant of its own` };
|
||||
if (!h.lean && h.granted && !h.blockingOpen && (afterFixCheck || (h.last === 'full' && h.fullPasses === FULL_PASS_CAP))) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check after round ${FULL_PASS_CAP} (review_loop_exception), ${afterFixCheck ? 'never a second' : 'never a fourth round'}` };
|
||||
if (!h.lean && h.granted && !h.blockingOpen && afterFixCheck) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check after round ${FULL_PASS_CAP} (review_loop_exception), never a second` };
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -451,21 +456,38 @@ function prCapped(h: History, n: NextStep): NextStep {
|
||||
if (prior >= cap) {
|
||||
if (h.last === 'none') return n.step === 'full' || n.step === 'scoped' ? { step: 'full', reason: `read-only final review (R51): this PR already had ${prior} full review rounds on earlier heads, so this head gets one full review with no fix round; a blocker goes to the lane's Captain as a decision and the count does not reopen` } : n;
|
||||
if (n.step === 'done') return n;
|
||||
if (h.fixedBelow && !h.fixedBlocking && !h.blockingOpen && !h.touchedGate && n.step !== 'stop') return { step: 'stop', reason: `a fix followed the read-only final review: ${CAPTAIN_DECIDES}` };
|
||||
if (!h.fixedBlocking && !h.blockingOpen && !h.touchedGate && n.step !== 'stop') return { step: 'done', reason: `read-only final review done (R51): its below-floor findings ship as notes in the PR body and receipt, with no fix round` };
|
||||
return { step: 'stop', reason: `PR_ROUND_CAP: the read-only final review of a PR that already had ${prior} full review rounds found a blocker; the lane's Captain decides (ship with the note, park, or buy its fix round with a fix-check grant naming the stop gstack-ship-receipt stop records), not an owner ask` };
|
||||
return { step: 'stop', reason: `PR_ROUND_CAP: the read-only final review of a PR that already had ${prior} full review rounds found a blocker; the lane's Captain decides (ship with the note, park, or keep the fix and run /ship again for one more read-only full review of the final head), not an owner ask` };
|
||||
}
|
||||
if (!prior || (n.step !== 'full' && n.step !== 'scoped')) return n;
|
||||
const used = prior + h.fullPasses;
|
||||
if (used < cap) return { ...n, reason: `${n.reason}; this PR already had ${prior} full review round${prior === 1 ? '' : 's'} on earlier heads, so this is its full round ${used + 1} of ${cap}${used + 1 === cap ? ', the last' : ''}` };
|
||||
if (h.roundGrant && used === cap && prior === cap - 1 && h.fullPasses === 1 && h.last === 'full') return { ...n, reason: `${n.reason}; round grant ${h.roundGrant} bought pass 1 as this PR's full round ${cap}, and this is that round's fix round, its last` };
|
||||
if (h.last !== 'none' && !h.fixedBlocking && !h.blockingOpen && !h.touchedGate) return { step: 'done', reason: `PR round cap ${cap} reached (${prior} on earlier heads): the below-floor fixes ship as notes in the PR body and receipt` };
|
||||
if (h.last !== 'none' && !h.blockingOpen) return used === cap
|
||||
? { step: 'full', reason: `${READ_ONLY_REVIEW}; this PR already had ${prior} full review round${prior === 1 ? '' : 's'} on earlier heads`, keepReader: true, readOnly: true }
|
||||
: { step: 'stop', reason: `a fix followed the read-only final review: ${CAPTAIN_DECIDES}` };
|
||||
return { step: 'stop', reason: `PR_ROUND_CAP: this PR already had ${used} full review round${used === 1 ? '' : 's'} across its heads and /ship runs${h.roundGrant ? ` (round grant ${h.roundGrant} included)` : ''}; another needs a reason the lane or its Captain records with gstack-approvals round-grant, not an owner ask` };
|
||||
}
|
||||
|
||||
const READ_ONLY_REVIEW = 'read-only final review (R51): fixes changed code after the last round, so the final head gets one full review of the whole PR diff (the dispatcher stages it on the merge base) with no fix round (GST-3562 A)';
|
||||
const CAPTAIN_DECIDES = "the lane's Captain decides (R51): ship with it as a ruled note, or keep the fix and run /ship again for one read-only full review of the final head";
|
||||
|
||||
/**
|
||||
* A step that applied fixes in the last allowed round (GST-3562 A, R51): the final head gets one read-only full review, unless
|
||||
* the fixes are below-floor and change no runtime lines on a light diff; a fix after that read-only review stops for the lane's
|
||||
* Captain. Code a fix changed never ships unread now that the fix-check is gone.
|
||||
*/
|
||||
function capStep(h: History, depth?: Depth): NextStep {
|
||||
if (h.fullPasses > FULL_PASS_CAP) return { step: 'stop', reason: `a fix followed the read-only final review: ${CAPTAIN_DECIDES}` };
|
||||
if (!h.fixedBlocking && !h.touchedGate && depth === 'light' && h.rangeRuntimeLines === 0) return { step: 'done', reason: `round cap ${FULL_PASS_CAP} reached: the below-floor fixes change no runtime lines and ship as notes in the PR body and receipt` };
|
||||
return { step: 'full', reason: READ_ONLY_REVIEW, keepReader: true, readOnly: true };
|
||||
}
|
||||
|
||||
/**
|
||||
* R65's lean table (GSTA-258): pass 1 is the one reviewer; any fix on a risk-class diff, and a fixed blocker or a gate-class
|
||||
* edit on any diff, earns one scoped fix-check (round 2, the cap); below-floor fixes on a light diff ship as notes. After the
|
||||
* fix-check a blocker or gate-class edit stops for the owner, whose recorded grant adds one more fix-check, never two.
|
||||
* edit on any diff, earns the one reviewer's full pass on the range (round 2, the cap; GST-3562 A); below-floor fixes on a
|
||||
* light diff ship as notes; capStep says what a fix after round 2 gets.
|
||||
*/
|
||||
function leanStep(h: History, depth?: Depth): NextStep {
|
||||
if (h.last === 'none') return { step: 'full', reason: 'pass 1: one reviewer reads the whole diff (R65)' };
|
||||
@@ -476,8 +498,9 @@ function leanStep(h: History, depth?: Depth): NextStep {
|
||||
}
|
||||
if (h.blockingOpen) return { step: 'stop', reason: 'a blocking finding is still open in fix scope: name it for the owner' };
|
||||
if (!h.fixedBlocking && !h.fixedBelow && !h.touchedGate) return { step: 'done', reason: 'the step applied no edits' };
|
||||
if (depth === 'light' && !h.fixedBlocking && !h.touchedGate) return { step: 'done', reason: 'light depth: the below-floor fixes ship as notes in the PR body and receipt without a fix-check (R65)' };
|
||||
return { step: 'fix-check', reason: `${h.fixedBlocking ? 'a blocking finding was fixed' : h.touchedGate ? 'a fix touched a gate-class path' : 'below-floor fixes on a risk-class diff'}: one scoped fix-check reads the touched hunks (round 2, the cap)` };
|
||||
if (depth === 'light' && !h.fixedBlocking && !h.touchedGate && h.rangeRuntimeLines === 0) return { step: 'done', reason: 'light depth: the below-floor fixes change no runtime lines, so they ship as notes in the PR body and receipt (R65)' };
|
||||
if (h.fullPasses >= FULL_PASS_CAP) return capStep(h, depth);
|
||||
return { step: 'full', reason: `${h.fixedBlocking ? 'a blocking finding was fixed' : h.touchedGate ? 'a fix touched a gate-class path' : depth === 'light' ? 'below-floor fixes changed runtime lines' : 'below-floor fixes on a risk-class diff'}: round 2 is the one reviewer's full pass on the range, never a fix-check (R51, GST-3562 A)`, keepReader: true };
|
||||
}
|
||||
|
||||
function loopStep(h: History, depth?: Depth): NextStep {
|
||||
@@ -487,9 +510,7 @@ function loopStep(h: History, depth?: Depth): NextStep {
|
||||
if (h.blockingOpen && h.fullPasses >= FULL_PASS_CAP) return { step: 'stop', reason: `a blocking finding is open after ${FULL_PASS_CAP} rounds: name it for the owner` };
|
||||
if (h.blockingOpen) return { step: 'stop', reason: 'a blocking finding is still open in fix scope: name it for the owner' };
|
||||
if (!fixed) return { step: 'done', reason: 'the step applied no edits' };
|
||||
if (h.fullPasses >= FULL_PASS_CAP) return h.fixedBlocking || h.touchedGate
|
||||
? { step: 'stop', reason: `${h.fixedBlocking ? 'a blocking finding was fixed' : 'a fix edited a gate-class path'} in round ${FULL_PASS_CAP}, the cap: name it for the owner, whose grant may add one scoped fix-check (review_loop_exception)` }
|
||||
: { step: 'done', reason: `round cap ${FULL_PASS_CAP} reached: the below-floor fixes ship as notes in the PR body and receipt` };
|
||||
if (h.fullPasses >= FULL_PASS_CAP) return capStep(h, depth);
|
||||
if (!h.fixedBlocking && !h.touchedGate && depth === 'light' && h.rangeRuntimeLines === 0) return { step: 'done', reason: 'light depth: the below-floor fixes change no runtime lines, so they ship as notes without a fix-check' };
|
||||
if (h.fixedBlocking || h.touchedGate) {
|
||||
if (!h.fixedBlocking) return { step: 'full', reason: 'a fix touched a gate-class path: full pass on the range' };
|
||||
@@ -499,7 +520,7 @@ function loopStep(h: History, depth?: Depth): NextStep {
|
||||
if (keep) return { step: 'full', reason: `a blocking finding was fixed and ${keep}: full pass on the range` };
|
||||
return { step: 'scoped', reason: `a blocking finding was fixed on a ${depth} diff with ${n} runtime lines in the fix range (<= ${SCOPED_RANGE_LINES}): scoped pass on the range` };
|
||||
}
|
||||
return { step: 'fix-check', reason: 'only below-floor fixes: one fix-check reads the touched hunks (round 2)' };
|
||||
return { step: 'full', reason: 'below-floor fixes changed code after round 1: round 2 is a full pass on the range, never a fix-check (R51, GST-3562 A)', keepReader: true };
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -615,13 +636,18 @@ export function keepCommand(d: Dispatch): string | null {
|
||||
|
||||
/** The reviewers the next step dispatches at its depth, with each role's effort tier and excluded pathspecs. */
|
||||
export function planReview(i: PlanInput): ReviewPlan {
|
||||
return planReviewAt(i, (h, d) => nextStep(h, d));
|
||||
}
|
||||
|
||||
/** planReview with the transition table passed in, so a no-loss replay can plan the step an earlier table chose. */
|
||||
export function planReviewAt(i: PlanInput, table: (h: History, depth: Depth) => NextStep): ReviewPlan {
|
||||
const c = classifyDiff(i);
|
||||
const depth = decideDepth(c, c.runtimeLines ?? (CLASS_RANK[c.class] >= CLASS_RANK.code ? i.diffLines : 0), i.floor);
|
||||
const { class: cls, runtimeLines } = depth;
|
||||
const sh = i.shape;
|
||||
const platformNow = !!sh && sh.platform === 'on' && sh.platformReview?.head === sh.head && i.history.fullPasses === 0 && !riskClass(c, depth) && platformFits(c.class, i.paths, depth.runtimeLines, i.numbers);
|
||||
const panel = !platformNow && (!sh || sh.panel === 'all' || (sh.panel === 'risk' && riskClass(c, depth)));
|
||||
const next = nextStep({ ...i.history, gate: cls === 'gate', adversarialRan: !!i.adversarialRan, lean: !panel }, depth.depth);
|
||||
const next = table({ ...i.history, gate: cls === 'gate', adversarialRan: !!i.adversarialRan, lean: !panel }, depth.depth);
|
||||
if (!panel) return leanPlan(i, c, depth, next);
|
||||
const h = i.history;
|
||||
const raise = depth.depth === 'light' && (h.fixedBlocking || h.blockingOpen || i.criticalFound);
|
||||
@@ -692,6 +718,7 @@ export function planReview(i: PlanInput): ReviewPlan {
|
||||
add('adversarial-native', 'adversarial', 'full');
|
||||
add('outside-voice', 'outside-voice', 'host');
|
||||
}
|
||||
if (next.keepReader && !dispatches.some(d => d.effort === 'full' && d.exclude.length === (x?.specs.length ?? 0))) add('red-team', 'red-team', 'full');
|
||||
if (i.targeted?.classes.length && ['full', 'scoped', 'fix-check', 'voices'].includes(next.step)) {
|
||||
if (i.targeted.ran) skipped.push('targeted (already read this product patch)');
|
||||
else add('targeted', 'targeted', ROLE_EFFORT.targeted);
|
||||
@@ -726,7 +753,7 @@ function leanPlan(i: PlanInput, c: ClassResult, depth: DepthResult, next: NextSt
|
||||
const plan = (n: NextStep, mode: ReviewMode): ReviewPlan => ({ ...depth, stepDepth: depth.depth, depthReasons: depth.reasons, reasons: c.reasons, next: n, numbers: i.numbers, dispatches, skipped, mode });
|
||||
const pr = sh.platformReview;
|
||||
const platformFit = !risky && platformFits(c.class, i.paths, depth.runtimeLines, i.numbers);
|
||||
if (next.step === 'full' && platformFit && sh.platform === 'on' && pr && pr.head === sh.head) {
|
||||
if (next.step === 'full' && i.history.last === 'none' && platformFit && sh.platform === 'on' && pr && pr.head === sh.head) {
|
||||
const why = `planned skip: platform review ${pr.id} by ${pr.reviewer} at ${pr.head.slice(0, 12)}`;
|
||||
for (const r of ['core checklist', 'specialists', 'red-team', 'adversarial-native', 'outside-voice', 'targeted']) skipped.push(`${r} (${why})`);
|
||||
return plan({ step: 'platform', reason: `review.platform on: the platform review ${pr.id} read HEAD ${pr.head.slice(0, 12)}, so /ship runs no reader (Step 11.5 binds the planned skip)` }, 'platform');
|
||||
@@ -739,6 +766,7 @@ function leanPlan(i: PlanInput, c: ClassResult, depth: DepthResult, next: NextSt
|
||||
: add('adversarial-native', 'single', 'full', docsAndOutputs, { checklists: [...batchChecklists('code', i, skipped), 'red-team'], model: sh.readerModel, ...classes });
|
||||
if (next.step === 'full' && (risky || depth.runtimeLines > 0)) {
|
||||
reader();
|
||||
if (i.history.fullPasses > 0 && i.numbers.publishes && i.reviewedNumbers !== undefined && i.reviewedNumbers !== i.numbers.fingerprint) add('outside-voice', 'outside-voice (numbers changed)', 'host');
|
||||
skipped.push(`specialists, red-team and outside-voice as their own readers (R65: the one ${risky ? 'risk-class' : 'light'} reader carries them)`);
|
||||
} else if (next.step === 'full') {
|
||||
const effort: Effort = i.tiers === false ? 'host' : ROLE_EFFORT.specialist;
|
||||
@@ -751,7 +779,8 @@ function leanPlan(i: PlanInput, c: ClassResult, depth: DepthResult, next: NextSt
|
||||
add('fix-check', 'fix-check', 'full');
|
||||
if (i.numbers.publishes && i.reviewedNumbers !== undefined && i.reviewedNumbers !== i.numbers.fingerprint) add('outside-voice', 'outside-voice (numbers changed)', 'host');
|
||||
}
|
||||
if (next.step === 'fix-check' && i.targeted?.classes.length) {
|
||||
if (next.keepReader && !dispatches.some(d => d.effort === 'full' && d.exclude.length === (x?.specs.length ?? 0))) add('red-team', 'red-team', 'full');
|
||||
if ((next.step === 'fix-check' || (next.keepReader && !dispatches.some(d => d.classes?.length))) && i.targeted?.classes.length) {
|
||||
if (i.targeted.ran) skipped.push('targeted (already read this product patch)');
|
||||
else add('targeted', 'targeted', ROLE_EFFORT.targeted);
|
||||
}
|
||||
|
||||
+1
-1
@@ -459,7 +459,7 @@ function route(cwd: string, base: string, reviewed: string, reviewedBase: Review
|
||||
for (const x of mech.refused) r.add(`ROUTE_MECHANICAL_REFUSED: ${x.path} ${x.reason} (docs/troubleshooting.md#route-mechanical-refused)`);
|
||||
for (const p of by.sidecar) r.add(`UID_SIDECAR: ${p} (beside ${uid.proven[p]})`);
|
||||
for (const x of uid.refused) r.add(`ROUTE_SIDECAR_REFUSED: ${x.path} ${x.reason} (docs/troubleshooting.md#route-sidecar-refused)`);
|
||||
if (by.behavior.length) { r.stop(`behavior, tests or build inputs changed since review (${short(by.behavior.sort())}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner's grant of one scoped fix-check (stage 2.1)`); return null; }
|
||||
if (by.behavior.length) { r.stop(`behavior, tests or build inputs changed since review (${short(by.behavior.sort())}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)`); return null; }
|
||||
const kept = by.mechanical.length || by.sidecar.length ? writeMechanicalRecord(cwd, now, mech.proven, uid.proven) : null;
|
||||
if (kept) { r.stop(`the mechanical and sidecar paths cannot be recorded for gstack-ship-receipt write (${kept}): make that directory writable, then rerun finish (stage 2.1)`); return null; }
|
||||
const scoped = [...by.context, ...by.tests, ...by.bounded].sort();
|
||||
|
||||
@@ -717,9 +717,9 @@ but missing dispatched output still blocks continuation, even with a QA exceptio
|
||||
note, never a pass).
|
||||
|
||||
1. **Apply the cap before any edit, then classify.** With the classified output in
|
||||
hand and nothing edited yet: if `CYCLES >= 3`, or under `frozen` `PASS >= 3` with
|
||||
a blocking finding in `scope: fix`, skip items 2–3 (no fix is applied on a capped
|
||||
pass), complete items 3.5–6 with the findings unfixed, and take decision 2 below.
|
||||
hand and nothing edited yet: if `CYCLES >= 3`, or the pass printed `READ_ONLY:` (the
|
||||
read-only final review), or under `frozen` `PASS >= 3` with a blocking finding in
|
||||
`scope: fix`, skip items 2–3 (no fix is applied on a capped pass), complete items 3.5–6 with the findings unfixed, and take decision 2 below.
|
||||
Otherwise: Classify only unmatched or reopened findings as AUTO-FIX or ASK when
|
||||
the classified output marks them `scope: fix`, per the Fix-First Heuristic in
|
||||
checklist.md. Critical findings lean toward ASK; informational lean toward AUTO-FIX.
|
||||
|
||||
@@ -127,9 +127,9 @@ but missing dispatched output still blocks continuation, even with a QA exceptio
|
||||
note, never a pass).
|
||||
|
||||
1. **Apply the cap before any edit, then classify.** With the classified output in
|
||||
hand and nothing edited yet: if `CYCLES >= 3`, or under `frozen` `PASS >= 3` with
|
||||
a blocking finding in `scope: fix`, skip items 2–3 (no fix is applied on a capped
|
||||
pass), complete items 3.5–6 with the findings unfixed, and take decision 2 below.
|
||||
hand and nothing edited yet: if `CYCLES >= 3`, or the pass printed `READ_ONLY:` (the
|
||||
read-only final review), or under `frozen` `PASS >= 3` with a blocking finding in
|
||||
`scope: fix`, skip items 2–3 (no fix is applied on a capped pass), complete items 3.5–6 with the findings unfixed, and take decision 2 below.
|
||||
Otherwise: Classify only unmatched or reopened findings as AUTO-FIX or ASK when
|
||||
the classified output marks them `scope: fix`, per the Fix-First Heuristic in
|
||||
checklist.md. Critical findings lean toward ASK; informational lean toward AUTO-FIX.
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* lib/review-depth.ts's transition table (nextStep and its helpers) as origin/main had it at 0408128 (v1.102.2.0), before
|
||||
* GST-3562 A retired the fix-check step. Frozen for the no-loss replays in test/review-depth*.test.ts: they plan each grid
|
||||
* case with this table through planReviewAt and check that every case the new table changes only adds review. Never edit.
|
||||
*/
|
||||
import { FULL_PASS_CAP, SCOPED_RANGE_LINES, type Depth, type History, type NextStep } from '../../../lib/review-depth';
|
||||
|
||||
export function mainNextStep(h: History, depth?: Depth): NextStep {
|
||||
if (h.grantedStop && h.last !== 'fix-check') return h.rangeRuntimeLines == null
|
||||
? { step: 'stop', reason: `fix-check grant ${h.grantedStop} answers the stop, but there is no fix to read since its head: commit the fix (a base merge, an empty or reverted change is none), then ask again` }
|
||||
: { step: 'fix-check', reason: `fix-check grant ${h.grantedStop} buys the stopped review's fix round: one scoped fix-check of the PR's own change since the stop's head, never a new full review and never a second fix-check` };
|
||||
const n = prCapped(h, h.lean ? leanStep(h, depth) : loopStep(h, depth));
|
||||
if (n.step !== 'stop') return n;
|
||||
if (h.gate && !h.adversarialRan) return { step: 'voices', reason: `gate class: Step 11's ${h.lean ? 'one reader' : 'voices (adversarial, outside, targeted)'} run${h.lean ? 's' : ''} before the owner's exit, then ask again with --adversarial-ran (${n.reason})` };
|
||||
const afterFixCheck = h.last === 'fix-check' && h.fullPasses === FULL_PASS_CAP - 1 && h.fixChecks === 1;
|
||||
if (h.postReview && h.last === 'fix-check' && h.granted && !h.blockingOpen) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check for the edits after the last fix-check, a new link of the fix-check chain (docs/ship-policy.md#fix-check-chain); a later post-review edit needs a grant of its own` };
|
||||
if (h.chained && h.last === 'fix-check' && h.granted && !h.blockingOpen) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check at the last fix-check's stop, a new link of the fix-check chain (docs/ship-policy.md#fix-check-chain); another stop needs a grant of its own` };
|
||||
if (!h.lean && h.granted && !h.blockingOpen && (afterFixCheck || (h.last === 'full' && h.fullPasses === FULL_PASS_CAP))) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check after round ${FULL_PASS_CAP} (review_loop_exception), ${afterFixCheck ? 'never a second' : 'never a fourth round'}` };
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* R51 per pull request (GST-2673, docs/review-policy.md#rounds-per-pull-request): the rounds earlier /ship runs on this
|
||||
* PR spent count against FULL_PASS_CAP with this run's, and a recorded round grant at this head adds one. At the cap a
|
||||
* below-floor fix ships as notes and anything else stops with PR_ROUND_CAP for the lane or its Captain, never the owner.
|
||||
* A PR already at the cap gets one read-only full review of this head: no fix round, the count does not reopen, and a
|
||||
* blocker stops with PR_ROUND_CAP as the lane's Captain's decision.
|
||||
*/
|
||||
function prCapped(h: History, n: NextStep): NextStep {
|
||||
const prior = h.priorFull ?? 0;
|
||||
const cap = FULL_PASS_CAP + (h.roundGrant ? 1 : 0);
|
||||
if (prior >= cap) {
|
||||
if (h.last === 'none') return n.step === 'full' || n.step === 'scoped' ? { step: 'full', reason: `read-only final review (R51): this PR already had ${prior} full review rounds on earlier heads, so this head gets one full review with no fix round; a blocker goes to the lane's Captain as a decision and the count does not reopen` } : n;
|
||||
if (n.step === 'done') return n;
|
||||
if (!h.fixedBlocking && !h.blockingOpen && !h.touchedGate && n.step !== 'stop') return { step: 'done', reason: `read-only final review done (R51): its below-floor findings ship as notes in the PR body and receipt, with no fix round` };
|
||||
return { step: 'stop', reason: `PR_ROUND_CAP: the read-only final review of a PR that already had ${prior} full review rounds found a blocker; the lane's Captain decides (ship with the note, park, or buy its fix round with a fix-check grant naming the stop gstack-ship-receipt stop records), not an owner ask` };
|
||||
}
|
||||
if (!prior || (n.step !== 'full' && n.step !== 'scoped')) return n;
|
||||
const used = prior + h.fullPasses;
|
||||
if (used < cap) return { ...n, reason: `${n.reason}; this PR already had ${prior} full review round${prior === 1 ? '' : 's'} on earlier heads, so this is its full round ${used + 1} of ${cap}${used + 1 === cap ? ', the last' : ''}` };
|
||||
if (h.roundGrant && used === cap && prior === cap - 1 && h.fullPasses === 1 && h.last === 'full') return { ...n, reason: `${n.reason}; round grant ${h.roundGrant} bought pass 1 as this PR's full round ${cap}, and this is that round's fix round, its last` };
|
||||
if (h.last !== 'none' && !h.fixedBlocking && !h.blockingOpen && !h.touchedGate) return { step: 'done', reason: `PR round cap ${cap} reached (${prior} on earlier heads): the below-floor fixes ship as notes in the PR body and receipt` };
|
||||
return { step: 'stop', reason: `PR_ROUND_CAP: this PR already had ${used} full review round${used === 1 ? '' : 's'} across its heads and /ship runs${h.roundGrant ? ` (round grant ${h.roundGrant} included)` : ''}; another needs a reason the lane or its Captain records with gstack-approvals round-grant, not an owner ask` };
|
||||
}
|
||||
|
||||
/**
|
||||
* R65's lean table (GSTA-258): pass 1 is the one reviewer; any fix on a risk-class diff, and a fixed blocker or a gate-class
|
||||
* edit on any diff, earns one scoped fix-check (round 2, the cap); below-floor fixes on a light diff ship as notes. After the
|
||||
* fix-check a blocker or gate-class edit stops for the owner, whose recorded grant adds one more fix-check, never two.
|
||||
*/
|
||||
function leanStep(h: History, depth?: Depth): NextStep {
|
||||
if (h.last === 'none') return { step: 'full', reason: 'pass 1: one reviewer reads the whole diff (R65)' };
|
||||
if (h.last === 'fix-check') {
|
||||
if (!h.blockingOpen && !h.fixedBlocking && !h.touchedGate) return { step: 'done', reason: h.fixedBelow ? 'round cap 2 reached: the below-floor fixes ship as notes in the PR body and receipt' : 'the fix-check found nothing blocking' };
|
||||
if (h.granted && !h.blockingOpen && h.fixChecks === 1) return { step: 'fix-check', reason: `the owner's grant ${h.granted} adds one scoped fix-check after round ${FULL_PASS_CAP} (review_loop_exception), never a second` };
|
||||
return { step: 'stop', reason: `the fix-check ${h.blockingOpen || h.fixedBlocking ? 'found a blocking finding' : 'edited a gate-class path'}: name it for the owner, whose grant may add one scoped fix-check, never a third round` };
|
||||
}
|
||||
if (h.blockingOpen) return { step: 'stop', reason: 'a blocking finding is still open in fix scope: name it for the owner' };
|
||||
if (!h.fixedBlocking && !h.fixedBelow && !h.touchedGate) return { step: 'done', reason: 'the step applied no edits' };
|
||||
if (depth === 'light' && !h.fixedBlocking && !h.touchedGate) return { step: 'done', reason: 'light depth: the below-floor fixes ship as notes in the PR body and receipt without a fix-check (R65)' };
|
||||
return { step: 'fix-check', reason: `${h.fixedBlocking ? 'a blocking finding was fixed' : h.touchedGate ? 'a fix touched a gate-class path' : 'below-floor fixes on a risk-class diff'}: one scoped fix-check reads the touched hunks (round 2, the cap)` };
|
||||
}
|
||||
|
||||
function loopStep(h: History, depth?: Depth): NextStep {
|
||||
if (h.last === 'none') return { step: 'full', reason: 'pass 1 reviews the whole diff' };
|
||||
const fixed = !!(h.fixedBlocking || h.fixedBelow || h.touchedGate);
|
||||
if (h.last === 'fix-check') return h.blockingOpen || h.fixedBlocking || h.touchedGate ? { step: 'stop', reason: `the fix-check ${h.touchedGate && !h.blockingOpen && !h.fixedBlocking ? 'edited a gate-class path' : 'found a blocking finding'}: name it for the owner, whose grant may add one scoped fix-check, never a third round` } : { step: 'done', reason: fixed ? 'round cap 2 reached: the below-floor fixes ship as notes in the PR body and receipt' : 'the fix-check found nothing blocking' };
|
||||
if (h.blockingOpen && h.fullPasses >= FULL_PASS_CAP) return { step: 'stop', reason: `a blocking finding is open after ${FULL_PASS_CAP} rounds: name it for the owner` };
|
||||
if (h.blockingOpen) return { step: 'stop', reason: 'a blocking finding is still open in fix scope: name it for the owner' };
|
||||
if (!fixed) return { step: 'done', reason: 'the step applied no edits' };
|
||||
if (h.fullPasses >= FULL_PASS_CAP) return h.fixedBlocking || h.touchedGate
|
||||
? { step: 'stop', reason: `${h.fixedBlocking ? 'a blocking finding was fixed' : 'a fix edited a gate-class path'} in round ${FULL_PASS_CAP}, the cap: name it for the owner, whose grant may add one scoped fix-check (review_loop_exception)` }
|
||||
: { step: 'done', reason: `round cap ${FULL_PASS_CAP} reached: the below-floor fixes ship as notes in the PR body and receipt` };
|
||||
if (!h.fixedBlocking && !h.touchedGate && depth === 'light' && h.rangeRuntimeLines === 0) return { step: 'done', reason: 'light depth: the below-floor fixes change no runtime lines, so they ship as notes without a fix-check' };
|
||||
if (h.fixedBlocking || h.touchedGate) {
|
||||
if (!h.fixedBlocking) return { step: 'full', reason: 'a fix touched a gate-class path: full pass on the range' };
|
||||
const n = h.rangeRuntimeLines;
|
||||
const keep = h.touchedGate ? 'a fix touched a gate-class path' : depth === undefined ? 'the depth is unknown' : h.pass1Depth === 'full' ? 'pass 1 ran at full depth' : depth === 'full' ? 'the diff is at full depth'
|
||||
: typeof n !== 'number' || !Number.isFinite(n) || n < 0 ? 'the fix range was not read' : n > SCOPED_RANGE_LINES ? `the fix range has ${n} runtime lines (> ${SCOPED_RANGE_LINES})` : null;
|
||||
if (keep) return { step: 'full', reason: `a blocking finding was fixed and ${keep}: full pass on the range` };
|
||||
return { step: 'scoped', reason: `a blocking finding was fixed on a ${depth} diff with ${n} runtime lines in the fix range (<= ${SCOPED_RANGE_LINES}): scoped pass on the range` };
|
||||
}
|
||||
return { step: 'fix-check', reason: 'only below-floor fixes: one fix-check reads the touched hunks (round 2)' };
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
{"sha":"82f87a1db38f5ccd82e5786840176e0142c318bd81ace0367ac2e03cb2d3524d","replay":"GST-3238"}
|
||||
{"sha":"e616b939cb5ad8283d9590ba887e63ad54018ee08e4846c59d8ec7171af24860","replay":"GST-3562-A"}
|
||||
@@ -1 +1 @@
|
||||
{"sha":"028d2acefe7be4eaba56ff7f086dc7eae1ef9d308f24276f9f3ef9b9b64bf1c1","replay":"GST-3364"}
|
||||
{"sha":"b62f72416cf46298004c399254b25ace4230dddf5528c3fe2685bdcc8b4b3fd3","replay":"GST-3562-A"}
|
||||
@@ -0,0 +1 @@
|
||||
{"replay": "GST-3562-A", "justification": "GST-3562 letter A (Garry 'Do it' 2026-11-23 to the /ship simplification cut list; Captain GStack Minder's CREW rule 15 ruling, approval a-6ec01c09edf8: \"Only B removes a reader that can block a merge. A replaces narrow re-checks with full rounds, K and L remove audits that never block, and F only reorders; none can lose a catch the panel makes.\"). Deterministic no-loss replay, no paid run: main's transition table frozen at 0408128 (test/fixtures/review-depth-main/next-step-0408128.ts) against this branch's nextStep over 3,932,160 History cases (passes 0-3; last none, full or fix-check; every mix of the four fix flags; range runtime lines unset, null, 0, 5 and 500; pass-1 and step depth unset, light, standard and full; gate, Step 11 run and lean on and off; 0 or 1 fix-checks; 0-3 prior full rounds; with and without a recorded grant and a round grant). 2,757,344 are identical. Every other case is one of five kinds that add review or move a decision to the lane's Captain, never drop a read of changed code: (a) a planned fix-check becomes a full pass on the same range, 133,120; (b) the same stop, voices or done step with reworded reason text, 897,760; (c) a fix-check after a read-only full review, or one a grant bought at the PR's round cap, becomes a stop for the Captain (on gate class after Step 11's voices), 74,880; (d) a below-floor fix main shipped unread (including a light lean fix that changed runtime lines) becomes a full pass, a read-only full review, or a stop, 46,976; (e) a fixed blocker or gate-class edit at the cap, granted or not, gets one read-only full review of the whole PR diff instead of a stop or a fix-check, 22,080. The lean round 2 that replaces a fix-check keeps the fix-check's second-model reader when published numbers changed. Dispatch equality: every kind (a) case must keep main's readers, meaning a full-effort reader that excludes nothing main's fix-check read plus each of main's other readers. The table marks each step that stands where main planned a fix-check, and the read-only final review, with a structured keepReader flag that prCapped's spreads carry; a dispatch with keepReader and no full-effort reader adds the Red Team reader at full effort on the fix range, and a lean keepReader step keeps main's targeted reader, and the bot-review (review.platform) skip applies only to a run's first review. test/helpers/gst3562-replay.ts asserts it on every grid, and test/review-depth-lean.test.ts runs it over 5 diff shapes x review.panel all, risk and off x review.platform off and on with a bot review at HEAD x published numbers or none x a targeted class, an already-read one or none x 0-2 prior full rounds x round grant or none x every in-run history (61,704 changed cases, all of the five kinds). The read-only final review also carries a structured readOnly flag: the dispatcher stages it on the PR's merge base whatever --diff-base the driver passes and prints READ_ONLY, and Step 3's edit guard in ship/sections/review-army.md applies no fix on a pass that printed it; that guard change adds an edit stop and removes no reader or brief byte (test/review-pass.test.ts). This replaces #4737's first attempt, which keyed the rule on reason text and missed three corners (findings/gstack-2026-11-23-full-rounds-first-attempt.md)."}
|
||||
@@ -217,6 +217,7 @@ export const FREE_FIXTURES: Readonly<Record<string, readonly string[]>> = {
|
||||
'test/fixtures/redact-diagram/**': ['test/redact-context-exemptions.test.ts'],
|
||||
'test/fixtures/remote-identity-vectors.json': ['test/bin-context-windows-slug.test.ts', 'test/gstack-slug-parity.test.ts', 'test/remote-identity-vectors.test.ts'],
|
||||
'test/fixtures/review-depth/**': ['crew/test/review-dispatch-compare.test.ts'],
|
||||
'test/fixtures/review-depth-main/**': ['test/helpers/gst3562-replay.ts'],
|
||||
'test/fixtures/review-fetch/**': ['test/review-fetch.test.ts'],
|
||||
'test/fixtures/review-ledger/**': ['test/review-dispatch.test.ts'],
|
||||
'test/fixtures/review-pins/**': ['test/review-packets-removed.test.ts'],
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* GST-3562 A's no-loss replay. /ship plans no new fix-check: a fix that main at 0408128 (v1.102.2.0) answered with a fix-check
|
||||
* now gets a full pass on the range, and a fix made in the last allowed round gets one read-only full review of the final head
|
||||
* instead of shipping unread or stopping; R51's 2-round cap stays. The Captain ruled on 2026-11-23 under rule 15 (approval
|
||||
* a-6ec01c09edf8): "Only B removes a reader that can block a merge. A replaces narrow re-checks with full rounds…".
|
||||
*
|
||||
* asMainBeforeGst3562 plans the input with main's frozen transition table (mainNextStep) through planReviewAt. When that plan
|
||||
* equals the branch's, it returns the branch's plan. Otherwise it asserts the change is one of the kinds the ruling allows and
|
||||
* returns main's plan, so a grid hash frozen to an older main still matches after the earlier adapters run:
|
||||
* a. main planned a fix-check; the branch plans a full or scoped pass on the same range that keeps main's readers: a
|
||||
* full-effort reader excluding nothing main's fix-check read, and each of main's other readers (the targeted brief may
|
||||
* ride on the one adversarial reader, as R65's merged reader carries it).
|
||||
* b. both plans take the same stop, voices or done step and differ only in its reason text.
|
||||
* c. main planned a fix-check at the cap after a read-only review had run; the branch stops for the lane's Captain (on gate
|
||||
* class, Step 11's voices first).
|
||||
* d. main was done with an unread below-floor fix; the branch reviews it (a full pass, a read-only full review, or a stop or
|
||||
* the voices before one).
|
||||
* e. main stopped (or ran the voices before stopping) on a blocker fixed or a gate edit made at the cap; the branch gives the
|
||||
* final head one read-only full review.
|
||||
*/
|
||||
import { expect } from 'bun:test';
|
||||
import { planReviewAt, type PlanInput, type ReviewPlan } from '../../lib/review-depth';
|
||||
import { mainNextStep } from '../fixtures/review-depth-main/next-step-0408128';
|
||||
|
||||
export type Gst3562Kind = 'a' | 'b' | 'c' | 'd' | 'e';
|
||||
|
||||
export function asMainBeforeGst3562(input: PlanInput, plan: ReviewPlan): { plan: ReviewPlan; kind?: Gst3562Kind } {
|
||||
const main = planReviewAt(input, mainNextStep);
|
||||
if (Bun.deepEquals(main, plan)) return { plan };
|
||||
const h = input.history;
|
||||
const [was, now] = [main.next, plan.next];
|
||||
const kind: Gst3562Kind | undefined =
|
||||
was.step === now.step && ['stop', 'voices', 'done'].includes(now.step) ? 'b'
|
||||
: was.step === 'fix-check' && (now.step === 'full' || now.step === 'scoped') && now.reason.includes('GST-3562 A') ? 'a'
|
||||
: was.step === 'fix-check' && (now.step === 'stop' || now.step === 'voices') && now.reason.includes('a fix followed the read-only final review') ? 'c'
|
||||
: was.step === 'done' && !!h.fixedBelow && ['full', 'stop', 'voices', 'fix-check'].includes(now.step) ? 'd'
|
||||
: (was.step === 'stop' || was.step === 'voices') && !!(h.fixedBlocking || h.touchedGate) && now.step === 'full' && now.reason.startsWith('read-only final review (R51)') ? 'e'
|
||||
: undefined;
|
||||
expect([h, was, now, kind]).toEqual([h, was, now, expect.any(String)]);
|
||||
if (kind === 'b') expect({ ...plan, next: was }).toEqual(main);
|
||||
if (kind === 'a') {
|
||||
const lost = main.dispatches.filter(d => d.role === 'fix-check'
|
||||
? !plan.dispatches.some(p => p.role !== 'targeted' && p.effort === 'full' && p.exclude.every(e => d.exclude.includes(e)))
|
||||
: !plan.dispatches.some(p => p.role === d.role || (d.role === 'targeted' && p.role === 'adversarial-native' && !!p.classes?.length)));
|
||||
expect([h, plan.mode, lost]).toEqual([h, plan.mode, []]);
|
||||
}
|
||||
return { plan: main, kind };
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { appendEvent, verify } from '../lib/review-ledger';
|
||||
import * as os from 'node:os';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { matchRisk } from '../lib/review-risk';
|
||||
import { asMainBeforeGst3562 } from './helpers/gst3562-replay';
|
||||
import { renderBrief, sectionTexts, sliceDiff, sliceNote } from '../lib/review-brief';
|
||||
import { validatePolicy, DEFAULT_POLICY, REVIEW_POLICY_KEY_VERSION } from '../lib/ship-policy';
|
||||
|
||||
@@ -128,14 +129,20 @@ describe('R65 lean dispatch (GSTA-258 build C): one reviewer, once', () => {
|
||||
expect(roles(p)).toEqual(['adversarial-native:single:full:lane']);
|
||||
expect(roles(planReview(base({ shape: lean({ readerModel: 'cross-family' }) })))).toEqual(['adversarial-native:single:full:cross-family']);
|
||||
});
|
||||
test('panel risk (opt-in, FOUN-64 item 1): a risk-class diff gets the printed full-depth panel; a fixed blocker re-runs the printed plan as round 2 (FOUN-32 §5)', () => {
|
||||
test('panel risk (opt-in, FOUN-64 item 1): a risk-class diff gets the printed full-depth panel; a fixed blocker re-runs the printed plan as round 2 (FOUN-32 §5), a round-2 fix gets the read-only full review, and a lean fixed blocker gets the one reader\'s full pass (GST-3562 A)', () => {
|
||||
const today = roles(planReview(base({ paths: ['lib/billing.ts'], targeted: { classes: ['money'] }, shape: undefined })));
|
||||
const p = planReview(base({ paths: ['lib/billing.ts'], targeted: { classes: ['money'] } }));
|
||||
expect([p.depth, p.mode, roles(p)]).toEqual(['full', 'panel', today]);
|
||||
expect(today.length).toBeGreaterThan(1);
|
||||
expect(planReview(base({ paths: ['lib/billing.ts'], history: { fullPasses: 1, last: 'full', fixedBlocking: true } })).next.step).toBe('full');
|
||||
expect(planReview(base({ paths: ['lib/billing.ts'], history: { fullPasses: 2, last: 'full', fixedBlocking: true } })).next.step).toBe('stop');
|
||||
expect(planReview(base({ history: { fullPasses: 1, last: 'full', fixedBlocking: true } })).next.step).toBe('fix-check');
|
||||
const readOnly = planReview(base({ paths: ['lib/billing.ts'], history: { fullPasses: 2, last: 'full', fixedBlocking: true } }));
|
||||
expect([readOnly.mode, readOnly.next.step, readOnly.next.reason, readOnly.next.readOnly]).toEqual(['panel', 'full', expect.stringContaining('read-only final review (R51)'), true]);
|
||||
expect(planReview(base({ paths: ['lib/billing.ts'], history: { fullPasses: 1, last: 'full', fixedBlocking: true } })).next.readOnly).toBeUndefined();
|
||||
expect(planReview(base({ paths: ['lib/billing.ts'], history: { priorRounds: 1, priorFull: 1, fullPasses: 1, last: 'full', fixedBlocking: true } })).next).toMatchObject({ step: 'full', readOnly: true, reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(planReview(base({ paths: ['lib/billing.ts'], history: { fullPasses: 3, last: 'full', fixedBlocking: true } })).next).toMatchObject({ step: 'stop', reason: expect.stringContaining("the lane's Captain decides") });
|
||||
const leanFix = planReview(base({ history: { fullPasses: 1, last: 'full', fixedBlocking: true } }));
|
||||
expect([leanFix.mode, leanFix.next.step, roles(leanFix)]).toEqual(['lean', 'full', ['adversarial-native:single:full:lane']]);
|
||||
expect(leanFix.next.reason).toContain('GST-3562 A');
|
||||
});
|
||||
test('panel off: risk class gets one reader on the configured model with the merged panel brief; it carries the targeted classes', () => {
|
||||
const p = planReview(base({ paths: ['lib/billing.ts'], targeted: { classes: ['money'] }, shape: lean({ panel: 'off' }) }));
|
||||
@@ -158,6 +165,36 @@ describe('R65 lean dispatch (GSTA-258 build C): one reviewer, once', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('GST-3562 A no-loss replay across panels, prior rounds, round grants, the bot-review skip and targeted classes', () => {
|
||||
// Value: protects=rule 15's no-loss rule for review depth: a step that stands where main planned a fix-check keeps a full-effort reader excluding nothing that fix-check read, plus main's other readers, under every panel, prior-round count, round grant, bot-review shape and targeted class; fails_when=a replacement pass dispatches no full-effort reader (the three corners #4737's read-only reviews found: a lean docs-only round 2, the same under a round grant, the bot-review skip on a repeat) or drops main's targeted or outside voice;
|
||||
// why_new=GST-3562 A; seam=planReview, asMainBeforeGst3562; no_claim=what the kept reader finds
|
||||
test('every changed case is an allowed kind, and each fix-check it replaces keeps its reader', () => {
|
||||
const kinds: Record<string, number> = {};
|
||||
const fixtures: Record<string, string[]> = { docs: ['docs/a.md'], tests: ['test/a.test.ts'], code: ['src/app.ts'], risk: ['lib/billing.ts'], mixed: ['src/app.ts', 'docs/a.md'] };
|
||||
const counted = scanNumbers({ 'docs/a.md': ['recall 87% (26/30)'] });
|
||||
const bot = { id: 'r1', head: HEAD, reviewer: 'capy-ai[bot]' };
|
||||
for (const [name, paths] of Object.entries(fixtures)) for (const panel of ['all', 'off', 'risk'] as const) for (const platform of ['off', 'on'] as const) for (const numbers of [none, counted])
|
||||
for (const targeted of [undefined, { classes: ['money'] }, { classes: ['money'], ran: true }]) for (const priorFull of [0, 1, 2]) for (const roundGrant of [undefined, 'g-1']) for (const fullPasses of [0, 1, 2]) for (const last of ['none', 'full', 'fix-check'] as const) for (let bits = 0; bits < 16; bits++) for (const adversarialRan of [false, true]) {
|
||||
const history = { fullPasses, last, fixedBlocking: !!(bits & 1), fixedBelow: !!(bits & 2), blockingOpen: !!(bits & 4), touchedGate: !!(bits & 8), priorFull, roundGrant };
|
||||
const input = base({ paths, numbers, history, adversarialRan, ...(targeted ? { targeted } : {}), shape: lean({ panel, platform, platformReview: platform === 'on' ? bot : null }) });
|
||||
const { kind } = asMainBeforeGst3562(input, planReview(input));
|
||||
if (kind) kinds[`${name}:${kind}`] = (kinds[`${name}:${kind}`] ?? 0) + 1;
|
||||
}
|
||||
expect(kinds).toEqual({ 'docs:a': 4134, 'docs:b': 6336, 'docs:c': 576, 'docs:d': 1086, 'docs:e': 576, 'tests:a': 4134, 'tests:b': 6336, 'tests:c': 576, 'tests:d': 1086, 'tests:e': 576, 'code:a': 3984, 'code:b': 6336, 'code:c': 576, 'code:d': 1056, 'code:e': 576, 'risk:a': 2664, 'risk:b': 6624, 'risk:c': 336, 'risk:d': 456, 'risk:e': 1152, 'mixed:a': 3984, 'mixed:b': 6336, 'mixed:c': 576, 'mixed:d': 1056, 'mixed:e': 576 });
|
||||
}, 60_000);
|
||||
test('the three corners keep the one full-effort reader main\'s fix-check was', () => {
|
||||
const bot = { id: 'r1', head: HEAD, reviewer: 'capy-ai[bot]' };
|
||||
for (const panel of ['off', 'risk'] as const) for (const extra of [{}, { priorFull: 1, roundGrant: 'g-1' }, { priorFull: 2, roundGrant: 'g-1' }]) for (const platform of ['off', 'on'] as const) {
|
||||
const p = planReview(base({ paths: ['docs/a.md'], history: { fullPasses: 1, last: 'full', fixedBlocking: true, ...extra }, shape: lean({ panel, platform, platformReview: platform === 'on' ? bot : null }) }));
|
||||
expect([panel, extra, platform, p.next.step, roles(p)]).toEqual([panel, extra, platform, 'full', ['red-team:red-team:full:-']]);
|
||||
}
|
||||
for (const paths of [['docs/a.md'], ['test/a.test.ts']]) for (const panel of ['off', 'risk'] as const) {
|
||||
const p = planReview(base({ paths, targeted: { classes: ['money'] }, history: { fullPasses: 1, last: 'full', fixedBlocking: true }, shape: lean({ panel }) }));
|
||||
expect([paths, panel, roles(p).filter(r => r.startsWith('red-team') || r.startsWith('targeted'))]).toEqual([paths, panel, ['red-team:red-team:full:-', 'targeted:targeted:full:-']]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('C6 platform depth (FOUN-32, founderstar#496): a planned skip needs the platform review at the exact head', () => {
|
||||
test('runtime code never fits the platform depth, even with no runtime lines (a registered generated output, a mode-only change)', () => {
|
||||
const none = scanNumbers({});
|
||||
@@ -216,20 +253,41 @@ describe('C6 platform depth (FOUN-32, founderstar#496): a planned skip needs the
|
||||
expect(planReview(base({ ...docs, shape: all(null) })).mode).toBe('panel');
|
||||
expect(planReview(base({ shape: all(ev) })).mode).toBe('panel');
|
||||
});
|
||||
test('the platform skip is pass 1 only: a later step plans as lean', () => {
|
||||
test('the platform skip is pass 1 only: a later step plans as lean, the one reader\'s full pass on the range (GST-3562 A)', () => {
|
||||
const p = planReview(base({ shape: on({ id: '1', head: HEAD, reviewer: 'capy-ai[bot]' }), history: { fullPasses: 1, last: 'full', fixedBlocking: true } }));
|
||||
expect(p.next.step).toBe('fix-check');
|
||||
expect([p.mode, p.next.step, roles(p)]).toEqual(['lean', 'full', ['adversarial-native:single:full:lane']]);
|
||||
expect(p.next.reason).toContain('GST-3562 A');
|
||||
});
|
||||
});
|
||||
|
||||
describe('R65 lean loop: one fix round, never more than 2 rounds', () => {
|
||||
const h = (o: object) => ({ fullPasses: 1, last: 'full' as const, lean: true, ...o });
|
||||
test('non-risk: a fixed blocker earns one fix-check; below-floor fixes ship as notes', () => {
|
||||
expect(nextStep(h({ fixedBlocking: true }), 'light').step).toBe('fix-check');
|
||||
expect(nextStep(h({ fixedBelow: true }), 'light')).toMatchObject({ step: 'done', reason: expect.stringContaining('notes') });
|
||||
test('non-risk: a fixed blocker earns the one reader\'s full pass on the range (GST-3562 A); below-floor fixes ship as notes only when they change no runtime lines', () => {
|
||||
expect(nextStep(h({ fixedBlocking: true }), 'light')).toMatchObject({ step: 'full', reason: expect.stringContaining("round 2 is the one reviewer's full pass on the range, never a fix-check (R51, GST-3562 A)") });
|
||||
expect(nextStep(h({ fixedBelow: true, rangeRuntimeLines: 0 }), 'light')).toMatchObject({ step: 'done', reason: expect.stringContaining('notes') });
|
||||
for (const rangeRuntimeLines of [undefined, null, 2]) {
|
||||
expect(nextStep(h({ fixedBelow: true, rangeRuntimeLines }), 'light')).toMatchObject({ step: 'full', reason: expect.stringContaining('below-floor fixes changed runtime lines') });
|
||||
expect(nextStep(h({ fixedBelow: true, rangeRuntimeLines, fullPasses: 2 }), 'light')).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(nextStep(h({ fixedBelow: true, rangeRuntimeLines, fullPasses: 3 }), 'light').step).toBe('stop');
|
||||
}
|
||||
});
|
||||
test('risk: any fix earns one scoped fix-check, a gate-class edit included, never a second full pass', () => {
|
||||
for (const o of [{ fixedBlocking: true }, { fixedBelow: true }, { fixedBelow: true, touchedGate: true }]) expect(nextStep(h(o), 'full').step).toBe('fix-check');
|
||||
test('risk: any fix earns the one reader\'s full pass on the range as round 2, a gate-class edit included (GST-3562 A); a round-2 fix gets one read-only full review, and a fix after it stops for the lane\'s Captain', () => {
|
||||
for (const o of [{ fixedBlocking: true }, { fixedBelow: true }, { fixedBelow: true, touchedGate: true }]) {
|
||||
expect(nextStep(h(o), 'full')).toMatchObject({ step: 'full', reason: expect.stringContaining('never a fix-check (R51, GST-3562 A)') });
|
||||
expect(nextStep(h({ ...o, fullPasses: 2 }), 'full')).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(nextStep(h({ ...o, fullPasses: 3 }), 'full')).toMatchObject({ step: 'stop', reason: expect.stringContaining("the lane's Captain decides") });
|
||||
}
|
||||
});
|
||||
// Value: protects=the lean round 2 that replaced the fix-check keeps its second-model check of changed published numbers
|
||||
// (R12's published-number blocker); fails_when=a code PR whose fix changed a published number gets only the native reader in
|
||||
// round 2; why_new=GST-3562 A (PR #4737's second-model review); seam=leanPlan; no_claim=what the reader finds
|
||||
test('round 2 on a code diff adds the second-model reader when the fix changed a published number, as the fix-check did', () => {
|
||||
const numbers = scanNumbers({ 'docs/bench.md': ['3x faster'] });
|
||||
const p = (reviewedNumbers: string) => planReview(base({ paths: ['src/app.ts', 'docs/bench.md'], numbers, reviewedNumbers, history: { fullPasses: 1, last: 'full', fixedBlocking: true } }));
|
||||
const roles = (q: ReturnType<typeof planReview>) => q.dispatches.map(d => `${d.role}:${d.name}`);
|
||||
expect(p('old').next.step).toBe('full');
|
||||
expect(roles(p('old'))).toContain('outside-voice:outside-voice (numbers changed)');
|
||||
expect(roles(p(numbers.fingerprint))).not.toContain('outside-voice:outside-voice (numbers changed)');
|
||||
});
|
||||
test('a fix-check blocker stops for the owner; a recorded grant adds one fix-check, never two', () => {
|
||||
expect(nextStep(h({ last: 'fix-check', fixedBlocking: true, fixChecks: 1 }), 'full').step).toBe('stop');
|
||||
@@ -237,8 +295,9 @@ describe('R65 lean loop: one fix round, never more than 2 rounds', () => {
|
||||
expect(nextStep(h({ last: 'fix-check', fixedBlocking: true, fixChecks: 2, granted: 'apr_1' }), 'full').step).toBe('stop');
|
||||
expect(nextStep(h({ last: 'fix-check', fixedBlocking: true, granted: 'apr_1' }), 'full').step).toBe('stop');
|
||||
});
|
||||
test('planReview marks the loop lean and a fix-check dispatches one full-effort reader', () => {
|
||||
expect(roles(planReview(base({ paths: ['lib/billing.ts'], history: { fullPasses: 1, last: 'full', fixedBlocking: true }, shape: lean({ panel: 'off' }) })))).toEqual(['fix-check:fix-check:full:-']);
|
||||
test('planReview marks the loop lean and round 2 dispatches the one full-effort reader with the merged brief, never a fix-check (GST-3562 A)', () => {
|
||||
const p = planReview(base({ paths: ['lib/billing.ts'], history: { fullPasses: 1, last: 'full', fixedBlocking: true }, shape: lean({ panel: 'off' }) }));
|
||||
expect([p.mode, p.next.step, roles(p)]).toEqual(['lean', 'full', ['adversarial-native:merged:full:lane']]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+96
-51
@@ -7,6 +7,7 @@ import { classifyDiff, classifyPath, dataCandidate, PREREG_PATH, depthFor, gateS
|
||||
import { summarizeReviewLoop } from '../lib/review-scope';
|
||||
import { sectionTexts } from '../lib/review-brief';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { asMainBeforeGst3562 } from './helpers/gst3562-replay';
|
||||
|
||||
const ROOT = path.join(import.meta.dir, '..');
|
||||
const none = scanNumbers({});
|
||||
@@ -44,24 +45,29 @@ describe('nextStep: the transition table', () => {
|
||||
test('pass 1 is full', () => expect(nextStep({ fullPasses: 0, last: 'none' }).step).toBe('full'));
|
||||
test('no edits is done', () => expect(nextStep({ fullPasses: 1, last: 'full' }).step).toBe('done'));
|
||||
test('a fixed blocker earns full pass 2', () => expect(nextStep({ fullPasses: 1, last: 'full', fixedBlocking: true }).step).toBe('full'));
|
||||
test('below-floor fixes earn one fix-check', () => expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true }).step).toBe('fix-check'));
|
||||
test('below-floor fixes after pass 1 earn a full pass on the range, never a fix-check (GST-3562 A)', () => expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true })).toMatchObject({ step: 'full', reason: expect.stringContaining('GST-3562 A') }));
|
||||
test('a fix touching gate code earns a full pass instead of a fix-check', () => expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true, touchedGate: true }).step).toBe('full'));
|
||||
// R51: two rounds is the cap, a fix-check included. A blocker open or fixed in round 2 stops for the owner (a grant may add
|
||||
// one scoped fix-check); below-floor fixes in round 2 finish with notes; a light pass whose fixes change no runtime lines is done.
|
||||
test('a blocker fixed in round 2 stops for the owner, never a third round', () => {
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBlocking: true })).toMatchObject({ step: 'stop', reason: expect.stringContaining('scoped fix-check') });
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBlocking: true, touchedGate: true }).step).toBe('stop');
|
||||
// R51: two rounds is the cap. A fix made in round 2 gets one read-only full review of the final head with no fix round
|
||||
// (GST-3562 A), unless a light diff's below-floor fixes change no runtime lines; a fix after that review stops for the lane's
|
||||
// Captain; a blocker left open stops; a light pass whose fixes change no runtime lines is done.
|
||||
const readOnly = { step: 'full', reason: expect.stringMatching(/^read-only final review \(R51\).*\(GST-3562 A\)/) };
|
||||
test('a blocker fixed in round 2 gets one read-only full review, and a fix after it stops for the lane\'s Captain, never a fix round', () => {
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBlocking: true })).toMatchObject(readOnly);
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBlocking: true, touchedGate: true })).toMatchObject(readOnly);
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP + 1, last: 'full', fixedBlocking: true })).toMatchObject({ step: 'stop', reason: expect.stringContaining("a fix followed the read-only final review: the lane's Captain decides") });
|
||||
});
|
||||
test('below-floor fixes in round 2 finish with notes, a fix-check included', () => {
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBelow: true })).toMatchObject({ step: 'done', reason: expect.stringContaining('notes') });
|
||||
test('below-floor fixes in round 2 get the read-only full review unless a light diff\'s fixes change no runtime lines; after a fix-check they finish with notes', () => {
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBelow: true })).toMatchObject(readOnly);
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBelow: true, rangeRuntimeLines: 0 }, 'light')).toMatchObject({ step: 'done', reason: expect.stringContaining('notes') });
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', fixedBelow: true, rangeRuntimeLines: 0 }, 'standard')).toMatchObject(readOnly);
|
||||
expect(nextStep({ fullPasses: 1, last: 'fix-check', fixedBelow: true })).toMatchObject({ step: 'done', reason: expect.stringContaining('notes') });
|
||||
expect(nextStep({ fullPasses: 1, last: 'fix-check', fixedBelow: true, fixedBlocking: true }).step).toBe('stop');
|
||||
});
|
||||
test('a light pass 1 whose below-floor fixes change no runtime lines is done; a runtime fix or a deeper diff keeps the fix-check', () => {
|
||||
test('a light pass 1 whose below-floor fixes change no runtime lines is done; a runtime fix or a deeper diff gets the full pass on the range (GST-3562 A)', () => {
|
||||
expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true, rangeRuntimeLines: 0 }, 'light').step).toBe('done');
|
||||
expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true, rangeRuntimeLines: 3 }, 'light').step).toBe('fix-check');
|
||||
expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true, rangeRuntimeLines: 0 }, 'full').step).toBe('fix-check');
|
||||
expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true }, 'light').step).toBe('fix-check');
|
||||
for (const [rangeRuntimeLines, depth] of [[3, 'light'], [0, 'full'], [undefined, 'light']] as const) {
|
||||
expect(nextStep({ fullPasses: 1, last: 'full', fixedBelow: true, rangeRuntimeLines }, depth)).toMatchObject({ step: 'full', reason: expect.stringContaining('never a fix-check (R51, GST-3562 A)') });
|
||||
}
|
||||
});
|
||||
test('a blocker open at the cap stops', () => expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', blockingOpen: true }).step).toBe('stop'));
|
||||
test('a blocker open with no fix stops', () => expect(nextStep({ fullPasses: 1, last: 'full', blockingOpen: true }).step).toBe('stop'));
|
||||
@@ -72,29 +78,38 @@ describe('nextStep: the transition table', () => {
|
||||
test('a clean fix-check is done', () => expect(nextStep({ fullPasses: 1, last: 'fix-check' }).step).toBe('done'));
|
||||
});
|
||||
|
||||
// Value: protects=on gate class Step 11's adversarial, outside and targeted voices run before any owner exit the round cap reaches, and a recorded owner grant dispatches its one scoped fix-check after round 2, once; fails_when=a gate-class round-2 blocker fix stops before Step 11 (C6-36 after-opus: next=stop, no voice ran), or a recorded grant still stops (C6-36 after-opus-grant: the lane hand-dispatched the fix-check);
|
||||
// Value: protects=on gate class Step 11's adversarial, outside and targeted voices run before any Captain or owner exit the round cap reaches (since GST-3562 A a round-2 fix first gets the read-only full review, which dispatches them), and a recorded owner grant dispatches its one scoped fix-check after round 2, once; fails_when=a gate-class stop at the cap comes before Step 11 (C6-36 after-opus: next=stop, no voice ran), or a recorded grant still stops (C6-36 after-opus-grant: the lane hand-dispatched the fix-check);
|
||||
// why_new=GST-967; seam=nextStep, planReview; no_claim=the voices' or the fix-check's verdicts
|
||||
describe('GST-967: the round cap limits fix rounds, not the gate-class voices; a recorded grant runs its fix-check', () => {
|
||||
const capStop = { fullPasses: FULL_PASS_CAP, last: 'full', fixedBlocking: true } as const;
|
||||
test('a gate-class round-2 blocker fix runs Step 11\'s voices before the owner stop, then stops', () => {
|
||||
expect(nextStep({ ...capStop, gate: true })).toMatchObject({ step: 'voices', reason: expect.stringContaining("Step 11's voices") });
|
||||
for (const o of [{ blockingOpen: true }, { fixedBlocking: false, fixedBelow: true, touchedGate: true }, { fullPasses: 1, last: 'fix-check' as const }, { fullPasses: 1, blockingOpen: true }]) expect(nextStep({ ...capStop, gate: true, ...o }).step).toBe('voices');
|
||||
expect(nextStep({ ...capStop, gate: true, adversarialRan: true }).step).toBe('stop');
|
||||
expect(nextStep(capStop).step).toBe('stop');
|
||||
// GST-3562 A: a blocker fixed in round 2 now gets one read-only full review of the final head, so the Captain stop moves to a fix
|
||||
// after that review (readOnlyStop); a blocker left open and a fix-check's blocker still stop at round 2.
|
||||
const readOnlyStop = { ...capStop, fullPasses: FULL_PASS_CAP + 1 };
|
||||
test('a gate-class blocker stop at the cap runs Step 11\'s voices before the Captain or owner stop, then stops', () => {
|
||||
expect(nextStep({ ...readOnlyStop, gate: true })).toMatchObject({ step: 'voices', reason: expect.stringContaining("Step 11's voices") });
|
||||
for (const o of [{ fullPasses: FULL_PASS_CAP, blockingOpen: true }, { fixedBlocking: false, fixedBelow: true, touchedGate: true }, { fullPasses: 1, last: 'fix-check' as const }, { fullPasses: 1, blockingOpen: true }]) expect(nextStep({ ...readOnlyStop, gate: true, ...o }).step).toBe('voices');
|
||||
expect(nextStep({ ...readOnlyStop, gate: true, adversarialRan: true }).step).toBe('stop');
|
||||
expect(nextStep(readOnlyStop).step).toBe('stop');
|
||||
expect(nextStep({ ...capStop, gate: true })).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
});
|
||||
test('C6-36 run 1 replanned: the plan lists Step 11\'s three voices, and once they ran the stop stands', () => {
|
||||
test('C6-36 run 1 replanned: round 2\'s fix gets the read-only full review with Step 11\'s three voices; after it, a fix lists the voices, and once they ran the stop stands', () => {
|
||||
const h = { ...capStop, touchedGate: true };
|
||||
const p = planReview(base({ gateTagged: 1, targeted: { classes: ['gate'] }, history: h }));
|
||||
expect([p.class, p.next.step, roles(p)]).toEqual(['gate', 'voices', ['adversarial-native:adversarial:full', 'outside-voice:outside-voice:host', 'targeted:targeted:full']]);
|
||||
expect(planReview(base({ gateTagged: 1, adversarialRan: true, targeted: { classes: ['gate'] }, history: h })).next.step).toBe('stop');
|
||||
expect([p.class, p.next.step, roles(p)]).toEqual(['gate', 'full', ['specialist:batched:medium', 'red-team:red-team:full', 'adversarial-native:adversarial:full', 'outside-voice:outside-voice:host', 'targeted:targeted:full']]);
|
||||
const after = { ...h, fullPasses: FULL_PASS_CAP + 1 };
|
||||
const v = planReview(base({ gateTagged: 1, targeted: { classes: ['gate'] }, history: after }));
|
||||
expect([v.class, v.next.step, roles(v)]).toEqual(['gate', 'voices', ['adversarial-native:adversarial:full', 'outside-voice:outside-voice:host', 'targeted:targeted:full']]);
|
||||
expect(planReview(base({ gateTagged: 1, adversarialRan: true, targeted: { classes: ['gate'] }, history: after })).next.step).toBe('stop');
|
||||
});
|
||||
test('a recorded grant dispatches one scoped fix-check after a round-2 full pass, after the gate-class voices, and never a second', () => {
|
||||
// GST-3562 A: a grant no longer replaces the read-only full review a round-2 fix gets (R51), so it changes nothing there or
|
||||
// after that review; only the one fix-check after a round-2 fix-check (GEVA-223, below) still answers a grant.
|
||||
test('a recorded grant after a round-2 full pass changes nothing: the fix gets the read-only full review, and a fix after it stops', () => {
|
||||
const g = { ...capStop, granted: 'a-feb4aba31633' };
|
||||
expect(nextStep(g)).toMatchObject({ step: 'fix-check', reason: expect.stringContaining('a-feb4aba31633') });
|
||||
expect(roles(planReview(base({ history: g })))).toEqual(['fix-check:fix-check:full']);
|
||||
expect(nextStep({ ...g, gate: true }).step).toBe('voices');
|
||||
expect(nextStep({ ...g, gate: true, adversarialRan: true }).step).toBe('fix-check');
|
||||
expect(nextStep({ ...g, fixedBlocking: false, fixedBelow: true, touchedGate: true }).step).toBe('fix-check');
|
||||
expect(nextStep(g)).toEqual(nextStep(capStop));
|
||||
expect(nextStep(g)).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(roles(planReview(base({ history: g })))).not.toContain('fix-check:fix-check:full');
|
||||
for (const o of [{ gate: true }, { gate: true, adversarialRan: true }, { fixedBlocking: false, fixedBelow: true, touchedGate: true }, { fullPasses: FULL_PASS_CAP + 1 }, { fullPasses: FULL_PASS_CAP + 1, gate: true, adversarialRan: true }, { priorFull: 1 }])
|
||||
expect([o, nextStep({ ...g, ...o })]).toEqual([o, nextStep({ ...capStop, ...o })]);
|
||||
expect(nextStep({ fullPasses: 1, last: 'fix-check', fixedBlocking: true, granted: 'a-1' }).step).toBe('stop');
|
||||
expect(nextStep({ ...g, blockingOpen: true }).step).toBe('stop');
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'fix-check', granted: 'a-1' }).step).toBe('done');
|
||||
@@ -143,7 +158,7 @@ describe('GST-967: the round cap limits fix rounds, not the gate-class voices; a
|
||||
const doc = fs.readFileSync(path.join(ROOT, 'docs', 'review-policy.md'), 'utf8');
|
||||
const table = doc.slice(doc.indexOf('<a id="transitions"></a>'), doc.indexOf('A **fix-check** is one reviewer'));
|
||||
expect(table).toContain("| a stop (any row above) on gate class before Step 11's voices ran | Step 11's voices (adversarial, outside, targeted), then ask again with `--adversarial-ran` |");
|
||||
expect(table).toContain('| a round-2 full pass that stops for a fixed blocking finding or a gate-class edit, with the owner\'s recorded grant (`--grant <approval id>`) | one scoped fix-check (round 3), after Step 11 on gate class |');
|
||||
expect(table).toContain('| the stop after a fix-check (granted before GST-3562) that was the run\'s only one, with the owner\'s recorded grant (`--grant <approval id>`) | one more scoped fix-check, after Step 11 on gate class, until a later release removes it; a grant after a round-2 full pass buys nothing, because the read-only full review replaces it |');
|
||||
const rule3 = doc.slice(doc.indexOf('3. **Two rounds is the cap**'), doc.indexOf('<a id="transitions"></a>')).replace(/\s+/g, ' ');
|
||||
expect(rule3).toContain("The cap limits fix rounds, not Step 11's voices");
|
||||
expect(rule3).toContain('`gstack-review-plan --grant <approval id> --range-base <round 2\'s PASS_HEAD>`');
|
||||
@@ -156,27 +171,29 @@ describe('GST-967: the round cap limits fix rounds, not the gate-class voices; a
|
||||
* not, Step 11 run or not, grant recorded or not.
|
||||
*/
|
||||
describe('GST-967 invariant: no gate-class owner exit before Step 11\'s voices; a recorded grant always gets its fix-check', () => {
|
||||
// Value: protects=a gate-class plan never stops (the exit where the owner may ship with open notes) before Step 11's adversarial, outside and targeted voices ran, voices is planned only then and dispatches all three, and a recorded grant always turns the stop after a round-2 full pass with a fixed finding into exactly one fix-check while changing nothing else, so it never repeats; fails_when=any state breaks one of those, so a later edit to nextStep cannot fail open;
|
||||
// Value: protects=a gate-class plan never stops (the exit where the owner may ship with open notes) before Step 11's adversarial, outside and targeted voices ran, voices is planned only then and dispatches all three, and a recorded grant turns only the stop after the one round-2 fix-check (GEVA-223) into exactly one fix-check, after Step 11 on gate class, while changing nothing else, so it never repeats and never replaces GST-3562 A's read-only full review; fails_when=any state breaks one of those, so a later edit to nextStep cannot fail open;
|
||||
// why_new=GST-967 (three earlier fixes failed open and a reviewer caught each after the fact); seam=nextStep, planReview; no_claim=the parent following NEXT
|
||||
test('every state of the table holds the property', () => {
|
||||
let states = 0, voices = 0, grants = 0;
|
||||
for (const fullPasses of [0, 1, 2, 3]) for (const last of ['none', 'full', 'fix-check'] as const) for (let bits = 0; bits < 16; bits++)
|
||||
for (const gate of [false, true]) for (const adversarialRan of [false, true]) {
|
||||
const h = { fullPasses, last, fixedBlocking: !!(bits & 1), fixedBelow: !!(bits & 2), blockingOpen: !!(bits & 4), touchedGate: !!(bits & 8), gate, adversarialRan };
|
||||
const plain = nextStep(h), granted = nextStep({ ...h, granted: 'a-1' });
|
||||
const ungatedStop = nextStep({ ...h, gate: false }).step === 'stop';
|
||||
states++;
|
||||
for (const n of [plain, granted]) {
|
||||
if (gate && !adversarialRan) expect(n.step).not.toBe('stop');
|
||||
if (n.step === 'voices') expect([gate, adversarialRan, ungatedStop]).toEqual([true, false, true]);
|
||||
for (const fixChecks of [0, 1]) {
|
||||
const plain = nextStep({ ...h, fixChecks }), granted = nextStep({ ...h, fixChecks, granted: 'a-1' });
|
||||
const ungatedStop = nextStep({ ...h, fixChecks, gate: false }).step === 'stop';
|
||||
states++;
|
||||
for (const n of [plain, granted]) {
|
||||
if (gate && !adversarialRan) expect(n.step).not.toBe('stop');
|
||||
if (n.step === 'voices') expect([gate, adversarialRan, ungatedStop]).toEqual([true, false, true]);
|
||||
}
|
||||
if (plain.step === 'voices') voices++;
|
||||
const owed = ungatedStop && !h.blockingOpen && last === 'fix-check' && fullPasses === FULL_PASS_CAP - 1 && fixChecks === 1 && (!gate || adversarialRan);
|
||||
if (owed) grants++;
|
||||
expect([granted.step === 'fix-check' && plain.step !== 'fix-check', granted.step === plain.step]).toEqual([owed, !owed]);
|
||||
if (owed) expect(granted.reason).toContain('a-1');
|
||||
}
|
||||
if (plain.step === 'voices') voices++;
|
||||
const owed = ungatedStop && !h.blockingOpen && last === 'full' && fullPasses === FULL_PASS_CAP && (!gate || adversarialRan);
|
||||
if (owed) grants++;
|
||||
expect([granted.step === 'fix-check' && plain.step !== 'fix-check', granted.step === plain.step]).toEqual([owed, !owed]);
|
||||
if (owed) expect(granted.reason).toContain('a-1');
|
||||
}
|
||||
expect(states).toBe(4 * 3 * 16 * 2 * 2);
|
||||
expect(states).toBe(4 * 3 * 16 * 2 * 2 * 2);
|
||||
expect([voices > 0, grants > 0]).toEqual([true, true]);
|
||||
const gatePlan = (o: Partial<PlanInput>) => planReview(base({ gateTagged: 1, targeted: { classes: ['gate'] }, ...o }));
|
||||
for (const fullPasses of [1, 2]) for (const last of ['full', 'fix-check'] as const) for (let bits = 0; bits < 16; bits++) {
|
||||
@@ -224,9 +241,18 @@ function asMainBeforeGst3187(input: PlanInput, p: ReturnType<typeof planReview>)
|
||||
}
|
||||
const MAIN_PLANS = '9d13d6bae86bfc9207ce7e0cec8da5b33db2518c1653e8e009160a98b0f04c89';
|
||||
const R51_CASES = 28;
|
||||
/**
|
||||
* GST-3562 A (the Captain's rule-15 ruling of 2026-11-23, approval a-6ec01c09edf8: "Only B removes a reader that can block a
|
||||
* merge. A replaces narrow re-checks with full rounds…"): asMainBeforeGst3562 (test/helpers/gst3562-replay.ts) replans each
|
||||
* grid case with main's transition table at 0408128, checks that every case the branch changes is an allowed kind, and reads it
|
||||
* back as main's plan before the GST-3187 and R51 adapters run. On this grid: (a) 20 fix-checks become a full pass on the
|
||||
* range, (d) 10 cases main left done with an unread below-floor fix get their review, and (e) 60 stops (or voices before a stop)
|
||||
* on a blocker fixed or a gate edit at the cap become one read-only full review of the final head.
|
||||
*/
|
||||
const GST3562_967_CASES = { a: 20, d: 10, e: 60 };
|
||||
const MAIN_SECTIONS = '0608589f33d7cc47f27ccf98538d1c76edc1a475075b419de12c76ba9c433518';
|
||||
describe('GST-967 dispatch-superset no-loss check', () => {
|
||||
// Value: protects=the no-loss rule for review-depth changes: GST-967 drops, renames and re-efforts no reviewer main dispatches on any grid case, and changes no brief body; fails_when=a non-stop plan changes, a voices step appears off gate class or after Step 11, it dispatches anything but the three voices, or a brief body moves;
|
||||
// Value: protects=the no-loss rule for review-depth changes: GST-967 drops, renames and re-efforts no reviewer main dispatches on any grid case, changes no brief body, and GST-3562 A changes only the kinds its replay allows; fails_when=a non-stop plan changes outside those kinds, a voices step appears off gate class or after Step 11, it dispatches anything but the three voices, or a brief body moves;
|
||||
// why_new=GST-967; seam=planReview, sectionTexts; no_claim=what the added voices find (they only add coverage)
|
||||
test('the grid matches main except gate-class stops before Step 11, which add only the three voices; brief bodies are main\'s', () => {
|
||||
const sha = (x: unknown) => createHash('sha256').update(JSON.stringify(x)).digest('hex');
|
||||
@@ -241,10 +267,13 @@ describe('GST-967 dispatch-superset no-loss check', () => {
|
||||
let voices = 0;
|
||||
let r51 = 0;
|
||||
const gst3187: Record<string, number> = {};
|
||||
const gst3562: Record<string, number> = {};
|
||||
for (const [name, f] of Object.entries(fixtures)) for (const fullPasses of [0, 1, 2]) for (const last of ['none', 'full', 'fix-check'] as const) for (let bits = 0; bits < 16; bits++) for (const adversarialRan of [false, true]) {
|
||||
const history = { fullPasses, last, fixedBlocking: !!(bits & 1), fixedBelow: !!(bits & 2), blockingOpen: !!(bits & 4), touchedGate: !!(bits & 8) };
|
||||
const input = { ...f, numbers: none, history, adversarialRan } as PlanInput;
|
||||
const { plan: p, changed } = asMainBeforeGst3187(input, planReview(input));
|
||||
const { plan: main0408128, kind } = asMainBeforeGst3562(input, planReview(input));
|
||||
if (kind) gst3562[kind] = (gst3562[kind] ?? 0) + 1;
|
||||
const { plan: p, changed } = asMainBeforeGst3187(input, main0408128);
|
||||
if (changed) gst3187[`${name}:${changed}`] = (gst3187[`${name}:${changed}`] ?? 0) + 1;
|
||||
let { step, reason } = p.next;
|
||||
const back = asMainBeforeR51(p);
|
||||
@@ -261,6 +290,7 @@ describe('GST-967 dispatch-superset no-loss check', () => {
|
||||
expect(gst3187).toEqual({
|
||||
'docs:full': 4, 'docs:stop': 2, 'gate:full': 4, 'gate:stop': 1, 'gate:voices': 1, 'light:full': 4, 'light:stop': 2, 'standard:full': 4, 'standard:stop': 2, 'tests:full': 4, 'tests:stop': 2,
|
||||
});
|
||||
expect(gst3562).toEqual(GST3562_967_CASES);
|
||||
expect(sha(sectionTexts(ROOT))).toBe(MAIN_SECTIONS);
|
||||
});
|
||||
});
|
||||
@@ -295,6 +325,14 @@ describe('GST-972 follow-up: review-exclude and default-base are gate paths; har
|
||||
* effort, while the Red Team keeps full effort as its own dispatch.
|
||||
*/
|
||||
const MAIN_972_PLANS = '798e56faf8a44c182b77e1638b9a80c554a5d727bb56a84786b1c11507b31030';
|
||||
/**
|
||||
* GST-3562 A (the Captain's rule-15 ruling of 2026-11-23, approval a-6ec01c09edf8: "Only B removes a reader that can block a
|
||||
* merge. A replaces narrow re-checks with full rounds…"): both grids, the real paths (0) and the stand-ins (1), go through
|
||||
* asMainBeforeGst3562 first, which checks each changed step is an allowed kind and plans it with main's table at 0408128, so this
|
||||
* check still compares only the GST-972 class and depth moves. Per grid: (a) 16 fix-checks become a full pass on the range,
|
||||
* (d) 8 unread below-floor fixes get their review, (e) 48 cap stops become one read-only full review.
|
||||
*/
|
||||
const GST3562_972_CASES = { '0:a': 16, '0:d': 8, '0:e': 48, '1:a': 16, '1:d': 8, '1:e': 48 };
|
||||
describe('GST-972 follow-up no-loss check', () => {
|
||||
// Value: protects=the no-loss rule for review-depth changes: the GST-972 follow-up drops no reviewer main dispatched and lowers no class, depth or effort beyond the named Red Team split; fails_when=a stand-in stops matching main's plans, a reader disappears, a class or depth falls, or an effort falls anywhere else;
|
||||
// why_new=GST-972 follow-up; seam=planReview; no_claim=what the added readers find (they only add coverage)
|
||||
@@ -306,12 +344,15 @@ describe('GST-972 follow-up no-loss check', () => {
|
||||
'helper+pin': [['test/helpers/e2e-gate.ts', 'scripts/harness-pins/test/helpers/e2e-gate.ts.json'], ['test/helpers/e2e-gate.ts', 'test/helpers/e2e-gate.ts.json'], { SCOPE_TESTS: 'true' }],
|
||||
pin: [['scripts/harness-pins/scripts/lib/paid-plan.ts.json'], ['scripts/lib/paid-plan.ts.json'], {}],
|
||||
};
|
||||
const gst3562: Record<string, number> = {};
|
||||
const grid = (pick: 0 | 1) => {
|
||||
const rows: { name: string; fullPasses: number; last: string; bits: number; adversarialRan: boolean; class: string; depth: string; step: string; dispatches: { role: string; name: string; effort: string; checklists: string[] }[] }[] = [];
|
||||
for (const [name, c] of Object.entries(cases)) for (const fullPasses of [0, 1, 2]) for (const last of ['none', 'full', 'fix-check'] as const) for (let bits = 0; bits < 16; bits++) for (const adversarialRan of [false, true]) {
|
||||
const history = { fullPasses, last, fixedBlocking: !!(bits & 1), fixedBelow: !!(bits & 2), blockingOpen: !!(bits & 4), touchedGate: !!(bits & 8) };
|
||||
const input = { paths: c[pick], scope: c[2], gateTagged: 0, diffLines: 40, consumed: [], numbers: none, history, adversarialRan } as PlanInput;
|
||||
const p = pick ? asMainBeforeGst3187(input, planReview(input)).plan : planReview(input);
|
||||
const { plan: main0408128, kind } = asMainBeforeGst3562(input, planReview(input));
|
||||
if (kind) gst3562[`${pick}:${kind}`] = (gst3562[`${pick}:${kind}`] ?? 0) + 1;
|
||||
const p = pick ? asMainBeforeGst3187(input, main0408128).plan : main0408128;
|
||||
rows.push({ name, fullPasses, last, bits, adversarialRan, class: p.class, depth: p.depth, step: p.next.step, dispatches: (pick ? asMainBeforeR51(p).dispatches : p.dispatches).map(d => ({ role: d.role, name: d.name, effort: d.effort, checklists: d.checklists ?? [] })) });
|
||||
}
|
||||
return rows;
|
||||
@@ -338,6 +379,7 @@ describe('GST-972 follow-up no-loss check', () => {
|
||||
expect([main.length, split, moves]).toEqual([1152, 168, {
|
||||
'review-exclude: code/light -> gate/full': 288, 'default-base: code/light -> gate/full': 288, 'helper+pin: tests/light -> code/light': 288, 'pin: docs/light -> code/light': 288,
|
||||
}]);
|
||||
expect(gst3562).toEqual(GST3562_972_CASES);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -446,13 +488,16 @@ describe('planReview', () => {
|
||||
expect(roles(p)).toContain('adversarial-native:adversarial:full');
|
||||
expect(planReview(base({ paths: ['docs/a.md'], history: { fullPasses: 1, last: 'full', fixedBlocking: true } })).dispatches.some(d => d.role === 'adversarial-native')).toBe(false);
|
||||
});
|
||||
test('a fix-check is one full-effort dispatch', () => {
|
||||
expect(roles(planReview(base({ history: { fullPasses: 1, last: 'full', fixedBelow: true } })))).toEqual(['fix-check:fix-check:full']);
|
||||
test('below-floor fixes after pass 1 dispatch the full pass on the range, never a fix-check (GST-3562 A)', () => {
|
||||
const p = planReview(base({ history: { fullPasses: 1, last: 'full', fixedBelow: true } }));
|
||||
expect([p.next.step, roles(p)]).toEqual(['full', ['specialist:batched:full', 'adversarial-native:adversarial:full']]);
|
||||
expect(p.next.reason).toContain('GST-3562 A');
|
||||
});
|
||||
test('changed numeric claims rerun only the outside voice', () => {
|
||||
test('changed numeric claims add the outside voice to the full pass on the range; unchanged ones do not', () => {
|
||||
const numbers = scanNumbers({ 'docs/bench.md': ['3x faster'] });
|
||||
const p = planReview(base({ numbers, reviewedNumbers: 'old', history: { fullPasses: 1, last: 'full', fixedBelow: true } }));
|
||||
expect(roles(p)).toEqual(['fix-check:fix-check:full', 'outside-voice:outside-voice (numbers changed):host']);
|
||||
const p = planReview(base({ numbers, reviewedNumbers: 'old', adversarialRan: true, history: { fullPasses: 1, last: 'full', fixedBelow: true } }));
|
||||
expect(roles(p)).toEqual(['specialist:batched:full', 'outside-voice:outside-voice (numbers changed):host']);
|
||||
expect(roles(planReview(base({ numbers, reviewedNumbers: numbers.fingerprint, adversarialRan: true, history: { fullPasses: 1, last: 'full', fixedBelow: true } })))).toEqual(['specialist:batched:full']);
|
||||
});
|
||||
// Value: protects=GSTA-167 part 3 (specialists at medium, CREW 30c) without moving the GSTA-131 lesson (a light fix-check missed
|
||||
// a fail-open a full one caught): Red Team, native adversarial and fix-check stay full; fails_when=any of those drops below
|
||||
@@ -709,8 +754,8 @@ describe('D6: the scoped second pass after a blocking fix (GSTA-152 PR B)', () =
|
||||
expect(p.next.step).toBe('scoped');
|
||||
expect(r(p)).toEqual(['fix-check:fix-check', 'red-team:red-team', 'adversarial-native:adversarial']);
|
||||
});
|
||||
test('the scoped pass counts toward the cap, and a blocker it leaves stops for the owner', () => {
|
||||
expect(nextStep(fixed(10, { fullPasses: FULL_PASS_CAP }), 'standard').step).toBe('stop');
|
||||
test('the scoped pass counts toward the cap: a fix after it gets the read-only full review, and a blocker it leaves stops for the owner', () => {
|
||||
expect(nextStep(fixed(10, { fullPasses: FULL_PASS_CAP }), 'standard')).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', blockingOpen: true, rangeRuntimeLines: 10 }, 'light').step).toBe('stop');
|
||||
const at = (m: number) => new Date(Date.UTC(2026, 9, 28, 10, m)).toISOString();
|
||||
const rows = [
|
||||
|
||||
@@ -10,6 +10,22 @@ import { withWorkspace } from '../lib/review-brief';
|
||||
import { PARENT_ONLY_QA, type Manifest } from '../lib/review-pass';
|
||||
import { ROOT, BIN, spec, manifest, repo, host, runPass, bin } from './helpers/review-pass-harness';
|
||||
|
||||
/**
|
||||
* GST-3562 A: the planner plans a fix-check only for a grant answering the stop after a round-2 fix-check (GEVA-223), until a
|
||||
* later release removes it. Commit a fix, record the owner's grant at that stop head, and return the plan flags of that stop.
|
||||
*/
|
||||
function legacyGrantFlags(dir: string, env: NodeJS.ProcessEnv): string[] {
|
||||
const sh = (c: string) => spawnSync('bash', ['-c', c], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 });
|
||||
const rangeBase = sh('git rev-parse HEAD').stdout.trim();
|
||||
expect(sh('echo "export const fix = 1;" >> src/a.ts && git commit -qam fix').status).toBe(0);
|
||||
const stopHead = sh('git rev-parse HEAD').stdout.trim();
|
||||
env.GSTACK_APPROVALS_MIRROR = '0';
|
||||
delete env.GSTACK_APPROVALS_DIR;
|
||||
const a = spawnSync(path.join(BIN, 'gstack-approvals'), ['add', '--ask', `Owner grant: one scoped fix-check after round 2 (review_loop_grant ${stopHead.slice(0, 12)})`, '--words', 'do it', '--by', 'GStack Minder', '--scope', 'this /ship invocation', '--json'], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 });
|
||||
expect(a.status, a.stderr).toBe(0);
|
||||
return ['--pass', '1', '--last', 'fix-check', '--fix-checks', '1', '--fixed-blocking', '--adversarial-ran', '--range-base', rangeBase, '--grant', JSON.parse(a.stdout).added[0]];
|
||||
}
|
||||
|
||||
describe('Capy pass program (fake host, real bins)', () => {
|
||||
test('Step 11 notes its own growth from its first dispatch, not from the pass\'s starting reading', async () => {
|
||||
const { dir, env } = repo();
|
||||
@@ -112,7 +128,7 @@ describe('Capy pass program (fake host, real bins)', () => {
|
||||
fs.mkdirSync(files, { recursive: true });
|
||||
const fc: Record<string, string> = {};
|
||||
for (const [k, v] of [['fix_list', '1. src/a.ts: guard v80\n'], ['hunks', 'diff --git a/src/a.ts b/src/a.ts\n+export const v81 = 81;\n'], ['tests', 'bun test: 3 pass, 0 fail\n'], ['callers', 'none\n']]) { fc[k] = path.join(files, k + '.txt'); fs.writeFileSync(fc[k]!, v!); }
|
||||
const planFlags = ['--pass', '1', '--last', 'full', '--fixed-below'];
|
||||
const planFlags = legacyGrantFlags(dir, env);
|
||||
const missing = await runPass(host(dir, env), { base: 'main', out: path.join(dir, '.state/run/fc0'), pass: 'x19fc0', planFlags });
|
||||
expect(missing).toContain('STOP: gstack-review-dispatch pass exited');
|
||||
expect(missing).toContain('the plan dispatches a fix-check: pass needs --fix-list, --hunks and --tests');
|
||||
@@ -140,7 +156,7 @@ describe('Capy pass program (fake host, real bins)', () => {
|
||||
fs.mkdirSync(files, { recursive: true });
|
||||
const fc: Record<string, string> = {};
|
||||
for (const [k, v] of [['fix_list', '1. src/a.ts: guard v80\n'], ['hunks', 'diff --git a/src/a.ts b/src/a.ts\n+export const v81 = 81;\n'], ['tests', 'bun test: 3 pass, 0 fail\n']]) { fc[k] = path.join(files, k + '.txt'); fs.writeFileSync(fc[k]!, v!); }
|
||||
const res = await runPass(host(dir, env), { base: 'main', out: path.join(dir, '.state/run/fcr'), pass: 'x52fc', planFlags: ['--pass', '1', '--last', 'full', '--fixed-below'], fixCheck: fc, logStart: ['review'] });
|
||||
const res = await runPass(host(dir, env), { base: 'main', out: path.join(dir, '.state/run/fcr'), pass: 'x52fc', planFlags: legacyGrantFlags(dir, env), fixCheck: fc, logStart: ['review'] });
|
||||
expect(res).toMatch(/REVIEW_LOG_START: review-fix-check token=\S+/);
|
||||
expect(res).not.toMatch(/REVIEW_LOG_START: review token=/);
|
||||
}, 240_000);
|
||||
@@ -181,7 +197,7 @@ describe('Capy pass program (fake host, real bins)', () => {
|
||||
|
||||
// Value: protects=the pass program dispatches the owner's granted fix-check from the plan, as decision 3.5 runs any fix-check, instead of PASS: none; fails_when=a recorded grant still prints PASS: none next=stop and the lane renders, sends and collects the fix-check by hand (C6-36 after-opus-grant);
|
||||
// why_new=GST-967; seam=the pass program; no_claim=the fix-check reviewer's verdict
|
||||
test('GST-967: a recorded grant after round 2 runs its one scoped fix-check through the program', async () => {
|
||||
test('GST-967: a recorded grant after the round-2 fix-check runs its one scoped fix-check through the program (GST-3562 A: a grant after a round-2 full pass buys none)', async () => {
|
||||
const { dir, env } = repo();
|
||||
const head = spawnSync('git', ['rev-parse', 'HEAD'], { cwd: dir, encoding: 'utf8', timeout: 10_000 }).stdout.trim();
|
||||
const add = spawnSync(path.join(BIN, 'gstack-approvals'), ['add', '--ask', `Owner grant: one scoped fix-check after round 2 (review_loop_grant ${head.slice(0, 12)})`, '--words', 'one scoped fix-check after round 2', '--by', 'GStack Minder', '--scope', 'this /ship invocation', '--json'], { cwd: dir, env: { ...env, GSTACK_APPROVALS_MIRROR: '0' }, encoding: 'utf8', timeout: 60_000 });
|
||||
@@ -192,7 +208,7 @@ describe('Capy pass program (fake host, real bins)', () => {
|
||||
const fc: Record<string, string> = {};
|
||||
for (const [k, v] of [['fix_list', '1. src/a.ts: guard v80\n'], ['hunks', 'diff --git a/src/a.ts b/src/a.ts\n+export const v81 = 81;\n'], ['tests', 'bun test: 3 pass, 0 fail\n'], ['callers', 'none\n']]) { fc[k] = path.join(files, k + '.txt'); fs.writeFileSync(fc[k]!, v!); }
|
||||
const h = host(dir, env);
|
||||
const res = await runPass(h, { base: 'main', out: path.join(dir, '.state/run/gfc'), pass: 'x30gfc', planFlags: ['--pass', '2', '--last', 'full', '--fixed-blocking', '--range-base', head, '--grant', id], fixCheck: fc, logStart: ['review-fix-check'] });
|
||||
const res = await runPass(h, { base: 'main', out: path.join(dir, '.state/run/gfc'), pass: 'x30gfc', planFlags: ['--pass', '1', '--last', 'fix-check', '--fix-checks', '1', '--fixed-blocking', '--range-base', head, '--grant', id], fixCheck: fc, logStart: ['review-fix-check'] });
|
||||
expect(res).not.toContain('PASS: none');
|
||||
expect(res).toContain(`NEXT: fix-check (the owner's grant ${id}`);
|
||||
expect(h.creates.map(c => c.title)).toEqual(['ship x30gfc fix-check']);
|
||||
|
||||
@@ -305,6 +305,26 @@ describe('a scoped pass after a blocker fix (GST-619)', () => {
|
||||
}, 120_000);
|
||||
});
|
||||
|
||||
describe('the read-only final review reads the whole PR diff (GST-3562 A)', () => {
|
||||
// Value: protects=the read-only final review of a PR at its round cap is staged on the merge base even when the driver passes the fix range as --diff-base, and the pass says no fix round follows; fails_when=the dispatcher honors --diff-base on that plan, or prints no READ_ONLY line;
|
||||
// why_new=#4741 round-1 second-model finding (the driver sends RANGE_BASE on every full repeat); seam=none; no_claim=the edit guard's prose is followed
|
||||
test('an explicit --diff-base on the fix range is ignored and the whole branch is reviewed', () => {
|
||||
const { dir, env } = repo();
|
||||
const sh = (c: string) => { const r = spawnSync('bash', ['-c', c], { cwd: dir, env, encoding: 'utf8', timeout: 60_000 }); if (r.status !== 0) throw new Error(r.stderr); return r.stdout.trim(); };
|
||||
const mergeBase = sh('git merge-base main HEAD');
|
||||
const rangeBase = sh('git rev-parse HEAD');
|
||||
sh('for i in $(seq 1 24); do echo "export const f$i = $i;" >> src/fix.ts; done && git add -A && git commit -qm "fix: pre-landing review fixes"');
|
||||
const out = path.join(dir, '.state/run/p2');
|
||||
const p = bin(dir, env, ['pass', '--base', 'main', '--out', out, '--pass', 'p2', '--diff-base', rangeBase, '--', '--prior-rounds', '1', '--prior-full', '1', '--pass', '1', '--last', 'full', '--pass1-depth', 'standard', '--fixed-blocking', '--adversarial-ran', '--range-base', rangeBase.slice(0, 7)]);
|
||||
expect(p.status, p.stdout + p.stderr).toBe(0);
|
||||
expect(p.stdout).toMatch(/^NEXT: full \(read-only final review \(R51\)/m);
|
||||
expect(p.stdout).toContain(`READ_ONLY: the final review reads the whole PR diff from the merge base (--diff-base ${rangeBase} ignored); no fix round follows it`);
|
||||
const m = JSON.parse(fs.readFileSync(path.join(out, 'pass-manifest.json'), 'utf8')) as Manifest;
|
||||
expect(m.diff_base).toBe(mergeBase);
|
||||
expect(m.readers.every(r => (r.diff_base ?? m.diff_base) === mergeBase)).toBe(true);
|
||||
}, 120_000);
|
||||
});
|
||||
|
||||
describe('the fetch sweep quarantines a stage that fetched (GST-1322 PR B)', () => {
|
||||
const clone = (at: string) => { fs.mkdirSync(at, { recursive: true }); expect(spawnSync('bash', ['-c', 'git init -q && git remote add origin https://github.com/sealed-org/BEAM.git'], { cwd: at, encoding: 'utf8', timeout: 30_000 }).status).toBe(0); };
|
||||
const made: string[] = [];
|
||||
|
||||
@@ -110,10 +110,12 @@ describe('gstack-review-plan', () => {
|
||||
expect(host.dispatches.find((d: any) => d.role === 'adversarial-native').effort).toBe('full');
|
||||
expect(run(r, ['--no-tiers', '--depth-floor', 'standard']).stdout).toContain('DISPATCH: specialist batched effort=host checklists=testing,security,state-machines');
|
||||
});
|
||||
test('a below-floor fix after pass 1 plans one fix-check', () => {
|
||||
test('a below-floor fix after pass 1 plans the full pass on the range as round 2, never a fix-check (GST-3562 A)', () => {
|
||||
const r = run(repo({ 'src/a.ts': 'export const a = 1;\n' }), ['--pass', '1', '--last', 'full', '--fixed-below']);
|
||||
expect(r.stdout).toContain('next=fix-check dispatches=1');
|
||||
expect(r.stdout).toContain('DISPATCH: fix-check fix-check effort=full');
|
||||
expect(r.stdout).toMatch(/^REVIEW_PLAN: class=code pass=2 next=full dispatches=2 .*reason="below-floor fixes changed code after round 1: round 2 is a full pass on the range, never a fix-check \(R51, GST-3562 A\)"$/m);
|
||||
expect(r.stdout).toContain('DISPATCH: specialist batched effort=full checklists=testing,security,state-machines,red-team');
|
||||
expect(r.stdout).toContain('DISPATCH: adversarial-native adversarial effort=full');
|
||||
expect(r.stdout).not.toContain('DISPATCH: fix-check');
|
||||
});
|
||||
// Value: protects=the CLI the ship loop calls after a fix-check prints NEXT: done when the fix-check was clean and only below-floor fixes came before it; fails_when=`--last fix-check --fixed-below` prints NEXT: stop with a blocking-finding reason (GSTA-167 replay 8G on #34);
|
||||
// why_new=no CLI case covered --last fix-check; seam=bin/gstack-review-plan (lib/review-depth.ts stays at its no-loss pin); no_claim=the fix-check reviewer's verdict
|
||||
@@ -145,16 +147,19 @@ describe('gstack-review-plan', () => {
|
||||
add(`Owner accepts the stop after the fix-check (review_loop_exception ${stopHead.slice(0, 12)})`), add('Approve the plan for the README rewrite'), 'a-000000000000'];
|
||||
const plan = (a: string[]) => spawnSync(BIN, ['--base', 'main', '--gate-tagged', '0', ...a], { cwd: r.dir, encoding: 'utf8', timeout: 60_000, env });
|
||||
const capStop = ['--pass', '2', '--last', 'full', '--fixed-blocking', '--range-base', passHead];
|
||||
expect(plan(capStop).stdout).toContain('NEXT: stop');
|
||||
expect(plan(capStop).stdout).toContain('NEXT: full (read-only final review (R51)');
|
||||
const granted = plan([...capStop, '--grant', id]);
|
||||
expect(granted.status, granted.stderr).toBe(0);
|
||||
expect(granted.stdout).toContain(`NEXT: fix-check (the owner's grant ${id}`);
|
||||
expect(granted.stdout).toContain('DISPATCH: fix-check fix-check effort=full');
|
||||
expect(granted.stdout).toContain('NEXT: full (read-only final review (R51)');
|
||||
expect(granted.stdout).not.toContain('DISPATCH: fix-check');
|
||||
const afterFixCheck = ['--pass', '1', '--last', 'fix-check', '--fix-checks', '1', '--fixed-blocking', '--range-base', passHead];
|
||||
expect(plan([...afterFixCheck, '--grant', id]).stdout).toContain(`NEXT: fix-check (the owner's grant ${id}`);
|
||||
expect(plan([...afterFixCheck, '--grant', id]).stdout).toContain('DISPATCH: fix-check fix-check effort=full');
|
||||
commit(3);
|
||||
expect(plan([...capStop, '--grant', id]).stdout).toContain(`NEXT: fix-check (the owner's grant ${id}`);
|
||||
expect(plan([...afterFixCheck, '--grant', id]).stdout).toContain(`NEXT: fix-check (the owner's grant ${id}`);
|
||||
expect(plan(['--pass', '2', '--last', 'fix-check', '--fixed-blocking', '--range-base', passHead, '--grant', id]).stdout).toContain('NEXT: stop');
|
||||
for (const other of refusedIds) {
|
||||
const refused = plan([...capStop, '--grant', other]);
|
||||
const refused = plan([...afterFixCheck, '--grant', other]);
|
||||
expect([other, refused.status, refused.stdout]).toEqual([other, 3, '']);
|
||||
expect(refused.stderr).toContain(`--grant ${other}`);
|
||||
}
|
||||
|
||||
@@ -186,6 +186,8 @@ describe('GST-1702: release stamps and a docs-audit edit after the last fix-chec
|
||||
* GST-1775 (GBRA-347, gbrain#8730): /ship Step 16 stage 2.1 inserted a Step 9 for edits after the review bound on a gate-class
|
||||
* diff. `gstack-review-plan --post-review --pass 2 --last full` printed NEXT: voices with the voices' DISPATCH lines, and Step 11's
|
||||
* `gstack-review-dispatch pass --voices` with the same plan flags printed PASS: none, so the voices the plan asked for could not run.
|
||||
* Since GST-3562 A a post-review edit at pass 2 gets the read-only full review, so the stop (and the voices before it on gate
|
||||
* class) is the edit after that review, pass 3.
|
||||
*/
|
||||
function postReviewBranch(): { repo: FixtureRepo; flags: string[] } {
|
||||
const repo = makeFixtureRepo({ prefix: 'gst1775-voices-' });
|
||||
@@ -199,7 +201,7 @@ function postReviewBranch(): { repo: FixtureRepo; flags: string[] } {
|
||||
};
|
||||
const rangeBase = edit('export const spend_cap_usd = 5;\n', 'feature');
|
||||
edit('export const spend_cap_usd = 5;\nexport const retries = 2;\n', 'edit after the review bound');
|
||||
return { repo, flags: ['--gate-tagged', '1', '--post-review', '--pass', '2', '--last', 'full', '--range-base', rangeBase, '--pass1-depth', 'full'] };
|
||||
return { repo, flags: ['--gate-tagged', '1', '--post-review', '--pass', '3', '--last', 'full', '--range-base', rangeBase, '--pass1-depth', 'full'] };
|
||||
}
|
||||
const dispatchLines = (out: string) => out.split('\n').filter(l => l.startsWith('DISPATCH: ')).map(l => l.split(' ')[1]);
|
||||
|
||||
|
||||
@@ -25,16 +25,21 @@ describe('PR round cap', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('one prior full round: after pass 1, a below-floor fix keeps its in-run fix-check and a fixed blocker stops for the lane, not the owner', () => {
|
||||
expect(nextStep(h({ priorFull: 1, fullPasses: 1, last: 'full', fixedBelow: true }), 'standard').step).toBe('fix-check');
|
||||
const stop = nextStep(h({ priorFull: 1, fullPasses: 1, last: 'full', fixedBlocking: true }), 'standard');
|
||||
expect(stop.step).toBe('stop');
|
||||
expect(stop.reason).toStartWith('PR_ROUND_CAP');
|
||||
expect(stop.reason).not.toContain('for the owner');
|
||||
});
|
||||
|
||||
test('a fix-check stays the in-run table\'s call: lean\'s one fix-check after a fixed blocker still runs', () => {
|
||||
expect(nextStep(h({ priorFull: 1, fullPasses: 1, last: 'full', fixedBlocking: true, lean: true }), 'standard').step).toBe('fix-check');
|
||||
// Value: protects=GST-3562 A at the PR cap: a fix made in the PR's last full round gets one read-only full review of the final
|
||||
// head with no fix round, in both tables, and a fix after that review stops for the lane's Captain, never the owner;
|
||||
// fails_when=the cap plans a fix-check, ships the fix unread, or stops before the read-only review; seam=nextStep;
|
||||
// no_claim=the CLI's pr_rounds= print (pr-round-cli)
|
||||
test('one prior full round: after pass 1, any fix gets one read-only full review, and a fix after it stops for the lane\'s Captain, not the owner', () => {
|
||||
for (const lean of [false, true]) for (const fix of [{ fixedBelow: true }, { fixedBlocking: true }, { touchedGate: true }]) {
|
||||
const n = nextStep(h({ priorFull: 1, fullPasses: 1, last: 'full', lean, ...fix }), 'standard');
|
||||
expect([lean, fix, n.step]).toEqual([lean, fix, 'full']);
|
||||
expect(n.reason).toStartWith('read-only final review (R51): fixes changed code after the last round');
|
||||
expect(n.reason).toContain('(GST-3562 A); this PR already had 1 full review round on earlier heads');
|
||||
const stop = nextStep(h({ priorFull: 1, fullPasses: 2, last: 'full', lean, ...fix }), 'standard');
|
||||
expect([lean, fix, stop.step]).toEqual([lean, fix, 'stop']);
|
||||
expect(stop.reason).toStartWith("a fix followed the read-only final review: the lane's Captain decides (R51)");
|
||||
expect(stop.reason).not.toContain('for the owner');
|
||||
}
|
||||
});
|
||||
|
||||
// Value: protects=F1's past-cap case: a PR with two full rounds whose own code changed gets one read-only full review of
|
||||
@@ -48,10 +53,10 @@ describe('PR round cap', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('after the read-only review: below-floor findings ship as notes, a blocker stops for the lane\'s Captain', () => {
|
||||
test('after the read-only review: unfixed below-floor findings ship as notes, and a fix of any kind or a blocker stops for the lane\'s Captain (GST-3562 A)', () => {
|
||||
for (const lean of [false, true]) {
|
||||
expect(nextStep(h({ priorFull: 2, fullPasses: 1, last: 'full', lean })).step).toBe('done');
|
||||
expect(nextStep(h({ priorFull: 2, fullPasses: 1, last: 'full', fixedBelow: true, lean }), 'standard')).toMatchObject({ step: 'done', reason: expect.stringContaining('no fix round') });
|
||||
expect(nextStep(h({ priorFull: 2, fullPasses: 1, last: 'full', fixedBelow: true, lean }), 'standard')).toMatchObject({ step: 'stop', reason: expect.stringContaining("a fix followed the read-only final review: the lane's Captain decides") });
|
||||
for (const x of [{ blockingOpen: true }, { fixedBlocking: true }, { touchedGate: true, fixedBelow: true }]) {
|
||||
const stop = nextStep(h({ priorFull: 3, fullPasses: 1, last: 'full', lean, ...x }), 'standard');
|
||||
expect(stop.step).toBe('stop');
|
||||
@@ -61,16 +66,17 @@ describe('PR round cap', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// Value: protects=the read-only stop offers only what the Captain can do: a grant recorded after that review can't buy a
|
||||
// fix round (GST-2706); fails_when=the stop lists a round grant as an option; seam=nextStep; no_claim=history's grant route
|
||||
// GST-2968 reverses GST-2706's "a later grant buys no fix round": PR_ROUND_CAP printed the grant command anyway, and two grants
|
||||
// on gstack#4272 bought nothing. The stop now names the fix-check grant that answers its stop record
|
||||
// (test/round-cap-granted-stop.test.ts covers what that grant buys).
|
||||
test('the read-only stop offers ship-with-the-note, park, or a fix-check grant naming the stop', () => {
|
||||
// Value: protects=the read-only stop offers only what the Captain can do: GST-3562 A plans no new fix-check, so the stop offers
|
||||
// ship-with-the-note, park, or a new /ship run's read-only full review of the kept fix, and never a fix-check grant or a round
|
||||
// grant; fails_when=the stop offers a grant that buys a fix round; seam=nextStep; no_claim=history's grant route
|
||||
// GST-2968 had the stop name the fix-check grant that answers its stop record; a grant recorded before GST-3562 still buys it for
|
||||
// one release (test/round-cap-granted-stop.test.ts), but the stop no longer offers one.
|
||||
test('the read-only stop offers ship-with-the-note, park, or keeping the fix for one more read-only full review, never a fix-check grant', () => {
|
||||
for (const roundGrant of [undefined, 'a-000000000001']) {
|
||||
const stop = nextStep(h({ priorFull: 3, fullPasses: 1, last: 'full', fixedBlocking: true, roundGrant }), 'standard');
|
||||
expect(stop.step).toBe('stop');
|
||||
expect(stop.reason).toContain('(ship with the note, park, or buy its fix round with a fix-check grant naming the stop gstack-ship-receipt stop records)');
|
||||
expect(stop.reason).toContain("the lane's Captain decides (ship with the note, park, or keep the fix and run /ship again for one more read-only full review of the final head)");
|
||||
expect(stop.reason).not.toContain('fix-check grant');
|
||||
expect(stop.reason).not.toContain('does not buy a fix round');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,12 +59,14 @@ describe('UI text and SVGs stay code (R51: the docs paths are deferred to an all
|
||||
});
|
||||
|
||||
describe('round 2 never ships an unread gate edit', () => {
|
||||
// Value: protects=a gate-class edit after round 1 always gets the owner's eyes; fails_when=a round-2 or fix-check gate edit
|
||||
// returns done; seam=nextStep
|
||||
test('a gate edit in round 2 or in the fix-check stops for the owner; a plain below-floor fix there finishes', () => {
|
||||
expect(nextStep({ fullPasses: 2, last: 'full', fixedBelow: true, touchedGate: true })).toMatchObject({ step: 'stop', reason: expect.stringContaining('gate-class') });
|
||||
// Value: protects=a gate-class edit after round 1 is always read again or goes to the owner (GST-3562 A: round 2's gate edit
|
||||
// gets the read-only full review of the final head, a gate edit after it stops); fails_when=a round-2 or fix-check gate
|
||||
// edit returns done; seam=nextStep
|
||||
test('a gate edit in round 2 gets the read-only full review, one after it or in a fix-check stops for the owner; a plain below-floor fix on a light no-runtime range finishes', () => {
|
||||
expect(nextStep({ fullPasses: 2, last: 'full', fixedBelow: true, touchedGate: true })).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(nextStep({ fullPasses: 3, last: 'full', fixedBelow: true, touchedGate: true }).step).toBe('stop');
|
||||
expect(nextStep({ fullPasses: 1, last: 'fix-check', touchedGate: true })).toMatchObject({ step: 'stop', reason: expect.stringContaining('gate-class') });
|
||||
expect(nextStep({ fullPasses: 2, last: 'full', fixedBelow: true }).step).toBe('done');
|
||||
expect(nextStep({ fullPasses: 2, last: 'full', fixedBelow: true, rangeRuntimeLines: 0 }, 'light').step).toBe('done');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import { createHash } from 'node:crypto';
|
||||
import { depthOfCommitInput, isGatePath, planReview, ROLE_EFFORT, scanNumbers } from '../lib/review-depth';
|
||||
import { matchRisk, secretPath } from '../lib/review-risk';
|
||||
import { targetedClasses } from '../lib/review-targeted';
|
||||
import { asMainBeforeGst3562 } from './helpers/gst3562-replay';
|
||||
|
||||
const GODOT_TOKENS = ['class_name UIToken', 'extends RefCounted', 'const COLOR_PRIMARY := Color("#ff6a00")', 'const SPACING_MD := 12', 'const LABEL_PLAY := "Play"'];
|
||||
const BENIGN: Record<string, string[]> = {
|
||||
@@ -126,6 +127,15 @@ describe('GST-1350: founderstar#546 shape, a copy-only edit to a Godot token fil
|
||||
const MAIN_1350_PLANS = 'bafc2b5329237dbb994ab85d5ee0a696e7bd479615f81206c9b4ce7507af108e';
|
||||
// GST-3187: on the stand-ins, a full pass whose only fix flag is touchedGate now plans its review where main planned done; those
|
||||
// cases are checked to be a review step and read back as main's plan (the same input with touchedGate unset).
|
||||
/**
|
||||
* GST-3562 A (the Captain's rule-15 ruling of 2026-11-23, approval a-6ec01c09edf8: "Only B removes a reader that can block a
|
||||
* merge. A replaces narrow re-checks with full rounds…"): both grids, the real paths (0) and the stand-ins (1), go through
|
||||
* asMainBeforeGst3562 (test/helpers/gst3562-replay.ts) first, which checks each changed step is an allowed kind and plans it with
|
||||
* main's table at 0408128, so this check still compares only the GST-1350 class and depth moves. Per grid: (a) 44 fix-checks
|
||||
* become a full pass on the range, (d) 22 unread below-floor fixes get their review, (e) 132 cap stops become one read-only full
|
||||
* review of the final head.
|
||||
*/
|
||||
const GST3562_1350_CASES = { '0:a': 44, '0:d': 22, '0:e': 132, '1:a': 44, '1:d': 22, '1:e': 132 };
|
||||
describe('GST-1350 no-loss check', () => {
|
||||
// Value: protects=the no-loss rule for review-depth changes: narrowing the token name drops readers only on benign token files;
|
||||
// fails_when=a stand-in stops matching main's plans, a token file with a secret or a secrets, credentials or key file loses a
|
||||
@@ -147,6 +157,7 @@ describe('GST-1350 no-loss check', () => {
|
||||
'token-json': ['token.json', 'token.json', [googleToken()]],
|
||||
'tokens-db': ['cache/tokens.db', 'cache/tokens.db', []],
|
||||
};
|
||||
const gst3562: Record<string, number> = {};
|
||||
type Row = { name: string; fullPasses: number; last: string; bits: number; adversarialRan: boolean; targeted: string[]; class: string; depth: string; step: string; dispatches: { role: string; name: string; effort: string; checklists: string[] }[] };
|
||||
const grid = (pick: 0 | 1) => {
|
||||
const rows: Row[] = [];
|
||||
@@ -157,7 +168,9 @@ describe('GST-1350 no-loss check', () => {
|
||||
for (const fullPasses of [0, 1, 2]) for (const last of ['none', 'full', 'fix-check'] as const) for (let bits = 0; bits < 16; bits++) for (const adversarialRan of [false, true]) {
|
||||
const history = { fullPasses, last, fixedBlocking: !!(bits & 1), fixedBelow: !!(bits & 2), blockingOpen: !!(bits & 4), touchedGate: !!(bits & 8) };
|
||||
const input = { paths, added, removed: {}, scope: {}, gateTagged: 0, diffLines: 40, consumed: [], numbers: none, history, adversarialRan, targeted: { classes: t } };
|
||||
let p = planReview(input);
|
||||
const replay = asMainBeforeGst3562(input, planReview(input));
|
||||
if (replay.kind) gst3562[`${pick}:${replay.kind}`] = (gst3562[`${pick}:${replay.kind}`] ?? 0) + 1;
|
||||
let p = replay.plan;
|
||||
if (pick && last === 'full' && bits === 8) {
|
||||
expect(['full', 'stop', 'voices']).toContain(p.next.step);
|
||||
p = planReview({ ...input, history: { ...history, touchedGate: false } });
|
||||
@@ -195,5 +208,6 @@ describe('GST-1350 no-loss check', () => {
|
||||
'pem: code/light -> gate/full': 288, 'dotenv: code/light -> gate/full': 288, 'id-rsa: code/light -> gate/full': 288, 'secrets-dir: gate/full -> gate/full': 288, 'credentials-json: gate/full -> gate/full': 288,
|
||||
'token-json: gate/full -> gate/full': 288, 'tokens-db: gate/full -> gate/full': 288,
|
||||
}]);
|
||||
expect(gst3562).toEqual(GST3562_1350_CASES);
|
||||
});
|
||||
});
|
||||
@@ -130,12 +130,13 @@ describe('GST-3187: a plan that would ship unreviewed commits refuses instead of
|
||||
});
|
||||
|
||||
describe('GST-3187: nextStep counts a gate-class fix as an edit', () => {
|
||||
// Value: protects=--touched-gate alone after a full pass plans the full pass on the range, and at the cap it stops for the
|
||||
// owner; fails_when=loopStep's fix test ignores touchedGate (it returned done "the step applied no edits");
|
||||
// Value: protects=--touched-gate alone after a full pass plans the full pass on the range, at the cap it gets the read-only
|
||||
// full review of the final head (GST-3562 A), and after that it stops for the lane's Captain; fails_when=loopStep's fix test ignores touchedGate (it returned done "the step applied no edits");
|
||||
// seam=nextStep; no_claim=the gate-class voices' ordering, which GST-967's cases cover
|
||||
test('--touched-gate with no other fix flag is a fix', () => {
|
||||
expect(nextStep({ fullPasses: 1, last: 'full', touchedGate: true })).toMatchObject({ step: 'full', reason: 'a fix touched a gate-class path: full pass on the range' });
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', touchedGate: true }).step).toBe('stop');
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP, last: 'full', touchedGate: true })).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(nextStep({ fullPasses: FULL_PASS_CAP + 1, last: 'full', touchedGate: true }).step).toBe('stop');
|
||||
expect(nextStep({ fullPasses: 1, last: 'full' })).toMatchObject({ step: 'done', reason: 'the step applied no edits' });
|
||||
});
|
||||
});
|
||||
@@ -107,7 +107,7 @@ describe('the targeted brief', () => {
|
||||
describe('planReview dispatches the targeted reader', () => {
|
||||
const plan = (o: Partial<PlanInput>) => planReview({ paths: ['src/a.ts'], scope: {}, gateTagged: 0, diffLines: 5, numbers: scanNumbers({}), history: { fullPasses: 0, last: 'none' }, ...o } as PlanInput);
|
||||
const roles = (p: ReturnType<typeof plan>) => p.dispatches.map(d => `${d.role} ${d.effort}`);
|
||||
test('at light, standard and full depth when a class hit, never when none did', () => {
|
||||
test('at light, standard and full depth when a class hit, never when none did, and on the full pass on the range a below-floor fix now earns (GST-3562 A)', () => {
|
||||
expect(plan({ targeted: { classes: ['money'] } })).toMatchObject({ depth: 'light' });
|
||||
expect(roles(plan({ targeted: { classes: ['money'] } }))).toContain('targeted full');
|
||||
expect(plan({ diffLines: 80, perPath: [{ path: 'src/a.ts', lines: 80, binary: false }], targeted: { classes: ['secret'] }, floor: 'standard' }).depth).toBe('standard');
|
||||
@@ -115,7 +115,9 @@ describe('planReview dispatches the targeted reader', () => {
|
||||
expect(plan({ gateTagged: 1, targeted: { classes: ['gate'] } }).depth).toBe('full');
|
||||
expect(roles(plan({ gateTagged: 1, targeted: { classes: ['gate'] } }))).toContain('targeted full');
|
||||
expect(roles(plan({ targeted: { classes: [] } }))).not.toContain('targeted full');
|
||||
expect(roles(plan({ targeted: { classes: ['money'] }, history: { fullPasses: 1, last: 'full', fixedBelow: true } }))).toEqual(['fix-check full', 'targeted full']);
|
||||
const below = plan({ targeted: { classes: ['money'] }, history: { fullPasses: 1, last: 'full', fixedBelow: true } });
|
||||
expect([below.next.step, roles(below)]).toEqual(['full', ['specialist full', 'adversarial-native full', 'targeted full']]);
|
||||
expect(below.next.reason).toContain('GST-3562 A');
|
||||
expect(plan({ targeted: { classes: ['money'] }, history: { fullPasses: 1, last: 'full' } }).dispatches).toEqual([]);
|
||||
const ran = plan({ targeted: { classes: ['money'], ran: true } });
|
||||
expect(roles(ran)).not.toContain('targeted full');
|
||||
@@ -195,6 +197,13 @@ const R51: Record<string, { depth: string; panel: boolean; dropped?: string[] }>
|
||||
'money-light': { depth: 'full', panel: true }, 'money-path': { depth: 'full', panel: true }, 'money-removed': { depth: 'full', panel: true }, 'money-standard': { depth: 'full', panel: true },
|
||||
'auth-path': { depth: 'full', panel: true }, 'money-fix-check': { depth: 'full', panel: false }, 'money-pass2': { depth: 'full', panel: false }, 'gate-repeat': { depth: 'full', panel: false },
|
||||
};
|
||||
/**
|
||||
* GST-3562 A (the Captain's rule-15 ruling of 2026-11-23, approval a-6ec01c09edf8: "Only B removes a reader that can block a
|
||||
* merge. A replaces narrow re-checks with full rounds…"): /ship plans no new fix-check, so a fixture where main dispatched the
|
||||
* fix-check now runs a full pass on the range. The check accepts the fix-check role's absence only when the printed REVIEW_PLAN
|
||||
* reason carries "GST-3562 A" and the full panel is dispatched in its place; every other role assertion stands.
|
||||
*/
|
||||
const GST3562_FIX_CHECK_FIXTURES = ['money-fix-check'];
|
||||
const field = (out: string, prefix: string, key: string) => new RegExp(`^${prefix}.* ${key}=(\\S+)`, 'm').exec(out)?.[1];
|
||||
|
||||
describe('gstack-review-plan prints TARGETED and dispatches the targeted reader', () => {
|
||||
@@ -209,6 +218,7 @@ describe('gstack-review-plan prints TARGETED and dispatches the targeted reader'
|
||||
expect(Object.keys(MAIN).sort()).toEqual(Object.keys(FIXTURES).sort());
|
||||
expect(Object.keys(R51).sort()).toEqual(Object.keys(FIXTURES).sort());
|
||||
const role = (d: string) => d.split(' ')[0]!;
|
||||
const replaced: string[] = [];
|
||||
for (const [name, f] of Object.entries(FIXTURES)) {
|
||||
const r = planRepo(f).run(f.args ?? []);
|
||||
expect(r.status, `${name}: ${r.stderr}`).toBe(0);
|
||||
@@ -216,11 +226,19 @@ describe('gstack-review-plan prints TARGETED and dispatches the targeted reader'
|
||||
const want = MAIN[name]!, now = R51[name]!;
|
||||
expect(r.stdout, name).toContain(`REVIEW_DEPTH: ${now.depth} `);
|
||||
const roles = new Set(got.map(role));
|
||||
expect([...new Set(want.main.map(role))].filter(x => !roles.has(x)), name).toEqual(now.dropped ?? []);
|
||||
let dropped = [...new Set(want.main.map(role))].filter(x => !roles.has(x));
|
||||
if (dropped.includes('fix-check')) {
|
||||
expect(r.stdout.split('\n').find(l => l.startsWith('REVIEW_PLAN: ')), name).toMatch(/ reason="[^"]*GST-3562 A[^"]*"$/);
|
||||
expect(FULL_PANEL.filter(x => !roles.has(x)), name).toEqual([]);
|
||||
dropped = dropped.filter(x => x !== 'fix-check');
|
||||
replaced.push(name);
|
||||
}
|
||||
expect(dropped, name).toEqual(now.dropped ?? []);
|
||||
if (now.panel) expect(FULL_PANEL.filter(x => !roles.has(x)), name).toEqual([]);
|
||||
expect(roles.has('targeted'), name).toBe(want.classes !== 'none');
|
||||
expect(field(r.stdout, 'TARGETED:', 'classes'), name).toBe(want.classes);
|
||||
}
|
||||
expect(replaced).toEqual(GST3562_FIX_CHECK_FIXTURES);
|
||||
}, 180_000);
|
||||
|
||||
test('the TARGETED line carries the rules hash and the brief\'s sha256; --targeted-ran skips the reader only for the same product patch', () => {
|
||||
|
||||
@@ -62,8 +62,9 @@ describe('the plan: a fix-check grant answering a stop buys its fix round (GST-2
|
||||
const n = nextStep({ fullPasses: 1, last: 'full', priorFull: 2, roundGrant: 'a-2', fixedBlocking: true, rangeRuntimeLines: 500 } as any, 'full');
|
||||
expect(['full', 'scoped', 'fix-check']).toContain(n.step);
|
||||
});
|
||||
test('G4 (guard): the owner\'s in-run loop grant after a round-2 full pass still plans its one fix-check', () => {
|
||||
expect(nextStep({ fullPasses: 2, last: 'full', fixedBlocking: true, granted: 'a-3' } as any).step).toBe('fix-check');
|
||||
test('G4 (guard): an in-run loop grant after a round-2 full pass buys no fix-check: the fix gets the read-only full review (GST-3562 A); after a round-2 fix-check it still plans its one fix-check', () => {
|
||||
expect(nextStep({ fullPasses: 2, last: 'full', fixedBlocking: true, granted: 'a-3' } as any)).toMatchObject({ step: 'full', reason: expect.stringContaining('read-only final review (R51)') });
|
||||
expect(nextStep({ fullPasses: 1, last: 'fix-check', fixedBlocking: true, fixChecks: 1, granted: 'a-3' } as any).step).toBe('fix-check');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -118,14 +118,19 @@ describe('one grant kind: planner, claim and receipt accept either row (GST-3546
|
||||
expect(w.stderr).toContain(`FIX_CHECK_CLEAR: grant=${id} run=r2 closed=${ID}`);
|
||||
});
|
||||
|
||||
// Value: protects=GST-3546: gstack-review-plan --grant takes a round-grant fix-check row too, at the head it names;
|
||||
// fails_when=--grant refuses it ("no approved row ... naming review_loop_grant"); seam=gstack-review-plan --grant
|
||||
test('the planner plans the fix-check for a round-grant fix-check row', () => {
|
||||
// Value: protects=GST-3546: gstack-review-plan --grant takes a round-grant fix-check row too, at the head it names; since
|
||||
// GST-3562 A it buys the fix-check only at the stop after a round-2 fix-check, and after a round-2 full pass the fix gets the
|
||||
// read-only full review instead; fails_when=--grant refuses the row ("no approved row ... naming review_loop_grant"), or the
|
||||
// grant swaps the read-only review for a fix-check; seam=gstack-review-plan --grant
|
||||
test('the planner takes a round-grant fix-check row: the fix-check after a round-2 fix-check, the read-only full review after a round-2 full pass', () => {
|
||||
const c = atCap([open(ID, FP)]);
|
||||
const id = grantId(ok(c.run('gstack-approvals', ['round-grant', '--pr', '7', '--head', c.S, '--kind', 'fix-check', '--reason', 'Captain ruled: fix it', '--by', CAPTAIN, '--owner-ref', 'GSTA-36:2026-11-22T12:00:00Z', '--words', 'fix it'])));
|
||||
const plan = c.run('gstack-review-plan', ['--base', 'main', '--gate-tagged', '0', '--pass', '2', '--last', 'full', '--fixed-blocking', '--range-base', c.S, '--grant', id]);
|
||||
expect(plan.status, plan.stderr).toBe(0);
|
||||
expect(plan.stdout).toContain(`NEXT: fix-check (the owner's grant ${id}`);
|
||||
expect(plan.stdout).toContain('NEXT: full (read-only final review (R51)');
|
||||
const after = c.run('gstack-review-plan', ['--base', 'main', '--gate-tagged', '0', '--pass', '1', '--last', 'fix-check', '--fix-checks', '1', '--fixed-blocking', '--range-base', c.S, '--grant', id]);
|
||||
expect(after.status, after.stderr).toBe(0);
|
||||
expect(after.stdout).toContain(`NEXT: fix-check (the owner's grant ${id}`);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ const snapshot = (f: ShipFx, docs = ['README.md'], out = path.join(f.root, 'post
|
||||
return out;
|
||||
};
|
||||
const finish = (f: ShipFx, reviewed: string, post: string, extra: string[] = []) => f.run(RELEASE, ['finish', '--base', 'main', '--reviewed-tree', reviewed, '--docs-post', post, '--lane', LANE, ...extra]);
|
||||
const behaviorStop = (p: string) => `STOP: behavior, tests or build inputs changed since review (${p}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner's grant of one scoped fix-check (stage 2.1)`;
|
||||
const behaviorStop = (p: string) => `STOP: behavior, tests or build inputs changed since review (${p}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)`;
|
||||
const packetOf = (out: string) => /reads (\S+\.md)[ ,]/.exec(out)?.[1] ?? '';
|
||||
const record = (f: ShipFx, paths: string[], packet: string | null, extra: Record<string, unknown> = {}) => {
|
||||
const file = path.join(f.root, 'bounded-reviewed.json');
|
||||
|
||||
@@ -23,7 +23,7 @@ const wtree = (f: ShipFx) => f.run(path.join(BIN, 'gstack-wtree'), []).stdout.tr
|
||||
const head = (f: ShipFx) => f.git('rev-parse', 'HEAD').stdout.trim();
|
||||
const finish = (f: ShipFx, reviewed: string, post: string, extra: string[] = []) => f.run(RELEASE, ['finish', '--base', 'main', '--reviewed-tree', reviewed, '--docs-post', post, '--lane', LANE, ...extra]);
|
||||
const lines = (n: number, edit: Record<number, string> = {}) => Array.from({ length: n }, (_, i) => edit[i + 1] ?? `export const l${i + 1} = ${i + 1};`).join('\n') + '\n';
|
||||
const behaviorStop = (paths: string) => `STOP: behavior, tests or build inputs changed since review (${paths}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner's grant of one scoped fix-check (stage 2.1)`;
|
||||
const behaviorStop = (paths: string) => `STOP: behavior, tests or build inputs changed since review (${paths}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)`;
|
||||
|
||||
const TEST_V0 = "import { expect, test } from 'bun:test';\ntest('lands', () => { expect(1).toBe(1); });\n";
|
||||
const TEST_V1 = "import { expect, test } from 'bun:test';\ntest('lands direct', () => { expect(1).toBe(1); });\n";
|
||||
|
||||
@@ -26,7 +26,7 @@ const SAVES = (n: number, odd: Record<number, number> = {}) => Object.fromEntrie
|
||||
const GOLDEN = 'test/golden/rules.golden';
|
||||
const REGEN = JSON.stringify({ entries: [{ id: 'rules-golden', command: `sed -n 's/^const RULE_NUMBERS := //p' scripts/core/game.gd | sed 's/^/rules=/' > ${GOLDEN}`, outputs: [GOLDEN], inputs: ['scripts/core/game.gd'] }] }) + '\n';
|
||||
const POLICY = JSON.stringify({ mechanical_retake: [{ path: 'scripts/core/game.gd', template: 'const RULE_NUMBERS := {n}', fields: [{ glob: 'fixtures/saves/*.json', field: 'save_version' }], regen: ['rules-golden'] }], min_gstack_version: MECHANICAL_RETAKE_KEY_VERSION }) + '\n';
|
||||
const behaviorStop = (p: string) => `STOP: behavior, tests or build inputs changed since review (${p}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner's grant of one scoped fix-check (stage 2.1)`;
|
||||
const behaviorStop = (p: string) => `STOP: behavior, tests or build inputs changed since review (${p}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)`;
|
||||
|
||||
/**
|
||||
* founderstar#563: the branch took 80 and was reviewed; the base then took 80 for another rule and added 7 files; the
|
||||
@@ -133,10 +133,12 @@ describe('a declared mechanical retake after a base merge (GST-1560: founderstar
|
||||
describe('finish and gstack-review-plan agree at the round cap (GST-1560)', () => {
|
||||
test('the behavior STOP names --post-review, and the planner then plans the owner\'s exit at the cap, never done', () => {
|
||||
const { f, run } = founderstar({ game: GAME(81, { top: 'func rule_other(): pass', bottom: 'func rule_80(): pass', ready: 'return' }) });
|
||||
expect(lineOf(run().stdout, 'STOP')).toContain('plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner\'s grant of one scoped fix-check');
|
||||
expect(lineOf(run().stdout, 'STOP')).toContain('plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head');
|
||||
const plan = (...a: string[]) => lineOf(f.run(path.join(BIN, 'gstack-review-plan'), ['--base', 'main', '--adversarial-ran', ...a]).stdout, 'NEXT');
|
||||
expect(plan('--pass', '2', '--last', 'full')).toStartWith('NEXT: done');
|
||||
expect(plan('--pass', '2', '--last', 'full', '--post-review')).toStartWith('NEXT: stop (edits after the review bound (Step 16 stage 2.1)');
|
||||
expect(plan('--pass', '2', '--last', 'full', '--post-review')).toStartWith('NEXT: full (edits after the review bound (Step 16 stage 2.1)');
|
||||
expect(plan('--pass', '2', '--last', 'full', '--post-review')).toContain('read-only final review (R51)');
|
||||
expect(plan('--pass', '3', '--last', 'full', '--post-review')).toStartWith('NEXT: stop (edits after the review bound (Step 16 stage 2.1)');
|
||||
expect(plan('--pass', '1', '--last', 'fix-check', '--fix-checks', '1', '--post-review')).toStartWith('NEXT: stop (edits after the review bound');
|
||||
expect(plan('--pass', '1', '--last', 'full', '--post-review')).toMatch(/^NEXT: (full|fix-check) \(edits after the review bound/);
|
||||
const stage2 = fs.readFileSync(path.join(ROOT, 'ship/SKILL.md.tmpl'), 'utf8').split('### 2. Choose the change route')[1]!.split('### 3.')[0]!;
|
||||
|
||||
@@ -178,7 +178,7 @@ describe('finish route after a base merge (GST-407 #1, GBRA-108 #7739)', () => {
|
||||
expect(comparePath(f.work, sides(), 'assets/x.bin')).toBe('changed');
|
||||
f.write({ 'assets/x.bin': 'a\u0000b\n', 'src/auth.ts': 'export const authRequired = false;\nexport const a = 2;\n' }); f.commit('flip');
|
||||
const r = finish(f, reviewed, post, ['--reviewed-base', reviewedBase]);
|
||||
expect([r.status, lineOf(r.stdout, 'STOP')]).toEqual([3, 'STOP: behavior, tests or build inputs changed since review (src/auth.ts): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner\'s grant of one scoped fix-check (stage 2.1)']);
|
||||
expect([r.status, lineOf(r.stdout, 'STOP')]).toEqual([3, 'STOP: behavior, tests or build inputs changed since review (src/auth.ts): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -197,7 +197,7 @@ describe('a version stamp after review (GBRA-251, gbrain #8095)', () => {
|
||||
const post = snapshot(f);
|
||||
f.write({ VERSION: '1.0.1.0\n', 'plugin.json': pluginAfter, 'docs/guide.md': guide('1.0.1.0') }); f.commit('stamp');
|
||||
const r = finish(f, reviewed, post, ['--reviewed-base', mergeBase(f)]);
|
||||
if (stops) expect([name, r.status, lineOf(r.stdout, 'STOP')]).toEqual([name, 3, 'STOP: behavior, tests or build inputs changed since review (plugin.json): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner\'s grant of one scoped fix-check (stage 2.1)']);
|
||||
if (stops) expect([name, r.status, lineOf(r.stdout, 'STOP')]).toEqual([name, 3, 'STOP: behavior, tests or build inputs changed since review (plugin.json): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)']);
|
||||
else expect([name, lineOf(r.stdout, 'ROUTE')]).toEqual([name, expect.stringMatching(/ behavior=0 docs=0 metadata=3 tests=0 /)]);
|
||||
}
|
||||
});
|
||||
@@ -220,7 +220,7 @@ describe('a restamp after a lost slot (GST-895, GBRA-218, gbrain #8134)', () =>
|
||||
mergeMain(f, { VERSION: '1.0.2.0\n', 'src/notice.ts': notice(['0.9.0.0', 'old'], ['1.0.1.0', 'theirs'], [ownRow, 'mine']) });
|
||||
return { f, reviewed: wtree(f), reviewedBase: mergeBase(f), post: snapshot(f) };
|
||||
};
|
||||
const behaviorStop = 'STOP: behavior, tests or build inputs changed since review (src/notice.ts): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner\'s grant of one scoped fix-check (stage 2.1)';
|
||||
const behaviorStop = 'STOP: behavior, tests or build inputs changed since review (src/notice.ts): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)';
|
||||
|
||||
test('the moved stale stamp is metadata; a moved base row or pre-fork row stops', () => {
|
||||
const own = lostSlot('1.0.1.0');
|
||||
@@ -472,7 +472,7 @@ describe('test-only and audit-requested edits after the docs audit (GST-391, gbr
|
||||
const plong = snapshot(long);
|
||||
long.write({ 'test/b.test.ts': spec('b') + Array.from({ length: 250 }, (_, i) => `test('case ${i}', () => expect(${i}).toBe(${i}));\n`).join('') }); long.commit('test: 250 cases');
|
||||
const tooLong = finish(long, rlong, plong, ['--reviewed-base', mergeBase(long)]);
|
||||
expect([tooLong.status, lineOf(tooLong.stdout, 'STOP')]).toEqual([3, 'STOP: behavior, tests or build inputs changed since review (test/b.test.ts): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner\'s grant of one scoped fix-check (stage 2.1)']);
|
||||
expect([tooLong.status, lineOf(tooLong.stdout, 'STOP')]).toEqual([3, 'STOP: behavior, tests or build inputs changed since review (test/b.test.ts): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)']);
|
||||
expect(tooLong.stdout).toContain('too large for the scoped review (over 200 lines in a section): test/b.test.ts');
|
||||
|
||||
for (const [rel, route] of [['src/main/java/ABTest.java', 'behavior=1 docs=0 metadata=0 tests=0'], ['app/test_mode.py', 'behavior=1 docs=0 metadata=0 tests=0'], ['tests/test_mode.py', 'behavior=0 docs=0 metadata=0 tests=1']] as const) {
|
||||
|
||||
@@ -35,7 +35,7 @@ const exceptionFile = (f: ShipFx, fixHead: string) => {
|
||||
fs.writeFileSync(file, JSON.stringify({ accepted_by: 'GStack Minder (rule 23 grant)', date: '2026-11-06', via: 'GSTA-36', reason: 'the CI fix after the granted fix-check, then ship', fix_check: { head: fixHead, findings: 1 } }));
|
||||
return file;
|
||||
};
|
||||
const behaviorStop = (p: string) => `STOP: behavior, tests or build inputs changed since review (${p}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap stops for the owner's grant of one scoped fix-check (stage 2.1)`;
|
||||
const behaviorStop = (p: string) => `STOP: behavior, tests or build inputs changed since review (${p}): insert 5–11.5 → 12–14 → 16 before Step 17; plan that Step 9 with gstack-review-plan --post-review, which at the round cap plans one read-only full review of the final head (stage 2.1)`;
|
||||
const UID = 'uid://cecaux1sm7mo\n';
|
||||
const SIDECAR = 'tests/cutscene_check.gd.uid';
|
||||
const CUTSCENE = (extra = '') => `extends Node\nfunc play(): return\n${extra}`;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"bytes": 63,
|
||||
"why": "GST-3562 A: the edit guard names the read-only final review's READ_ONLY line, so no fix is applied on it"
|
||||
}
|
||||
Reference in new issue
Block a user