Skip to content

test: cover fail-loud guard error paths in build-disciplines#7

Merged
gpxl merged 1 commit into
mainfrom
claude/frosty-mayer-58b024
Jul 8, 2026
Merged

test: cover fail-loud guard error paths in build-disciplines#7
gpxl merged 1 commit into
mainfrom
claude/frosty-mayer-58b024

Conversation

@gpxl

@gpxl gpxl commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

Deferred error-path guard tests from P2C (#6, already merged as 2ff0c3a).
That PR shipped scripts/build-disciplines.mjs with happy-path drift-lock
coverage only; this adds tests for each fail-loud guard actually throwing:

  • Silent-drop of a new/unhandled section (would otherwise be absorbed into
    an unrendered bucket)
  • Unresolved ${...} interpolation left over after substitution
  • Residual DeepAgents vocabulary leaking into generated output
  • Renamed, reordered, or missing section headers
  • Mode-template count != 3

To make these testable without a fixture repo, the parsing/guard helpers
(readTemplate, extractSingleTemplate, extractAllTemplates,
readConstants, substitute, splitSections, assertNoResidualVocab)
are now exported, and generate() accepts an optional injected-sources
object. Production behavior (no-arg generate(), still reads the vendored
files) is unchanged and the drift-lock is intact.

Note on base branch: the original task assumed this would stack on the
still-open P2C PR (claude/p2c-generate-disciplines), but that PR merged
(squash) into main as 2ff0c3a before this branch was pushed, and its
branch was deleted. This PR targets main directly; the diff contains only
the new test/export changes described above — the existing happy-path
drift-lock tests are untouched.

Commits

  • 49f7c24 test: cover fail-loud guard error paths in build-disciplines

Test plan

  • npm test — 101 passing
  • npm run lint — clean (shellcheck; not applicable to this .mjs file's own gate, but full lint run is clean)
  • node scripts/build-disciplines.mjs --check — in sync
  • Mutation-tested the silent-drop and mode-count guards to confirm the new tests fail when the guard is neutered
  • Manual verification

🤖 Generated with Claude Code

Exports the parsing/guard helpers (readTemplate, extractSingleTemplate,
extractAllTemplates, readConstants, substitute, splitSections,
assertNoResidualVocab) and lets generate() accept an optional
injected-sources object, so guard behavior can be exercised with
crafted source strings instead of a fixture repo. Production
behavior (no-arg generate(), still reads the vendored files) is
unchanged and the drift-lock is intact.

Adds the deferred P2C error-path tests: silent-drop of an unhandled
section, unresolved ${...} interpolation, residual DeepAgents
vocabulary, renamed/reordered/missing section headers, and a
mode-template count != 3. Existing happy-path drift-lock tests are
untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gpxl
gpxl force-pushed the claude/frosty-mayer-58b024 branch from 49f7c24 to 5f1be97 Compare July 8, 2026 13:59
@gpxl
gpxl merged commit 11ddd16 into main Jul 8, 2026
4 checks passed
@gpxl
gpxl deleted the claude/frosty-mayer-58b024 branch July 8, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant