/gstack-ship honours ruled edits after the final review and records second-model stops (GST-3814) (#4829)

/gstack-ship no longer asks for every reviewer again after an edit the
owner already ruled a note, and a stop on a second-model reviewer's
blocker now records instead of failing with STOP_UNBOUND.

Why: both forced hand-written workarounds after the final review (#4819,
yc-software/qm#3973, gskills#45 and #46).

Nothing to do: the fixes apply on the next /gstack-ship run.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p2/outside-voice#1 reader=outside-voice
Review-Finding: p2/outside-voice#2 reader=outside-voice
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-25 16:21:05 +00:00
1 parent ec5d7e6fbd
commit 7eba5caf6f
23 files changed
+201 -104

No files matched your search

+4 -2
View File
@@ -40,7 +40,7 @@ const finish = (tail) => {
const stop = (why) => finish(['STOP: ' + why]);
const logStart = input.stage === 'voices' ? (input.logStart ?? ['adversarial-review']) : (input.logStart || []);
if (!Array.isArray(logStart) || !logStart.every((s) => typeof s === 'string' && s.trim())) return stop('input.logStart must be a list of review-log start skills (strings), got ' + JSON.stringify(input.logStart) + '; nothing ran');
if (input.stage === 'voices' && !(logStart.length && logStart.every((s) => s.split(' ')[0] === 'adversarial-review'))) return stop('Step 11 (stage "voices") takes the adversarial-review start token, which Step 11.5 binds, so its logStart is ["adversarial-review"] (with any --reservation in input.reservation) or omitted, never ' + JSON.stringify(input.logStart) + '; nothing ran');
if (input.stage === 'voices' && !(logStart.length && logStart.every((s) => s.split(' ')[0] === 'adversarial-review'))) return stop('Step 11 (stage "voices") takes the adversarial-review start token, which Step 11.5 binds, so its logStart is omitted (one adversarial-review start per voice row it logs: the native adversarial and the second-model reader each log their own row) or lists only adversarial-review (with any --reservation in input.reservation), never ' + JSON.stringify(input.logStart) + '; nothing ran');
const runDir = input.out.replace(/\/+$/, '').replace(/\/[^/]+$/, '');
const nextPhase = input.stage === 'voices' ? 5 : input.step === '14.5' ? 7 : 4;
const withParts = async (tail) => {
@@ -196,7 +196,9 @@ try {
if (heldBase !== 'none' && startTop !== want) return stop('readers on the shared machine start in ' + startTop + ', not in ' + want + ', the checkout this pass ships, and ' + startTop + ' also holds its diff base ' + heldBase + '; a reader that ran a brief command without its cd would review that checkout\'s diff with no error, so no start token was taken and no reader was dispatched. Start /ship in the shipped checkout: run it from a thread whose working directory is ' + want + ', or one whose working directory holds no checkout of this history');
if (reach.exit_code !== 0 || got !== want) return stop('readers on the shared machine cannot reach ' + want + ', the checkout this pass ships: ' + got.slice(-300) + '; no start token was taken and no reader was dispatched. Each brief tells its reader to cd there before anything else, so that path must be readable from the directory readers start in');
}
const starts = input.stage !== 'voices' && m.next === 'fix-check' ? logStart.map((s) => (s.split(' ')[0] === 'review' ? 'review-fix-check' + s.slice(6) : s)) : logStart;
const starts = input.stage !== 'voices' && m.next === 'fix-check' ? logStart.map((s) => (s.split(' ')[0] === 'review' ? 'review-fix-check' + s.slice(6) : s)) : [...logStart];
const voiceRows = input.stage === 'voices' ? m.readers.filter((r) => r.stage === 'voices' && !r.retry_of && (r.role === 'adversarial-native' || r.role === 'outside-voice')).length : 0;
while (starts.length < voiceRows) starts.push(starts[0]);
const seen = {};
for (const s of starts) {
const nth = (seen[s] = (seen[s] || 0) + 1);
+7 -20
View File
@@ -4,8 +4,8 @@
* Each class has one deterministic test here; anything that fails it, and any stop outside the four,
* still stops for the owner.
*
* - scoped-fix-check: one scoped fix-check past R51's two-round cap when the round-2 fix is docs-only
* (docs class, lib/review-depth.ts classifyPath) or timeout-only. One per branch.
* - scoped-fix-check: removed with fix-check grants (GST-3562 part 4); refused, so a stop after round 2 goes to the lane's
* Captain. The class stays in NO_STOP_CLASSES so receipts written before still validate.
* - test-timeout-fix: a fix whose every changed line, all in test files, only raises a timeout value.
* - pregate-flake-rerun: one rerun of a failed pregate case at the same tree (CREW rule 16). One per branch.
* - autoplan-regate: a later autoplan gate revision whose plan-file edit only adds ELI5 lines that name no
@@ -19,7 +19,6 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import { branchKey } from './approval-record';
import { NO_STOP_CLASSES, type NoStopClass } from './headless-artifacts';
import { classifyPath } from './review-depth';
export interface NoStopRecord { class: NoStopClass; reason: string; evidence: string }
export type NoStopVerdict = { ok: true; record: NoStopRecord; detail: string } | { ok: false; reason: string };
@@ -82,13 +81,6 @@ export function notTimeoutOnly(files: FileDiff[]): string | null {
return null;
}
/** Why the paths are not docs-only, or null: each is docs class as /ship's review classifies it (agent-read and skill prose is not). */
export function notDocsOnly(paths: string[], root: string): string | null {
if (!paths.length) return 'the fix changes nothing';
const code = paths.filter(p => classifyPath(p, root) !== 'docs');
return code.length ? `not docs: ${code.slice(0, 3).join(', ')}` : null;
}
const HEADING = /^#{1,6}\s+(.*)$/;
const ELI5 = /^eli5\b/i;
@@ -123,20 +115,15 @@ export function checkNoStop(i: NoStopInput): NoStopVerdict {
const cls = i.cls as NoStopClass;
if (!i.reason.trim() || !i.evidence.trim()) return { ok: false, reason: 'a no-stop record needs a reason and evidence that resolves (run id, commit or file)' };
const record = { class: cls, reason: i.reason.trim(), evidence: i.evidence.trim() };
if ((cls === 'scoped-fix-check' || cls === 'pregate-flake-rerun') && i.prior.some(r => r.class === cls)) return { ok: false, reason: `one ${cls} per branch is recorded already; a second goes to the owner` };
if (cls === 'scoped-fix-check') return { ok: false, reason: "scoped-fix-check was removed with fix-check grants (GST-3562 part 4): a stop after round 2 goes to the lane's Captain, who ships it with notes or parks it" };
if (cls === 'pregate-flake-rerun' && i.prior.some(r => r.class === cls)) return { ok: false, reason: `one ${cls} per branch is recorded already; a second goes to the owner` };
if (cls === 'pregate-flake-rerun') return { ok: true, record, detail: 'one rerun at the same tree (rule 16): green is flaky, red again is real' };
if (cls === 'autoplan-regate') return { ok: false, reason: 'gstack-autoplan decides re-gates at the gate (lib/autoplan-carry.ts), never by hand' };
const files = parseDiff(i.diff ?? '');
const where = files.map(f => f.path).join(', ');
const outside = files.filter(f => !TEST_PATH.test(f.path)).map(f => f.path);
if (outside.length) return { ok: false, reason: `not a test file: ${outside.slice(0, 3).join(', ')}` };
const timeout = notTimeoutOnly(files);
if (cls === 'test-timeout-fix') {
const outside = files.filter(f => !TEST_PATH.test(f.path)).map(f => f.path);
if (outside.length) return { ok: false, reason: `not a test file: ${outside.slice(0, 3).join(', ')}` };
return timeout ? { ok: false, reason: timeout } : { ok: true, record, detail: `timeout raised in ${where}` };
}
if (!timeout) return { ok: true, record, detail: `timeout-only fix in ${where}` };
const docs = notDocsOnly(files.map(f => f.path), i.root ?? process.cwd());
return docs ? { ok: false, reason: `the fix is neither docs-only (${docs}) nor timeout-only (${timeout})` } : { ok: true, record, detail: `docs-only fix in ${where}` };
return timeout ? { ok: false, reason: timeout } : { ok: true, record, detail: `timeout raised in ${files.map(f => f.path).join(', ')}` };
}
/** The branch's ledger under the checkout's git dir, or null outside a git checkout. */
+6 -6
View File
@@ -190,7 +190,7 @@ export const RELEASE_RESULT_CODES = {
SHIP_BASE_RED_FIXER: {
anchor: 'ship-base-red-fixer',
summary: 'ready --base-red names no fixer PR, or the receipt\'s base-red condition no longer matches the base: a conditional READY needs an owner for its condition and a current classification',
fix: 'pass --fixer <pr> naming the open PR whose merge fixes the cases; when the base moved, rerun gstack-base-red classify (and /ship) first',
fix: 'pass --fixer <pr> naming the open PR whose merge fixes the cases; when the base moved, rerun gstack-base-red classify (and /gstack-ship) first',
},
QUEUE_TRAIN_FROZEN: {
anchor: 'queue-train-frozen',
@@ -443,12 +443,12 @@ export const RELEASE_RESULT_CODES = {
RECEIPT_CARRY_PRODUCT_CHANGED: {
anchor: 'receipt-carry-product-changed',
summary: 'the product diff against the base changed between the receipt\'s head and HEAD (a product file differs beyond a base merge, a test-only fix, release metadata or a regenerated output), so the reviewed verdict does not cover HEAD',
fix: 'run /gstack-ship on the new head; the receipt carries only when every changed path is a test, release metadata, a registered output the pregate regen check proved, or the base merge, and the product patch-id is unchanged; base context next to unchanged reviewed hunks carries as the base merge, and a hunk the base merge spliced is RECEIPT_CARRY_SCOPED_REVIEW instead (one scoped reader, no /ship)',
fix: 'run /gstack-ship on the new head; the receipt carries only when every changed path is a test, release metadata, a registered output the pregate regen check proved, or the base merge, and the product patch-id is unchanged; base context next to unchanged reviewed hunks carries as the base merge, and a hunk the base merge spliced is RECEIPT_CARRY_SCOPED_REVIEW instead (one scoped reader, no /gstack-ship)',
},
STOP_UNBOUND: {
anchor: 'stop-unbound',
summary: 'gstack-ship-receipt stop found no review of this run bound to one committed tree, so it recorded no stop record',
fix: 'the lane or its Captain ships with the open notes listed or parks; a fresh /ship run gives the head its review',
fix: 'the lane or its Captain ships with the open notes listed or parks; a fresh /gstack-ship run gives the head its review',
},
GRANT_SPENT: {
anchor: 'grant-spent',
@@ -463,7 +463,7 @@ export const RELEASE_RESULT_CODES = {
SHIP_RUN_RECORD_UNREADABLE: {
anchor: 'ship-run-record-unreadable',
summary: 'this checkout\'s /ship run record (git dir gstack-ship-run) is neither a run record nor a run id, so every guard reads it as an open run',
fix: 'if no /ship run is working on this checkout, end it with the gstack-ship-run abandon --run unknown --sha256 <digest> command status prints, once',
fix: 'if no /gstack-ship run is working on this checkout, end it with the gstack-ship-run abandon --run unknown --sha256 <digest> command status prints, once',
},
GRANT_UNKNOWN: {
anchor: 'grant-unknown',
@@ -473,7 +473,7 @@ export const RELEASE_RESULT_CODES = {
RECEIPT_CARRY_SCOPED_REVIEW: {
anchor: 'receipt-carry-scoped-review',
summary: 'the base replaced the very lines one of the branch\'s hunks replaces and the merge kept both (GST-2975), so the branch\'s own lines are not the reviewed bytes; the receipt carries only after a scoped review of those hunks',
fix: 'dispatch one fix-check reviewer on the packet the refusal names, write its clean verdict as { head, paths, reviewer, verdict } and rerun carry with --scoped-review <record.json>; a blocking finding means /gstack-ship on the new head',
fix: 'dispatch one scoped reader (not a review round) on the packet the refusal names, write its clean verdict as { head, paths, reviewer, verdict } and rerun carry with --scoped-review <record.json>; a blocking finding means /gstack-ship on the new head',
},
RECEIPT_DOCS_AUDIT_READ: {
anchor: 'receipt-docs-audit-read',
@@ -540,7 +540,7 @@ export const RELEASE_RESULT_CODES = {
QUEUE_LAND_DRIFT: {
anchor: 'queue-land-drift',
summary: 'the base branch moved between the merge step\'s last check and the squash merge, so main\'s tree is not the stamped tree land verified',
fix: 'gstack-ship-queue land --pr <n> --repair opens a PR whose only change is a fragment for what the outside merge brought; /ship and land it, which releases the lock',
fix: 'gstack-ship-queue land --pr <n> --repair opens a PR whose only change is a fragment for what the outside merge brought; /gstack-ship and land it, which releases the lock',
},
QUEUE_LAND_BASE_BUSY: {
anchor: 'queue-land-base-busy',
+2 -2
View File
@@ -451,7 +451,7 @@ function prCapped(h: History, n: NextStep): NextStep {
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 keep the fix and run /ship again for one more read-only full review of the final head), 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 /gstack-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;
@@ -463,7 +463,7 @@ function prCapped(h: History, n: NextStep): NextStep {
}
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";
const CAPTAIN_DECIDES = "the lane's Captain decides (R51): ship with it as a ruled note, or keep the fix and run /gstack-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
+36
View File
@@ -8,6 +8,7 @@
import { locate, readRecord, type ApprovalRow, type Env } from './approval-record';
import { isSecurityFinding, REDACTED_FINDING, REDACTED_REASON } from './security-findings';
import { openRun, readRunRecord } from './ship-run-record';
import { spawnSync } from './spawn-sync';
export interface RuledNote { finding: string; head: string; by: string; reason: string; at: string; approval: string; relayed?: string; not_security?: true }
@@ -75,3 +76,38 @@ export const ruledNoteText = (note: RuledNote) => { const n = publicRuledNote(no
* beat_age and abandon command; none once the run finished or was abandoned (lib/ship-run-record.ts).
*/
export const openShipRun = (cwd: string) => openRun(readRunRecord(cwd));
/** Finish's and the plan's line for a ruled path: `RULED_EDIT: <path> (ruled at <head12> by <who>, approval <id>)`. */
export const ruledEditLine = (p: string, n: RuledNote) => `RULED_EDIT: ${p} (ruled at ${n.head.slice(0, 12)} by ${n.by}, approval ${n.approval})`;
/**
* Which of `paths` an owner's `edit:<path>` ruling clears at `now` (a commit or tree; docs/ship-policy.md#ruled-edits): the ruling
* names HEAD or an ancestor of it, both trees hold the path as one file under exactly this spelling with the same mode and bytes,
* and no first-parent commit after the ruled head touches it. finish routes the cleared paths as RULED_EDIT and gstack-review-plan
* leaves them out of the fix range (GST-3814), so both read a ruling the same way; `refused` names each ruled path that did not
* clear, with why.
*/
export function ruledEdits(cwd: string, paths: readonly string[], now: string, edits: readonly RuledNote[]): { ruled: Map<string, RuledNote>; refused: string[] } {
const git = (dir: string, args: string[]) => { const r = spawnSync('git', args, { cwd: dir, encoding: 'utf8', timeout: 120_000, maxBuffer: 64 * 1024 * 1024 }); return { status: r.status, stdout: String(r.stdout ?? '') }; };
const ancestor = (a: string, d: string) => git(cwd, ['merge-base', '--is-ancestor', a, d]).status === 0;
const top = edits.length ? git(cwd, ['rev-parse', '--show-toplevel']).stdout.trim() : '';
const entry = (tree: string, p: string) => { const ls = git(cwd, ['--literal-pathspecs', 'ls-tree', '-z', '--full-tree', tree, '--', p]); const rows = ls.stdout.split('\0').filter(Boolean);
return ls.status !== 0 || rows.length > 1 || rows.some(e => e.slice(e.indexOf('\t') + 1) !== p) ? null : rows[0] ?? ''; };
const untouched = (head: string, p: string) => { const log = git(top, ['--literal-pathspecs', 'log', '--first-parent', '--format=%H', `${head}..HEAD`, '--', p]); return log.status === 0 && !log.stdout.trim(); };
const refusal = (n: RuledNote, p: string) => {
if (!ancestor(n.head, 'HEAD')) return `ruled at ${n.head.slice(0, 12)}, which is not HEAD or an ancestor of it`;
const [at, cur] = [entry(n.head, p), entry(now, p)], where = (e: string | null) => e === at ? n.head.slice(0, 12) : 'the tree finish routes';
if (at === null || cur === null) return `git ls-tree could not read it at ${where(null)}`;
if (!at || !cur) return `no file at ${where('')}: a ruling covers a file git holds under this spelling, never a deletion`;
if (p.includes('\uFFFD')) return 'its spelling holds a replacement character (U+FFFD), so the file git changed may have another name';
if (at !== cur) return `its mode or bytes differ from the ruled head ${n.head.slice(0, 12)}`;
return top && untouched(n.head, p) ? '' : `a commit after ${n.head.slice(0, 12)} touches it, or git could not list them`;
};
const ruled = new Map<string, RuledNote>(), refused: string[] = [];
for (const p of paths) {
const why = edits.filter(n => n.finding === `edit:${p}`).map(n => [n, refusal(n, p)] as const);
const ok = why.filter(([, w]) => !w).at(-1);
if (ok) ruled.set(p, ok[0]); else if (why.length) refused.push(`${p} (${why.at(-1)![1]}; keep the edit and run /gstack-ship again, docs/ship-policy.md#ruled-edits)`);
}
return { ruled, refused };
}
+1 -1
View File
@@ -122,7 +122,7 @@ function integrate(cwd: string, base: string, run: string | undefined, r: Report
return false;
}
if (line === 'CARRY: refused (RECEIPT_CARRY_SCOPED_REVIEW)') {
r.next(`carry route (Step 1.4): the base edited context next to reviewed hunks: fix what the base merge broke (CHANGELOG, size caps), commit and push; then gstack-ship-receipt carry --pr ${n} --base ${base} writes the packet for that head; one fix-check reviewer reads it; gstack-pregate --allow-repo-commands, then carry again with --scoped-review <record.json> --pregate .gstack/tmp/pregate.json; a blocking finding runs Steps 2-16`);
r.next(`carry route (Step 1.4): the base edited context next to reviewed hunks: fix what the base merge broke (CHANGELOG, size caps), commit and push; then gstack-ship-receipt carry --pr ${n} --base ${base} writes the packet for that head; one scoped reader (not a review round) reads it; gstack-pregate --allow-repo-commands, then carry again with --scoped-review <record.json> --pregate .gstack/tmp/pregate.json; a blocking finding runs Steps 2-16`);
return false;
}
} else r.add('PR: none open');
+3 -22
View File
@@ -22,7 +22,7 @@ import { mechanicalPaths, writeMechanicalRecord } from './ship-mechanical';
import { uidSidecars } from './ship-sidecar';
import type { MechanicalConstant } from './ship-policy-mechanical';
import { forbidSpecs } from './review-fetch';
import { readRuledNotes, ruledNoteText } from './ruled-notes';
import { readRuledNotes, ruledEditLine, ruledEdits, ruledNoteText } from './ruled-notes';
import { dispositionedOn, gateDispositionText, readGateDispositions } from './gate-dispositions';
import { parseReceiptDocs, type ReceiptDocs } from './ship-receipt-docs';
import { redactFindingSpans } from './redact-engine';
@@ -299,33 +299,14 @@ function route(cwd: string, base: string, reviewed: string, reviewedBase: Review
for (const k of ['context', 'tests', 'bounded'] as const) by[k] = by[k].filter(p => !packetBody.over.includes(p));
}
printRulings(cwd, r);
const ancestor = (a: string, d: string) => git(cwd, ['merge-base', '--is-ancestor', a, d]).status === 0;
const edits = readRuledNotes(cwd).filter(n => n.finding.startsWith('edit:'));
const top = edits.length ? git(cwd, ['rev-parse', '--show-toplevel']).stdout.trim() : '';
const entry = (tree: string, p: string) => { const ls = git(cwd, ['--literal-pathspecs', 'ls-tree', '-z', '--full-tree', tree, '--', p]); const rows = ls.stdout.split('\0').filter(Boolean);
return ls.status !== 0 || rows.length > 1 || rows.some(e => e.slice(e.indexOf('\t') + 1) !== p) ? null : rows[0] ?? ''; };
const untouched = (head: string, p: string) => { const log = git(top, ['--literal-pathspecs', 'log', '--first-parent', '--format=%H', `${head}..HEAD`, '--', p]); return log.status === 0 && !log.stdout.trim(); };
const refusal = (n: (typeof edits)[number], p: string) => {
if (!ancestor(n.head, 'HEAD')) return `ruled at ${n.head.slice(0, 12)}, which is not HEAD or an ancestor of it`;
const [at, cur] = [entry(n.head, p), entry(now, p)], where = (e: string | null) => e === at ? n.head.slice(0, 12) : 'the tree finish routes';
if (at === null || cur === null) return `git ls-tree could not read it at ${where(null)}`;
if (!at || !cur) return `no file at ${where('')}: a ruling covers a file git holds under this spelling, never a deletion`;
if (p.includes('\uFFFD')) return 'its spelling holds a replacement character (U+FFFD), so the file git changed may have another name';
if (at !== cur) return `its mode or bytes differ from the ruled head ${n.head.slice(0, 12)}`;
return top && untouched(n.head, p) ? '' : `a commit after ${n.head.slice(0, 12)} touches it, or git could not list them`;
};
const ruled = new Map<string, (typeof edits)[number]>(), refusedEdits: string[] = [];
for (const p of by.behavior) {
const why = edits.filter(n => n.finding === `edit:${p}`).map(n => [n, refusal(n, p)] as const);
const ok = why.filter(([, w]) => !w).at(-1);
if (ok) ruled.set(p, ok[0]); else if (why.length) refusedEdits.push(`${p} (${why.at(-1)![1]}; keep the edit and run /ship again, docs/ship-policy.md#ruled-edits)`);
}
const { ruled, refused: refusedEdits } = ruledEdits(cwd, by.behavior, now, edits);
by.behavior = by.behavior.filter(p => !ruled.has(p));
const uid = uidSidecars(cwd, { sides, candidates: parent ? [] : by.behavior, excluded: opts.excluded });
by.sidecar = Object.keys(uid.proven).sort();
by.behavior = by.behavior.filter(p => !by.sidecar.includes(p));
r.add(`ROUTE: reviewed=${reviewed.slice(0, 12)} current=${now.slice(0, 12)} behavior=${by.behavior.length} docs=${by.docs.length} metadata=${by.metadata.length} tests=${by.tests.length} base=${sides ? by.base.length : 'unknown'} context=${by.context.length}${by.bounded.length ? ` bounded=${by.bounded.length}` : ''}${by.mechanical.length ? ` mechanical=${by.mechanical.length}` : ''}${by.sidecar.length ? ` sidecar=${by.sidecar.length}` : ''}`);
for (const [p, n] of ruled) r.add(`RULED_EDIT: ${p} (ruled at ${n.head.slice(0, 12)} by ${n.by}, approval ${n.approval})`);
for (const [p, n] of ruled) r.add(ruledEditLine(p, n));
for (const x of refusedEdits) r.add(`RULED_EDIT_REFUSED: ${x}`);
for (const n of edits) r.add(`RULED_NOTE: ${ruledNoteText(n)}${[...ruled.values()].includes(n) ? '' : ' (no RULED_EDIT at this head; not applied)'}`);
for (const x of bounded.refused) if (by.behavior.includes(x.path)) r.add(`ROUTE_BOUNDED_REFUSED: ${x.path} ${x.reason} (fix: ${x.fix}; docs/troubleshooting.md#route-bounded-refused)`);