Skip to content

Let a plugin manifest name the oldest Buzz it runs on - #4264

Draft
BurningMoneySlowly wants to merge 2 commits into
mainfrom
tylerg/plugin-min-buzz-version
Draft

BurningMoneySlowly wants to merge 2 commits into
mainfrom
tylerg/plugin-min-buzz-version

Conversation

@BurningMoneySlowly

@BurningMoneySlowly BurningMoneySlowly commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Why

Today a plugin has to stay compatible with every Buzz build it might be installed on. Nothing stops an older Buzz from installing a plugin, or updating to a version of it, that uses host features that older build doesn't have. So authors feature-detect each capability (ctx.host?.runCommand?.(...), "On Buzz 0.7.19 and later…") and keep fallbacks around indefinitely.

This is a proposal: let a plugin release say which Buzz it needs, so it can drop that compatibility code instead of carrying it.

What

  • Manifest field. A manifest can set an optional "minBuzzVersion": "1.2.0". validate accepts only a plain MAJOR.MINOR.PATCH (no ranges, prereleases or v prefix).
  • Version source. The desktop passes its own version (context.package_info().version, which release builds set via --config candidate.json) to the plugin Manager with with_buzz_version.
  • Gate. install_artifact_if, which every install and update path goes through (folder, Git and URL imports, and automatic managed updates), reload and rollback refuse a plugin whose minBuzzVersion is newer than the running Buzz. The error is "Example needs Buzz 1.5.0 or later, and this is Buzz 1.4.0. Update Buzz to install it." The installed copy stays where it is.
  • Prereleases. A prerelease counts as its release: 1.5.0-preview.3 and 1.5.0-beta.1 satisfy 1.5.0.
  • CLI and dev builds. buzzodz passes no version and refuses nothing. Dev builds (tauri::is_dev()) don't pass one either, because they report tauri.conf.json's version, not the release they become.

Older Buzz builds

The manifest is parsed with deny_unknown_fields, so a Buzz from before this change already rejects a manifest that sets minBuzzVersion. The gate fails closed on old builds too; they just show an "unknown field" error instead of the friendly one.

Why the check isn't in Manifest::validate

Manager::read runs validate() on every installed manifest and fails the whole registry if one fails. If the version check lived there, downgrading Buzz below a plugin's minimum would stop every plugin from loading. So validate checks only the field's syntax, and the version comparison runs only when new bytes come in.

Open questions for maintainers

  1. Field shape. minBuzzVersion is a flat string. Something like "requires": { "buzz": "1.2.0" } would leave room for other requirements later. I went with the smallest shape.
  2. Prereleases. Should a prerelease count as its release? Strict semver says no (1.5.0-preview.3 < 1.5.0). But previews are "one patch above the highest stable", so under strict semver, preview users couldn't install plugins that need features they already have. The cost is that an early preview of 1.5.0 built before the feature landed would also pass.
  3. After a downgrade. A plugin installed under a newer Buzz still loads after a downgrade, though rolling back to a revision that needs a newer Buzz is refused. Refusing it there would need a non-fatal "unavailable" state in the catalog, which seems like more than this needs.
  4. Showing it before the click. Import previews and managed "update available" entries don't check the version yet, so the error only shows when the person tries to install. A follow-up could check in the import preview and mark managed entries as needing a newer Buzz.
  5. api.ts is FOUNDATION. This adds one optional field (minBuzzVersion?: string) to PluginManifest, the public plugin contract. It needs a maintainer's explicit go-ahead.

Tests

New tests in crates/plugin-manager/src/lib.rs:

  • min_buzz_version_is_a_release_version_and_absent_by_default: old manifests round-trip without the field; valid and invalid version strings.
  • app_versions_compare_by_release_and_prereleases_count_as_their_release: ordering (including 1.9.9 vs 1.10.0), prerelease handling, and the error text.
  • a_plugin_that_needs_a_newer_buzz_is_not_installed_updated_or_reloaded: a refused install leaves nothing installed. A refused update or reload keeps the current revision. A newer Buzz installs it, and the older manager still lists it afterwards.
  • a_rollback_to_a_version_that_needs_a_newer_buzz_is_refused: a rollback after a downgrade is refused and keeps the current revision. It fails without the fix.

Checks run at 388c38dda:

  • cargo test -p buzzodz-plugins: 140 lib tests plus the integration suites pass.
  • cargo clippy -p buzzodz-plugins --all-targets: clean.
  • cargo check -p Buzz: compiles.
  • pnpm typecheck: passes.

Not tested in the running app.

Docs

  • docs/plugin-authoring-guide.md (contract rules): describes the field.
  • docs/plugins.md: points to it.
  • docs/managed-plugins.md: what happens when a policy pins a version that needs a newer Buzz.

🤖 Generated with Claude Code

A plugin that starts using a host feature has to keep working on every
Buzz that lacks it, by feature-detecting each one, because nothing stops
an older Buzz from installing or updating to it.

A manifest can now set "minBuzzVersion": "1.2.0". The desktop tells the
plugin manager its own version, and an install, update or reload to a
plugin that needs a newer Buzz is refused with a message naming both
versions; an installed copy stays where it is. A prerelease counts as its
release. A Buzz from before this field already refuses such a manifest as
an unknown key.

The check is not part of Manifest::validate, which runs on every
installed plugin each time the registry is read, so a plugin installed
before a downgrade does not stop the others from loading. The buzzodz CLI
passes no version and refuses nothing.

Co-authored-by: Swiper <24077d5cda8e7e757be4b5e182ef5a8daf7c0447eb339cbf9c3d148fbcc8ecfa@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tyler Green <tylerg@squareup.com>
Review feedback on the minBuzzVersion gate:

- A rollback switched to the previous revision without checking its
  minBuzzVersion, so after a Buzz downgrade it could restore a version
  that a fresh install refuses. It is now checked like an install.
- A dev build reports tauri.conf.json's version rather than the release
  it becomes, so a plugin naming that release could not be installed in
  its own author's dev build. Dev builds now check no minBuzzVersion.

Co-authored-by: Swiper <24077d5cda8e7e757be4b5e182ef5a8daf7c0447eb339cbf9c3d148fbcc8ecfa@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tyler Green <tylerg@squareup.com>
@BurningMoneySlowly

Copy link
Copy Markdown
Contributor Author

🤖 Addressed the two P2 findings from the sq agents review run (code-review-28d492650ec2) in 388c38d:

  • Rollback bypassed the gate (crates/plugin-manager/src/lib.rs): rollback now calls check_buzz_version on the previous revision's manifest before changing anything, so after a Buzz downgrade it can't restore a version a fresh install would refuse. New test a_rollback_to_a_version_that_needs_a_newer_buzz_is_refused (it fails without the fix).
  • Dev builds checked against the stale tauri.conf.json version (src-tauri/src/lib.rs): dev builds (tauri::is_dev()) no longer pass a version to the plugin manager, so they check no minBuzzVersion. The authoring guide says so.

The review posted no inline threads here, so there's nothing to resolve on GitHub.

This branch has not been deployed

No deployments
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