iceboundrock / iceboundrock/AutoForge
Subset YAML parser errors do not name the config file
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 8h 56m
- Merged PRs (30d)
- 40
Description
Context
Found while addressing the #64 review. load_config_file wraps parse errors from tomllib, json.loads and PyYAML as cannot parse config <path>: ..., but the built-in YAML subset parser (_parse_yaml_subset in src/autoforge/config.py) raises ConfigurationError directly, and load_config_file re-raises ConfigurationError unchanged. Those messages therefore never carry the file path:
YAML subset parser: bad indentation at: 'allow_merge: true' — install PyYAML for full YAML support
config must contain a mapping at top level # subset parser, list at the root
config cfg.yaml must contain a mapping at top level # PyYAML, same file
An operator who passes --config from a wrapper script, or who keeps several config files, cannot tell from the message which file failed. The two backends also word the root-type error differently for the same input.
Proposed change
Either have _parse_yaml_subset raise a plain ValueError so the existing cannot parse config <path>: wrapper applies (the duplicate-key error added in #64 already does this), or prefix the path in load_config_file when re-raising a ConfigurationError from a parser. Tests that match= on the message body keep passing either way since pytest.raises(match=) uses re.search.
Cosmetic; no behavioural change to what is accepted or rejected.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/autoforge/config.py by reading _parse_yaml_subset and load_config_file, then inspect the existing parser-error tests and their match= assertions. Make subset-parser failures identify the config path consistently with the other backends, without changing which inputs are accepted or rejected, and run the relevant configuration tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100