Skip to content

Resolve Yaml core schema tags - #10285

Closed
effect-bot wants to merge 6 commits into
agent/effect-bot/eff-3232-flow-plain-dashfrom
agent/nelson-effect-bot/eff-3232-stage5-core-tags
Closed

effect-bot wants to merge 6 commits into
agent/effect-bot/eff-3232-flow-plain-dashfrom
agent/nelson-effect-bot/eff-3232-stage5-core-tags

Conversation

@effect-bot

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

Copy link
Copy Markdown
Contributor

This is stage 5 of the YAML expansion: Yaml.parse and Yaml.parseAll now resolve the core schema's tags instead of rejecting every tag.

Behavior (YAML 1.2.2 §10.3)

  • The shorthand core tags resolve: !!str, !!int, !!float, !!bool, !!null, !!seq and !!map. A scalar tag applies to the scalar as written, so !!str 0x10 is "0x10", !!str ~ is "~", and !!int "42" is 42. For quoted and block scalars, that means the decoded string. An empty tagged node is the empty string: a: !!str gives "" and a: !!null gives null.

  • The spec's patterns decide what each tag accepts:

    • !!int: decimal, 0o and 0x integers
    • !!float: decimals with an optional fraction and exponent, so 1 and -1. are floats, plus .inf and .nan in their three spellings
    • !!bool: true and false as lowercase, capitalised or uppercase
    • !!null: null, Null, NULL, ~ and empty

    yaml 2.9.1 rejects !!float 1; the spec's float pattern matches it, so this follows the spec.

  • A node that doesn't match its tag fails: !!int x, !!bool yes, !!float 0x10, !!str [1], !!seq {a: 1}, an empty !!map, and so on.

  • Where tags can appear: block and flow values, block and flow keys, the document root, block scalars, and quoted scalars. A tag can come before or after an anchor, and the anchor records the resolved value. A tagged key never merges. A second tag on one node fails, and so does a tag on an alias.

  • Still rejected, with the tag named in the error:

    • local tags (!custom)
    • the non-specific tag !
    • verbatim tags such as !<tag:yaml.org,2002:str>, even when they name a core tag
    • YAML 1.1 tags (!!binary, !!timestamp, !!set)
    • unknown !! tags

    The agreed scope covers the shorthand forms only. Both the module docs and the release note say so.

Plain scalars that contain ! (x!y, hello!) are still plain text.

Docs

  • The module header lists the resolved core tags and the tags that remain unsupported.
  • The parse JSDoc explains that a tag applies to the scalar as written. Its doctest now resolves !!str 8080 and rejects !custom 8080.
  • The release note is .changeset/yaml-core-tags.md (minor).

Validation

  • Yaml.test.ts: 286 of 286, including the 13 stage 5 "resolves" rows. No test was changed.
  • YAML, CLI, Skills, ai-codegen and openapi-generator tests: 930 passed, 3 skipped.
  • 20 extra cases match yaml 2.9.1, apart from the intended verbatim rejection. They cover tag-then-anchor order, tags on the next line, indentless !!seq, a tagged << key, flow anchors on tagged keys, !!float .nan, tab separation, multiple tags, a tag on an alias, and folded block scalars.
  • pnpm lint, pnpm jsdocs --check and the Yaml.ts doctests pass.
  • pnpm check reports one error, the apiStabilityLeak in cluster/ShardingRegistrationEvent.ts, which also occurs 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
  7. Resolve Yaml core schema tags #10285: core schema tags, based on Reject Yaml flow plain scalars starting with a dash and separation #10284 (this PR)
  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: 3dfbaab

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

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

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 v4/next-minor branch 7 times, most recently from 97a1ee1 to 10d44ad Compare November 3, 2026 22:52
@effect-bot
effect-bot force-pushed the agent/nelson-effect-bot/eff-3232-stage5-core-tags branch from cc45e2e to 56f1a86 Compare November 3, 2026 23:14
@effect-bot
effect-bot force-pushed the agent/nelson-effect-bot/eff-3232-stage5-core-tags branch from 56f1a86 to 7f10be2 Compare November 3, 2026 23:39
@effect-bot
effect-bot changed the base branch from v4/next-minor to agent/effect-bot/eff-3232-flow-plain-dash November 3, 2026 23:40
@effect-bot
effect-bot changed the base branch from agent/effect-bot/eff-3232-flow-plain-dash to v4/next-minor November 3, 2026 23:40
@effect-bot
effect-bot changed the base branch from v4/next-minor to agent/effect-bot/eff-3232-flow-plain-dash November 3, 2026 23:42
The shorthand tags !!str, !!int, !!float, !!bool, !!null, !!seq and
!!map resolve against the scalar as written, a mismatched node fails,
and every other tag, including verbatim and non-specific tags, still
fails.
Tags keep the token start for structure and comment scanning, a node's
properties may continue on the next line and its anchor records the
resolved value, and a node has at most one anchor and tag, no
properties on an alias, and separation before flow content.
A scalar tag on a flow collection key fails like a tagged collection
value, and a node starting with '&' must name its anchor.
@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
effect-bot force-pushed the agent/nelson-effect-bot/eff-3232-stage5-core-tags branch from 7f10be2 to 3dfbaab 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant