Skip to content

fix: nightly hardening - CLI config top-level validation#34

Open
mouse-value-add wants to merge 1 commit into
brainsparker:mainfrom
mouse-value-add:chore/nightly-hardening-20260525-config-shape-guards
Open

fix: nightly hardening - CLI config top-level validation#34
mouse-value-add wants to merge 1 commit into
brainsparker:mainfrom
mouse-value-add:chore/nightly-hardening-20260525-config-shape-guards

Conversation

@mouse-value-add

Copy link
Copy Markdown
Contributor

problem

promptlens run assumes the YAML config always parses into a mapping. Empty files (None) or non-mapping top-level YAML (for example a list) fail later with less clear behavior and weaker guardrails.

approach

  • Load config with explicit UTF-8 encoding.
  • Add early top-level validation in CLI run flow:
    • Reject empty YAML config files.
    • Reject non-mapping top-level config shapes.
  • Return clear, actionable validation messages before attempting RunConfig parsing.
  • Add regression tests for both edge cases.

verification

  • Ran test suite: python3 -m pytest -q
  • Result: 11 passed.
  • Added tests:
    • test_run_rejects_empty_config_file
    • test_run_rejects_non_mapping_top_level_config

risks

  • Low risk. Behavior only changes for invalid config inputs.
  • Valid config paths are unchanged.

rollback plan

  • Revert commit e2ab2a8 to restore previous behavior.

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