Repository navigation
Conversation
- resolveYamlInteger: the base-10 path always failed because the sexagesimal check ran on an empty slice; return true per js-yaml and handle null input. This also unbreaks explicit !!int tags on decimal values, which previously threw "Cannot resolve a node". - resolveYamlInteger/constructYamlInteger: add the missing 0o octal form handled by js-yaml. - resolveYamlOmap/construct: guard null input so an empty !!omap node resolves to [] instead of throwing "data is not iterable". - nil: resolve null input so an empty !!null node resolves to null. - resolveTag: bind the anchor for untagged/null-tag states so an anchor placed on a mapping key line aliases the indented scalar value instead of an empty container. - readFlowCollections: reject empty entries per YAML 1.2 7.4 instead of silently pushing null. All behaviors verified against js-yaml 4.1.0.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7374 +/- ##
==========================================
- Coverage 95.04% 95.03% -0.02%
==========================================
Files 619 618 -1
Lines 52012 51778 -234
Branches 9450 9419 -31
==========================================
- Hits 49434 49205 -229
+ Misses 2031 2021 -10
- Partials 547 552 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Summary
Differential testing of
@std/yamlagainstjs-yaml4.1.0 (the library it is ported from) surfaced a family of scalar/tag-resolution divergences where@std/yamlthrew on valid input, produced wrong values, or accepted invalid input:!!inton decimal values threwCannot resolve a node— the base-10 path ofresolveYamlIntegerended in/^(:[0-5]?[0-9])+$/tested against an empty slice (the base-60:-break from js-yaml 3.x was dropped, and the pattern itself should have been zero-or-more). Explicit!!int 42now resolves to42; plain decimal resolution nowreturn trueper js-yaml.0ooctal was unresolved —0o17parsed as the string"0o17". Added the0obranch to bothresolveandconstructper js-yaml (0o17→15).x: !!omapon an empty value threwTypeError: data is not iterable—resolveYamlOmapiteratednull(rawTypeErrorleaked fromparse()). Bothresolveandconstructnow null-guard; an empty omap resolves to[]per js-yaml.x: !!inton an empty value threwTypeError—resolveYamlIntegerreaddata.lengthonnull; added thedata === nullguard per js-yaml.x: !!nullon an empty value threw instead of resolving tonull— added thedata === nullguard per js-yaml.a: &A\n value\nref: *Aaliased to{}(or[]for an empty value) becauseresolveTagreturned early onnull/"!"tags without writinganchorMap[anchor] = result. Aliases now resolve to the composed scalar/null, matching js-yaml.null—[1, , 3]parsed as[1, null, 3]. Per YAML 1.2 §7.4 flow entries can never be empty; this now throws, matching js-yaml'sexpected the node content, but found ','.Each divergence was verified to match js-yaml 4.1.0 behavior after the fix, including error-vs-ok parity on malformed input. Regression tests added to
parse_test.tscovering all six cases.Test plan
deno test yaml/— 97 tests pass (6 new regression assertions/blocks)deno lint yaml/— cleandeno fmt --check yaml/— cleanKnown remaining divergences (out of scope, happy to follow up):
@std/yamlis more lenient than js-yaml on indentation errors (e.g. tabs in indentation, keys abutting scalars) — a deliberate-looking strictness trade-off rather than a porting bug.