From 4e2f87b23a9756714301312290c5a7bb17a17517 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 2 Nov 2026 14:06:05 +0000 Subject: [PATCH] test(review-depth): GST-967 dispatch-superset no-loss check; repin review-depth and the two ship sections to it Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/review-depth.test.ts | 43 +++++++++++++++++++++++++++++ test/review-packets-removed.test.ts | 7 +++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/test/review-depth.test.ts b/test/review-depth.test.ts index 084d5ce87..4d5d37871 100644 --- a/test/review-depth.test.ts +++ b/test/review-depth.test.ts @@ -5,6 +5,8 @@ import * as os from 'node:os'; import * as path from 'node:path'; import { classifyDiff, classifyPath, dataCandidate, depthFor, gateScanNeeded, depthOfCommitInput, diffCommand, nextStep, planReview, reviewPlanLine, scanNumbers, DEPTH_RULES, FULL_PASS_CAP, SCOPED_RANGE_LINES, type DepthError, type PlanInput } from '../lib/review-depth'; import { summarizeReviewLoop } from '../lib/review-scope'; +import { sectionTexts } from '../lib/review-brief'; +import { createHash } from 'node:crypto'; const ROOT = path.join(import.meta.dir, '..'); const none = scanNumbers({}); @@ -110,6 +112,47 @@ describe('GST-967: the round cap limits fix rounds, not the gate-class voices; a }); }); +/** + * The GST-967 dispatch-superset no-loss check (crew rule 2026-10-30; replay 'GST-967' in test/review-packets-removed.test.ts). + * On a 1,440-case grid (five diffs: light, standard, gate, docs, tests; passes 0-2; last none, full or fix-check; every mix of + * the four fix flags; Step 11 run or not), main's planReview at 1022f4f (v1.92.81.0) hashes to MAIN_PLANS. The branch's plan, + * with each voices step read back as main's stop (its reason is the parenthesised tail, no dispatch), hashes to the same value, + * and every voices step is a gate-class stop before Step 11 that adds exactly Step 11's three voices. No grant is passed (main + * takes none). The brief bodies lib/review-brief.ts cuts from the ship sections hash to MAIN_SECTIONS, main's value. + */ +const MAIN_PLANS = '9d13d6bae86bfc9207ce7e0cec8da5b33db2518c1653e8e009160a98b0f04c89'; +const MAIN_SECTIONS = 'a2b999aa2de2c4cdbb953aeb0a4fac6a67e01a2c5d74121e191b95781e68e345'; +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; + // 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'); + const fixtures: Record> = { + light: { paths: ['src/app.ts'], scope: { SCOPE_BACKEND: 'true', SCOPE_STATE_MACHINE: 'false' }, gateTagged: 0, diffLines: 120 }, + standard: { paths: ['src/app.ts'], scope: { SCOPE_BACKEND: 'true', SCOPE_STATE_MACHINE: 'false' }, gateTagged: 0, diffLines: 120, floor: 'standard' }, + gate: { paths: ['src/app.ts'], scope: { SCOPE_BACKEND: 'true' }, gateTagged: 1, diffLines: 120, targeted: { classes: ['gate'] } }, + docs: { paths: ['README.md'], scope: {}, gateTagged: null, diffLines: 30 }, + tests: { paths: ['test/a.test.ts'], scope: { SCOPE_TESTS: 'true' }, gateTagged: 0, diffLines: 40 }, + }; + const rows: unknown[] = []; + let voices = 0; + 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 p = planReview({ ...f, numbers: none, history, adversarialRan } as PlanInput); + let { step, reason } = p.next; + let dispatches = p.dispatches; + if (step === 'voices') { + voices++; + expect([p.class, adversarialRan, dispatches.map(d => `${d.role}:${d.effort}`)]).toEqual(['gate', false, ['adversarial-native:full', 'outside-voice:host', 'targeted:full']]); + [step, reason, dispatches] = ['stop', reason.slice(reason.indexOf('--adversarial-ran (') + '--adversarial-ran ('.length, -1), []]; + } + rows.push({ name, fullPasses, last, bits, adversarialRan, class: p.class, step, reason, dispatches, skipped: p.skipped }); + } + expect([rows.length, voices, sha(rows)]).toEqual([1440, 71, MAIN_PLANS]); + expect(sha(sectionTexts(ROOT))).toBe(MAIN_SECTIONS); + }); +}); + describe('scanNumbers', () => { test('finds claims and fingerprints them', () => { const a = scanNumbers({ 'docs/bench.md': ['Median dropped 48% to 1.2s', 'no numbers here'] }); diff --git a/test/review-packets-removed.test.ts b/test/review-packets-removed.test.ts index 1ae42964e..10c7a86a1 100644 --- a/test/review-packets-removed.test.ts +++ b/test/review-packets-removed.test.ts @@ -61,11 +61,12 @@ const NO_LOSS_REPLAYS = { 'GST-911': "GST-911 no-loss replay (GSTA-249/13): the planner over the last 100 first-parent main commits to f5cb6ec1e, origin/main's code against this branch, gate scan fixed at 0, changes no commit's depth, class, risk classes, targeted classes or SCOPE_AUTH; the three misreads (a drawing-only SVG, a session-named data file, a bare base) are proven on fixtures (test/review-planner-misreads.test.ts), where every SVG that can run script stays code with the security class; reviewer text is unchanged", 'R51': "R51 risk-tier routing no-loss re-score (GSTA-167): the saved panel findings (349 records over 24 of the 26 no-loss units) re-scored against the branch's plan lose no blocker whose only finders are roles it drops, and every gate, security, user-data and money fixture keeps main's reviewers plus the full panel (test/review-targeted.test.ts, test/review-risk-routing.test.ts); reviewer text is unchanged", 'GST-898': "GST-898 verdict-identity no-loss check: the linear rm rule, and the rmSync rule (which also raises security on any call with more than 500 characters before its closing parenthesis), give the same verdict as R51's on every changed line of the last 100 main commits (69,023 lines, a563f47 back 100 first-parent commits) and on 60,000 seeded lines per rule (test/review-risk-redos.test.ts), and no commit changes depth, class or risk class, so every diff dispatches main's reviewers unchanged; reviewer text is unchanged", + 'GST-967': "GST-967 dispatch-superset no-loss check (test/review-depth.test.ts, 'GST-967 dispatch-superset no-loss check'): over 1,440 planReview cases the branch plans exactly what main planned at 1022f4f except the 71 gate-class stops before Step 11, which add only Step 11's adversarial, outside and targeted voices, so no reviewer main dispatches is dropped or re-efforted; the brief bodies lib/review-brief.ts cuts from the ship sections hash to main's; only the lead's repeat-decision and Step 11 instructions changed; reviewer text is unchanged", } as const; type Replay = keyof typeof NO_LOSS_REPLAYS; const REVIEWER_BRIEFS: Record = { - 'ship/sections/review-army.md': { sha: 'b7ca291a1cc63750bfb9710a4c12fd971523b9598da2a32ef80fb258eb0eceab', replay: 'L' }, - 'ship/sections/adversarial.md': { sha: 'd776ee5bc6e0c13930f8f4de05bad2f1ed9e52bc9fc5df80ae3ba7680455b2bb', replay: 'GST-257' }, + 'ship/sections/review-army.md': { sha: '12f0e686fc50bccdcd5d0ee30b1f2925e47cde11ac83c008916114029e17cce5', replay: 'GST-967' }, + 'ship/sections/adversarial.md': { sha: 'd83e95536d8e380c13e6282b93fd6a7deaa77dc1584e7325bd87b1601d1f44fb', replay: 'GST-967' }, 'review/sections/review-army.md': { sha: '78329b64640260cd8831ca81a9189f3f8dcade9c406431631d3f2cd798cd3967', replay: '#3638' }, 'review/sections/adversarial.md': { sha: 'e6962fa25b78f362654f2954f79683e524d2ebd452d1494f8a2b099888e8e255', replay: 'G1' }, 'review/checklist.md': { sha: '607788afeb2c83f2dff1dccd58d212616ec72393d28cda2fa18690c1a83df699', replay: '#3638' }, @@ -82,7 +83,7 @@ const REVIEWER_BRIEFS: Record = { 'review/specialists/testing.md': { sha: 'd6cc2bef7be562387d0c0a22fefe646dff9c295f1d34d8453a6cb496584150e4', replay: '#3638' }, 'review/specialists/targeted.md': { sha: '7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5', replay: 'GST-257' }, 'scripts/resolvers/fix-check.ts': { sha: '712bf5b0c439e96bac32f19cbe25394dabb4c94aa66600100bfde9b100e15a08', replay: '#3638' }, - 'lib/review-depth.ts': { sha: '166dd7b1148a272b345dd9d2ceccd14348cc59c52ef9c88109436f6f61cf6b69', replay: 'GST-911-redos' }, + 'lib/review-depth.ts': { sha: '7768bfa3e31b914432dbebd3dcc574ae132d1edd5b7dee23dea3d2d1465aae07', replay: 'GST-967' }, 'lib/review-risk.ts': { sha: '126eff0f1de6982e03dc24d8017c67e6807c91dfa518b18d2db3aa910aac911f', replay: 'GST-911' }, };