test(W7c): match document-release spawned-dispatch contract on meaning

W7c conversion (t04 F3; W7a run-in-background-guidance.test.ts:472,474, named
by the Eng W7c gate as anti-injection and VERSION invariants that stay as
case-insensitive meaning checks). The run_in_background flag pins, structural
scanner and inverted-phrasing ban are unchanged.

Removed assertion groups (invariant -> remaining protection):
- 'NEVER trigger it on their own' (caps literal): prompt/file/tool claims do
  not enable spawned mode (anti-injection) -> kept free: /claims never
  trigger it on their own/i in the generated skill and template.
- 'The NEVER-do invariants below do' (short form of a wrapped sentence that
  names the caps headings s10 rewrites): spawned auto-pick still never
  rewrites CHANGELOG or changes VERSION -> kept free: /skip any
  recommendation that rewrites CHANGELOG or changes VERSION/i
  (whitespace-normalized) in both files; gate E2E document-release.
- 'A spawned run must never change VERSION': same rule, now /i.

Mutation pass (scratch worktree; document-release skill, template and
release-body section, ship/sections/documentation.md): 7/7 as expected;
deleting the anti-injection clause, the CHANGELOG/VERSION carve-out, the
spawned VERSION line, the run_in_background flag or the dispatch heading
goes red; lowering NEVER and rewording 'NEVER-do invariants' stays green.
Log: .context/mutation-run-in-background-guidance.md.
This commit is contained in:
garrytan committed 2026-10-03 01:17:01 +00:00
1 parent 5b2bb3a1a5
commit 27dac76763
1 file changed
+8 -7
+8 -7
View File
@@ -459,25 +459,26 @@ describe('run_in_background guidance (#2440)', () => {
// class regressed twice via unpinned prose. Pin the document-release
// contract, the Step 8.4d spawned note, and the resolver-side Codex
// doc-review skip in both generated output and templates.
const CONTRACT_PINS: Array<[string[], string]> = [
const CONTRACT_PINS: Array<[string[], string | RegExp]> = [
[['document-release/SKILL.md', 'document-release/SKILL.md.tmpl'], 'When dispatched as a subagent'],
[
['document-release/sections/release-body.md', 'document-release/sections/release-body.md.tmpl'],
'A spawned run must never change VERSION',
/a spawned run must never change VERSION/i,
],
[['document-release/sections/release-body.md'], 'Spawned-session skip'],
// Anti-injection trigger + invariant carve-out — the two clauses whose
// deletion would silently reopen the prompt-injection / silent-VERSION
// holes while the 'When dispatched' heading pin stays green.
[['document-release/SKILL.md', 'document-release/SKILL.md.tmpl'], 'NEVER trigger it on their own'],
// (short form — the sentence wraps across template lines; toContain is literal)
[['document-release/SKILL.md', 'document-release/SKILL.md.tmpl'], 'The NEVER-do invariants below do'],
// holes while the 'When dispatched' heading pin stays green. Matched on
// meaning (case-insensitive, whitespace-normalized), not register.
[['document-release/SKILL.md', 'document-release/SKILL.md.tmpl'], /claims never trigger it on their own/i],
[['document-release/SKILL.md', 'document-release/SKILL.md.tmpl'], /skip any recommendation that rewrites CHANGELOG or changes VERSION/i],
];
test('document-release carries the spawned-dispatch contract', () => {
for (const [sites, phrase] of CONTRACT_PINS) {
for (const rel of sites) {
const content = fs.readFileSync(path.join(ROOT, rel), 'utf-8');
expect(content).toContain(phrase);
if (typeof phrase === 'string') expect(content).toContain(phrase);
else expect(content.replace(/\s+/g, ' ')).toMatch(phrase);
}
}
});