Separate config validation from file loading and preserve diagnostic paths #104

Closed
opened 2026-10-05 12:50:13 +00:00 by eleith · 0 comments
Owner

Motivation

The shared config loader currently combines filesystem loading, AJV defaults, environment interpolation and final validation. It joins AJV messages but drops instance paths. Missing environment variables are warned about individually and left unresolved, including an enabled-auth secret case covered by existing tests.

When provides a useful boundary: validation of an unknown object, structured path/message issues, and filesystem loading as a small wrapper. This is independent of schema authoring in #78.

Scope / acceptance

  • Introduce a filesystem-independent validation entry point without mutating caller-owned input, and keep file loading thin.
  • Return/throw structured diagnostics with field paths and useful safe messages; do not include secret values.
  • Preserve absent/empty-file defaults, interpolation escaping/fallback/name behavior and public loader behavior unless a change is explicitly agreed.
  • Aggregate missing-variable diagnostics. Decide and document active-feature secret failure policy before tightening it; disabled auth and default/sparse configurations must remain usable without unrelated secrets.
  • Clearly distinguish structural checks used by examples/tooling from checks that require the deployment environment. Do not claim literal placeholders always pass string format/pattern constraints.
  • Test multiple invalid fields, nested paths, input preservation, defaults, interpolation and enabled/disabled feature cases.
  • No no-op normalization framework, speculative cross-reference rules, path-base migration, runtime reload, or file watcher.

Sources

Keep this separate from #78 so the TypeBox migration can preserve runtime behavior. A stricter environment policy is an explicit compatibility/security decision, not an automatic consequence of adopting TypeBox.

## Motivation The shared config loader currently combines filesystem loading, AJV defaults, environment interpolation and final validation. It joins AJV messages but drops instance paths. Missing environment variables are warned about individually and left unresolved, including an enabled-auth secret case covered by existing tests. When provides a useful boundary: validation of an unknown object, structured path/message issues, and filesystem loading as a small wrapper. This is independent of schema authoring in #78. ## Scope / acceptance - Introduce a filesystem-independent validation entry point without mutating caller-owned input, and keep file loading thin. - Return/throw structured diagnostics with field paths and useful safe messages; do not include secret values. - Preserve absent/empty-file defaults, interpolation escaping/fallback/name behavior and public loader behavior unless a change is explicitly agreed. - Aggregate missing-variable diagnostics. Decide and document active-feature secret failure policy before tightening it; disabled auth and default/sparse configurations must remain usable without unrelated secrets. - Clearly distinguish structural checks used by examples/tooling from checks that require the deployment environment. Do not claim literal placeholders always pass string format/pattern constraints. - Test multiple invalid fields, nested paths, input preservation, defaults, interpolation and enabled/disabled feature cases. - No no-op normalization framework, speculative cross-reference rules, path-base migration, runtime reload, or file watcher. ## Sources - [`packages/web/config/src/lib/config/config.ts`](https://git.eleith.com/eleith/luzzle/src/branch/main/packages/web/config/src/lib/config/config.ts) - [`packages/web/config/src/lib/config/config.test.ts`](https://git.eleith.com/eleith/luzzle/src/branch/main/packages/web/config/src/lib/config/config.test.ts) - [When loader boundary](https://git.eleith.com/eleith/when/src/commit/c54c134/packages/config/src/load.ts) - [When interpolation diagnostics](https://git.eleith.com/eleith/when/src/commit/c54c134/packages/config/src/interpolate.ts) Keep this separate from #78 so the TypeBox migration can preserve runtime behavior. A stricter environment policy is an explicit compatibility/security decision, not an automatic consequence of adopting TypeBox.
eleith added the enhancement label 2026-10-05 12:50:13 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eleith/luzzle#104