Repository navigation
Omit the default plugin install selection from SDK requests - #1802
SawyerHood merged 3 commits into
Conversation
|
🚨 |
| }); | ||
| // The response is a stub, so response parsing may throw; only the request | ||
| // body matters here. | ||
| await sdk.plugins.install(args).catch(() => undefined); |
There was a problem hiding this comment.
🚨 slopcop/review — This catch hides a real legacy response failure after a successful install.
A version 0.37 server omits publisherLabel, but the current installed-plugin schema requires it.
The SDK then throws after the server installs the plugin.
The CLI reports failure after a successful change.
Return a realistic version 0.37 response and require this call to resolve.
Default the missing direct-install label to null, or add version negotiation before the POST.
There was a problem hiding this comment.
Fixed in the follow-up commit: installedPluginSchema.publisherLabel now defaults to null when a response omits it (same pattern as the capabilities default), and the test returns a full 0.37.x plugin response and requires sdk.plugins.install to resolve instead of catching the error. The test fails without the default (expected string, received undefined at plugin.publisherLabel) and passes with it. PR body updated to say what the fix covers.
There was a problem hiding this comment.
🚨 SLOP COP 🚨 · review
Plain-English summary
This PR removes a default plug-in choice from install requests.
Older servers reject that extra choice.
Explicit subdirectory and collection choices still go to the server.
Finding
High: The compatibility test hides a response error after the server completes the install.
The current SDK requires publisherLabel, but version 0.37 servers do not return it.
Thus, the CLI can report failure after a successful install.
The PR body notes this gap, but Fixes #1662 still overstates the result.
See the inline comment.
Review results
- Security: I found no new security issue.
- Performance: I found no new loop, I/O, cache, or retained-state cost.
- Architecture: I found no duplicate selection helper or useful shared refactor.
- Tests: The SDK type check and all 92 SDK tests passed.
- Tests: All 17 focused CLI tests and all 20 focused app tests passed.
- Browser test: The local app did not start within the review window.
- Browser test: Its plug-in SDK declaration build did not finish, so I stopped the local process.
The SDK sent selection: { kind: "root" } on every plugin install, even
when the caller asked for a plain root install. Servers older than
bb-app 0.38.0 validate POST /api/v1/plugins/install with a strict
{ source }-only schema, so a newer CLI got HTTP 422 'expected { "source":
string }' while a hand-written curl succeeded. The server already
defaults selection to root, so the SDK now sends selection only when the
caller sets --plugin or --subdirectory.
Fixes #1662
Co-Authored-By: Claude <[email protected]>
A bb-app 0.37.x server installs the plugin, then answers with the 0.37.x installed-plugin shape, which has no publisherLabel. The SDK required that field and threw after the server had applied the change, so the CLI reported a failure after a successful install. The contract now defaults a missing publisherLabel to null, and the #1662 repro test requires the legacy round trip to resolve instead of swallowing the error. Co-Authored-By: Claude <[email protected]>
c352606 to
a06ff85
Compare
Co-Authored-By: Claude <[email protected]>
What was wrong
bb plugin install <path>builds its request through@bb/sdk. Since fc34548 (#1579, first shipped in bb-app 0.38.0) the SDK sentselection: { kind: "root" }on every install, even a plain root install where the server defaults the selection to root anyway. Servers released before that commit (bb-app <= 0.37.x) validatePOST /api/v1/plugins/installwith a strict{ source }-only schema, so a >= 0.38.0 CLI against a <= 0.37.x server gotHTTP 422: expected { "source": string }, while a hand-writtencurl -d '{"source": ...}'succeeded against the same server. The SDK filled a server-owned default on the client, which broke forward compatibility with strict schemas.What changed
packages/sdk/src/areas/plugins.ts:pluginSourceSelectionreturnsundefinedfor a root install. The SDK sendsselectiononly when the caller sets--pluginor--subdirectory. The body still passes throughpluginInstallSourceRequestSchema.parsefor validation, but the SDK sends the caller-set keys, not the parsed output with the filled default.packages/server-contract/src/api/plugins.ts:installedPluginSchema.publisherLabeldefaults tonullwhen a response omits it. A 0.37.x server installs the plugin and then answers with the 0.37.x plugin shape, which has nopublisherLabel; the SDK used to throw on that response after the server had already applied the change. Same pattern as the existingcapabilitiesdefault in that schema.packages/sdk/test/plugin-install-body.test.ts: new repro test. It mimics a 0.37.x server (strict{ source }request, 0.37.x plugin response) and requires the root install round trip to resolve, and asserts the request body. It fails before the change and passes after.packages/sdk/test/sdk.test.ts,apps/cli/src/__tests__/command-output/plugin-catalog.test.ts,apps/app/src/hooks/queries/plugin-catalog-queries.test.ts, andapps/app/src/components/plugin/management/AddPluginDialog.test.tsx.No route or request fields change; the only contract change is the response-side
publisherLabeldefault. No server/daemon wire change, soHOST_DAEMON_PROTOCOL_VERSIONstays the same. No CLI flags change.Verification
pnpm exec turbo run test --filter=@bb/sdk -- plugin-install-body-> 1 failed (a plain root install sends only { source }), 1 passed.publisherLabeldefault): 1 failed (Invalid input: expected string, received undefinedatplugin.publisherLabel).pnpm exec turbo run typecheck test --filter=@bb/server-contract --filter=@bb/sdk --filter=@bb/cli --force-> typecheck clean, server-contract 57/57, sdk 93/93, cli 450/450 passed.@bb/serverand@bb/apptypecheck clean.pnpm exec turbo run typecheck test --filter=@bb/cli --force-> typecheck clean, 49 files / 450 tests passed.pnpm exec turbo run typecheck --filter=@bb/app --force-> clean;pnpm exec turbo run test --filter=@bb/app -- plugin-catalog-queries AddPluginDialog-> 2 files / 20 tests passed.Scope
This PR fixes the reported failure: a >= 0.38.0 CLI can now install a plugin on a <= 0.37.x server, and the response parses. The report also proposes a general CLI-side version-skew warning (compare
GET /api/v1/system/versionwith the CLI version). That is a separate change and is not in this PR; other newer-CLI-vs-older-server paths are not covered here.Fixes #1662
Report: https://get-bb.github.io/reports/issues/1662.html