Repository navigation
Return Result from Yaml.parse instead of throwing - #10224
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: f5c8633 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.
|
tim-smart
commented
Oct 31, 2026
tim-smart
force-pushed
the
agent/bob/dc727a942ae8
branch
from
October 31, 2026 08:47
b4f31b5 to
f5c8633
Compare
effect-bot
added a commit
that referenced
this pull request
Nov 1, 2026
Rebased onto v4/next-minor, which already returns Result from Yaml.parse (#10224). parseAll parses document streams with per-document anchors, accepts %YAML 1.2, and rejects other directives and plain scalars starting with '%'.
tim-smart
added a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 3, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 4, 2026
tim-smart
added a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 4, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 6, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 6, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 6, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 6, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 6, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 7, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 7, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 7, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 8, 2026
tim-smart
added a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 16, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 17, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 18, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 18, 2026
effect-bot
pushed a commit
that referenced
this pull request
Nov 19, 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.
Yaml.parsewas the last synchronous parser ineffect/encodingthat threw on bad input. It now returnsResult<unknown, EncodingError>, the same wayToml.parsedoes.Contract
Result.succeedwith the same value as before. Merge keys, BOM/CRLF handling, anchors and scalar decoding are untouched.Result.fail(new EncodingError({ module: "Yaml", kind: "Decode", input, message })).messageis the oldSyntaxErrormessage, including itsat line N/at flow offset Nsuffix.try, likeToml.parse, so it never throws for any string input.import.meta.vitestexample with one success and oneResult.isFailure.@stability unstableand@since 4.0.0are unchanged.Call sites
cli/Primitive.ts: theyml/yamlentries useResult.getOrThrow, the same astoml. The CLI error now readsFailed to parse '.yaml' file content: EncodingError: <message>instead ofSyntaxError: <message>, which is how TOML failures already read.tools/openapi-generator/src/OpenApiPatch.ts:parseYamlContentmaps theEncodingErrortoJsonPatchParseErrorand dropsEffect.try.reasonis still the parser message.tools/ai-codegentests (OpenAiGeneration,OpenRouterTranscriptions):Result.getOrThrowaround the config parse.The issue also listed
ai-codegen/src/Discovery.ts,ai-codegen/src/SpecFetcher.tsandapi-diff/src/Annotations.ts. All three import the npmyamlpackage, noteffect/encoding/Yaml, so this change doesn't reach them and I left them alone.Merging
mainintov4/next-minorpackages/effect/src/ai/internal/mcpSkills.ts(#10082) is only onmain, so this PR can't update it. ItsparseFrontmatterwrapsYaml.parseintry/catchand then checksPredicate.isObject(parsed). That still compiles against the new signature, but aResultis always an object, so every frontmatter block would come back as the serializedResultinstead of the mapping. Whenmainis next merged intov4/next-minor, it needs:Tests
packages/effect/test/encoding/Yaml.test.tswas moved to theResultcontract in the first commit, using theparse/failureMessagehelpers from the Json5/Jsonc tests (#9972). Every rejection now also checksmodule,kindandinput. The tests weren't changed in the implementation commit.Validation
pnpm check,pnpm lintandpnpm jsdocs --checkpass.pnpm codegenleaves no diff.pnpm doctest --run packages/effect/src/encoding/Yaml.ts packages/effect/src/cli/Primitive.tspasses.pnpm test --run packages/effect/test/encoding packages/effect/test/cli packages/effect/test/ai: 61 files, 2640 tests pass.pnpm test --run packages/tools/ai-codegen/test packages/tools/openapi-generator/test: 10 files, 174 tests pass.Closes EFF-3201