Skip to content

Offer plugin releases outside the saved version range and let the user take them - #7216

Merged
ymichael merged 3 commits into
mainfrom
bb/5570-plugin-updates-outside-the-installed-range-thr_w4dqfgknn7
Nov 9, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/5570-plugin-updates-outside-the-installed-range-thr_w4dqfgknn7

Conversation

@ymichael

@ymichael ymichael commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb copies a plugin's semver range into the installed row at install time (plugins.source_git_range / source_npm_requested_spec), and every later update check resolves only inside that copy (update-resolver.ts filters tags by the saved range). Nothing re-reads the catalog. So a release outside the range never reaches existing installs. That covers a new 0.x minor under ^0.y.z (367 of 420 bb-community entries), a new major, and every release a catalog range bump admits. The check also answers current, with no hint that anything newer exists. The marketplace audit counted 26 stale entries covering about 1,487 installs. Users only got the release by removing and reinstalling, which deletes settings, secrets and schedules. Issue: #5570.

What changed

Behaviour decided

  • Every update check now also reports a rangeUpgrade for git semver and npm range sources: one newer stable release outside the saved range.
  • Marketplace installs follow the catalog. A plugin installed from a marketplace entry is offered only a release that the entry's current range admits, and that range is the one proposed. This applies only while the entry still names the same repository, subdirectory and tag prefix (or the same npm package). The catalog stays the review gate, so stray tags are never offered: office-viewer's old v0.9.0 and kilocode's inherited OpenCode v0.2.0 from the audit are examples.
  • Other installs (direct installs, or a plugin whose marketplace was removed) are offered their newest stable release, with ^<version> proposed. A plugin its marketplace no longer lists is offered nothing; --range still takes any release explicitly.
  • Pinned sources (exact npm versions, git tags and commits) are never offered one.
  • Nothing is applied automatically. Taking the release is always an explicit range change. bb plugin update --all and Settings → Updates' Update all skip these releases. The engines/SDK checks are unchanged. A candidate that fails them is reported with its reasons and cannot be taken, and bb falls back to an older compatible out-of-range release when there is one.
  • Apply gains range and expectedVersion. The range change uses the existing staged activation, state snapshot and rollback. A failed activation restores the previous release and the previous range and source, and keeps enabled state, settings and data. bb refuses:
    • pinned sources;
    • ranges that admit nothing newer;
    • downgrades;
    • a release other than the one the user reviewed. The refusal names both releases by version and saves a fresh check, so the details panel offers the new release instead of the stale one.
  • breaking follows the caret rule from the installed version: a new major, or a new minor on 0.x. It is shown as a warning and is not a gate, because every out-of-range release already needs the user.

Server

  • apps/server/src/services/plugins/update-resolver.ts:
    • rangeUpgradeCandidates and isBreakingUpgrade;
    • git and npm range-upgrade selection that reuses the tag list or packument the check already fetched;
    • at most 3 compatibility probes, through the existing probe cache.
  • plugin-updates.ts:
    • the entry carries rangeUpgrade;
    • applyUpdate(id, { range, expectedVersion }), including the downgrade and reviewed-release guards;
    • a preview made under a proposed range is never persisted;
    • an out-of-range offer survives a normal in-range update.
  • managed-plugin-artifacts.ts: git activation can write the new canonical source string.
  • plugin-service.ts picks the basis per row. catalogRangeForInstalledSource lives in marketplace-manifest.ts.
  • routes/plugins.ts: POST /plugins/:id/update accepts { range?, expectedVersion? }.

Contract and SDK

  • pluginRangeUpgradeSchema, on both check entries and updateState.
  • pluginApplyUpdateRequestSchema gains range and expectedVersion.
  • PluginBbSdk.plugins.applyUpdate and experimental_startUpdate take PluginApplyUpdateArgs.
  • Plugin SDK bumped to 0.6.134.
  • Added an entry to docs/api_to_audit.md and a bullet to the Plugin Guide bb-sdk surface.

CLI

  • bb plugin outdated marks the status current · 0.3.0 outside range and prints a note with the exact command, e.g. range-demo: 0.3.0 is outside your saved range ^0.2.0. It may include breaking changes. Review it with `bb plugin update range-demo --range '^0.3.0'`. bb plugin update <id> prints the same note.
  • New bb plugin update <id> --range <range>:
    • it shows from → to and both ranges, plus a breaking-change warning;
    • it asks for confirmation (--yes skips it);
    • when you take the offered range, it sends expectedVersion.

bb guide plugins documents all of this.

UI

  • Plugin details show 0.3.0 is available outside the version range ^0.2.0 this plugin follows. [The marketplace now lists …] It may include breaking changes, so bb won’t install it until you review it. next to a Review action.
  • The installed-list row shows the update badge.
  • Both open the update dialog: "Update X to 0.3.0?". The dialog names the current and new range, warns about breaking changes, shows the compatibility check and the rollback note, and has an Update to 0.3.0 button.

