fix: frontmatter delimiter trailing-whitespace + consolidate lint scanner (iss-69) - #36
Merged
Conversation
Fields compared a delimiter line against exactly '---', so a closing '--- ' (trailing space or tab) was not recognised as the close and every body line after it leaked in as a frontmatter field. Trim trailing spaces/tabs (not just CR) before both the opening and closing delimiter comparisons. Assisted-by: Claude:claude-opus-4-8
…er (iss-69) lint carried its own copy of the frontmatter line-scanner (frontmatterFields + fmKeyRe) — logic- and regex-identical to internal/core/frontmatter.Fields, including the same trailing-whitespace delimiter bug just fixed. frontmatterFields is now a thin adapter over the canonical scanner (keeping lint's local fmField shape, so no call site changes), so the primitive lives in ONE place and lint inherits the delimiter fix. Behaviour-preserving; lint tests + record-lint green. Memory's parseFrontmatter is deliberately NOT consolidated here: it is a full nested-YAML parser (map[string]any with nested maps like source:), a genuinely different primitive from the flat top-level scanner — folding it in would require widening frontmatter to nested parsing (a new capability, not a refactor). Assisted-by: Claude:claude-opus-4-8
Assisted-by: Claude:claude-opus-4-8
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.
Resolves iss-69 (native ledger).
Fix (C5)
frontmatter.Fieldscompared a delimiter line against exactly---, so a closing---(trailing space or tab) went unrecognised and every body line after it was misread as a frontmatter field. It now trims trailing spaces/tabs (not just CR) before both the opening and closing delimiter comparisons. TDD:TestFieldsToleratesDelimiterTrailingSpace(fails on revert).Refactor (seed1a — separate commit, behaviour-preserving)
record-lintcarried its ownfrontmatterFields/fmKeyRescanner — logic- and regex-identical tofrontmatter.Fields, including the same delimiter bug. It is now a thin adapter over the canonical scanner (keeping lint's localfmFieldshape, so no call-site churn), so the primitive lives in one place and lint inherits the fix. lint tests +record-lintgreen.Deferred (seed1b)
memory.parseFrontmatteris a full nested-YAML parser (map[string]anywith nested maps likesource:) — a genuinely different primitive from the flat top-level scanner. Folding it in would require wideningfrontmatterto nested parsing (a new capability, not a refactor).intent's in-place writer scanner is likewise a separate concern, flagged for a future consolidation pass.make preflight+make record-lintgreen. Reviewed: ruthless-reviewer SHIP (not a trust boundary, so no security review); both its NICE-TO-HAVEs (package-doc accuracy, the deferral rationale) applied.Assisted-by: Claude:claude-opus-4-8