diff --git a/bin/gstack-docs-candidate b/bin/gstack-docs-candidate index a1a605932..332ba377a 100755 --- a/bin/gstack-docs-candidate +++ b/bin/gstack-docs-candidate @@ -5,7 +5,7 @@ * Usage (run inside the repository): * gstack-docs-candidate snapshot --out --audit-id --mode edit|read-only * --base [--select ]... [--docs [,...]]... [--exception ] - * [--run ] [--pre [--carry ]] + * [--run ] [--pre [--carry ] [--carry-stopped ]] * gstack-docs-candidate compare * gstack-docs-candidate attempt --state * gstack-docs-candidate result --audit-id --out-dir [--repair-of ] @@ -35,7 +35,10 @@ * snapshot> (with --pre and --run) saves that audit and the ones it carried as * `earlier`, so receipt write resets every file this run's audits edited * (GST-1616); a snapshot of another run, one without `edited`, or one whose - * HEAD is not an ancestor of HEAD is refused. + * HEAD is not an ancestor of HEAD is refused. --carry-stopped , at + * this audit's HEAD, adds that audit with its edits read as what changed + * between the two Prepare snapshots (GST-3502). * * compare re-reads the same state and prints one JSON object: whether HEAD or * the index changed, which recorded paths' content changed or disappeared, and @@ -68,7 +71,7 @@ import { baseContainsHead } from '../lib/default-base'; import { baseArg } from '../lib/gate-diff/git'; import { resultLine } from '../lib/result-codes'; import { checkDocsRepair, checkDocsResult, docsRepairPrompt, docsRetryNote, type DocsResultCheck } from '../lib/ship-docs-result'; -import { parseReceiptDocs, type ReceiptDocs } from '../lib/ship-receipt-docs'; +import { parseReceiptDocs, sameRun, type ReceiptDocs } from '../lib/ship-receipt-docs'; function git(args: string[]): string { const r = spawnSync('git', args, { encoding: 'utf8', env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' }, maxBuffer: 256 * 1024 * 1024 }); @@ -149,7 +152,7 @@ function one(args: string[], name: string): string { return values[0]!; } -const USAGE = `usage: gstack-docs-candidate snapshot --out --audit-id --mode edit|read-only --base [--select ]... [--docs [,...]]... [--exception ] [--run ] [--pre [--carry ]] +const USAGE = `usage: gstack-docs-candidate snapshot --out --audit-id --mode edit|read-only --base [--select ]... [--docs [,...]]... [--exception ] [--run ] [--pre [--carry ] [--carry-stopped ]] gstack-docs-candidate compare gstack-docs-candidate attempt --state gstack-docs-candidate result --audit-id --out-dir [--repair-of ] @@ -190,7 +193,7 @@ type Edited = Record; /** The post snapshot's own audit: each path whose content differs from this audit's Prepare snapshot, before (its Prepare hash, else HEAD's blob) and after. */ function auditEdits(pre: Record, file: string, post: { audit_id: string; run_id?: string; head: string; hashes: Record }): { edited: Edited } { - if (pre.audit_id !== post.audit_id || pre.head !== post.head || pre.run_id !== post.run_id) throw new Error(`--pre ${file} is not this audit's Prepare snapshot (its audit id, HEAD or run differs)`); + if (pre.audit_id !== post.audit_id || pre.head !== post.head || !sameRun(pre.run_id, post.run_id)) throw new Error(`--pre ${file} is not this audit's Prepare snapshot (its audit id, HEAD or run differs)`); const paths = [...new Set([...Object.keys(pre.hashes), ...Object.keys(post.hashes)])].sort(); const now = hashes(paths.filter(p => !(p in post.hashes))); const blob = (p: string) => spawnSync('git', ['rev-parse', '--verify', '--quiet', `${pre.head}:${p}`], { encoding: 'utf8', timeout: 60_000 }).stdout?.trim() || null; @@ -205,13 +208,25 @@ function auditEdits(pre: Record, file: string, post: { audit_id: st /** An earlier audit of this run and the audits it carried, oldest first; refuses another run's snapshot, one without `edited` and one whose HEAD is not an ancestor of HEAD. */ function carried(prior: Record, file: string, post: { audit_id: string; run_id?: string; head: string }): Array<{ run_id: string; audit_id: string; head: string; edited: Edited }> { - if (prior.run_id !== post.run_id) throw new Error(`--carry ${file} is audit ${prior.audit_id} of another /ship run (${prior.run_id ?? 'no --run'}), not ${post.run_id}: a post snapshot carries only this run's earlier audits`); + if (!sameRun(prior.run_id, post.run_id)) throw new Error(`--carry ${file} is audit ${prior.audit_id} of another /ship run (${prior.run_id ?? 'no --run'}), not ${post.run_id}: a post snapshot carries only this run's earlier audits`); if (!prior.edited || typeof prior.edited !== 'object' || Array.isArray(prior.edited)) throw new Error(`--carry ${file} names no edited files: take each post snapshot with --pre `); if (prior.audit_id === post.audit_id) throw new Error(`--carry ${file} is this audit (${post.audit_id}), not an earlier one`); if (spawnSync('git', ['merge-base', '--is-ancestor', String(prior.head), post.head], { timeout: 60_000 }).status !== 0) throw new Error(`--carry ${file}: its HEAD ${String(prior.head).slice(0, 12)} is not an ancestor of HEAD`); return [...(Array.isArray(prior.earlier) ? prior.earlier : []), { run_id: prior.run_id, audit_id: prior.audit_id, head: prior.head, edited: prior.edited }]; } +/** + * An audit of this run that stopped (blocked) before its post snapshot (GST-3502), from its Prepare snapshot: its edits are what changed + * between that snapshot and this re-audit's Prepare snapshot at the same HEAD, so receipt write resets them like a carried audit's. + */ +function stoppedAudit(prepare: Record, file: string, post: { audit_id: string; run_id?: string; head: string }, pre: Record): { run_id: string; audit_id: string; head: string; edited: Edited } { + if (!sameRun(prepare.run_id, post.run_id)) throw new Error(`--carry-stopped ${file} is audit ${prepare.audit_id} of another /ship run (${prepare.run_id ?? 'no --run'}), not ${post.run_id}`); + if (prepare.audit_id === post.audit_id) throw new Error(`--carry-stopped ${file} is this audit (${post.audit_id}), not an earlier one`); + if (prepare.edited !== undefined || prepare.earlier !== undefined) throw new Error(`--carry-stopped ${file} is a post snapshot: carry it with --carry`); + if (prepare.head !== pre.head) throw new Error(`--carry-stopped ${file} was taken at HEAD ${String(prepare.head).slice(0, 12)}, not this audit's HEAD ${String(pre.head).slice(0, 12)}: a stopped audit is carried only at the HEAD the re-audit read`); + return { run_id: prepare.run_id, audit_id: prepare.audit_id, head: prepare.head, edited: auditEdits({ ...prepare, audit_id: post.audit_id, run_id: post.run_id }, file, { ...post, hashes: pre.hashes }).edited }; +} + /** Each field compare needs that the record lacks or types wrongly; empty for a valid record. */ function recordProblems(record: any): string[] { if (!record || typeof record !== 'object' || Array.isArray(record)) return ['not a JSON object']; @@ -231,7 +246,7 @@ function main(argv: string[]): void { return; } if (command === 'snapshot') { - const known = new Set(['--out', '--audit-id', '--mode', '--base', '--select', '--docs', '--exception', '--run', '--pre', '--carry']); + const known = new Set(['--out', '--audit-id', '--mode', '--base', '--select', '--docs', '--exception', '--run', '--pre', '--carry', '--carry-stopped']); for (let i = 0; i < args.length; i += 2) if (!known.has(args[i]!)) throw new Error(`unknown argument: ${args[i]}`); const out = path.resolve(one(args, '--out')); const top = fs.realpathSync(git(['rev-parse', '--show-toplevel']).trim()); @@ -243,7 +258,7 @@ function main(argv: string[]): void { if (self) throw new Error(resultLine('snapshot', 'BASE_CONTAINS_HEAD', self)); const exceptionFile = flag(args, '--exception')[0]; const exception = exceptionFile === undefined ? undefined : acceptedException(exceptionFile); - const [preFile, carryFile] = ['--pre', '--carry'].map(name => { const v = optional(args, name); return v === undefined ? undefined : path.resolve(v); }); + const [preFile, carryFile, stoppedFile] = ['--pre', '--carry', '--carry-stopped'].map(name => { const v = optional(args, name); return v === undefined ? undefined : path.resolve(v); }); process.chdir(top); const now = state(base); const listed = nul(git(['ls-files', '-z', '--cached', '--others', '--exclude-standard'])); @@ -255,8 +270,10 @@ function main(argv: string[]): void { const run = optional(args, '--run'); const record = { schema_version: 1, audit_id: auditId, ...(run === undefined ? {} : { run_id: run }), mode, base, ...now, selected, docs, hashes: hashes(tracked), ...(exception ? { exception } : {}) }; if (carryFile !== undefined && (preFile === undefined || run === undefined)) throw new Error('--carry needs --pre and --run: only a post snapshot of a named /ship run carries an earlier audit'); + if (stoppedFile !== undefined && (preFile === undefined || run === undefined)) throw new Error('--carry-stopped needs --pre and --run: only a post snapshot of a named /ship run carries a stopped audit'); const audit = preFile === undefined ? {} : auditEdits(readRecord(preFile, '--pre'), preFile, record); - const earlier = carryFile === undefined ? {} : { earlier: carried(readRecord(carryFile, '--carry'), carryFile, record) }; + const chain = [...(carryFile === undefined ? [] : carried(readRecord(carryFile, '--carry'), carryFile, record)), ...(stoppedFile === undefined ? [] : [stoppedAudit(readRecord(stoppedFile, '--carry-stopped'), stoppedFile, record, readRecord(preFile!, '--pre'))])]; + const earlier = carryFile === undefined && stoppedFile === undefined ? {} : { earlier: chain }; fs.writeFileSync(out, JSON.stringify({ ...record, ...audit, ...earlier }, null, 2) + '\n', { mode: 0o600 }); console.log(`CANDIDATE: ${out}`); console.log(`base=${base} head=${now.head} branch=${now.branch || '(detached)'} mode=${mode}`); diff --git a/changelog.d/docs-re-audit-keeps-stopped-audit-edits.md b/changelog.d/docs-re-audit-keeps-stopped-audit-edits.md new file mode 100644 index 000000000..edc9fdbc6 --- /dev/null +++ b/changelog.d/docs-re-audit-keeps-stopped-audit-edits.md @@ -0,0 +1 @@ +**/ship can write its receipt after a docs audit that stopped before saving its snapshot.** Before, when Step 14.5's first docs audit edited a docs file the review leaves out and then stopped as blocked, the re-audit's snapshot could not account for that edit, so `gstack-ship-receipt write` refused on `review_exclude` and no supported path led to a receipt (GST-3502). `gstack-docs-candidate snapshot --carry-stopped ` now carries the stopped audit's edits into the re-audit's snapshot, and two spellings of the same run record path now count as one run. diff --git a/lib/ship-receipt-depth.ts b/lib/ship-receipt-depth.ts index 65b32416f..a966dffff 100644 --- a/lib/ship-receipt-depth.ts +++ b/lib/ship-receipt-depth.ts @@ -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; export type ReviewLoopException = NonNullable; @@ -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 `); diff --git a/lib/ship-receipt-docs.ts b/lib/ship-receipt-docs.ts index 06f0cef7f..78aaf73fd 100644 --- a/lib/ship-receipt-docs.ts +++ b/lib/ship-receipt-docs.ts @@ -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 } @@ -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); } diff --git a/ship/sections/documentation.md b/ship/sections/documentation.md index 44be5357d..87edbed2a 100644 --- a/ship/sections/documentation.md +++ b/ship/sections/documentation.md @@ -135,7 +135,9 @@ auto-commit or push unexpected child commits. result is such a correction: end the remaining attempt's prompt with its `RETRY_NOTE:` text verbatim. Repeat Prepare using current inputs and a fresh id/snapshot, run the remaining - attempt, then validate it through Parent processing. + attempt, then validate it through Parent processing. When the stopped audit saved no post + snapshot, the re-audit's post snapshot adds `--carry-stopped ` + so receipt write resets the stopped audit's edits too. 3. Otherwise STOP before commit/publication and do not launch another child. AskUserQuestion: stop for repair (recommended), or ship with the specific named documentation risk. Only an actual user exception counts, never a default, diff --git a/ship/sections/documentation.md.tmpl b/ship/sections/documentation.md.tmpl index b22c0998d..9804b6447 100644 --- a/ship/sections/documentation.md.tmpl +++ b/ship/sections/documentation.md.tmpl @@ -133,7 +133,9 @@ auto-commit or push unexpected child commits. result is such a correction: end the remaining attempt's prompt with its `RETRY_NOTE:` text verbatim. Repeat Prepare using current inputs and a fresh id/snapshot, run the remaining - attempt, then validate it through Parent processing. + attempt, then validate it through Parent processing. When the stopped audit saved no post + snapshot, the re-audit's post snapshot adds `--carry-stopped ` + so receipt write resets the stopped audit's edits too. 3. Otherwise STOP before commit/publication and do not launch another child. AskUserQuestion: stop for repair (recommended), or ship with the specific named documentation risk. Only an actual user exception counts, never a default, diff --git a/test/review-exclude-stopped-audit.test.ts b/test/review-exclude-stopped-audit.test.ts new file mode 100644 index 000000000..216adff72 --- /dev/null +++ b/test/review-exclude-stopped-audit.test.ts @@ -0,0 +1,91 @@ +/** + * GST-3502 (GBRA-732, gbrain#10036 at 8e0159ab): Step 14.5's first docs audit edited an excluded docs file, then stopped as + * blocked, so it never saved a post snapshot; the re-audit passed and edited nothing. Its post snapshot could not carry the + * stopped audit (no `edited`, and the two run ids spelled the same record path two ways), so receipt write read the stopped + * audit's edit as content the reviewers had read and refused RECEIPT_INVALID on review_exclude. The re-audit's post snapshot now + * carries a stopped audit's Prepare snapshot (--carry-stopped): its edits are what changed between the two Prepare snapshots at the same HEAD. + */ +import { afterEach, describe, expect, test } from 'bun:test'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import { EXIT } from '../lib/headless-artifacts'; +import { REVIEW_EXCLUDE_KEY_VERSION } from '../lib/ship-policy'; +import { cleanup, commit, makeFixtureRepo, runBin, write, type FixtureRepo } from './helpers/pregate-fixture'; + +const repos: FixtureRepo[] = []; +afterEach(() => { while (repos.length) cleanup(repos.pop()!); }); +const policyText = (patterns: string[]) => JSON.stringify({ review_exclude_paths: patterns, min_gstack_version: REVIEW_EXCLUDE_KEY_VERSION }) + '\n'; +const BRANCH = { 'lib/reader.js': "exports.p = 'docs/parity.md';\n", 'docs/parity.md': '# parity\n' }; +const RUN_A1 = '/records/ship2/../ship2-record.md'; +const RUN_A2 = '/records/ship2-record.md'; + +/** Reviewed; audit a1 takes its Prepare snapshot, edits docs/key-files.md (so code now names lib/reader.js there) and stops; audit a2 takes its Prepare snapshot, edits nothing, and saves its post snapshot carrying `carry`; all of it is committed. */ +function stoppedThenReaudited(opts: { a1Run?: string; moveHead?: boolean; refusals?: boolean } = {}) { + const repo = makeFixtureRepo({ prefix: 'gst3502-', baseFiles: { '.gstack/ship-policy.json': policyText(['docs/**']), 'docs/key-files.md': '# key files\n', 'lib/index.js': "exports.k = 'docs/key-files.md';\n" } }); + repos.push(repo); + commit(repo, BRANCH); + const reviewed = JSON.parse(runBin(repo, 'gstack-review-plan', ['--base', 'main', '--gate-tagged', '0', '--json']).out).review_exclude.digest as string; + const base = repo.git('rev-parse', 'origin/main'); + const snapshot = (out: string, id: string, run: string, extra: string[] = []) => runBin(repo, 'gstack-docs-candidate', ['snapshot', '--out', out, '--audit-id', id, '--mode', 'edit', '--base', base, '--docs', 'docs', '--run', run, ...extra]); + const a1 = path.join(repo.root, 'docs-audit-1.json'); + expect(snapshot(a1, 'ship2-docs-1', opts.a1Run ?? RUN_A1).status).toBe(0); + write(repo.work, 'docs/key-files.md', '# key files\n- lib/reader.js: the parity guard\n'); + if (opts.moveHead) { write(repo.work, 'lib/extra.js', 'exports.x = 1;\n'); repo.git('add', 'lib/extra.js'); repo.git('commit', '-q', '-m', 'a commit between the audits'); } + const a2 = path.join(repo.root, 'docs-audit-2.json'); + expect(snapshot(a2, 'ship2-docs-2', RUN_A2).status).toBe(0); + const post = path.join(repo.root, 'ship2-docs-2-post.json'); + const carried = snapshot(post, 'ship2-docs-2', RUN_A2, ['--pre', a2, '--carry-stopped', a1]); + const plain = path.join(repo.root, 'ship2-docs-2-post-plain.json'); + expect(snapshot(plain, 'ship2-docs-2', RUN_A2, ['--pre', a2]).status).toBe(0); + const a1Post = path.join(repo.root, 'ship2-docs-1-post.json'); + const refused = !opts.refusals ? undefined : { + postAsStopped: (expect(snapshot(a1Post, 'ship2-docs-1', RUN_A1, ['--pre', a1]).status).toBe(0), snapshot(path.join(repo.root, 'refused-1.json'), 'ship2-docs-2', RUN_A2, ['--pre', a2, '--carry-stopped', a1Post])), + itself: snapshot(path.join(repo.root, 'refused-2.json'), 'ship2-docs-2', RUN_A2, ['--pre', a2, '--carry-stopped', a2]), + noPre: snapshot(path.join(repo.root, 'refused-3.json'), 'ship2-docs-2', RUN_A2, ['--carry-stopped', a1]), + written: () => ['refused-1.json', 'refused-2.json', 'refused-3.json'].filter(f => fs.existsSync(path.join(repo.root, f))), + }; + commit(repo, {}, 'docs audit'); + const body = path.join(repo.root, 'body.md'); + const writeWith = (postFile: string) => runBin(repo, 'gstack-ship-receipt', ['write', '--pr', '10036', '--base', 'main', '--version', '1.0.0', '--session-kind', 'unattended', '--body', body, + '--review-exclude', reviewed, '--docs-post', postFile, '--docs-pre', a2, + '--review-targeted', JSON.stringify({ classes: ['money', 'gate', 'auth', 'secret'], rules: 'r', brief_sha: 'a'.repeat(64), status: 'done', findings: 0, raised_by: 'targeted', head: repo.git('rev-parse', 'HEAD') })]); + return { carried, post, plain, writeWith, refused }; +} + +describe('a re-audit carries the docs audit that stopped before its post snapshot (GST-3502)', () => { + // Value: protects=a /ship run whose first docs audit stopped as blocked still gets its receipt after the re-audit passes + // (gbrain#10036 had no supported path); fails_when=a stopped audit needs its post snapshot to be carried, or the same record path + // spelled two ways reads as two runs; seam=gstack-docs-candidate snapshot --carry-stopped, then gstack-ship-receipt write; no_claim=gh + test('the gbrain#10036 shape: carrying the stopped audit\'s Prepare snapshot binds the reviewed selection', () => { + const s = stoppedThenReaudited(); + expect({ status: s.carried.status, err: s.carried.err }).toMatchObject({ status: 0 }); + expect(s.carried.out).toContain('earlier: ship2-docs-1'); + const before = s.writeWith(s.plain); + expect(before.status).toBe(EXIT.fail); + expect(before.err).toContain('field=review_exclude'); + const w = s.writeWith(s.post); + expect({ status: w.status, err: w.status === EXIT.ok ? '' : w.err }).toEqual({ status: EXIT.ok, err: '' }); + expect(w.err + w.out).toContain('REVIEW_EXCLUDE_DOCS_AUDIT:'); + }, 240_000); + + // Value: protects=only this run's stopped audit at the same HEAD is carried; fails_when=another run's or an older HEAD's + // Prepare snapshot is read as a stopped audit; seam=gstack-docs-candidate snapshot --carry-stopped; no_claim=- + test('a Prepare snapshot from another run, or at another HEAD, is still refused', () => { + const other = stoppedThenReaudited({ a1Run: '/records/another-run.md' }); + expect(other.carried.status).not.toBe(0); + expect(other.carried.err).toContain('another /ship run'); + const moved = stoppedThenReaudited({ moveHead: true }); + expect(moved.carried.status).not.toBe(0); + expect(moved.carried.err).toContain('HEAD'); + }, 240_000); + + // Value: protects=--carry-stopped takes only an earlier audit's Prepare snapshot of a named run; fails_when=the post-snapshot, + // same-audit or --pre/--run guard is dropped; seam=gstack-docs-candidate snapshot --carry-stopped; no_claim=- + test('a post snapshot, this audit\'s own Prepare snapshot, or a call without --pre is refused', () => { + const r = stoppedThenReaudited({ refusals: true }).refused!; + expect({ status: r.postAsStopped.status, err: r.postAsStopped.err }).toMatchObject({ status: 1, err: expect.stringContaining('is a post snapshot') }); + expect({ status: r.itself.status, err: r.itself.err }).toMatchObject({ status: 1, err: expect.stringContaining('is this audit') }); + expect({ status: r.noPre.status, err: r.noPre.err }).toMatchObject({ status: 1, err: expect.stringContaining('needs --pre and --run') }); + expect(r.written()).toEqual([]); + }, 240_000); +}); diff --git a/test/size-ledger/ship/docs-re-audit-keeps-stopped-audit-edits.json b/test/size-ledger/ship/docs-re-audit-keeps-stopped-audit-edits.json new file mode 100644 index 000000000..dc3d4d104 --- /dev/null +++ b/test/size-ledger/ship/docs-re-audit-keeps-stopped-audit-edits.json @@ -0,0 +1,4 @@ +{ + "bytes": 199, + "why": "Blocked docs recovery names --carry-stopped for an audit that stopped before saving its snapshot (GST-3502)" +}