Skip to content

fix(yaml): support multiline flow collections - #9700

Merged
tim-smart merged 4 commits into
mainfrom
fix/yaml-flow-mappings
Oct 21, 2026
Merged

tim-smart merged 4 commits into
mainfrom
fix/yaml-flow-mappings

Conversation

@fubhy

@fubhy fubhy commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Summary

Yaml.parse failed on moby's Docker Engine API document with SyntaxError: Expected ':' at flow offset 1. The cause is a JSON-style flow mapping split across lines:

        example:
          {
            "active_anon": 1572864,
            "active_file": 5115904
          }

The parser handed only the first line of a flow collection to the flow parser. Now the flow parser pulls in continuation lines while it is inside a collection:

  • Continuation lines must be indented past the parent node.
  • The closing bracket may also sit at the parent's indentation. YAML 1.2 doesn't allow that, but it's the common hand-written layout and yaml and libyaml accept it. The module doc states this difference.
  • Comment and blank lines inside the collection are skipped, and multiline plain scalars are folded.
  • Multiline quoted scalars inside flow collections are still unsupported and listed in the module doc.
parse("a:\n  {\n    \"b\": 1\n  }\n")   // before: SyntaxError → after: { a: { b: 1 } }
parse("a: [\n  1,\n  2\n]\n")          // before: SyntaxError → after: { a: [1, 2] }

Tests

The existing tests are unchanged. A new multiline flow collections block covers the moby shape, a closing bracket at the parent's indentation, nested collections, a sibling key after the collection, comment and blank lines, and plain-scalar folding. It also checks that three inputs are rejected: a continuation line at the parent's indentation, an unterminated collection before a sibling key, and content after the closing bracket.

Merge Danger

Door: two-way

Parser-only change behind the existing parse signature.

Blast Radius: additive

Only input that used to fail now parses. Valid single-line input is unaffected.

Closes EFF-2728

@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d1562a4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@fubhy
fubhy requested a review from tim-smart October 21, 2026 08:13
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 39.13 KB 39.13 KB 0.00 KB (0.00%)
basic.ts 7.04 KB 7.04 KB 0.00 KB (0.00%)
batching.ts 10.91 KB 10.91 KB 0.00 KB (0.00%)
brand.ts 6.71 KB 6.71 KB 0.00 KB (0.00%)
cache.ts 11.35 KB 11.35 KB 0.00 KB (0.00%)
config.ts 22.51 KB 22.51 KB 0.00 KB (0.00%)
differ.ts 21.66 KB 21.66 KB 0.00 KB (0.00%)
http-client.ts 26.02 KB 26.02 KB 0.00 KB (0.00%)
http-router.ts 35.69 KB 35.69 KB 0.00 KB (0.00%)
logger.ts 11.70 KB 11.70 KB 0.00 KB (0.00%)
metric.ts 9.27 KB 9.27 KB 0.00 KB (0.00%)
optic.ts 6.93 KB 6.93 KB 0.00 KB (0.00%)
pubsub.ts 15.79 KB 15.79 KB 0.00 KB (0.00%)
queue.ts 12.61 KB 12.61 KB 0.00 KB (0.00%)
schedule.ts 11.60 KB 11.60 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 13.84 KB 13.84 KB 0.00 KB (0.00%)
schema-binary.ts 40.58 KB 40.58 KB 0.00 KB (0.00%)
schema-class.ts 21.36 KB 21.36 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 32.33 KB 32.33 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 27.52 KB 27.52 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.09 KB 15.09 KB 0.00 KB (0.00%)
schema-string.ts 12.10 KB 12.10 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.02 KB 16.02 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 38.66 KB 38.66 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 25.71 KB 25.71 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 20.59 KB 20.59 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 20.77 KB 20.77 KB 0.00 KB (0.00%)
schema-toFormatter.ts 20.88 KB 20.88 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 25.46 KB 25.46 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 20.88 KB 20.88 KB 0.00 KB (0.00%)
schema.ts 20.55 KB 20.55 KB 0.00 KB (0.00%)
stm.ts 13.89 KB 13.89 KB 0.00 KB (0.00%)
stream.ts 10.14 KB 10.14 KB 0.00 KB (0.00%)

effect-bot and others added 2 commits October 21, 2026 20:32
Yaml.parse handed only the first line of a flow collection to the flow parser, so a JSON-style mapping or sequence spanning lines failed with "Expected ':'". The flow parser now pulls continuation lines while inside a collection; they must be indented past the parent node, except a closing bracket at the parent's indentation. Multiline plain scalars inside flow collections are folded.
@effect-bot
effect-bot force-pushed the fix/yaml-flow-mappings branch from fe32fc6 to 0201939 Compare October 21, 2026 20:34
@effect-bot effect-bot changed the title fix(yaml): parse multiline flow collections and the remaining YAML 1.2 constructs fix(yaml): support multiline flow collections Oct 21, 2026
@tim-smart
tim-smart enabled auto-merge (squash) October 21, 2026 20:46
@tim-smart
tim-smart merged commit 5fa5fa5 into main Oct 21, 2026
12 checks passed
@tim-smart
tim-smart deleted the fix/yaml-flow-mappings branch October 21, 2026 20:53
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.

3 participants