Skip to content

fix: nightly hardening - CLI config load guards#36

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

fix: nightly hardening - CLI config load guards#36
mouse-value-add wants to merge 1 commit into
brainsparker:mainfrom
mouse-value-add:chore/nightly-hardening-20260601-cli-config-load-guards

Conversation

@mouse-value-add

Copy link
Copy Markdown
Contributor

problem

PromptLens run assumes config YAML always parses into a top-level object. Empty files or non-object YAML (like lists) can trigger confusing downstream errors during override/parsing.

approach

  • Added _load_config_data() in promptlens/cli.py to centralize config loading.
  • Added explicit guards to fail early when YAML is empty or top-level is not a mapping.
  • Wired run to use this loader before applying CLI overrides.
  • Added focused tests for empty, non-mapping, and valid mapping config files.

verification

  • Ran: python3 -m pytest -q tests/test_cli_config_loading.py tests/test_cli_hardening.py
  • Result: 6 passed.

risks

  • Very low risk. Only affects config load/validation path and improves error clarity.

rollback plan

  • Revert commit f2ff9ff to restore previous config loading 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