There is no daemon wire change, so HOST_DAEMON_PROTOCOL_VERSION is unchanged. This PR doesn't port the rollback-to-a-replaced-release work from the closed #6044.

How you verified

Tests added

  • update-resolver.test.ts, against real git repositories:
    • a direct install is offered ^2.0.0 as breaking;
    • catalog basis: only what the catalog range admits, and nothing when the catalog range is unchanged;
    • fallback to an older compatible release when the newest is blocked, and a blocked-only offer that carries its reasons;
    • npm range upgrade.
  • plugin-update.test.ts, through the real service:
    • discovery;
    • plain apply stays current;
    • an expectedVersion mismatch refuses and changes nothing;
    • a reviewed range change rewrites source, range, tag and commit and keeps the plugin disabled;
    • a downgrade is refused;
    • a failing activation rolls back to the old source, range and tag.
    • a release tagged after review is refused, and the saved offer moves to it;
    • a plugin its marketplace stops listing is offered nothing.
  • marketplace-manifest.test.ts: the catalog range is followed only for the same URL, subdirectory and tag prefix.
  • CLI: outdated note and incompatible note; --range request body; --all does not apply it.
  • App: the dialog sends { range, expectedVersion }, and the details Review and status show for a compatible release but not for an incompatible one.

Local commands (targeted only; CI runs the full suites)

  • pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/app --filter=@bb/cli --filter=@bb/sdk
  • turbo run lint on the touched packages: 0 errors.
  • Vitest:
    • server: update-resolver, plugin-update, marketplace-manifest, 83 tests;
    • CLI: plugin-updates, 15;
    • app: UpdatePluginDialog, PluginUpdatesCard, plugin-status, InstalledPluginsTab, 33.
  • turbo run test for @get-bb/plugin-sdk, @bb/sdk, @bb/templates, @bb/server-contract and the Plugin Guide.

Live, on an isolated pnpm start:worktree instance, with a local git repo tagged v0.2.2 and v0.3.0:

  • installing @semver:^0.2.0 and then running bb plugin outdated printed the note above;
  • the plugin page showed the status line and Review;
  • the dialog's Update to 0.3.0 moved the plugin to ^0.3.0 at v0.3.0, and the next check was clean.

I then tagged v1.0.0:

  • bb plugin update range-demo --range '^1.0.0' --yes printed now follows ^1.0.0; updated and activated …v0.3.0 → …v1.0.0;
  • --range '^0.2.0' was refused with ^0.2.0 resolves to 0.2.2, which is not newer than the installed 1.0.0; bb does not downgrade plugins.

The live run caught that PluginDetail gated the section on in-range fields only; the second commit fixes that.

Fixes #5570

🤖 Generated with Claude Code

AGENT GENERATED

ymichael and others added 3 commits November 6, 2026 16:54
…r take them

bb saves a marketplace plugin's semver range at install and resolves every
later update inside it, so a release outside that range (a new 0.x minor, a
new major, or anything a catalog range bump admits) never reached existing
installs. Update checks reported "current" with no hint that a newer release
existed.

Update checks now also report a rangeUpgrade for git semver and npm range
sources: one newer stable release outside the saved range, the proposed
range, whether it may break (caret rule), and engine problems if it cannot
run on this bb. Marketplace installs are offered only what the entry's
current range admits, and that range is proposed, so the catalog stays the
review gate; other installs get their newest release with ^<version>.

Taking it is always explicit: applyUpdate/experimental_startUpdate accept
range and expectedVersion, and POST /plugins/:id/update forwards them. The
range change rides the existing staged activation, snapshot, and rollback,
so a failed activation restores the old release and range. bb refuses pinned
sources, ranges with nothing newer, downgrades, and a release other than the
one reviewed. --all and Update all never take a range change.

Surfaces: bb plugin outdated notes the release and the exact command;
bb plugin update <id> --range <range>; plugin details and the installed list
show a Review action whose dialog names both ranges. Guide, Plugin Guide
surface, and API audit entry updated; plugin SDK bumped to 0.6.134.

Fixes #5570

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r none for delisted plugins

A range change refused because the reviewed release changed left the old
offer saved, so plugin details kept offering it and every retry was refused
again. Refused range changes now save a fresh check, and the refusal names the
reviewed and current releases by version instead of commit.

A plugin whose marketplace no longer lists it is no longer offered the
repository's newest release; --range still takes any release explicitly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 17c2018 into main Nov 9, 2026
50 checks passed
@ymichael
ymichael deleted the bb/5570-plugin-updates-outside-the-installed-range-thr_w4dqfgknn7 branch November 9, 2026 17:45
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.

Plugin updates: Notify users of out-of-range releases and allow safe version-range upgrades

1 participant