Skip to content

fix: validate config.yaml services and cache parsed result - #100

Merged
GoodbyePlanet merged 1 commit into
mainfrom
fix/config-validation-caching
Jul 27, 2026
Merged

fix: validate config.yaml services and cache parsed result#100
GoodbyePlanet merged 1 commit into
mainfrom
fix/config-validation-caching

Conversation

@GoodbyePlanet

Copy link
Copy Markdown
Owner

Summary

  • ServiceConfig is now a validated Pydantic model instead of a hand-rolled class, so malformed config.yaml entries raise a clear error instead of a raw KeyError.
  • Duplicate service names in config.yaml now raise a RuntimeError instead of silently sharing the service payload namespace.
  • Settings.load_services() now caches the parsed result per instance instead of re-reading and re-parsing the YAML file on every call (it's invoked from several per-request paths: search.py, stats.py, service_registry.py, both indexing pipelines).

Fixes #76.

Test plan

  • uv run pytest tests/test_config.py -q — 11 passed, including new tests for invalid entries, duplicate names, and caching.
  • uv run pytest -q — full suite, 292 passed.

🤖 Generated with Claude Code

ServiceConfig was hand-rolled and load_services() re-parsed config.yaml
on every call (invoked from several per-request paths). Malformed
entries raised a raw KeyError and duplicate service names silently
clobbered each other in the payload namespace.

Fixes #76.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@GoodbyePlanet
GoodbyePlanet merged commit 675540b into main Jul 27, 2026
2 checks passed
@GoodbyePlanet
GoodbyePlanet deleted the fix/config-validation-caching branch July 27, 2026 06:37
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.

config.yaml is re-parsed on every call and has no validation

1 participant