Skip to content

fix(infra): enforce -boon.N correction floors in plugin API compat matcher - #347

Merged
convyusboy merged 1 commit into
boonfrom
eng-23072-pluginapi-boon-correction-floor
Nov 29, 2026
Merged

convyusboy merged 1 commit into
boonfrom
eng-23072-pluginapi-boon-correction-floor

Conversation

@convyusboy

@convyusboy convyusboy commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Closes ENG-23072

What Problem This Solves

Found during review of #341 (cubic-dev-ai, extensions/tlon/package.json:76), which bumped every bundled plugin's compat.pluginApi floor from -boon.2 to -boon.3. A bundled plugin's compat.pluginApi floor pinned to a specific -boon.N fork correction (the shape pnpm plugins:sync writes on every fork version bump) was not actually enforced against an older fork host. A host running 2026.7.35-boon.2 would incorrectly satisfy a >=2026.7.35-boon.3 floor and load a plugin that declared it needed the newer correction, because the host's -boon.N suffix was being stripped before the comparison regardless of what the floor itself required.

Why This Change Was Made

satisfiesPluginApiRange → satisfiesComparator → normalizePluginApiVersionForComparator (src/infra/clawhub.ts) called normalizeOpenClawNumericCorrectionForPluginApi unconditionally on the host's running version, stripping any -boon.N down to the bare YYYY.M.PATCH before comparing against the floor. Because standard semver ranks a bare release above any prerelease of the same base, 2026.7.35 >= 2026.7.35-boon.3 evaluated true.

The fix adds comparePluginApiVersionToTarget, which special-cases a correction-pinned comparator target (-boon.N or upstream numeric -N) to rank both sides with the fork's existing compareOpenClawReleaseVersions release ordering (src/infra/npm-registry-spec.ts, already used by update-check.ts) instead of plain semver — a correction outranks its bare base there. Non-correction targets keep the prior suffix-normalizing semver path unchanged. Both the >=/operator comparator and the caret (^) range's lower bound now go through it; the caret's upper bound (always a bare bumped version, never correction-pinned) deliberately keeps normalizing against base exactly as before, to avoid a stripped-prerelease edge case at the next-major boundary.

The fix is symmetric: a bare upstream host (no -boon.N at all) now also correctly fails a correction-pinned floor, matching the fork's own release ranking where a correction outranks the bare base.

Out of scope (recorded here per review, not fixed in this PR):

  • satisfiesGatewayMinimum (clawhub.ts) has the same class of defect (parseSemver drops the prerelease entirely), but minGatewayVersion only ever arrives from remote ClawHub compatibility metadata and is set in no manifest in this repo, so it cannot carry a fork suffix in practice.
  • Plugin package version ordering (src/plugins/install.ts, src/plugins/update.ts) uses raw compareComparableSemver with the same bare-above-correction skew, but that's a different decision surface (plugin artifact versions, not host compat).

User Impact

A host older than a bundled plugin's declared -boon.N floor now correctly fails to load that plugin instead of silently loading it. In practice, since scripts/sync-plugin-versions.ts writes >=<root version> into every bundled manifest in the same run that bumps the host version, floor and host version are equal on every release today, so this only changes behavior for hosts that have fallen behind the bundled plugin versions they ship with.

