fix(config): validate collection document wrappers - #41
Merged
Conversation
Reject malformed collection values and unknown top-level keys as path-qualified ConfigError instances instead of leaking TypeError or silently dropping configuration.
sturlese
force-pushed
the
fix/bughunt-config-collection-wrappers
branch
from
August 30, 2026 09:39
6c058c8 to
ecd9ce0
Compare
Owner
Author
Adversarial gate: PASSThe first gate found two issues in the new error path: diagnostics were not fully actionable, and a hostile YAML key such as Final evidence for commit
The pre-existing PyYAML duplicate-key behavior and non-YAML file-read errors were noted as separate future hardening and were not introduced or widened by this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This bughunt fix validates the document wrappers in
models.yamlandusecases.yaml, keeping every malformed configuration inside the path-qualifiedConfigErrorboundary.Bug
Truthy scalar collection values such as
models: 7orusecases: 7reached the item iterator and raised an uncaughtTypeError. Unknown top-level keys were silently ignored even though configuration loading is documented as strict.Root cause
The loader validated the top-level YAML mapping and each collection item, but extracted the collection with
.get(...)without validating the wrapper's allowed keys or value type.Fix
ConfigErrormessages that name the file.Testing
.venv/bin/python -m pytest tests/test_store_config.py tests/test_cli_and_html.py -q— 67 passed..venv/bin/python -m pytest --cov=flightdeck --cov-fail-under=85— 254 passed, 94.41% coverage..venv/bin/ruff check src tests— passed.