From 76535826f5d50c721f95820f300037a3efe833a9 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Wed, 18 Nov 2026 04:08:56 +0800 Subject: [PATCH] /ship stops asking owners to clear base-side merge text and reviewers' confirmation prose (GST-2975, GST-2972) (#4458) /ship no longer stops for an owner's ruling when a base merge only changes base-side text, such as the preamble hash in regenerated SKILL.md files, and a reviewer's confirmation prose becomes a finding the lead can lower with a reason. Why: each of these cost a stopped /ship and an owner ruling on recent PRs (#4383, ghome#16, #4431), which keeps unattended shipping from finishing. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- ...y-ship-base-side-and-confirmation-prose.md | 9 ++ docs/review-policy.md | 6 +- docs/ship-policy.md | 10 ++ lib/review-ledger.ts | 22 +-- lib/ship-patch.ts | 103 ++++++++++-- lib/ship-release.ts | 4 +- scripts/lib/windows-curation.ts | 4 + test/review-ledger-quiet-reply.test.ts | 90 +++++++++++ test/ship-base-side-masks.test.ts | 151 ++++++++++++++++++ 9 files changed, 376 insertions(+), 23 deletions(-) create mode 100644 changelog.d/capy-ship-base-side-and-confirmation-prose.md create mode 100644 test/review-ledger-quiet-reply.test.ts create mode 100644 test/ship-base-side-masks.test.ts diff --git a/changelog.d/capy-ship-base-side-and-confirmation-prose.md b/changelog.d/capy-ship-base-side-and-confirmation-prose.md new file mode 100644 index 000000000..24dcbbb77 --- /dev/null +++ b/changelog.d/capy-ship-base-side-and-confirmation-prose.md @@ -0,0 +1,9 @@ +--- +important: blocker +--- +**/ship stops asking owners to clear two kinds of bookkeeping noise: base-side merge text and a reviewer's confirmation prose.** + +### Fixed +- **A base merge that only touched base-side text no longer stops `/ship` finish for an owner's grant.** After a main merge, finish counted two base-side differences as "behavior, tests or build inputs changed since review": the shared-preamble hash id in every regenerated skill file the branch also touched (#4383, 94 files), and an expected-value list where main's new entry was spliced next to the branch's own (ghome#16). The path comparison now reads both sides with the shared-preamble ids masked (a file whose only branch change is that id compares as unchanged), and a line that is the base's new line plus exactly the tokens the branch added to the reviewed line counts as base context, so it goes to the one scoped reader instead. A resolution that drops, invents or rewrites anything on the branch's own lines still stops as a behavior change. + +- **A reviewer's confirmation prose no longer becomes a Critical finding that only an owner can clear.** The collector read prose that named a file and line while confirming code, such as "a High or Critical challenge…", as an anchored Critical finding that judgment could not lower, even when the reply's own `REVIEW_VERDICT` said `blocking=0` or it said `NO FINDINGS`, so each one cost an owner ruling and a stopped `/ship` (twice on #4431). A file:line in prose, or a list item or the native voice's FIXABLE tag in a reply that says `NO FINDINGS`, no longer anchors a finding, so under a `blocking=0` verdict such a row is a summary candidate the lead can lower with a reason. It still blocks until then, so prose that names a real blocker ("no Critical issues except the token leak in log.ts:3") is never dropped. Structured findings (JSON, a lead severity label, a label heading, a numbered finding heading, a `Severity` or `Blocks: yes` field, or the native voice's FIXABLE/INVESTIGATE tag) still collect as anchored and still disagree with the verdict, and a reply whose verdict declares a blocker is read as before. diff --git a/docs/review-policy.md b/docs/review-policy.md index f38b993b1..4c1a321f8 100644 --- a/docs/review-policy.md +++ b/docs/review-policy.md @@ -1032,7 +1032,9 @@ ones, and the arm lost blockers. `bin/gstack-review-dispatch` closes both ends: reverted that. A reply that says `NO FINDINGS` keeps only its structured findings (GST-2122). Those are JSON objects (malformed JSON included), lead labels, label headings, numbered finding headings, `Severity` fields, `Blocks: yes`, the native voice's FIXABLE or INVESTIGATE tag, and anything naming a file:line, which still collect at their label. - Its other prose collects nothing. Outside such a reply prose collects as described above. A denial that a change + Only a field, lead label, heading or JSON anchors there: a file:line in prose, a list item or the FIXABLE or + INVESTIGATE tag may be the reader confirming code (GST-2972), so under a valid verdict that declares fewer blockers such a row is a summary candidate (below) and still + blocks until lead judgment lowers it with a reason. Its other prose collects nothing. Outside such a reply prose collects as described above. A denial that a change introduced a severity ("No fix introduced a CRITICAL defect") is a no-defect clause too, and a line led by a bold, unlabelled lead ("**1. Coverage:** …", "- **Callers:** …") is read for those clauses after its lead. Each prose finding's line also records the Severity and Blocks its own text states as `stated`, beside the collected label and never in its place; @@ -1068,7 +1070,7 @@ ones, and the arm lost blockers. `bin/gstack-review-dispatch` closes both ends: | Malformed line (bad count, bad `at=`, more locations than ``, two different lines) | Findings as parsed. `declared=malformed`, with the reason in `why=`. | | `blocking=` equals the blocking rows parsed | Findings as parsed. `agrees=yes`. | | `` is more than parsed | Every parsed row stays, and collect adds CRITICAL rows (ids `#v1`, `#v2`…): one per `at=` location that no parsed blocking row names, then one more row for the declared blockers left over. The added rows count toward what blocks like any other. | - | `` is less than parsed | Nothing is lowered automatically. Each blocking row with no list item, heading, field, lead label, JSON or file:line, and no `Blocks: yes` (a row that blocks only because a sentence uses the word CRITICAL or P0, or because the native voice's FIXABLE raises it) is marked `summary_candidate`, so lead judgment may lower it with a written reason, which `judge` records as `dismissed`. Anchored rows keep blocking. | + | `` is less than parsed | Nothing is lowered automatically. Each blocking row with no list item, heading, field, lead label or JSON (a file:line in prose is not an anchor, nor, in a reply that says `NO FINDINGS`, is a list item or the FIXABLE or INVESTIGATE tag, GST-2972), and no `Blocks: yes` (a row that blocks only because a sentence uses the word CRITICAL or P0, or because the native voice's FIXABLE raises it) is marked `summary_candidate`, so lead judgment may lower it with a written reason, which `judge` records as `dismissed`. Anchored rows keep blocking. | A valid line never lowers a row by itself. FOUN-298's native "nothing blocks … all FIXABLE" sentence with `blocking=0` still collects as CRITICAL, as a summary candidate the lead lowers with a reason. An automatic relabel diff --git a/docs/ship-policy.md b/docs/ship-policy.md index c2692252d..29eee8355 100644 --- a/docs/ship-policy.md +++ b/docs/ship-policy.md @@ -2292,6 +2292,16 @@ whose plan reviews it in full (`lib/ship-patch.ts` `comparePath`). GST-1561 had sent it to the one scoped reader instead. A [mechanical retake](#mechanical-retake) does not apply here, since the branch retook nothing. +Two base-side differences are not the branch's own change (GST-2975). +`comparePath` reads every side with the shared-preamble hash id masked, so a +generated skill file whose only branch-side difference after a base merge is +that id compares as unchanged. A reviewed line that the base also replaced, +where the current line is the base's new line plus exactly the tokens the +branch added to the reviewed line (both sides appended an entry to one +expected-value list), is base context: it goes to the one scoped reader, never +through silently. A resolution that drops, invents or rewrites anything on the +branch's own lines stays a changed path. + **Rewritten history.** `write` records `head_tree` (the reviewed head's tree) and `product_patch_id` (its product patch against the base), and every carry rebinds both to the new head and keeps the earlier trees in `carry.trees`. diff --git a/lib/review-ledger.ts b/lib/review-ledger.ts index b2d447304..634a2a7ca 100644 --- a/lib/review-ledger.ts +++ b/lib/review-ledger.ts @@ -188,11 +188,13 @@ export interface MergedLine { id: string; reader: string; label: string; stated? * A native FIXABLE finding that states `Blocks: no` and one Severity field collects at that field on every class (GST-1031 ruling A); * one with no Blocks: no, no Severity field or only a FIXABLE field stays CRITICAL. fixableRaises false (a code or docs review with no * risk, error, history or floor reason, GST-987) also drops FIXABLE's raise from label headings and leads. - * In a reply that says NO FINDINGS (GST-2122) a finding with no structure (JSON, lead label, label heading, numbered finding heading, - * Severity or Blocks: yes field, the native voice's FIXABLE or INVESTIGATE, or a file:line on it or on the line it runs on from) collects - * nothing; elsewhere it collects as above. A line led by a bold, unlabelled lead ("**1. Coverage:** …") is read for a closing summary after it. + * In a reply that says NO FINDINGS (GST-2122) a finding with no file:line in its prose or on the line it runs on from, and no structure + * (JSON, lead label, label heading, numbered finding heading, Severity or Blocks: yes field, the native voice's FIXABLE or INVESTIGATE), + * collects nothing. One with a file:line but no structure still collects, since it may name a real blocker. parseReply anchors a row + * there only by a field, lead label, heading or JSON: a file:line, a list item or the FIXABLE or INVESTIGATE tag does not (GST-2972: a + * reader confirming code names its lines). Elsewhere it collects as above. A line led by a bold, unlabelled lead ("**1. Coverage:** …") is read for a closing summary after it. */ -function parseLabelled(reader: string, output: string, fixableRaises: boolean): Array<{ label: string; raw: string; shaped: boolean; anchored: boolean }> { +function parseLabelled(reader: string, output: string, fixableRaises: boolean): Array<{ label: string; raw: string; shaped: boolean; fielded: boolean; anchored: boolean }> { type Finding = { label: string; raw: string; fields: Set; list: boolean; lead?: string; fixable?: boolean; heading?: boolean; item?: boolean; nested?: boolean; closed?: boolean; section?: boolean; context?: string }; const out: Finding[] = []; let section: string | null = null; @@ -313,11 +315,11 @@ function parseLabelled(reader: string, output: string, fixableRaises: boolean): const unblocked = (f: Finding) => fixableRaises || role !== 'adversarial-native' || !(f.fixable || f.label.toUpperCase() === 'FIXABLE' || /(? { const ls = [...raw.matchAll(SEVERITY_FIELD)].flatMap(m => (m[1] ?? m[2]!).match(FIELD_LABELS)!); return ls.length === 1 && !!rank(ls[0]); }; - const shaped = (f: Finding, tag = true) => f.section || f.heading || [...f.raw.split(' | '), f.context ?? ''].some(t => t.startsWith('{') || LEAD_LABEL.test(t) || META.test(t) || !!t.match(STATED_SEVERITY) || BLOCKS_YES.test(t) - || LOCUS.test(t) || PATH_LOCUS.test(t) || (tag && role === 'adversarial-native' && /(? f.section || f.heading || [...f.raw.split(' | '), f.context ?? ''].some(t => t.startsWith('{') || LEAD_LABEL.test(t) || META.test(t) || !!t.match(STATED_SEVERITY) || BLOCKS_YES.test(t) + || (loci && (LOCUS.test(t) || PATH_LOCUS.test(t))) || (tag && role === 'adversarial-native' && /(? { const own = relaxed?.length === out.length && relaxed[i]!.raw === f.raw && statesNoBlocks(f.raw) && statesSeverity(f.raw) ? relaxed[i]!.label : undefined; - return { label: own ?? (unblocked(f) ? f.label : 'CRITICAL'), raw: f.raw, shaped: shaped(f), anchored: f.list || shaped(f, false) }; + return { label: own ?? (unblocked(f) ? f.label : 'CRITICAL'), raw: f.raw, shaped: shaped(f), fielded: shaped(f, false, false), anchored: f.list || shaped(f, false, false) }; }); } @@ -333,15 +335,15 @@ const blockingRow = (f: { label: string; raw: string }) => (rank(f.label) ?? 0) * A reply's findings, and with asked (its render carried the verdict ask, GST-2495) the check of its REVIEW_VERDICT line * (lib/review-verdict.ts, docs/review-policy.md#verdict-line). A well-formed verdict line never parses as a finding, and a valid * line lowers nothing by itself. Declared more than parsed adds CRITICAL rows, one per unmatched at= location and one for the - * rest; declared fewer marks each blocking row with no anchor (no list item, heading, field, lead label, JSON or file:line) and - * no Blocks: yes a summary candidate, whether a CRITICAL or P0 word or the native voice's FIXABLE raise made it block. It still + * rest; declared fewer marks each blocking row with no anchor (no list item, heading, field, lead label or JSON; a file:line in prose + * is not one, and in a NO FINDINGS reply a list item is not one either, GST-2972) and no Blocks: yes a summary candidate, whether a CRITICAL or P0 word or the native voice's FIXABLE raise made it block. It still * blocks until lead judgment lowers it with a reason. */ export function parseReply(reader: string, output: string, fixableRaises = true, asked = false): { findings: ReplyFinding[]; verdict?: VerdictCheck } { const verdict = asked ? parseVerdict(output) : undefined; const text = asked ? withoutVerdictLines(output) : output; const clean = text.split('\n').some(l => /^NO FINDINGS\.?$/.test(l.trim())); - const rows = parseLabelled(reader, text, fixableRaises).filter(r => r.shaped || !clean); + const rows = parseLabelled(reader, text, fixableRaises).filter(r => r.shaped || !clean).map(r => clean ? { ...r, anchored: r.fielded } : r); if (verdict?.state !== 'valid') { const findings = rows.map(({ label, raw }) => ({ label, raw })); return { findings, ...(verdict ? { verdict: { state: verdict.state, parsed: findings.filter(blockingRow).length, ...(verdict.state === 'malformed' ? { why: verdict.why } : {}) } } : {}) }; diff --git a/lib/ship-patch.ts b/lib/ship-patch.ts index 5155ad259..47f8d3830 100644 --- a/lib/ship-patch.ts +++ b/lib/ship-patch.ts @@ -112,6 +112,45 @@ function sameSpot(r: ZeroHunk, c: ZeroHunk, map: (line: number) => number | null return c.oldStart >= low && c.oldStart <= map(above)! - 1; } +/** + * Ids a generator derives from base-side text (GST-2975, #4383): every generated skill file names the shared preamble's + * content hash, so a base edit to the shared preamble changes that id in every file the branch also regenerated. The + * comparison reads each side with these ids masked; nothing else in the file is masked. + */ +const GENERATED_IDS: ReadonlyArray<[RegExp, string]> = [[/(gstack shared preamble `)[0-9a-f]{12}(`)/g, '$1$2'], [/^(# gstack shared preamble )[0-9a-f]{12}$/gm, '$1']]; +const maskIds = (text: string) => GENERATED_IDS.reduce((t, [re, to]) => t.replace(re, to), text); + +/** + * The path's diffs between two of the sides, read with GENERATED_IDS masked when any side's text carries one (a scratch + * object directory holds the masked blobs, so the repository gains no object); null masking when a side lacks the path, + * is binary, or names no id, and the diffs are then the plain ones. + */ +function sideDiffs(repoRoot: string, s: PatchSides, rel: string): { diff: (from: string, to: string, context: number) => string | null; done: () => void } { + const plain = { diff: (from: string, to: string, context: number) => pathDiff(repoRoot, from, to, rel, context), done: () => {} }; + const refs = [...new Set([s.reviewedBase, s.reviewed, s.currentBase, s.current])]; + const texts = refs.map(ref => spawnSync('git', ['cat-file', 'blob', `${ref}:${rel}`], { cwd: repoRoot, timeout: 120_000, maxBuffer: 256 * 1024 * 1024 })); + if (texts.some(t => t.status !== 0 || t.stdout.includes(0))) return plain; + const raw = texts.map(t => t.stdout.toString('utf8')); + if (!raw.some(t => maskIds(t) !== t)) return plain; + const objects = git(repoRoot, ['rev-parse', '--git-path', 'objects'])?.trim(); + if (!objects) return plain; + const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ship-patch-mask-')); + const env = { ...process.env, GIT_OBJECT_DIRECTORY: dir, GIT_ALTERNATE_OBJECT_DIRECTORIES: path.resolve(repoRoot, objects) }; + const run = (args: string[], input?: string) => spawnSync('git', ['-c', 'core.quotepath=off', ...args], { cwd: repoRoot, env, encoding: 'utf8', input, timeout: 120_000, maxBuffer: 256 * 1024 * 1024 }); + const blobs = new Map(refs.map((ref, i) => [ref, run(['hash-object', '-w', '--stdin'], maskIds(raw[i]!)).stdout.trim()])); + const done = () => fs.rmSync(dir, { recursive: true, force: true }); + if ([...blobs.values()].some(b => !/^[0-9a-f]{40,64}$/.test(b))) { done(); return plain; } + return { + diff: (from, to, context) => { + const [a, b] = [blobs.get(from)!, blobs.get(to)!]; + const r = run(['diff', '--no-color', '--no-ext-diff', '--no-textconv', '--binary', '--full-index', `-U${context}`, a, b]); + if (r.status !== 0) return null; + return r.stdout.split('\n').map(l => /^(diff --git|--- |\+\+\+ )/.test(l) ? l.replaceAll(`a/${a}`, `a/${rel}`).replaceAll(`b/${b}`, `b/${rel}`) : l).join('\n'); + }, + done, + }; +} + /** The verdict for one path the branch touches on either side (module header). */ export function comparePath(repoRoot: string, s: PatchSides, rel: string): PathVerdict { const r3 = pathDiff(repoRoot, s.reviewedBase, s.reviewed, rel, 3); @@ -119,16 +158,60 @@ export function comparePath(repoRoot: string, s: PatchSides, rel: string): PathV if (r3 === null || c3 === null || (!r3.trim() && !c3.trim())) return 'changed'; const modes = (d: string) => d.split('\n').filter(l => /^(old mode|new mode|new file mode|deleted file mode) /.test(l)).join('\n'); if (modes(r3) !== modes(c3)) return 'changed'; - const ids = [patchId(repoRoot, r3), patchId(repoRoot, c3)]; - if (ids[0] === null || ids[1] === null) return 'changed'; - const r0 = zeroHunks(pathDiff(repoRoot, s.reviewedBase, s.reviewed, rel, 0) ?? ''); - const c0 = zeroHunks(pathDiff(repoRoot, s.currentBase, s.current, rel, 0) ?? ''); - if (ids[0] === ids[1] && r0 === null) return 'same'; - const b0 = zeroHunks(pathDiff(repoRoot, s.reviewedBase, s.currentBase, rel, 0) ?? ''); - if (!r0?.length || !c0 || !b0 || r0.length !== c0.length) return 'changed'; - const map = mapper(b0); - if (!r0.every((h, i) => h.body === c0[i]!.body && sameSpot(h, c0[i]!, map))) return 'changed'; - return ids[0] === ids[1] ? 'same' : 'context'; + const sides = sideDiffs(repoRoot, s, rel); + try { + const [mr3, mc3] = [sides.diff(s.reviewedBase, s.reviewed, 3), sides.diff(s.currentBase, s.current, 3)]; + if (mr3 === null || mc3 === null) return 'changed'; + if (!mr3.trim() && !mc3.trim()) return 'same'; + const ids = [patchId(repoRoot, mr3), patchId(repoRoot, mc3)]; + if (ids[0] === null || ids[1] === null) return 'changed'; + const r0 = zeroHunks(sides.diff(s.reviewedBase, s.reviewed, 0) ?? ''); + const c0 = zeroHunks(sides.diff(s.currentBase, s.current, 0) ?? ''); + if (ids[0] === ids[1] && r0 === null) return 'same'; + const b0 = zeroHunks(sides.diff(s.reviewedBase, s.currentBase, 0) ?? ''); + if (!r0?.length || !c0 || !b0 || r0.length !== c0.length) return 'changed'; + const map = mapper(b0); + let spliced = false; + for (const [i, h] of r0.entries()) { + if (h.body === c0[i]!.body && sameSpot(h, c0[i]!, map)) continue; + if (!splicedHunk(h, c0[i]!, b0)) return 'changed'; + spliced = true; + } + return ids[0] === ids[1] && !spliced ? 'same' : 'context'; + } finally { + sides.done(); + } +} + +const TOKEN = /\s+|[\w$.]+|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`(?:[^`\\]|\\.)*`|[^]/g; +/** The tokens `to` adds to `from` when `from` is `to` with tokens left out (a greedy embedding), else null. */ +function insertedTokens(from: string, to: string): string[] | null { + const [f, t] = [from.match(TOKEN) ?? [], to.match(TOKEN) ?? []]; + const added: string[] = []; + let k = 0; + for (const tok of t) { if (k < f.length && tok === f[k]) k++; else added.push(tok); } + return k === f.length ? added : null; +} + +/** + * A hunk the base merge spliced (GST-2975, ghome#16): the base replaced exactly the lines the branch's hunk replaces, line + * for line, and each current line is the base's new line with the very tokens the branch added to the reviewed line, as + * when both sides appended an entry to one expected-value list. The branch removes nothing on those lines, so its own change + * is the reviewed one and the merge only kept both; the caller still routes the path to a scoped reader (context), never + * through silently. + */ +function splicedHunk(r: ZeroHunk, c: ZeroHunk, base: ZeroHunk[]): boolean { + if (!r.oldCount || r.oldCount !== r.newCount || c.oldCount !== r.oldCount || c.newCount !== r.newCount) return false; + const b = base.find(h => h.oldStart === r.oldStart && h.oldCount === r.oldCount && h.newCount === r.oldCount && h.newStart === c.oldStart); + if (!b) return false; + const side = (h: ZeroHunk, sign: string) => h.body.split('\n').filter(l => l.startsWith(sign)).map(l => l.slice(1)); + const [rm, ra, cm, ca, bm, ba] = [side(r, '-'), side(r, '+'), side(c, '-'), side(c, '+'), side(b, '-'), side(b, '+')]; + if (rm.join('\n') !== bm.join('\n') || cm.join('\n') !== ba.join('\n')) return false; + return rm.every((was, k) => { + const mine = insertedTokens(was, ra[k]!); + const kept = insertedTokens(cm[k]!, ca[k]!); + return !!mine?.length && !!kept && mine.length === kept.length && mine.every((x, j) => x === kept[j]); + }); } /** diff --git a/lib/ship-release.ts b/lib/ship-release.ts index e0711fe1a..7f36f8b34 100644 --- a/lib/ship-release.ts +++ b/lib/ship-release.ts @@ -397,13 +397,15 @@ function route(cwd: string, base: string, reviewed: string, reviewedBase: Review const by: Routed = { behavior: [], docs: [], metadata: [], tests: [], base: [], context: [], bounded: [], mechanical: [], accepted: [], fix_checked: [], sidecar: [] }; const isMetadata = (p: string) => parent && shipped.has(p) ? opts.baseRelease!.includes(p) || harnessRepin(cwd, sides!.currentBase, now, p) : release.includes(p) || harnessRepin(cwd, reviewed, now, p); const onlyShipped = new Set(parent ? [...shipped].filter(p => !changedSet.has(p)) : []); + const baseSide = new Set(); for (const p of [...changedSet, ...onlyShipped].sort()) { const verdict = sides ? (!touched.has(p) || (parent && !shipped.has(p) && baseHolds(cwd, sides, p)) ? 'same' : comparePath(cwd, sides, p)) : 'changed'; + if (verdict === 'context') baseSide.add(p); const metadata = isMetadata(p); by[verdict === 'same' ? 'base' : metadata ? 'metadata' : sides && isTestCode(p, opts.testCode) ? 'tests' : classifyPath(p, cwd) === 'docs' && !matchesAny(opts.bookkeeping, p) ? 'docs' : verdict === 'context' ? 'context' : 'behavior'].push(p); } const shippedTests = by.tests.filter(p => onlyShipped.has(p)); - const gated = new Set([...(gateEditedPaths(cwd, reviewed, now, by.tests.filter(p => !onlyShipped.has(p))) ?? by.tests), ...(gateEditedPaths(cwd, sides?.currentBase ?? reviewed, now, shippedTests) ?? shippedTests)]); + const gated = new Set([...(gateEditedPaths(cwd, reviewed, now, by.tests.filter(p => !onlyShipped.has(p) && !baseSide.has(p))) ?? by.tests), ...(gateEditedPaths(cwd, sides?.currentBase ?? reviewed, now, shippedTests) ?? shippedTests)]); by.behavior.push(...by.tests.filter(p => gated.has(p))); by.tests = by.tests.filter(p => !gated.has(p)); const mech = mechanicalPaths(cwd, { sides, base, candidates: parent ? [] : [...by.behavior, ...by.tests, ...by.docs], declared: opts.mechanical }); diff --git a/scripts/lib/windows-curation.ts b/scripts/lib/windows-curation.ts index 9258d0e38..e778bb67f 100644 --- a/scripts/lib/windows-curation.ts +++ b/scripts/lib/windows-curation.ts @@ -444,6 +444,10 @@ export const KNOWN_WINDOWS_INCOMPATIBLE: Array<{ file: string; reason: string }> file: 'test/ship-receipt-carry-mixed.test.ts', reason: 'drives bin/gstack-ship-receipt, gstack-ship-release, gstack-docs-candidate and gstack-wtree (shebangs) through test/helpers/ship-bin-fixture.ts like test/ship-mechanical-retake.test.ts; windows-latest fails every case at the first bin spawn (windows-scoped-shard, run 42167292675)', }, + { + file: 'test/ship-base-side-masks.test.ts', + reason: 'drives bin/gstack-ship-release, gstack-docs-candidate and gstack-wtree (shebangs) through test/helpers/ship-bin-fixture.ts like test/ship-rereview-triggers.test.ts; windows-latest fails every case at the first bin spawn (windows-scoped-shard, run 41950236362)', + }, { file: 'test/ship-uid-sidecar.test.ts', reason: 'drives bin/gstack-ship-release, gstack-ship-receipt, gstack-docs-candidate and gstack-wtree (shebangs) through test/helpers/ship-bin-fixture.ts like test/ship-mechanical-retake.test.ts; windows-latest fails every case at the first bin spawn (windows-scoped-shard, run 42205201312)', diff --git a/test/review-ledger-quiet-reply.test.ts b/test/review-ledger-quiet-reply.test.ts new file mode 100644 index 000000000..732410136 --- /dev/null +++ b/test/review-ledger-quiet-reply.test.ts @@ -0,0 +1,90 @@ +/** + * GST-2972 (#4431, twice): the collector minted Critical findings from a reader's confirmation prose. A fix-check whose own + * REVIEW_VERDICT said blocking=0 (p1fc at 00155f5) wrote "a High or Critical challenge" in a paragraph naming + * autoplan-revise.ts:103, and a clean one (blocking=0 and NO FINDINGS, p3fc at b1b3c3c) had a nested bullet under a line naming + * lib/autoplan-gate.ts:197. The file:line made each an anchored Critical that lead judgment could not lower, so each cost an owner + * ruling. Captain ruling D1 (2026-11-14, test/review-verdict.test.ts) holds: a verdict line lowers nothing by itself, and neither + * does NO FINDINGS (Captain, 2026-11-17: prose that names a real blocker must not vanish). So the prose rows still collect and block, + * but a file:line in prose, or a list item in a NO FINDINGS reply, no longer anchors them: under a valid verdict that declares fewer + * blockers each is a summary candidate the lead may lower with a reason, instead of an owner ruling. + */ +import { describe, expect, test } from 'bun:test'; +import { parseReply } from '../lib/review-ledger'; + +// The two replies as the readers returned them (GSTA-573 subagents 3.3 and 3.9). +const P1FC = "REVIEWED_TREE: 00155f52976c3d27c8c874c16ba0f16b401ed97f /workspace/gstack\nREVIEW_VERDICT: blocking=0\n\n{\"severity\":\"INFORMATIONAL\",\"path\":\"lib/autoplan-confirm.ts\",\"line\":125,\"summary\":\"Fix 1 still lets an ordinary finding close an unrelated open challenge when that finding is marked settled_by. annotateConfirm (line 163) sets row.correlates to every earlier row whose title scores at least 0.6, but it sets settled_by from only one of them (`prior`). Take a later-round Low row whose title matches both earlier challenge A, which was answered at the gate, and earlier challenge B, which is still open. That row gets settled_by A's decision and correlates [A, B], so openEarlier counts B as covered, and buildGate (line 221) never carries B to the owner. Fix 1 was meant to stop this kind of silent close. Fix: count a settled row's correlates only for the ids that settledIds actually contains.\"}\n\nFixes 2 and 3 look sound. Fix 2 now sends a quoted-plan user_challenge that has no valid owner_quote to propose(), whatever its severity. The one behaviour change is for a High or Critical challenge like that: it used to become a `|finding` item with a \"carry into the build as a blocking task\" option, and now it becomes a proposal. That is the same treatment challenges that carry `changes` already get, the twin bundling is unchanged, and the rerun agentDecision path isn't reachable from the new branch. Fix 3 only appends a fourth origin segment. Every origin parser I found (settledIds, decisionSeverity in autoplan-revise.ts:103, and autoplan-shadow.ts:198) reads segments [0] and [1], so none of them break. The day-one titles it hashes are stable (the `reason` strings in autoplan-owner-text.ts are fixed text), so a change only asks again when the list or a row's wording actually changed. A gate answered before this commit gets re-asked once after the upgrade, which errs on the side of asking again. The commit only adds tests and doesn't weaken any existing one. I reran `bun test test/autoplan-day-one-gate.test.ts` at this tree: 21 pass, 0 fail.\n"; +const P3FC = "REVIEWED_TREE: b1b3c3cca68f1087cbca0d4f24c94e168daeb920 /workspace/gstack\nREVIEW_VERDICT: blocking=0\n\nNO FINDINGS\n\nEvery statement in 9c1e407 and ed1dd85 matches the code at HEAD ed1dd85. I checked each one against its source:\n\n- **Result-format contract (docs/unattended.md).** It matches `RESULT_FORMAT` in lib/autoplan-prompts.ts:126 and the parser. `CHANGES` in lib/autoplan-reconcile.ts:36 accepts scope, cost, direction, packaging and ordering, and the parser takes `owner_quote` (positive integer) and `resolves`.\n- **Gate step.** It matches `buildGate` (lib/autoplan-gate.ts:197-288) and lib/autoplan-gate-items.ts:\n - With an Owner's words section, a `changes` or `user_challenge` row that names no quote becomes a `proposal` uc approval item. Its `b` keeps the draft, and that becomes a blocking build task when any row is Critical or High (`blockingProposal`, `FINDING_ORIGIN`).\n - Without that section, `confirm_direction` is a d/auto item, added only when a one-voice challenge1 was kept.\n - Earlier open challenges come back through `openEarlier`, and only a later `resolves` row or an owner's answer closes them.\n - `day_one` items (missing page when `scope.ui` is set, plus each assumed row) and `cut` items (a cut that drops a day-one row or quote) are uc approvals. The other cuts form one `cuts` d/auto item.\n- **Owner-only replies (troubleshooting `OWNER_REPLY_REQUIRED`, unattended step 4).** The guard at lib/autoplan-gate.ts:455 refuses agent words on any non-p1 `approval` item. That covers proposal, day_one and cut, and correctly leaves out the auto items `cuts` and `confirm_direction`.\n- **Redaction (`ARTIFACT_OWNER_WORDS` and the public-copy text).** lib/autoplan-owner-words.ts:277-278 reads quotes from plan-active, plan-source*, plan-at-gate.r*, and plan-file.* files, so a quote a later revision removed stays redacted.\n- **Shadow item_class list.** It equals `ItemClass` in lib/gate-list.ts:51-52.\n- **Brief order, owner brief.** lib/owner-brief.ts:89-96 renders URGENT, then `renderDayOne`, then the summary.\n- **Brief order, captain.md.** lib/captain-brief.ts:146 renders URGENT, the header, then Day one / What it won't do yet / \"Your words this plan follows\" (each only when present), then ELI5 and the sections. So captain.md's new order still tells agents the right thing.\n- **Changelog.** The High/Critical decline sentence matches `proposalItem`'s `b` text and `settledIds` (a finding-origin decision settles only on `a`). The removed-quote redaction sentence matches the redaction code above. Dropping the tracker code passes `changelog-fragments.test.ts`.\n\n**Tests.** The fix list's 10 files (730 pass) didn't cover the files that read these docs or the fragment, so I also ran changelog-fragments, capy-skill-wrapper, captain-brief, host-conformance and docs-only at this tree: 155 pass, 0 fail.\n\nThe fixes change no code symbols, so there are no callers to break.\n"; + +const blocking = (r: ReturnType) => r.findings.filter(f => /^(CRITICAL|P0|P1|HIGH)$/i.test(f.label)); + +describe('confirmation prose in a reply that says nothing blocks (GST-2972)', () => { + // Value: protects=the two #4431 replies: each prose Critical is a summary candidate the lead may lower, and p1fc keeps its JSON + // finding; fails_when=either prose row is an anchored Critical (the owner-ruling stop), or the JSON line is lost; + // seam=parseReply as collect calls it (verdict asked); no_claim=what the lead decides about the candidate + test('p3fc and p1fc prose rows are summary candidates, not anchored Criticals; p1fc keeps its JSON finding', () => { + const p3 = parseReply('fix-check', P3FC, true, true); + expect(p3.findings.map(f => [f.label, f.summary ?? false])).toEqual([['Critical', true]]); + expect(p3.findings[0]!.raw).toStartWith("- With an Owner's words section"); + expect(p3.verdict).toMatchObject({ state: 'valid', declared: 0, parsed: 1, agrees: false }); + const p1 = parseReply('fix-check', P1FC, true, true); + expect(p1.findings.map(f => [f.label, f.summary ?? false])).toEqual([['INFORMATIONAL', false], ['Critical', true]]); + expect(p1.findings[0]!.raw).toContain('"path":"lib/autoplan-confirm.ts"'); + expect(p1.findings[1]!.raw).toStartWith('Fixes 2 and 3 look sound.'); + expect(p1.verdict).toMatchObject({ state: 'valid', declared: 0, parsed: 1, agrees: false }); + }); + + // Value: protects=negative controls: a structured blocker in a blocking=0 or NO FINDINGS reply still collects as CRITICAL, is no summary candidate, and the + // verdict disagrees, and the same prose under a verdict that declares a blocker still collects; fails_when=the quiet rule drops a + // lead-labelled, Severity-field, Blocks: yes or JSON blocker, or prose in a reply that declares one; seam=parseReply + test('a structured blocker still collects in a quiet reply, and prose still collects when the verdict declares a blocker', () => { + const head = 'REVIEWED_TREE: ' + 'a'.repeat(40) + ' /workspace/gstack\nREVIEW_VERDICT: blocking=0\n\n'; + for (const line of [ + '**CRITICAL** lib/store.ts:40: the migration drops the rows it was meant to copy.', + 'lib/store.ts:40: the migration drops the rows it was meant to copy.\nSeverity: Critical', + 'lib/store.ts:40: the migration drops the rows it was meant to copy. Blocks: yes', + '{"severity":"CRITICAL","path":"lib/store.ts","line":40,"summary":"the migration drops the rows it was meant to copy"}', + ]) { + for (const tail of ['', '\nNO FINDINGS\n']) { + const r = parseReply('fix-check', head + line + '\n' + tail, true, true); + expect(blocking(r).length).toBe(1); + expect(blocking(r)[0]!.summary).toBeUndefined(); + expect(r.verdict).toMatchObject({ declared: 0, parsed: 1, agrees: false }); + } + } + const declared = parseReply('fix-check', P1FC.replace('REVIEW_VERDICT: blocking=0', 'REVIEW_VERDICT: blocking=1 at=lib/autoplan-gate.ts:257'), true, true); + expect(blocking(declared).length).toBeGreaterThanOrEqual(1); + expect(blocking(declared).every(f => !f.summary)).toBe(true); + const unasked = parseReply('fix-check', P1FC, true, false); + expect(blocking(unasked).map(f => f.summary ?? false)).toEqual([false]); + }); + + // Value: protects=a NO FINDINGS reply whose prose names a real blocker still blocks (Captain, 2026-11-17; the GPT-6.1 Sol trail read + // on #4449): under blocking=0 it is a summary candidate the lead must lower with a reason, and with no verdict asked it is an + // ordinary CRITICAL; negative control: NO FINDINGS prose with no file:line still collects nothing (GST-2122); + // fails_when=the token-leak line vanishes or the verdict agrees, or unlocated prose starts collecting; seam=parseReply + test('a NO FINDINGS reply whose prose names a token leak still blocks', () => { + const leak = 'No CRITICAL issues except the token leak in log.ts:3.'; + const head = 'REVIEWED_TREE: ' + 'a'.repeat(40) + ' /workspace/gstack\nREVIEW_VERDICT: blocking=0\n\nNO FINDINGS\n\n'; + const asked = parseReply('fix-check', head + leak + '\n', true, true); + expect(blocking(asked).map(f => [f.raw, f.summary ?? false])).toEqual([[leak, true]]); + expect(asked.verdict).toMatchObject({ state: 'valid', declared: 0, parsed: 1, agrees: false }); + const unasked = parseReply('fix-check', 'NO FINDINGS\n\n' + leak + '\n', true, false); + expect(blocking(unasked).map(f => [f.raw, f.summary ?? false])).toEqual([[leak, false]]); + const unlocated = parseReply('fix-check', head + 'I read every changed file and the critical paths look right.\n', true, true); + expect(unlocated.findings).toEqual([]); + expect(unlocated.verdict).toMatchObject({ state: 'valid', declared: 0, parsed: 0, agrees: true }); + }); + + // Value: protects=the native voice's FIXABLE tag does not anchor a prose row in a NO FINDINGS reply (#4449's read-only final review), + // so under blocking=0 it stays a summary candidate as on main; negative control: with no verdict asked it is a plain CRITICAL; + // fails_when=the FIXABLE-only row is anchored (an owner stop) or stops blocking; seam=parseReply with the native voice + test('a FIXABLE-only prose row in a NO FINDINGS reply is a summary candidate, not an anchored Critical', () => { + const row = "The cache key ignores the user id, so one user can read another user's cached page. FIXABLE: key on the user id too."; + const head = 'REVIEWED_TREE: ' + 'a'.repeat(40) + ' /workspace/gstack\nREVIEW_VERDICT: blocking=0\n\nNO FINDINGS\n\n'; + const asked = parseReply('adversarial-native', head + row + '\n', true, true); + expect(blocking(asked).map(f => [f.label, f.summary ?? false])).toEqual([['CRITICAL', true]]); + expect(asked.verdict).toMatchObject({ state: 'valid', declared: 0, parsed: 1, agrees: false }); + const unasked = parseReply('adversarial-native', 'NO FINDINGS\n\n' + row + '\n', true, false); + expect(blocking(unasked).map(f => [f.label, f.summary ?? false])).toEqual([['CRITICAL', false]]); + }); +}); diff --git a/test/ship-base-side-masks.test.ts b/test/ship-base-side-masks.test.ts new file mode 100644 index 000000000..fb3f07567 --- /dev/null +++ b/test/ship-base-side-masks.test.ts @@ -0,0 +1,151 @@ +/** + * GST-2975: /ship finish stopped with "behavior, tests or build inputs changed since review" after a base merge whose only + * effect on the branch's files was base-side: the shared-preamble hash id in regenerated skill files (#4383, 94 files), and + * main's new entry spliced into an expected-value list the branch also appended to (ghome#16). Both now compare with the + * base-side difference masked; the spliced list goes to the scoped reader, and a real change to the branch's own lines + * still stops. + */ +import { afterEach, describe, expect, setDefaultTimeout, test } from 'bun:test'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { comparePath } from '../lib/ship-patch'; +import { lineOf, RELEASE, shipFixture, type ShipFx } from './helpers/ship-bin-fixture'; + +setDefaultTimeout(90_000); +const BIN = path.dirname(RELEASE); +const LANE = 'tests=printf " 3 pass\\n 0 fail\\nRan 3 tests across 1 file. [5.00ms]\\n"'; +const ships: ShipFx[] = []; +afterEach(() => { while (ships.length) ships.pop()!.cleanup(); }); +const fx = (...a: Parameters) => { const f = shipFixture(...a); ships.push(f); return f; }; +const wtree = (f: ShipFx) => f.run(path.join(BIN, 'gstack-wtree'), []).stdout.trim(); +const mergeBase = (f: ShipFx) => f.git('merge-base', 'origin/main', 'HEAD').stdout.trim(); +const snapshot = (f: ShipFx) => { + const out = path.join(f.root, 'post.json'); + expect(f.run(path.join(BIN, 'gstack-docs-candidate'), ['snapshot', '--out', out, '--audit-id', 'a1', '--mode', 'edit', '--base', 'main', '--docs', 'README.md']).status).toBe(0); + return out; +}; +const mergeMain = (f: ShipFx, resolved: Record) => { + f.git('fetch', '-q', 'origin'); + if (f.git('merge', '-q', '--no-edit', 'origin/main').status !== 0) { f.write(resolved); f.commit('merge main'); } +}; +const finish = (f: ShipFx, reviewed: string, post: string, reviewedBase: string) => + f.run(RELEASE, ['finish', '--base', 'main', '--reviewed-tree', reviewed, '--docs-post', post, '--lane', LANE, '--reviewed-base', reviewedBase]); +const sidesOf = (f: ShipFx, reviewed: string, reviewedBase: string) => + ({ reviewedBase, reviewed, currentBase: mergeBase(f), current: f.git('rev-parse', 'HEAD').stdout.trim() }); + +/** A generated skill file as gen-skill-docs writes it: the shared-preamble id twice, then rules the branch edits. */ +const SKILL = 'ship/SKILL.md'; +const PREAMBLE = 'ship/sections/preamble.md'; +const skill = (id: string, rules: string[], tail = 'Run the review.') => + ['---', 'name: ship', '---', '', `This skill follows gstack shared preamble \`${id}\` (AskUserQuestion format, voice, writing). Read it once.`, '', '## Rules', '', ...rules.map(r => `- ${r}`), '', '## Steps', '', tail, ''].join('\n'); +const preamble = (id: string, rules: string[]) => [`# gstack shared preamble ${id}`, '', ...rules, ''].join('\n'); +const MAIN_RULES = ['Ask one question at a time.', 'Write plain English.']; +const BRANCH_RULES = [...MAIN_RULES, 'Never print secrets.']; +const MAIN_PREAMBLE = ['Voice: direct.', 'Completeness: finish the task.']; + +/** #4383 (dfab3a0): reviewed at the branch's regeneration, then main changed the shared preamble, so every id moved. */ +function preambleMerge(resolvedRules = BRANCH_RULES) { + const f = fx({ [SKILL]: skill('aaaaaaaaaaaa', MAIN_RULES), [PREAMBLE]: preamble('aaaaaaaaaaaa', MAIN_PREAMBLE) }, + { [SKILL]: skill('bbbbbbbbbbbb', BRANCH_RULES), [PREAMBLE]: preamble('bbbbbbbbbbbb', [...MAIN_PREAMBLE, 'Never print secrets.']) }); + const reviewed = wtree(f); + const reviewedBase = mergeBase(f); + const post = snapshot(f); + f.advanceBase({ [SKILL]: skill('cccccccccccc', MAIN_RULES, 'Run the review, then the docs audit.'), [PREAMBLE]: preamble('cccccccccccc', ['Voice: direct and brief.', 'Completeness: finish the task.']) }); + mergeMain(f, { [SKILL]: skill('dddddddddddd', resolvedRules, 'Run the review, then the docs audit.'), [PREAMBLE]: preamble('dddddddddddd', ['Voice: direct and brief.', 'Completeness: finish the task.', 'Never print secrets.']) }); + return { f, reviewed, reviewedBase, post }; +} + +describe('regenerated skill files whose only base-side change is the shared-preamble id (#4383)', () => { + // Value: protects=#4383: a main merge that only moved the shared-preamble hash id in the branch's regenerated files is a + // base merge, not a behavior change; fails_when=finish stops with behavior=N for the id lines; seam=comparePath via finish; + // no_claim=a hash id outside the two generated forms + test('the id lines are masked: the paths route as base or context and finish never stops for a behavior change', () => { + const { f, reviewed, reviewedBase, post } = preambleMerge(); + const sides = sidesOf(f, reviewed, reviewedBase); + expect(comparePath(f.work, sides, SKILL)).toBe('same'); + expect(comparePath(f.work, sides, PREAMBLE)).toBe('context'); + const r = finish(f, reviewed, post, reviewedBase); + expect(lineOf(r.stdout, 'ROUTE')).toMatch(/ behavior=0 .* base=1 context=1$/); + expect(r.stdout).not.toContain('behavior, tests or build inputs changed since review'); + expect(r.stdout).toContain(`STOP: base context moved next to the reviewed hunks in ${PREAMBLE}`); + }); + + // Value: protects=#4383's own files: a branch that edits the shared preamble changes every generated file by its id alone, and + // a main merge that moves the id again compares as same; fails_when=the empty masked diffs read as changed and finish stops; + // seam=comparePath; no_claim=the preamble file itself, which keeps its own comparison + test('a regenerated file whose only branch change is the id compares as same, and a rule changed in the merge still stops', () => { + const idOnly = (rules: string[]) => { + const f = fx({ [SKILL]: skill('aaaaaaaaaaaa', MAIN_RULES) }, { [SKILL]: skill('bbbbbbbbbbbb', MAIN_RULES) }); + const reviewed = wtree(f); + const reviewedBase = mergeBase(f); + f.advanceBase({ [SKILL]: skill('cccccccccccc', MAIN_RULES) }); + mergeMain(f, { [SKILL]: skill('dddddddddddd', rules) }); + return comparePath(f.work, sidesOf(f, reviewed, reviewedBase), SKILL); + }; + expect(idOnly(MAIN_RULES)).toBe('same'); + expect(idOnly([...MAIN_RULES, 'Print secrets when asked.'])).toBe('changed'); + }); + + // Value: protects=negative control: masking the id never hides the branch's own lines; fails_when=a resolution that drops a + // rule the branch added, or edits one, routes as base or context; seam=comparePath via finish; no_claim=none + test('a resolution that changes the branch\'s own rule still stops as a behavior change', () => { + for (const rules of [MAIN_RULES, [...MAIN_RULES, 'Print secrets when asked.']]) { + const { f, reviewed, reviewedBase, post } = preambleMerge(rules); + expect(comparePath(f.work, sidesOf(f, reviewed, reviewedBase), SKILL)).toBe('changed'); + const r = finish(f, reviewed, post, reviewedBase); + expect(r.status).toBe(3); + expect(r.stdout).toContain('behavior, tests or build inputs changed since review'); + expect(r.stdout).toContain(SKILL); + } + }); +}); + +const LIST = 'test/methods.test.ts'; +const methods = (entries: string[], check = 'expect(METHODS).toEqual(EXPECTED)') => + ["import { expect, test } from 'bun:test';", "import { METHODS } from '../src/methods';", '', `const EXPECTED = [${entries.map(e => `"${e}"`).join(', ')}];`, '', `test('the plugin registers every method', () => ${check});`, ''].join('\n'); +const BASE_METHODS = ['ghome.prep', 'ghome.lookup']; + +/** ghome#16 (feb89ba): the branch appended ghome.brief, main appended ghome.talk.target, and the merge kept both. */ +function listMerge(resolved: string) { + const f = fx({ [LIST]: methods(BASE_METHODS) }, { [LIST]: methods([...BASE_METHODS, 'ghome.brief']) }); + const reviewed = wtree(f); + const reviewedBase = mergeBase(f); + const post = snapshot(f); + f.advanceBase({ [LIST]: methods([...BASE_METHODS, 'ghome.talk.target']) }); + mergeMain(f, { [LIST]: resolved }); + return { f, reviewed, reviewedBase, post }; +} + +describe('an expected-value list the base merge spliced (ghome#16)', () => { + // Value: protects=ghome#16: a resolved line that is main's line plus exactly the entry the branch added goes to the scoped + // reader of its test hunks, not to an owner grant; fails_when=gateEditedPaths sends it to behavior (the owner-grant stop) or + // it passes with no reader; seam=comparePath + finish route; no_claim=the scoped reader's verdict + test('the union is context: finish stops for the scoped reader, never for a behavior change', () => { + const { f, reviewed, reviewedBase, post } = listMerge(methods([...BASE_METHODS, 'ghome.talk.target', 'ghome.brief'])); + expect(comparePath(f.work, sidesOf(f, reviewed, reviewedBase), LIST)).toBe('context'); + const r = finish(f, reviewed, post, reviewedBase); + expect(lineOf(r.stdout, 'ROUTE')).toMatch(/ behavior=0 .*tests=1 /); + expect(r.stdout).not.toContain('behavior, tests or build inputs changed since review'); + expect(r.status).toBe(3); + const packet = /STOP: test code changed since review in test\/methods\.test\.ts: .* reads (\S+),/.exec(r.stdout)?.[1]; + expect(packet).toBeDefined(); + expect(fs.readFileSync(packet!, 'utf8')).toContain('"ghome.talk.target", "ghome.brief"'); + }); + + // Value: protects=negative control: a resolution that is not main's line plus the branch's entry is the branch's own change; + // one that invents an entry or changes the check still stops for the full loop; fails_when=any of them is context, or an + // invented entry or a weakened check routes to the scoped reader; seam=comparePath + gateEditedPaths via finish; + // no_claim=a same-count literal swap, which gateEditedPaths already sends to the scoped reader (literalOnly) + test('a resolution that drops, invents or changes anything is changed, and an invented entry or a new check still stops', () => { + const changed = (resolved: string) => { const x = listMerge(resolved); expect(comparePath(x.f.work, sidesOf(x.f, x.reviewed, x.reviewedBase), LIST)).toBe('changed'); return x; }; + changed(methods(['ghome.prep', 'ghome.talk.target', 'ghome.brief'])); + changed(methods([...BASE_METHODS, 'ghome.brief'])); + changed(methods([...BASE_METHODS, 'ghome.brief', 'ghome.talk.target'])); + for (const resolved of [methods([...BASE_METHODS, 'ghome.talk.target', 'ghome.brief', 'ghome.admin']), methods([...BASE_METHODS, 'ghome.talk.target', 'ghome.brief'], 'expect(METHODS.length).toBeGreaterThan(0)')]) { + const { f, reviewed, reviewedBase, post } = changed(resolved); + const r = finish(f, reviewed, post, reviewedBase); + expect(r.status).toBe(3); + expect(r.stdout).toContain(`behavior, tests or build inputs changed since review (${LIST})`); + } + }); +});