fix(#1505): extract context_guard step to reference file; fix allow-test-rule see ref

- Extract execute-phase.md context_guard step prose to
  gsd-core/references/execute-phase-context-guard.md (@-ref lazy load),
  bringing execute-phase.md back under the ADR-857 phase-6 size ceiling
  (92914 < 93166 bytes)
- Fix allow-test-rule comment: add `see #1452` per ADR-456 lint rule
- Update feat-1452 tests to check the reference file for extracted content
- Register execute-phase-context-guard.md in INVENTORY-MANIFEST.json and
  INVENTORY.md Workflow References section
- Regenerate workflow-size-baseline.json after file shrinkage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-06-20 18:38:20 -04:00
parent a77f3c4b3a
commit b63a500fad
6 changed files with 33 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
// allow-test-rule: source-text-is-the-product
// allow-test-rule: source-text-is-the-product see #1452
// The execute-phase.md workflow and context-budget.md reference ARE the runtime
// contract loaded by AI runtimes. Asserting that the canonical wording for
// `workflow.context_guard_mode` is present in those files is the only way to
@@ -126,32 +126,39 @@ describe('workflow.context_guard_mode config round-trip', () => {
describe('execute-phase.md documents the context_guard step', () => {
let executePhase;
let contextGuardRef;
beforeEach(() => {
executePhase = fs.readFileSync(
path.join(REPO_ROOT, 'gsd-core', 'workflows', 'execute-phase.md'),
'utf-8',
);
// The step body is extracted to a reference file loaded via @-ref in execute-phase.md.
// Both files together constitute the execute-phase wave-boundary contract.
const refPath = path.join(REPO_ROOT, 'gsd-core', 'references', 'execute-phase-context-guard.md');
contextGuardRef = fs.existsSync(refPath) ? fs.readFileSync(refPath, 'utf-8') : '';
});
test('references workflow.context_guard_mode by canonical name', () => {
const combined = executePhase + '\n' + contextGuardRef;
assert.ok(
executePhase.includes('workflow.context_guard_mode'),
'execute-phase.md must reference workflow.context_guard_mode so runtimes resolve the config-driven behavior',
combined.includes('workflow.context_guard_mode'),
'execute-phase.md (or its @-referenced execute-phase-context-guard.md) must reference workflow.context_guard_mode so runtimes resolve the config-driven behavior',
);
});
test('defines context_guard step at wave boundaries', () => {
assert.ok(
executePhase.includes('context_guard') || executePhase.includes('context-guard'),
'execute-phase.md must define a context_guard step that fires before each wave',
'execute-phase.md must define a context_guard step (or @-ref to it) that fires before each wave',
);
});
test('references context-budget.md tiers in the guard step', () => {
const combined = executePhase + '\n' + contextGuardRef;
assert.ok(
executePhase.includes('context-budget') || executePhase.includes('POOR') || executePhase.includes('DEGRADING'),
'execute-phase.md context_guard must reference context-budget.md degradation tiers',
combined.includes('context-budget') || combined.includes('POOR') || combined.includes('DEGRADING'),
'execute-phase.md context_guard (or its @-referenced file) must reference context-budget.md degradation tiers',
);
});
});

View File

@@ -24,7 +24,7 @@
"docs-update.md": 55662,
"edit-phase.md": 12883,
"eval-review.md": 9923,
"execute-phase.md": 93995,
"execute-phase.md": 92914,
"execute-plan.md": 31365,
"explore.md": 10497,
"extract-learnings.md": 12849,