Repository navigation
fix(plugin): accept prereleases when checking engines.opencode - #27
Merged
Merged
Conversation
checkPluginCompatibility compared the build's own version against a plugin's
engines.opencode range with plain semver, under which a prerelease satisfies no
ordinary range. Measured:
1.18.32-swxtch.1 >=1.18.0 false
1.18.32-swxtch.1 ^1.18.0 false
1.18.31 >=1.18.0 true
1.18.32 >=1.18.0 true
Every build of this fork is versioned 1.18.32-swxtch.N, so ANY plugin
declaring engines.opencode was rejected here - with a message naming the
plugin rather than the version string that actually caused it. The same
misdirection as #16, which cost hours.
#21 offered two fixes and they are not equivalent. semver.coerce would turn
1.19.0-beta.1 into 1.19.0 and therefore SATISFY a plugin requiring >=1.19.0,
loading it against a build of a release that is not out yet. Measured both:
for that case coerce returns true and includePrerelease returns false.
includePrerelease removes the "prereleases match nothing" rule without
disturbing version ordering, so that is what this uses.
Tests cover both directions, including the case that distinguishes the two
fixes, plus the early returns that mean "cannot judge" rather than
"compatible". Mutation-verified: reverting to plain satisfies fails 4 of them;
switching to coerce fails exactly the one written to tell them apart.
Closes #21
Claude-Session: https://claude.ai/code/session_017iG7xA9wRvNyFYZSXm8inU
brentyates-swx
force-pushed
the
fix/21-prerelease-plugin-gate
branch
from
September 22, 2026 15:53
4f4b333 to
a1c1e64
Compare
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.
Closes #21
The defect
checkPluginCompatibility(packages/opencode/src/plugin/shared.ts) compared the build's own version against a plugin'sengines.opencoderange with plain semver, under which a prerelease satisfies no ordinary range:1.18.32-swxtch.1>=1.18.01.18.32-swxtch.1^1.18.01.18.31>=1.18.01.18.32>=1.18.0Every build of this fork is versioned
1.18.32-swxtch.N, so any plugin declaringengines.opencodewas rejected here — and the message named the plugin:That is the same misdirection as #16, where a fork version string broke a gate that assumed an upstream release string, and the message pointed away from the cause.
Why
includePrereleaseand notsemver.coerce#21 offered both, and they are not equivalent. The case that separates them is a prerelease of the very version a plugin requires:
Measured, not reasoned about.
coercediscards prerelease ordering and is more permissive in exactly the case where strictness matters.includePrereleaseremoves the "prereleases match nothing" rule and leaves ordering alone, so it is what this uses.Tests
Added to
packages/opencode/test/plugin/shared.test.ts, which previously had no coverage of this function at all:>=1.18.0,^1.18.0,>=1.18.0 <2.0.0,1.xengines, a non-recordengines, a non-string range — all of which mean "cannot judge", not "compatible"Mutation-verified: reverting to plain
satisfiesfails 4 of these; switching tocoercefails exactly the one written to tell the two fixes apart. Three consecutive clean runs of the file.🤖 Generated with Claude Code
https://claude.ai/code/session_017iG7xA9wRvNyFYZSXm8inU