fix: handle quotes, comments, and indented lines in frontmatter parser#4
fix: handle quotes, comments, and indented lines in frontmatter parser#4Tokenized2027 wants to merge 2 commits intoleonprou:mainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Skip lines starting with '#' (YAML comments) so they don't pollute the parsed fields dict with comment text as keys - Skip lines starting with whitespace (space or tab) so indented list items and continuation lines are ignored; parse_frontmatter_list() handles those separately - Strip surrounding single or double quotes from scalar values so that 'name: "my-task"' returns 'my-task' rather than '"my-task"' All three changes are surgical: no new dependencies, no behaviour changes for well-formed YAML that didn't hit these cases, and all existing 416 tests still pass. Add tests/test_frontmatter.py with 26 focused test cases covering regression parity, colon-in-value, quoted values, comment skipping, indented-line skipping, empty frontmatter blocks, and a realistic mixed frontmatter fixture.
|
Hey, thanks for the contribution! The diff looks larger than expected because the file was converted from LF to CRLF (Windows line endings) — every line shows as changed even though only a few lines actually differ. Could you normalize the line endings back to LF? This should work on any OS: git config core.autocrlf input
git rm --cached src/openstation/core.py
git add src/openstation/core.py
git commit -m "fix: normalize line endings to LF"Also, if you're up for it, it'd be great to add a Once that's done the diff should be clean and easy to review. Thanks! |
Apply fixes from PR #4 (Tokenized2027) with clean LF line endings: - Skip YAML comment lines (starting with #) in parse_frontmatter() - Skip indented lines (list continuations) instead of mishandling them - Strip surrounding single/double quotes from frontmatter values - Add .gitattributes to enforce LF line endings - Add 26 new tests covering all edge cases Co-Authored-By: Tokenized2027 <Tokenized2027@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Merged manually into main via commit 05edca2. Applied the three parser fixes and 26 new tests with clean LF line endings (avoiding the CRLF whole-file diff). Added .gitattributes to prevent future line-ending issues. Thanks for the contribution! |
1 similar comment
|
Merged manually into main via commit 05edca2. Applied the three parser fixes and 26 new tests with clean LF line endings (avoiding the CRLF whole-file diff). Added .gitattributes to prevent future line-ending issues. Thanks for the contribution! |
Apply fixes from PR #4 (Tokenized2027) with clean LF line endings: - Skip YAML comment lines (starting with #) in parse_frontmatter() - Skip indented lines (list continuations) instead of mishandling them - Strip surrounding single/double quotes from frontmatter values - Add .gitattributes to enforce LF line endings - Add 26 new tests covering all edge cases Co-Authored-By: Tokenized2027 <Tokenized2027@users.noreply.github.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reviewed and merged PR #4 frontmatter parser fixes with CRLF normalization
What
Three surgical fixes to the hand-rolled YAML frontmatter parser in
parse_frontmatter()(src/openstation/core.py). Zero new dependencies — stays true to the project's minimal philosophy.Edge cases fixed
1. Quoted values not unquoted
Before:
name: "my-task"→'"my-task"'(quotes included in value)After:
name: "my-task"→'my-task'Works for both single and double quotes. Mismatched quotes (opening ≠ closing) are left untouched.
2. Comment lines silently poisoning the fields dict
Before:
# this is a comment→ key"# this is a comment"added to resultAfter: comment lines are skipped entirely
3. Indented list items treated as key-value pairs
Before:
- subtask-1→ key" - subtask-1"with empty value added to resultAfter: lines starting with whitespace (space or tab) are skipped —
parse_frontmatter_list()handles those separately, as it always hasNew tests
tests/test_frontmatter.py— 26 test cases across 7 test classes:TestStandardFrontmatter— regression tests for existing behaviourTestColonValues— values containing colons (including URLs)TestQuotedValues— single quotes, double quotes, mismatched, unquotedTestCommentLines— full-line comments skipped, inline comments preservedTestIndentedLines— space-indented and tab-indented lines skippedTestEmptyFrontmatter— empty block, comment-only, blank-line-onlyTestRealisticFrontmatter— full task and agent spec fixturesTest results
All existing 416 tests pass. 26 new tests added, all passing.
(The 5 pre-existing failures in
test_hooks.pyare Windows shell-environment issues unrelated to this change — they fail identically onmain.)🤖 Generated with Claude Code