Repository navigation
fix(config): refuse a malformed chartula.yaml naming the file, line and column - #238
Merged
Merged
Conversation
goldbarth
added a commit
that referenced
this pull request
Oct 1, 2026
…320) Follows #319 (ADR 0004); this branch builds on it for the index row and is rebased onto `main` once #319 is merged. - **Why:** seven changes since September made Chartula stop where it used to choose silently, each with its own reasoning in its pull request, but the rule they share was written down nowhere. A contributor adding an option or a setting could not tell whether to refuse an ambiguous value or take the likelier reading, nor when refusing goes too far. - **Context** lists the seven cases in one table, each with what the silent choice did and the change that ended it: a first tag (#198 for #138, #282), a key sent to the other provider's host (#235), an unknown or misindented key (#238), a shallow clone read as a first release (#244), review mode approving unseen text (#247), two configuration files (#287 for #278), and options a command does not take (#301). Decided is #198, the first of them. - **Decision:** stop and say so instead of choosing; before anything is spent; with a message that names the cause and the fix, shown with two real messages; ask at a terminal where the answer is the user's, and stop naming the option without one; refuse only what Chartula can tell for certain (an empty list, an unknown host and an unknown model id are taken as written); refuse a setting that would have no effect. The rule is about what the user meant, not about what the release says, which is what flags are for. - **Consequences** name the cost: a run that could have produced something stops, and a CI job fails until the input says what it means. The ADR weighs that rerun against what a silent choice cost in the seven cases. For a new case, four questions in order, so a contributor can apply the rule rather than match it against the examples. - The index in `adr/README.md` lists 0005. **Verified:** - Each case was checked against its pull request's description and the issue it closes (#237, #243, #233, #278, #300, #138); the dates are the merge dates. - Both messages are the ones `docs/cli.md` and `docs/configuration.md` show from the built binary. - The counter-cases were checked in the code: `ProviderHost` accepts every host but two, `ClaudeThinkingSupport` passes an unknown model id, #289 reads an empty list as written, and #244 still runs `--since` in a shallow clone when the range holds. - Every relative link and anchor in all Markdown files of the repository resolves (script, with a negative test). Tests: none, documentation only.
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.
Closes #237
object:ChartulaYamlReaderloads the file through YamlDotNet's representation model, which keeps the line and column of every key and value (and is reflection-free, so no step back for the AOT goal). The flattening intoChartula:keys is unchanged.(Line: .., Col: .., Idx: ..)prefix, and what it most likely means:[/{says so; a duplicate key is refused instead of the last one winning silently.faithfulness:indented underllm:- valid YAML once the 4-space lines are fixed - leftthorough: falsewithout effect. The refusal says what the key most likely is: a section of its own, a key of another section ('model' is a key of 'llm' and 'faithfulness'), or a misspelling (Did you mean 'model'?). Keys of maps the user names (labels.category,categories.names) are free.true/falsekeys take only those (the binder's message namedChartula:Faithfulness:ThoroughandSystem.Boolean, and no line); list keys take a list, other keys a single value; a section takes keys. Values beyond that (thinking,depth,maxOutputTokens) are still checked where they are read, as before.ChartulaYamlSchemalists every key;ChartulaYamlSchemaTestsfails when an options type gains a property the list does not have, or the reverse.~ornullstill leaves the setting unset; keys are still case-insensitive; the environment-only refusal still comes first and reads as before. Every problem is named at once, one per line.configuration.md(A file that cannot be read as meant),cli.md(Configuration file).Reproduced before the fix with the release binary, the file from the issue:
Tabs and an unclosed
[crashed the same way; an unknown key,faithfulness:underllm:, a scalar for a list, a list for a scalar and a duplicate key ran with the setting silently not in force.Verified after the fix, same file, exit code 1:
The other cases, each exit code 1:
Tests:
MalformedYamlTests(every case above, all problems at once, file named as found, empty values and casing unchanged, the documented example and this repository'schartula.yamlaccepted),ChartulaYamlSchemaTests(schema matches the options types),MalformedConfigurationTests(the built CLI on the issue's file: exit 1, no stack trace); full suite 775 passing, build anddotnet formatclean. Merged together with #235 and #236: 804 passing.