fix(decision-records): flag strict-YAML hazards in front matter - #7
Merged
Merged
Conversation
The tolerant line-based parser accepts values a spec-compliant YAML parser rejects — chiefly an unquoted ': ' inside a plain scalar, which YAML reads as a nested mapping and errors on. GitHub's front-matter renderer uses a strict parser, so such a record renders as an error banner on github.com (hit in practice by a summary containing 'two modes: channel mode'). check now reports front-matter values that are plain scalars containing ': ' (or ending with ':'), and unbalanced quotes; quoted values, flow sequences, and block scalars stay exempt.
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.
Problem
parse_front_matteris deliberately tolerant (line-based, first-:split), so it accepts front matter that a spec-compliant YAML parser rejects. The sharp edge: an unquoted:inside a plain scalar starts a nested mapping in real YAML, which is illegal mid-value. GitHub's front-matter renderer uses a strict parser, so an affected record displays an error banner instead of rendering — hit in practice by skymavis/lanh-ai's 0009, whose summary contained…two modes: channel mode…("Error in user YAML: mapping values are not allowed in this context").Fix
New
front_matter_errors()wired intocheck: for every record and draft, plain-scalar values containing:(or ending with:) are reported as errors, as are unbalanced opening quotes. Quoted values, flow sequences ([...]),null/empty, and folded/literal block scalars are exempt — block-scalar bodies are skipped by indent, mirroring the parser.Deliberately narrow: this targets the one hazard class with a public failure surface, not full YAML validation — no new dependency.
Testing