Skip to content

fix: accept folded block scalars in handoff YAML - #214

Merged
TheAmericanMaker merged 1 commit into
mainfrom
fix/yaml-folded-scalars
Sep 10, 2026
Merged

fix: accept folded block scalars in handoff YAML#214
TheAmericanMaker merged 1 commit into
mainfrom
fix/yaml-folded-scalars

Conversation

@TheAmericanMaker

Copy link
Copy Markdown
Member

Closes #211.

closeout_summary: >- is valid YAML and the natural choice for a wrapped prose field, but it failed with:

Invalid YAML indentation near: Mapped rel-mcp: one module, two pure exports, …

The parser handled only | and |-. A >- header fell through to the plain-scalar path, and the block body underneath it then failed the indentation check — so the error blamed whitespace when the cause was the scalar style. That sends you re-indenting instead of changing one character; it did exactly that to me.

It matters because a handoff is usually written by a model, and a model writing a wrapped prose field reaches for >-. Found during the 0.19.2 surface verification by writing a handoff by hand and hitting it on the first try.

The fix

Both block styles and all three chomping indicators — |, |-, |+, >, >-, >+ — with real folding semantics:

  • a single line break between content lines becomes a space
  • a run of k blank lines becomes k newlines
  • more-indented lines keep their breaks, so a folded block can still carry an indented snippet without it being flattened onto one line

Literal blocks parse exactly as before; |+ is newly supported alongside them. A value that merely starts with an indicator (|x, > not a header) is still a plain scalar.

templates/phase-handoff.yaml said "YAML literal blocks are supported" — accurate before, incomplete now. It names both styles.

Verification

The exact handoff that failed during the 0.19.2 verification now parses:

closeout_summary: "Mapped rel-mcp: one module, two pure exports, no dependencies, no lifecycle, no state. Key hazard is ESM syntax without a module declaration. Routed arch-CF1 to contracts."

Six new tests in tests/yaml.test.mjs cover folding, all three chomping indicators, blank-line runs, more-indented lines, literal-block regression, and the not-a-header cases.

npm run build clean, 677/677 tests pass.

🤖 Generated with Claude Code

closeout_summary: >- is valid YAML and the natural choice for a wrapped prose
field, but the parser handled only | and |-. A >- header fell through to the
plain-scalar path and the block body underneath then failed the indentation
check, so the error blamed whitespace when the cause was the scalar style —
sending you re-indenting instead of changing one character.

It matters because a handoff is usually written by a model, and a model writing
wrapped prose reaches for >-. Found during the 0.19.2 surface verification by
writing a handoff by hand and hitting it on the first try.

Both block styles and all three chomping indicators are now supported — |, |-,
|+, >, >-, >+ — with real folding semantics: a single break between content
lines becomes a space, a run of k blank lines becomes k newlines, and
more-indented lines keep their breaks so a folded block can still carry an
indented snippet. Literal blocks parse exactly as before, and |+ is newly
supported alongside them.

Closes #211

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@TheAmericanMaker
TheAmericanMaker merged commit 4dc6353 into main Sep 10, 2026
5 checks passed
@TheAmericanMaker TheAmericanMaker mentioned this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handoff YAML: folded scalars (>-) are rejected as an indentation error

1 participant