Open
Reject invalid YAML frontmatter in a single, self-identifying test#5264
Conversation
Copilot created this pull request from a session on behalf of
ahpook
July 24, 2026 18:21
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds targeted YAML frontmatter validation while preventing cross-topic parse-error cascades.
Changes:
- Extracts shared frontmatter parsing.
- Adds path-qualified YAML syntax errors.
- Adds per-topic and per-collection syntax tests.
Show a summary per file
| File | Description |
|---|---|
test/test_helper.rb |
Separates parsing from syntax reporting. |
test/topics_test.rb |
Adds topic YAML validation. |
test/collections_test.rb |
Adds collection YAML validation. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Medium
Comment on lines
+254
to
+255
| rescue Psych::SyntaxError | ||
| nil |
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.
A single malformed topic frontmatter file (e.g.
display_name:zorkmissing the space after the colon) produced ~825 identical, non-specificinvalid YAML: ... at line 3 column 18failures, becausemetadata_forflunked on parse errors and the alias cross-check test re-parses every other topic — so one bad file flunked once per topic, never naming the culprit.Changes
test/test_helper.rb):metadata_fornow only parses, returningnilonPsych::SyntaxErrorinstead of callingflunk. This stops the cascade through tests that read other items' metadata.yaml_syntax_error_forreturns a path-qualified message (invalid YAML in topics/zork/index.md: ...) ornil.it "has valid YAML frontmatter"totopics_test.rbandcollections_test.rb, each parsing only its ownindex.md.frontmatter_forhelper used by bothmetadata_forandyaml_syntax_error_for.Result
A broken
zork/index.mdnow fails exactly one test, pointing straight at the file:Other items' cross-checks treat an unparseable foreign file as having no aliases (its own YAML test already reports the failure), so no incidental noise.