fix(yaml): migrate to js-yaml 5 API and restore green CI - #69
Open
vandetho wants to merge 1 commit into
Open
Conversation
js-yaml 5 removed the `Type`/`DEFAULT_SCHEMA` custom-tag API and the `quotingType`/`styles` dump options, which broke `npm run typecheck` after dependabot bumped it in #64. Port both YAML modules to the v5 API: - `new yaml.Type(...)` -> `defineScalarTag(...)`, with resolve/construct collapsed into a single `resolve` - `DEFAULT_SCHEMA.extend([...])` -> `CORE_SCHEMA.withTags(...)` - `quotingType: "'"` -> `quoteStyle: "single"` - `styles: { "!!null": "canonical" }` is gone in v5, so `~` for null is now produced by overriding `represent` on the core null tag - js-yaml 5 has no default export; switch to named imports - drop `@types/js-yaml` — v5 ships its own type declarations Also pin `typescript` back to ^6.0.3. The ^7.0.2 bump in #67 conflicts with the `typescript >=4.8.4 <6.1.0` peer range of @typescript-eslint v8 and failed `npm ci` outright; no typescript-eslint release supports TS 7 yet. Dependabot is configured to skip typescript majors until one does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
mainhas been red since 2026-07-08. Two stacked breakages, both from dependabot bumps:1.
typescript@^7.0.2failsnpm ci(introduced in #67)No released typescript-eslint supports TS 7 — latest stable is 8.65.0 and it still caps at
<6.1.0— so bumping the plugin doesn't help.typescriptis pinned back to^6.0.3, and.github/dependabot.ymlnow ignorestypescriptsemver-majors so this doesn't come back next weekly run.2.
js-yaml@^5.2.1breakstypecheck(introduced in #64)This was hidden behind the
npm cifailure. #65 previously reverted js-yaml to 4.x; #64 re-bumped it. This PR migrates the code forward to the v5 API instead of reverting again.js-yaml 4 → 5 migration
new yaml.Type(tag, { kind, resolve, construct })defineScalarTag(tag, { resolve })— resolve/construct collapse into oneresolve(source)DEFAULT_SCHEMA.extend([...])CORE_SCHEMA.withTags(...)quotingType: "'"quoteStyle: "single"styles: { "!!null": "canonical" }import yaml from "js-yaml"@types/js-yamlTwo judgement calls worth reviewing:
CORE_SCHEMA, notYAML11_SCHEMA. v4'sDEFAULT_SCHEMAused core scalar resolution.YAML11_SCHEMAwould have silently started parsingyes/no/on/offas booleans — a real behavior change for place and transition names. The YAML 1.1 collection tags it also adds (omap,pairs,set,binary,timestamp) aren't used in Symfony workflow config.~for null. v5 has nostylesoption, andstyles: { "!!null": "canonical" }was what produced~rather thannullin exported YAML. Restored by spreading the exportednullCoreTagwith an overriddenrepresent, then passing that schema todump.Verification
Full CI step sequence run locally —
lint,format:check,typecheck,test(246 passed / 14 files),build. All green.The existing suite already covers the two behaviors most at risk:
expect(yaml).toContain("draft: ~")(tests/yaml.test.ts:74) and the!php/enumtag suite. Additionally smoke-tested the built CJS bundle to confirm the named-import switch survives the tsup transpile — export/import round-trips cleanly with~, flow arrays, and single-quoted scalars intact.🤖 Generated with Claude Code