Skip to content

Reject Yaml flow plain scalars starting with a dash and separation - #10284

Closed
effect-bot wants to merge 2 commits into
agent/effect-bot/eff-3232-literal-tab-escapefrom
agent/effect-bot/eff-3232-flow-plain-dash
Closed

effect-bot wants to merge 2 commits into
agent/effect-bot/eff-3232-literal-tab-escapefrom
agent/effect-bot/eff-3232-flow-plain-dash

Conversation

@effect-bot

@effect-bot effect-bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

YAML 1.2.2 §7.3.3 (ns-plain-first) lets a plain scalar in a flow collection start with - only when the next character is a non-space character other than a flow indicator. Yaml.parse and Yaml.parseAll didn't check this, so [- 1] gave ["- 1"] and [1, -] gave [1, "-"]. yaml 2.9.1 and js-yaml 4.3.2 both reject these inputs.

FlowParser.readPlain now looks at the character after a leading - in the source, before the scalar is folded and trimmed. A space, a tab, the end of the line, ,, [, ], { or } fails with "A flow plain scalar cannot start with '-' followed by white space or a flow indicator". It covers items, values and keys. {-: 1}, -1, -x, -#c and b - c still parse.

The tests were added first in b3e5bca7d6, and this PR doesn't change them.

Validation

  • Yaml and CLI Primitive tests pass (299 tests).
  • I compared 279 generated inputs with yaml 2.9.1 and js-yaml 4.3.2: 31 dash shapes in 9 flow positions (items, keys, values, multiline collections, a flow collection inside a block sequence). Both references agreed on 270 of them, and this branch now matches 266 of those 270, up from 183. The 4 remaining differences, such as {-]: 1}, come from block-level handling of malformed flow keys. They behave the same before and after this change.
  • Before and after this change, the only changed outcomes were inputs that now fail with the new error. No input that used to parse and is accepted by the references changed.
  • pnpm lint-fix and pnpm jsdocs --check pass.
  • pnpm check only reports the existing apiStabilityLeak at cluster/ShardingRegistrationEvent.ts:67, which is also on v4/next-minor.

Stack

These PRs form one stack. Each targets the PR before it, so its diff shows only its own stage. Merge them in this order:

  1. Add Yaml.parseAll and return Result from Yaml.parse #10271: Yaml.parseAll and Result from Yaml.parse (merged)
  2. Reject Yaml tags and explicit keys, resolve alias keys, and keep non-space white space #10276: parser hardening, based on v4/next-minor
  3. Parse Yaml compact nested sequences and multiline quoted flow scalars #10279: compact nested sequences and multiline quoted flow scalars, based on Reject Yaml tags and explicit keys, resolve alias keys, and keep non-space white space #10276
  4. Treat a tab after a Yaml sequence dash as separation #10282: tab after a sequence dash, based on Parse Yaml compact nested sequences and multiline quoted flow scalars #10279
  5. Accept escaped literal tabs in Yaml double-quoted scalars #10283: escaped literal tabs, based on Treat a tab after a Yaml sequence dash as separation #10282
  6. Reject Yaml flow plain scalars starting with a dash and separation #10284: flow plain scalars starting with a dash, based on Accept escaped literal tabs in Yaml double-quoted scalars #10283 (this PR)
  7. Resolve Yaml core schema tags #10285: core schema tags, based on Reject Yaml flow plain scalars starting with a dash and separation #10284
  8. Add Yaml.stringify and Yaml.stringifyAll #10272: Yaml.stringify and Yaml.stringifyAll, based on Resolve Yaml core schema tags #10285
  9. Harden and extend Yaml parsing and add Yaml.stringify #10287: printer round-trip through Yaml.parse, based on Add Yaml.stringify and Yaml.stringifyAll #10272

After a PR in the stack is squash-merged, the next one has to be rebased onto the squash commit and retargeted to v4/next-minor before it can merge.

Closes EFF-3232

@changeset-bot

changeset-bot Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49c0762

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

@github-actions

github-actions Bot commented Nov 2, 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.41 KB 39.41 KB 0.00 KB (0.00%)
basic.ts 7.23 KB 7.23 KB 0.00 KB (0.00%)
batching.ts 11.08 KB 11.08 KB 0.00 KB (0.00%)
brand.ts 6.87 KB 6.87 KB 0.00 KB (0.00%)
cache.ts 11.54 KB 11.54 KB 0.00 KB (0.00%)
config.ts 22.84 KB 22.84 KB 0.00 KB (0.00%)
differ.ts 22.00 KB 22.00 KB 0.00 KB (0.00%)
http-client.ts 27.12 KB 27.12 KB 0.00 KB (0.00%)
http-router.ts 37.04 KB 37.04 KB 0.00 KB (0.00%)
logger.ts 12.01 KB 12.01 KB 0.00 KB (0.00%)
metric.ts 9.47 KB 9.47 KB 0.00 KB (0.00%)
optic.ts 7.10 KB 7.10 KB 0.00 KB (0.00%)
pubsub.ts 16.02 KB 16.02 KB 0.00 KB (0.00%)
queue.ts 12.89 KB 12.89 KB 0.00 KB (0.00%)
schedule.ts 11.80 KB 11.80 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.14 KB 14.14 KB 0.00 KB (0.00%)
schema-binary.ts 41.99 KB 41.99 KB 0.00 KB (0.00%)
schema-class.ts 21.73 KB 21.73 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.60 KB 29.60 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 27.99 KB 27.99 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.35 KB 15.35 KB 0.00 KB (0.00%)
schema-string.ts 12.34 KB 12.34 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.27 KB 16.27 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 38.95 KB 38.95 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 26.15 KB 26.15 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 20.90 KB 20.90 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.05 KB 21.05 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.14 KB 21.14 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.17 KB 26.17 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.23 KB 21.23 KB 0.00 KB (0.00%)
schema.ts 20.82 KB 20.82 KB 0.00 KB (0.00%)
stm.ts 14.20 KB 14.20 KB 0.00 KB (0.00%)
stream.ts 10.38 KB 10.38 KB 0.00 KB (0.00%)

@effect-bot
effect-bot force-pushed the agent/effect-bot/eff-3232-literal-tab-escape branch from 6104199 to d99efdc Compare November 3, 2026 23:43
@effect-bot
effect-bot force-pushed the agent/effect-bot/eff-3232-flow-plain-dash branch from 738de7d to 49c0762 Compare November 3, 2026 23:43
@effect-bot

Copy link
Copy Markdown
Contributor Author

Superseded by #10287, which now holds the rest of the YAML expansion as one PR against v4/next-minor. This PR's commits are included there unchanged.

@effect-bot effect-bot closed this Nov 4, 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.

1 participant