Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

Accept a requested docs fix when the audit names the file with a line number (#4437)

Garry Tan127bcd6d55c3
diff --git a/changelog.d/docs-requested-accepts-path-line-blockers.md b/changelog.d/docs-requested-accepts-path-line-blockers.md
new file mode 100644
index 000000000..cdee4b9d8
--- /dev/null
+++ b/changelog.d/docs-requested-accepts-path-line-blockers.md
@@ -0,0 +1 @@
+- **/ship's `finish --docs-requested` now accepts a docs fix when the audit named the file with a line number.** An audit that wrote `changelog.d/engine-parity-decisions.md:8: wording` or `...md:8:12 wording` in its blockers or decisions was refused with "is not named in the audit result's blockers or decisions", even though `...md: line 8` worked. The path may now be followed by `:<line>` or `:<line>:<column>`. A different file whose name starts with the same path still doesn't match.
diff --git a/lib/ship-release.ts b/lib/ship-release.ts
index 442d567ac..e0711fe1a 100644
--- a/lib/ship-release.ts
+++ b/lib/ship-release.ts
@@ -546,7 +546,7 @@ function docsFresh(cwd: string, base: string, postFile: string, moved: readonly
try { audit = resultFile ? JSON.parse(fs.readFileSync(resultFile, 'utf8')) : null; } catch { audit = null; }
for (const p of requested.filter(q => stale!.includes(q) && !carried.tests.includes(q) && !carried.base.includes(q) && !carried.accepted.includes(q))) {
const asked = [...(Array.isArray(audit?.blockers) ? audit.blockers : []), ...(Array.isArray(audit?.decisions) ? audit.decisions : [])].filter((s: unknown) => typeof s === 'string');
- const token = new RegExp(`(^|[\\s\`'"(\\[])${p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?=$|[\\s\`'")\\]]|[,.:;](?:$|\\s))`);
+ const token = new RegExp(`(^|[\\s\`'"(\\[])${p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?::\\d+(?::\\d+)?)?(?=$|[\\s\`'")\\]]|[,.:;](?:$|\\s))`);
const stat = git(cwd, ['diff', '--numstat', '--no-renames', record.head, '--', `:(literal)${p}`]).stdout.trim().split(/\s+/);
const lines = Number(stat[0]) + Number(stat[1]);
const why = !audit ? 'needs --docs-result <the audit\'s saved result JSON>'
diff --git a/test/ship-rereview-triggers.test.ts b/test/ship-rereview-triggers.test.ts
index e3116eb6d..6dc0b54cf 100644
--- a/test/ship-rereview-triggers.test.ts
+++ b/test/ship-rereview-triggers.test.ts
@@ -554,6 +554,28 @@ describe('test-only and audit-requested edits after the docs audit (GST-391, gbr
expect(big.stdout).toContain('STOP: --docs-requested docs/KEY_FILES.md');
});
+ // Value: protects=an audit that names the requested doc as path:line or path:line:column (FOUN-32 via Vorflux at 2af3822f)
+ // still backs the fix, while a different file sharing the path's prefix never does; fails_when=a correct requested fix stops
+ // on how the audit wrote the location, or a sibling file's note waves the fix through; seam=finish --docs-requested;
+ // no_claim=the audit child's wording
+ test.each([
+ ['path:line', 'docs/KEY_FILES.md:8: the src/b.ts entry is missing', true],
+ ['path:line:column', 'docs/KEY_FILES.md:8:12 the src/b.ts entry is missing', true],
+ ['path then "line"', 'docs/KEY_FILES.md: line 8 is missing the src/b.ts entry', true],
+ ['another file sharing the prefix', 'docs/KEY_FILES.md.tmpl:8: the src/b.ts entry is missing', false],
+ ])('--docs-requested matches the audit naming the doc as %s: %p', (_name, decision, named) => {
+ const index = Array.from({ length: 30 }, (_, i) => `- entry ${i}`).join('\n') + '\n';
+ const f = fx({ 'docs/KEY_FILES.md': index });
+ const reviewed = wtree(f);
+ const post = snapshot(f, ['docs']);
+ const result = path.join(f.root, 'a1-result.json');
+ fs.writeFileSync(result, JSON.stringify({ schema_version: 1, audit_id: 'a1', status: 'current', files_updated: [], files_reviewed: ['docs/KEY_FILES.md'], blockers: [], decisions: [decision], documentation_section: 'x' }));
+ f.write({ 'docs/KEY_FILES.md': index + '- src/b.ts: the b constant\n' }); f.commit('docs: index link');
+ const r = finish(f, reviewed, post, ['--reviewed-base', mergeBase(f), '--docs-rechecked', '--docs-requested', 'docs/KEY_FILES.md', '--docs-result', result]);
+ if (named) expect([r.status, lineOf(r.stdout, 'DOCS')]).toEqual([0, expect.stringContaining('requested=1')]);
+ else expect(r.stdout).toContain("STOP: --docs-requested docs/KEY_FILES.md is not named in the audit result's blockers or decisions");
+ });
+
// Value: protects=an audit launch the child's install check refused is not counted, once per invocation; a crashed child,
// a completed audit and output that only quotes a refusal are counted, and a second refusal stops; fails_when=the refusal
// burns the only retry (gbrain #8084) or refusals relaunch forever; seam=none; no_claim=the parent's launch