Skip to content

feat: fail loud on unresolvable preset in all three resolvers (#179)#196

Open
brandon-behring wants to merge 1 commit into
mainfrom
feat/179-fail-loud-preset
Open

feat: fail loud on unresolvable preset in all three resolvers (#179)#196
brandon-behring wants to merge 1 commit into
mainfrom
feat/179-fail-loud-preset

Conversation

@brandon-behring

Copy link
Copy Markdown
Owner

Fixes #179. Converts the silent 'minimal' fallback into a thrown BookConfigError (or validate exit 1) with exact remediation text, in all three resolution paths — resolvePreset (schemas), defineBookConfig's composed chain, and validate.mjs's inline resolver — so the change is coherent rather than one-path-deep.

Blast radius audited before the change: every in-repo surface sets the preset explicitly (demo, all 6 fixtures — the two bare defineBookSchemas() fixtures are made explicit in this PR); scaffolded consumers all have the create-book-written .env. The 16 validate tests that silently ran under minimal now say so explicitly (--preset minimal), preserving their exact prior semantics; the two #20 .env-source tests are untouched.

Semver: minor with a CHANGELOG migration block at release (house precedent: #121/v4.14.3 shipped silent→loud as a patch). Suite 524 → 533; both loud errors observed on a deliberate unset-preset build.

Closes #179.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RAZxPcnVjkwv7nhYMxgKQE

An unset preset silently became 'minimal': resolvePreset console.warn'd,
defineBookConfig assumed it for an empty/preset-less style chain, and
validate defaulted its whole check profile. A book whose .env never
reached CI built the wrong profile — wrong schemas, wrong routes, no
KaTeX — with zero signal, and validate's profile-gated checks silently
didn't run. All three now throw/exit with the exact remediation and the
valid-preset list, citing the old behavior. Same silent→loud conversion
as the Theorem kind change (v4.14.3, #121).

- types.ts resolvePreset: unset → BookConfigError (invalid already threw)
- config.ts: empty chain and preset-less chain get distinct remediations
- validate.mjs: exhausted resolution → exit 1 with remediation
- the two bare defineBookSchemas() fixtures made explicit (they leaned on
  package.json script env); schemas-entry JSDoc example updated
- validate-root tests: 16 preset-less spawns made explicit (--preset
  minimal — their prior effective profile); new unset→error test
- new tests/resolve-preset.test.mjs (8 cases). Suite 524 -> 533

Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RAZxPcnVjkwv7nhYMxgKQE
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.

resolvePreset: unset BOOK_PRESET silently falls back to 'minimal' — codify or fail loud

1 participant