/ship can finish after a docs audit stopped before saving its snapshot (GST-3502) (#4693)

/ship no longer gets stuck when its docs audit edits a left-out docs
file and then stops: the second audit can now include the first audit's
edits, so /ship can record its result and finish.

Why: a gbrain release was blocked with no supported way forward.

Nothing to do: `gstack-docs-candidate snapshot` gains one optional flag
for this case, and /ship's Blocked recovery step names it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 12:16:34 +00:00
1 parent 3d3ce73eb9
commit 25bf93c4e2
8 files changed
+136 -14

No files matched your search

+2 -2
View File
@@ -38,7 +38,7 @@ import { branchSides } from './stamp-only';
import { classifyFiles } from './tree-receipt';
import { mergeChangelogs } from './changelog-check';
import { bindReceipt, type ReceiptBindingCode } from './ship-receipt';
import { carriedAudits, docsExceptionLine, parseReceiptDocs, type CarriedAudit } from './ship-receipt-docs';
import { carriedAudits, docsExceptionLine, parseReceiptDocs, sameRun, type CarriedAudit } from './ship-receipt-docs';
export type ReceiptDepth = NonNullable<ShipReceipt['review_depth']>;
export type ReviewLoopException = NonNullable<ShipReceipt['review_loop_exception']>;
@@ -371,7 +371,7 @@ export function writeExcludeBinds(root: string, base: string, head: string, revi
if (typeof post === 'string') return no(post);
const pre = docsPre === undefined ? null : snapshot(docsPre);
if (typeof pre === 'string') return no(`--docs-pre ${docsPre} ${pre}`);
if (pre && (pre.head !== post.head || pre.audit_id !== post.audit_id || pre.run_id !== post.run_id)) return no(`--docs-pre ${docsPre} is not this audit's Prepare snapshot (its HEAD, audit_id or run_id differs)`);
if (pre && (pre.head !== post.head || pre.audit_id !== post.audit_id || !sameRun(pre.run_id, post.run_id))) return no(`--docs-pre ${docsPre} is not this audit's Prepare snapshot (its HEAD, audit_id or run_id differs)`);
const earlier = carriedAudits(post);
if (typeof earlier === 'string') return no(earlier);
if (earlier.length && !pre) return no(`it carries audit ${earlier.map(e => e.audit_id).join(',')}, so write needs --docs-pre <its Prepare snapshot>`);
+6 -1
View File
@@ -5,6 +5,8 @@
* (`docs.caps`, docs/ship-policy.md#ship-receipt). Kept beside
* lib/ship-receipt.ts so that module stays under the size ratchet.
*/
import * as path from 'node:path';
export const DOCS_STATUSES = ['updated', 'current', 'blocked'] as const;
export type DocsStatus = typeof DOCS_STATUSES[number];
/** Only the owner accepts a documentation risk; the record names who, when, where and why, and the PR body repeats it word for word. */
@@ -47,6 +49,9 @@ export function docsExceptionLine(docs: ReceiptDocs): string | null {
return `Documentation exception: accepted by ${e.accepted_by} ${e.date} via ${e.via}: ${e.reason}`;
}
/** Whether two snapshots name the same /ship run: its record's path, compared resolved, so `ship2/../ship2-record.md` is `ship2-record.md` (GST-3502). */
export const sameRun = (a: unknown, b: unknown): boolean => a === b || (typeof a === 'string' && typeof b === 'string' && path.resolve(a) === path.resolve(b));
/** One earlier Step 14.5 audit of the same /ship run that a post snapshot carries (gstack-docs-candidate snapshot --carry, GST-1616). */
export interface CarriedAudit { run_id: string; audit_id: string; head: string; edited: Record<string, { before: string | null; after: string | null }> }
@@ -61,7 +66,7 @@ export function carriedAudits(post: { run_id?: unknown; audit_id?: unknown; earl
const edited = e?.edited;
if (!e || typeof e !== 'object' || !text(e.audit_id) || !sha(e.head) || !edited || typeof edited !== 'object' || Array.isArray(edited)
|| !Object.values(edited).every((v: any) => v && typeof v === 'object' && (v.before === null || sha(v.before)) && (v.after === null || sha(v.after)))) return 'it carries an earlier audit that is not { run_id, audit_id, head, edited }';
if (e.run_id !== post.run_id) return `it carries audit ${e.audit_id} of another /ship run (${String(e.run_id)}), not ${post.run_id}`;
if (!sameRun(e.run_id, post.run_id)) return `it carries audit ${e.audit_id} of another /ship run (${String(e.run_id)}), not ${post.run_id}`;
if (seen.has(e.audit_id)) return `it carries audit ${e.audit_id} twice`;
seen.add(e.audit_id);
}