Skip to content

fix: validate config enum values from YAML + add 13 config tests - #164

Open
TerminalGravity wants to merge 1 commit into
mainfrom
fix/config-validation-and-tests
Open

fix: validate config enum values from YAML + add 13 config tests#164
TerminalGravity wants to merge 1 commit into
mainfrom
fix/config-validation-and-tests

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Problem: Config values from .preflight/config.yml and triage.yml were accepted without validation — setting profile: "turbo" or strictness: "extreme" would silently corrupt config state.

Fix:

  • Validate profile, embeddings.provider, and triage.strictness against allowed enums
  • Invalid values log a warning and fall back to defaults
  • Export resetConfig() for test isolation

Tests: 13 new unit tests covering defaults, env vars, YAML loading, validation warnings, caching, and error handling. All 56 tests pass.

…fig tests

- Profile, embedding provider, and triage strictness values from
  .preflight/*.yml are now validated against allowed enums
- Invalid values log a warning and fall back to defaults instead of
  silently accepting arbitrary strings
- Add resetConfig() export for test isolation
- Add 13 unit tests covering defaults, env vars, YAML loading,
  validation warnings, caching, and error handling

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid defensive fix. Silent config corruption from typos is exactly the kind of thing that wastes hours debugging — "why isn't my profile working?" turns out to be profile: ful instead of profile: full.

The fallback-to-defaults approach is the right call over throwing — config errors shouldn't crash the MCP server. Warning + default keeps things running while surfacing the issue.

13 tests for the config module is good coverage. LGTM.

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