Repository navigation
Add Yaml.stringify and Yaml.stringifyAll - #10272
Closed
effect-bot wants to merge 10 commits into
Closed
effect-bot wants to merge 10 commits into
effect-bot wants to merge 10 commits into
Conversation
🦋 Changeset detectedLatest commit: 3b465fb The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
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 |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
effect-bot
force-pushed
the
agent/architect-effect-bot/6a52aa9988ae
branch
from
November 1, 2026 23:46
8521c14 to
a57986d
Compare
tim-smart
force-pushed
the
v4/next-minor
branch
from
November 3, 2026 20:54
2e13c53 to
5f5a4b3
Compare
effect-bot
force-pushed
the
v4/next-minor
branch
7 times, most recently
from
November 3, 2026 22:52
97a1ee1 to
10d44ad
Compare
effect-bot
force-pushed
the
agent/architect-effect-bot/6a52aa9988ae
branch
from
November 3, 2026 23:14
8943cbc to
dc389f2
Compare
effect-bot
added a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
force-pushed
the
v4/next-minor
branch
from
November 3, 2026 23:39
2650b53 to
0a68f11
Compare
effect-bot
changed the base branch from
v4/next-minor
to
agent/nelson-effect-bot/eff-3232-stage5-core-tags
November 3, 2026 23:40
effect-bot
changed the base branch from
agent/nelson-effect-bot/eff-3232-stage5-core-tags
to
v4/next-minor
November 3, 2026 23:40
This was referenced Nov 3, 2026
Closed
effect-bot
changed the base branch from
v4/next-minor
to
agent/nelson-effect-bot/eff-3232-stage5-core-tags
November 3, 2026 23:42
Tests-first run for stage 2 of EFF-3232. Specifies the value-oriented printer contract: Result<string, EncodingError>, re-parse based quoting, literal block scalars, non-finite numbers, undefined/toJSON handling, indent option, document streams, and path-carrying errors for cycles and unsupported values. Adds yaml as a dev-only oracle for packages/effect.
Value-oriented YAML printer returning Result<string, EncodingError>. Strings print plain only when parse reads them back unchanged, multiline strings use literal block scalars, toJSON/undefined follow JSON.stringify, and bigints, functions, symbols, non-plain objects, and cycles fail with the path of the offending value.
Merge key quoting, sparse array positions, non-printable character escaping, and the 1024-character implicit key limit.
Quote the merge key in key position, keep sparse array positions, escape every non-printable character before choosing plain or block style, and fail for keys longer than the 1024-character implicit key limit.
Iterate double-quoted output by code point instead of tracking surrogate pairs by hand, check block scalar lines with trim, derive the prototype name with optional chaining, and share one Result wrapper between stringify and stringifyAll.
…ings Non-iterable stream inputs must fail, and an unsupported prototype with a non-string constructor name must still report the offending path.
effect-bot
force-pushed
the
agent/nelson-effect-bot/eff-3232-stage5-core-tags
branch
from
November 3, 2026 23:43
7f10be2 to
3dfbaab
Compare
effect-bot
force-pushed
the
agent/architect-effect-bot/6a52aa9988ae
branch
from
November 3, 2026 23:43
7a672f9 to
3b465fb
Compare
effect-bot
added a commit
that referenced
this pull request
Nov 4, 2026
Contributor
Author
|
Superseded by #10287, which now holds the rest of the YAML expansion as one PR against |
effect-bot
added a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
added a commit
that referenced
this pull request
Nov 4, 2026
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.
Adds a value-oriented YAML printer to
effect/encoding/Yaml, stage 2 of the YAML expansion plan.API
Contract
null, booleans, numbers, strings, arrays, and plain objects. Block style, insertion-order keys,{}and[]for empty collections, output ends in one newline.parseand the YAML 1.2 core schema both read it back as the same string; otherwise it is double-quoted with YAML escapes. Keys follow the same rule, so"true":and"1":stay strings.|,|-, or|+literal block scalars when no line has surrounding whitespace or control characters; otherwise double-quoted..inf,-.inf,.nan, and-0.0round-trip, including the sign of zero.JSON.stringify:toJSONis applied first,undefinedproperties are omitted,undefineditems printnull, symbol keys are ignored.JSON.stringify, nothing is silently dropped or turned into{}: bigints, functions, symbols, objects with a non-plain prototype and notoJSON, and cycles fail with anEncodingErrorwhose message names the path (value.items[0],value[1].idin a stream).-then an indented- item) because the current parser does not read- - item; shared references print inline each time, no anchors.Integration with the parser stack
The printer commits were written on
v4/next-minorbefore the parser stages landed. The last commit on this branch merges them into the stage 5 head (#10285), so this PR's diff shows the printer as it fits on the finished parser. The merge had two conflicts, both from the two sides adding code next to each other:Yaml.tsmodule header and the end of the file keep the parser stack's text, then add the printer code. The printer branch's olderparsedefinition was dropped because the parser stack already has the current one.Yaml.test.tsstringify tests follow the parser tests.Validation
vitest packages/effect/test/encoding/Yaml.test.ts: 195 passed (35 new printer tests, committed in the tests-first run, plus the existing 160).yaml2.9.1 reference parser, added as a devDependency ofpackages/effectfor that purpose.Yaml.parseunchanged.tscforpackages/effect,oxlint,dprint,pnpm jsdocs --check, doctests for the module, andpnpm circularall pass.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:
Yaml.parseAllandResultfromYaml.parse(merged)v4/next-minorYaml.stringifyandYaml.stringifyAll, based on Resolve Yaml core schema tags #10285 (this PR)Yaml.parse, based on Add Yaml.stringify and Yaml.stringifyAll #10272After a PR in the stack is squash-merged, the next one has to be rebased onto the squash commit and retargeted to
v4/next-minorbefore it can merge.Closes EFF-3232