Uh oh!
There was an error while loading. Please reload this page.
fix(deps): pin @aws-cdk/toolkit-lib yaml to v1 to fix 'yaml/types' resolution - #2122
Conversation
Claude Security Review: no high-confidence findings. (run) |
notgitika
commented
Aug 26, 2026
looking into failing CI |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Changes requested
The override itself is correct and well-motivated — @aws-cdk/toolkit-lib@1.38.2 declares yaml: ^1, its yaml-cfn.js does require("yaml/types") which only resolves in yaml@1.x (v2 has no ./types in its exports map), and pinning the nested yaml to ^1 matches upstream's declared range. Bun supports npm's nested overrides syntax, so this works for both npm and bun install paths.
Issue: bun.lock is not updated
package.json is the only file changed in this PR, but every CI workflow in this repo runs bun install --frozen-lockfile (.github/workflows/build.yml, unit-test.yml, check.yml). Bun's --frozen-lockfile errors out when package.json and bun.lock disagree, which is what an added override does — the resolved yaml version under @aws-cdk/toolkit-lib in the lockfile will not reflect the new constraint until the lockfile is regenerated.
This matches what's happening on the PR: all build, unit-test, and check jobs across Linux/macOS/Windows are currently failing.
Fix: run bun install locally (without --frozen-lockfile) and commit the updated bun.lock alongside the package.json change. That will both make CI pass and ensure downstream bun compile builds embed the v1 copy of yaml/types deterministically (which is the whole point of the fix).
Once the lockfile is regenerated, it's worth spot-checking the bun.lock diff to confirm the toolkit-lib yaml entry is pinned to a 1.x version — that verifies the override actually took effect rather than silently being ignored.
be50d65 to
d93c63bComparenotgitika
commented
Aug 26, 2026
forgot to commit bun.lock earlier just added it |
Claude Security Review: no high-confidence findings. (run) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## refactor #2122 +/- ##
=========================================
Coverage 97.41% 97.41% =========================================
Files 453 453 Lines 27637 27637 =========================================
Hits 26922 26922 Misses 715 715 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
notgitika
commented
Aug 26, 2026
CI windows failure seems like it's from the branch but let me confirm |
…solution
@aws-cdk/toolkit-lib's yaml-cfn.js does require("yaml/types") at import
time, a subpath that only exists in yaml v1. When an install topology
resolves toolkit-lib's yaml to the hoisted yaml v2 (whose exports map
blocks ./types), the module fails to load with
ERR_PACKAGE_PATH_NOT_EXPORTED ("Cannot find module 'yaml/types'").
This bites bun compile, which inlines toolkit-lib and embeds whatever
the build machine resolves.
Add a nested override forcing toolkit-lib's yaml to ^1 so it always
resolves the v1 nested copy that ships yaml/types.d93c63b to
367f995CompareClaude Security Review: no high-confidence findings. (run) |
Hweinstock
left a comment
There was a problem hiding this comment.
makes sense. I'm not still not fully clear on why its resolving in the wrong version if its pinned here https://github.com/aws/aws-cdk-cli/blob/02523f01b0a45a04582628ef3cd53160a3287032/packages/%40aws-cdk/toolkit-lib/package.json#L132, but I guess its because its not bundled in, so it tries to pull it in at runtime via require which doesn't check the version.
notgitika
commented
Aug 27, 2026
Yeah, |
Uh oh!
There was an error while loading. Please reload this page.
bun 1.4.0 — which CI installs via the unpinned setup-bun@v2 — records nested package.json overrides in the lockfile and refuses frozen installs when they are missing, so every CI job fails with "lockfile had changes, but lockfile is frozen" (the base refactor branch's own CI run on 2026-08-31 fails the same way; runs from 2026-08-28 under the previous bun were green). The bun that last saved this lockfile predated nested-override recording and silently dropped the @aws-cdk/toolkit-lib yaml pin from #2122. Regenerated with bun 1.4.0. The only changes are lockfileVersion 1 -> 3 and the recorded override block — zero resolution changes ("Checked 766 installs across 703 packages (no changes)"). The full CI gate passes under bun 1.4.0: frozen install, 2513 tests, tsc, oxlint, prettier. Note: lockfileVersion 3 requires bun >= 1.4.0 for lockfile-honoring installs; older bun prints "Ignoring lockfile" (it cannot represent the nested override either way, so there is no lockfile both versions accept). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfADH54TZn2SSGUUixft8P
What
Add a nested
overridesentry forcing@aws-cdk/toolkit-lib'syamldependency to^1.Why
@aws-cdk/toolkit-lib'syaml-cfn.jsdoesrequire("yaml/types")at import time — a subpath that only exists inyamlv1.yaml@2(pulled transitively, e.g. via thelint-stageddevDep) has anexportsmap that does not expose./types, so any install topology that resolves toolkit-lib'syamlto the hoisted v2 fails to load the module with:This is especially dangerous for
bun compile, which inlines toolkit-lib (onlybundle()marks it external) and embeds whateveryaml/typesthe build machine resolves.Fix
Guarantees toolkit-lib always resolves the nested
yaml@1copy (which shipstypes.js).Testing
require.resolve('yaml/types')from toolkit-lib resolves to the v1 nested copy under bothnodeandbun.ERR_PACKAGE_PATH_NOT_EXPORTED) and confirmed the override prevents it.project deploy(CDK synth + CloudFormation) exercised end-to-end after the change.