v0.37.9.0 fix(frontmatter): canonical-style normalization for tag arrays (wave: #1217 + #1238)#1252
Merged
Merged
Conversation
Aligns the auto-fix engine, the inferred-frontmatter serializer, and the agent-facing skill on a single canonical YAML shape for tag arrays. v0.37.5.0 fixed the validator (it stopped flagging valid YAML); this release lines up everything else with that fix. Layer 1 (brain-writer.ts step 3a): allow-listed to `tags:` / `aliases:` keys. Rewrites `tags: ["yc"]` to `tags: ['yc']`; apostrophe fallback for `"Men's Fashion"`. Shares a NESTED_QUOTES dedup gate with the existing step 3 so one file with both rewrites surfaces as one audit entry, not two. Layer 4 (frontmatter-inference.ts): serializer emits the same canonical single-quote form by default. Inferred frontmatter on import and `--fix` output now match byte-for-byte. Layer 5 (frontmatter-guard SKILL.md): new "Prevention" section showing canonical vs JSON-style arrays + the JSON.stringify trap that produces the non-canonical form. Future agent writes start canonical. Parity test added to markdown-validation.test.ts pinning agreement between per-value safeLoad parsing and gray-matter full-document parse on the load-bearing inputs. PR #1238's "Layer 3" (put_page auto-normalization) was dropped during plan review: put_page parses YAML into typed fields and hashes them, so single-quoted vs double-quoted arrays are functionally identical in storage. The fix lives where the writes happen, not on the read path. Source PRs absorbed: #1217 (closed, serializer fix) + #1238 (closed, four-layer defense-in-depth narrowed to three layers). PR #1229 already merged as v0.37.5.0. Co-Authored-By: garrytan-agents <garrytan-agents@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0a19d2c to
4e0d8f4
Compare
…r-wave-v0.40.0.1 # Conflicts: # CHANGELOG.md # TODOS.md # VERSION # package.json
…r-wave-v0.40.0.1 # Conflicts: # CHANGELOG.md # VERSION # package.json
…r-wave-v0.40.0.1 # Conflicts: # CHANGELOG.md # TODOS.md # VERSION # package.json
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.
Summary
Wave PR aligning the auto-fix engine, the inferred-frontmatter serializer, and the agent-facing skill on a single canonical YAML shape for tag arrays. v0.37.5.0 (already on master) fixed the validator so
tags: [\"yc\", \"w2025\"]stops getting flagged. This release lines up everything else with that fix.frontmatter validate --fix), it writestags: ['yc', 'w2025']in the canonical single-quote form."Men's Fashion"— YAML stays valid without ugly''escaping.frontmatter-guard/SKILL.md.Three layers, not four
Original PR #1238 proposed four layers. After interactive plan-eng-review + codex outside-voice review, Layer 3 (put_page auto-normalization) was dropped. Reason:
put_pageparses YAML into typed fields and hashes them (import-file.ts:241). Single-quoted vs double-quoted arrays are functionally identical in storage. Layer 3 would have done zero observable work AND opened a DoS surface (autoFixFrontmatter scans before theimport-file.ts:229size guard). The fix lives where the writes happen, not on the read path.What landed
src/core/brain-writer.ts:155-220tags:/aliases:keys. Rewrites JSON-style arrays to single-quoted YAML with apostrophe fallback. Shares anestedQuotesFixeddedup gate with existing step 3 so one file with both rewrites surfaces as one audit entry, not two.src/core/frontmatter-inference.ts:411-416serializeFrontmatter()emits canonical single-quoted by default. JSON.stringify fallback only when tag contains'.skills/frontmatter-guard/SKILL.md:170-217JSON.stringifytrap explanation.test/brain-writer.test.ts,test/frontmatter-inference.test.ts,test/markdown-validation.test.tsWave packaging: VERSION 0.37.5.0 → 0.37.9.0, CHANGELOG entry written in the GStack voice (ELI10 lead, precision after),
TODOS.mdcleanup (removed the v0.37.5.0 P3 follow-up — resolved by this release).Source PR map
How this got reviewed
Two-round interactive review under
/plan-eng-review+ codex outside-voice. Decisions log:autoFixFrontmatter(moot — Layer 3 dropped)tags:/aliases:only (codex caught the broad regex would rewrite typed-numeric arrays likescores: ["1", "2"])Plan file:
~/.claude/plans/system-instruction-you-are-working-velvet-dolphin.mdTest plan
bun run verify— clean (typecheck + 8 pre-checks)bun test test/brain-writer.test.ts test/frontmatter-inference.test.ts test/markdown-validation.test.ts test/markdown.test.ts— 119/119 ✅bun run testran — 8133/5. The 5 failures are pre-existing onorigin/master(verified by stash + checkout + run), not introduced by this wave: 4×test/search/hybrid-reranker-integration.test.ts(reranker reorder tests) + 1×test/doctor-report-remote.test.ts:68(health score 50 < 70). Filed as separate concerns.gbrain frontmatter validate --fixon a file withtags: ["yc"]rewrites totags: ['yc']with a backup under~/.gbrain/backups/frontmatter/.To take advantage of v0.37.9.0
gbrain upgradeshould do this automatically.🤖 Generated with Claude Code