-
Notifications
You must be signed in to change notification settings - Fork 60
feat(config): typed Config model + validation for .vouch/config.yaml #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: test
Are you sure you want to change the base?
Changes from all commits
692415a
930a866
bb7b079
7ba8b5d
025ecd7
73d2672
52aff99
726353f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,27 +53,10 @@ def _configured_backend(store: KBStore) -> str: | |
|
|
||
| Reads the singular `retrieval.backend` string. For KBs initialised | ||
| before this knob existed, a legacy `retrieval.backends` list is honoured | ||
| by taking its first recognised entry. Anything unreadable or unrecognised | ||
| falls back to "auto". | ||
| by taking its first recognised entry. Anything unrecognised falls back to | ||
| "auto". Parsing + validation now lives in the typed `Config` model (#243). | ||
| """ | ||
| try: | ||
| loaded = yaml.safe_load(store.config_path.read_text(encoding="utf-8")) | ||
| except (OSError, yaml.YAMLError): | ||
| return "auto" | ||
| if not isinstance(loaded, dict): | ||
| return "auto" | ||
| retrieval = loaded.get("retrieval") | ||
| if not isinstance(retrieval, dict): | ||
| return "auto" | ||
| backend = retrieval.get("backend") | ||
| if isinstance(backend, str) and backend in _VALID_BACKENDS: | ||
| return backend | ||
| legacy = retrieval.get("backends") | ||
| if isinstance(legacy, list): | ||
| for entry in legacy: | ||
| if isinstance(entry, str) and entry in _VALID_BACKENDS: | ||
| return entry | ||
| return "auto" | ||
| return store.config.retrieval.resolved_backend() | ||
|
Comment on lines
+56
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift migrate while additionally, if 🤖 Prompt for AI Agents |
||
|
|
||
|
|
||
| def _configured_rerank(store: KBStore, *, limit: int) -> tuple[bool, int]: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
document the complete configuration-diagnostics behavior
the entry omits two user-visible behaviors added in this stack: malformed yaml syntax is converted into
ConfigErrorforvouch doctor, and nested unknown keys are reported with dotted paths. please mention both so the changelog accurately reflects the shipped diagnostics.🤖 Prompt for AI Agents