Skip to content

Fix Add a machine RPC input validation - #834

Merged
SawyerHood merged 2 commits into
mainfrom
bb/bb-76-fix-add-a-machine-rpc-input-validation-fai-thr_yqb7t42bya
Jul 21, 2026
Merged

SawyerHood merged 2 commits into
mainfrom
bb/bb-76-fix-add-a-machine-rpc-input-validation-fai-thr_yqb7t42bya

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #833

Summary:

  • Send JSON null for the connect createMachineCode RPC, matching its z.null() contract.
  • Parse the structured RPC error envelope so an unpaired/local server falls back to direct enrollment instead of surfacing not_paired.
  • Add focused AddMachineDialog coverage for both a paired machine-code command and the real unpaired error shape.
  • Leave the CLI join-code path and connect plugin contract unchanged.

Root cause:

The host Settings dialog calls plugin RPC through the generic @bb/sdk transport, not the contract-typed plugin useRpc hook. A stale empty-object payload therefore compiled but was rejected by the server before the handler ran.

Live QA also found that the intended unpaired fallback checked BbHttpError.code === "not_paired", while plugin handler failures use envelope code handler_error and carry not_paired in the structured error message. The dialog now validates that boundary payload before using it.

Validation:

  • pnpm exec turbo run test --filter=@bb/app --force -- src/components/dialogs/AddMachineDialog.test.tsx
  • pnpm exec turbo run typecheck --filter=@bb/app
  • pnpm exec turbo run test --filter=bb-plugin-connect --force
  • pnpm exec turbo run typecheck --filter=bb-plugin-connect
  • pnpm exec turbo run build --filter=@bb/app
  • pnpm exec turbo run lint --filter=@bb/app (passes with 129 existing warnings)
  • Live browser QA against an unpaired dev server: the dialog renders the direct installer command and expiry countdown.

@SawyerHood
SawyerHood force-pushed the bb/bb-76-fix-add-a-machine-rpc-input-validation-fai-thr_yqb7t42bya branch from 33db255 to 3c9af6f Compare July 21, 2026 15:32
@SawyerHood
SawyerHood merged commit 260edc4 into main Jul 21, 2026
10 checks passed
@SawyerHood
SawyerHood deleted the bb/bb-76-fix-add-a-machine-rpc-input-validation-fai-thr_yqb7t42bya branch July 21, 2026 15:37
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.

bb connect: "Add a machine" always fails — createMachineCode rejects the UI's input (rpc input validation failed)

1 participant