Evidence

  • node scripts/run-vitest.mjs src/infra/clawhub.test.ts — 70/70 passed (8 new correctness assertions for the ticket's test plan, 3 new edge-case regression assertions for the caret-range fix).
  • node scripts/run-vitest.mjs src/plugins/install.test.ts src/plugins/discovery.test.ts src/plugins/update.test.ts src/plugins/manifest-registry.test.ts — 368/368 passed (all consumer call sites of satisfiesPluginApiRange).
  • node scripts/run-vitest.mjs src/plugins/clawhub.test.ts — 79/79 passed.
  • oxfmt --check and node scripts/run-oxlint.mjs clean on both touched files.
  • Two rounds of /code-review (medium): first round caught a real edge-case regression in my own initial fix (the caret upper bound's normalization basis), which was corrected and locked in with a regression test; second round came back clean except one accepted efficiency nit (a cheap duplicate regex normalization call, not worth the added complexity to dedupe).
  • Blacksmith Testbox was unavailable in the authoring environment (blacksmith CLI missing, confirmed via crabbox doctor); tests were run via the narrow local fallback (node scripts/run-vitest.mjs) per policy after a one-time pnpm install.

🤖 Generated with Claude Code


Summary by cubic

Fixes the plugin API compatibility matcher so a host running an older -boon.N fork correction no longer satisfies a plugin floor that requires a newer correction. Previously the matcher stripped the host's correction suffix before comparing, so a 2026.7.35-boon.2 host could pass >=2026.7.35-boon.3 because plain semver ranks the bare release above any prerelease of the same base.

Correction-pinned floors now compare with the fork's release ordering, where a correction outranks its bare base, and a bare host without any correction now also correctly fails a correction-pinned floor. Non-correction floors and the caret upper bound keep the previous suffix-normalizing semver path unchanged.

Closes ENG-23072.

Written for commit 3720d21. Summary will update on new commits.

View guided diff Turn on auto-fix

…matcher

`satisfiesPluginApiRange` unconditionally stripped the host's `-boon.N`
fork-correction suffix before comparing it to a plugin's declared
`compat.pluginApi` floor. Since plain semver ranks a bare release above
any prerelease of the same base, a `2026.7.35-boon.2` host normalized to
`2026.7.35` and incorrectly satisfied a `>=2026.7.35-boon.3` floor, so a
bundled plugin's correction-pinned floor (as `pnpm plugins:sync` writes
on every fork version bump) was never actually enforced against an
older fork host.

Route any correction-pinned comparator target (`-boon.N` or upstream
numeric `-N`) through the existing `compareOpenClawReleaseVersions` fork
release ordering instead of plain semver, where a correction outranks
its bare base. Falls back to the prior suffix-normalizing semver path
for non-correction targets.

Found during review of #341 (cubic-dev-ai).

Closes ENG-23072

Co-Authored-By: Claude Sonnet 5 <[email protected]>

@boon-hermes-bot boon-hermes-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — code verdict for 3720d217db7ef8051c677f044e2288ccc9e66065 (base 766c304c9a6bfe629be39cdad05d23c4b3cb6170).

No actionable code findings. Correction-pinned plugin API floors now use the existing fork release ordering, while other targets retain the prior suffix-normalizing semver path. The regression coverage exercises older/current/newer and bare hosts, upstream numeric corrections, caret lower bounds, and the caret upper-bound edge case.

Focused exact-head tests:

  • node scripts/run-vitest.mjs src/infra/clawhub.test.ts — 68 passed, 2 skipped.
  • node scripts/run-vitest.mjs src/plugins/install.test.ts src/plugins/discovery.test.ts src/plugins/update.test.ts src/plugins/manifest-registry.test.ts — 368 passed.
  • node scripts/run-vitest.mjs src/plugins/clawhub.test.ts — 79 passed.

Hosted exact-head check runs: 152 total (success: 118, skipped: 32, neutral: 2; none failed or pending). CI workflow run #46285429946 completed successfully.

Merge gates are separate: the active branch rules require 1 approving review(s) and signed commits; 1 PR commit(s) are GitHub-verified. Classic branch-protection details were not readable by this integration (HTTP 403), so additional required-check contexts and merge readiness remain unverified. No auto-merge request or merge-queue membership was active at review time. This review does not merge the PR.

@convyusboy
convyusboy merged commit 4009b0e into boon Nov 29, 2026
153 checks passed
@convyusboy
convyusboy deleted the eng-23072-pluginapi-boon-correction-floor branch November 29, 2026 18:39
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