Skip to content

chore(deps): js-yaml 5, and what actually changed in it - #125

Merged
jonathansantilli merged 1 commit into
mainfrom
chore/js-yaml-5
Aug 26, 2026
Merged

chore(deps): js-yaml 5, and what actually changed in it#125
jonathansantilli merged 1 commit into
mainfrom
chore/js-yaml-5

Conversation

@jonathansantilli

Copy link
Copy Markdown
Owner

I held this back from #123 because bumping it failed 14 tests — every workflow real-case fixture (RC-01…RC-11) stopped detecting its rule, plus action-file discovery. On a scanner that is a false negative, which is the worst failure it has, so it needed understanding before shipping.

It was not a parsing change. js-yaml 5 removed the default export. import yaml from "js-yaml" resolves to undefined at runtime, so every call through config-parser threw and every workflow parsed as nothing. TypeScript did not catch it because the shipped types still describe a default export. One import changed to a namespace import and all 14 came back.

Two real behaviour changes, both now pinned by tests

An empty document throws where v4 returned undefined. An empty config file is an ordinary thing to find on a developer's machine and means nothing is configured — not a parse failure to report. Handled before the parser sees it.

Merge keys are no longer resolved. <<: *anchor now appears as a literal "<<" key rather than merging into the mapping:

v4:  {"y": {"p": 1, "q": 2}}
v5:  {"y": {"<<": {"p": 1}, "q": 2}}

Nothing in the corpus uses them and GitHub Actions rejects anchors in workflows, so no detector is affected today. But a detector reading a merged key would silently see nothing, so the behaviour is asserted where someone will find it rather than left to be rediscovered.

What did not change

Compared both versions across nine cases: on: keys, on as a bare word, yes/no as strings, sexagesimals, octals, duplicate-key rejection, and tab-indent rejection all behave identically.

882 tests pass; typecheck, lint and build clean.

Still held back

typescript 7 — typescript-eslint@8.68.0 (latest) still declares typescript >=4.8.4 <6.1.0. It is not adoptable yet, and that also pins this project to TypeScript 6.0.x.

I held this back because bumping it failed fourteen tests — every workflow
real-case fixture stopped detecting its rule — and on a scanner that is a
false negative, which is the worst thing it can do. It turns out not to be a
parsing change at all.

js-yaml 5 removed the default export. `import yaml from "js-yaml"` resolves
to undefined at runtime, so every call through config-parser threw and every
workflow parsed as nothing. TypeScript did not catch it because the types
still describe a default. One import changed to a namespace import.

Two real behaviour changes came with it, and both are now pinned by tests
rather than left to be discovered:

**An empty document throws** where 4 returned undefined. An empty config file
is an ordinary thing to find on a developer's machine and means nothing is
configured — it is not a parse failure to report, so it is handled before the
parser sees it.

**Merge keys are no longer resolved.** `<<: *anchor` now appears as a literal
"<<" key rather than merging into the mapping. Nothing in the corpus uses
them and GitHub Actions rejects anchors in workflows, so no detector is
affected today — but a detector reading a merged key would silently see
nothing, so the behaviour is asserted where someone will find it.

Comparing the two versions across nine cases, everything else is identical:
`on:` keys, yes/no strings, sexagesimals, octals, duplicate-key rejection and
tab-indent rejection all behave the same.
@jonathansantilli
jonathansantilli merged commit 1e31788 into main Aug 26, 2026
16 checks passed
@jonathansantilli
jonathansantilli deleted the chore/js-yaml-5 branch August 26, 2026 09:36
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