Skip to content

test(opencode): guard patched dependency versions - #46673

Merged
rekram1-node merged 2 commits into
devfrom
patch-version-guard
Sep 1, 2026
Merged

rekram1-node merged 2 commits into
devfrom
patch-version-guard

Conversation

@rekram1-node

Copy link
Copy Markdown
Contributor

Why

Bun applies a patchedDependencies patch only to the exact name@version in its key. If the dependency is bumped and the patch isn't regenerated, bun install does not fail; the patch silently stops applying and whatever it fixed is gone at runtime.

This isn't hypothetical. @ff-labs/fff-bun was bumped to 0.9.4 in #31583 (June) while its patch stayed keyed to 0.9.3, so it has been a no-op since; bun.lock doesn't even list it. #46653 nearly hit the same thing when dev bumped @ai-sdk/amazon-bedrock under it, which is what prompted this.

What

  • Remove the dead fff-bun@0.9.3 patch entry. No runtime change: 0.9.3 isn't installed anywhere.

  • Add test/patched-dependencies.test.ts. For every key in root patchedDependencies, assert the patch file exists and that the version resolved under packages/opencode/node_modules and packages/core/node_modules (the packages that ship in the CLI) equals the key's version. One test per patch so the failure names the offender:

    error: packages/opencode resolves @ff-labs/fff-bun@0.9.4; patch is for 0.9.3
    

Pure filesystem reads against package.json files; no network, no timers, nothing to flake.

Patches for transitive-only deps (pacote, gcp-metadata, @npmcli/agent, …) aren't linked into those two workspaces and so are only checked for the patch file existing.

The dependency moved to 0.9.4 in #31583 but the patch stayed keyed to 0.9.3,
so bun has not applied it since; only 0.9.4 is in the lockfile. Remove the
dead entry.
bun applies a patch only to the exact name@version in patchedDependencies.
A bump without regenerating the patch does not fail install; the patch just
stops applying. Assert that for packages/opencode and packages/core the
installed version of every patched dependency matches its patch key.
@rekram1-node
rekram1-node merged commit c066339 into dev Sep 1, 2026
11 checks passed
@rekram1-node
rekram1-node deleted the patch-version-guard branch September 1, 2026 19:59
filipeforattini added a commit to reddb-io/redcode that referenced this pull request Sep 5, 2026
filipeforattini added a commit to reddb-io/redcode that referenced this pull request Sep 5, 2026
rossigee pushed a commit to rossigee/opencode that referenced this pull request Sep 18, 2026
rldona pushed a commit to rldona/FlupCode that referenced this pull request Sep 24, 2026
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant