Skip to content

Move the thread header Commit action into the Git plugin - #6388

Merged
ymichael merged 5 commits into
mainfrom
bb/git-plugin-owns-the-header-git-actions-commit-thr_cihta272t4
Oct 27, 2026
Merged

ymichael merged 5 commits into
mainfrom
bb/git-plugin-owns-the-header-git-actions-commit-thr_cihta272t4

Conversation

@ymichael

@ymichael ymichael commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The thread header's Commit button, its overflow-menu row, and the Commit dialog behind them were core code (useThreadGitActions, ThreadGitActionDialog, ThreadDetailView). They read core's showGitChanges setting, the only Git UI left in core outside the composer's context-segment fold. Moving the button into the Git plugin needed a plugin path for header buttons. The thread-actions API that core's own thread actions use could only add menu entries, and they appeared in every menu. The separate experimental_threadHeaderAction slot could not do it either: it mounts before the workspace Open button and never folds into the menu in narrow headers.

What changed

SDK: placement on thread actions (0.6.92).

  • PluginThreadActionRegistration takes placement?: "menu" | "header", default "menu".
  • A "header" action shows only in the open thread's header. It is an outline button after the workspace Open button; several header actions share one split button. At compact width and in split panes under 560 px, the buttons become rows at the top of the header's thread menu, after Open.
  • Header actions never appear in other menus, selection menus, experimental_useThreadActions, or the quick-action picker. An action that returns choices is left out of the header.
  • A header action's useData receives only the threads whose header is on screen (threadIds is now tracked per placement), not every sidebar row.
  • The collector validates the field, and the Plugin Guide's thread-header card now documents header thread actions.

Core header uses that path.

  • ThreadDetailHeader gets its buttons from useThreadHeaderActionEntries. In overflow it passes them to the menu render prop, which appends them after the workspace items in the 0_header group, as before.
  • Deleted from core: useThreadGitActions, ThreadGitActionDialog and its story, ChangedFilesDetailRow, AppToastCommitDescription, useRequestEnvironmentAction with its request types, and the "commit" lifecycle operation.
  • With several header actions, each keeps its own disabled state: a disabled first action disables only the main half of the split button, and disabled dropdown rows cannot run. Rows are keyed by action key, not label.
  • The plugin-bound SDK's environments.commit now invalidates the same environment and thread queries the deleted mutation did.

Git plugin owns Commit (plugins/git/ui/commit/).

  • commitThreadAction is a "header" thread action. It shows Commit when all of these hold:

    • the showGitChanges setting is on, read from system.config() and refreshed on system:config-changed;
    • the thread is not archived;
    • the header passes a reusable environment, meaning the host is active, the environment is ready, and it has a path;
    • that environment's git status has uncommitted changes.

    These are core's previous conditions.

  • The dialog is a plugin app overlay with the same markup, copy, and rows (branch, git status, changed files).

  • Commits are queued per thread with the same toasts: "Creating commit" or "Commit queued", then "Commit created" with the short SHA and subject, or "Commit failed". The failure toast carries the same lifecycle copy, for example "Commit failed. Workspace is still starting."

  • The dialog closes when its thread's header leaves the screen, as core's per-view dialog did.

  • status-state.ts now shares its last-known-workspace rule between single- and multi-environment status reads.

app.slots.experimental_threadHeaderAction retired.

  • Removed with PluginThreadHeaderActionRegistration and PluginThreadHeaderActionProps from the public typings, the Plugin Guide, and the authoring docs (frontend-registration.md, frontend-core-slots.md, both API indexes).
  • It still works at runtime as a legacy slot alias with internal types, so existing plugins register and render exactly as before, including ones that check typeof app.slots.experimental_threadHeaderAction === "function" first.
  • bb-plugin-build warns on any use and names the replacement: a thread action with placement: "header".
  • docs/api_to_audit.md replaces the slot's entry with a Retired entry listing its marketplace callers. The October marketplace scan found 105 plugins calling it.

Out of scope and unchanged: generalSettings.showGitChanges stays a core general setting, and the composer context-segment fold that hides the PR segment when the setting is off is untouched. No server or daemon wire change.

How you verified

  • pnpm exec turbo run test typecheck lint for @get-bb/plugin-sdk, @bb/app, bb-plugin-plugin-api-docs, bb-plugin-bb--git, @bb/plugin-build, and bb-plugin-bb-guide.
  • New tests:
    • ThreadActionsMenu.test.tsx: a header registration with a bulk item is absent from every menu surface, the selection menu, and the picker list. useThreadHeaderActionEntries returns only header actions and drops ones with choices. A header action's useData sees only the header's thread, not sidebar rows. Making the placement filter always pass fails 24 of these tests.
    • ThreadDetailHeader.test.tsx: a header registration renders as a button in wide split panes and moves to the menu args in narrow ones. Three header actions (first and second disabled) render one split button whose main half is disabled while the dropdown opens, the disabled row does not run, and the enabled row does.
    • plugin-app-definition.test.ts: placement is kept and validated; the legacy header slot still collects.
    • plugins/git/ui/commit/commit-action.test.tsx: Commit shows only for a dirty workspace on a non-archived thread with a reusable environment and follows live changes to the setting; per-thread queue toasts; lifecycle and server failure copy; the dialog shows branch, status, and files, commits, and closes.
    • build-plugin-app.test.ts: a plugin calling the retired slot builds, keeps the call, and gets the placement: "header" warning.
  • Live run on an isolated pnpm dev instance (fresh data dir), with a project on a scratch repo containing one modified and one untracked file:
    • Desktop width: the header shows the Open split button, then Commit, the same order as main.
    • Neither the header "…" menu nor the sidebar row's right-click menu lists Commit.
    • Clicking Commit opens "Commit changes" with Branch main, Git status Dirty, and both files.
    • Submitting closes the dialog and shows "Creating commit", then "Commit created bf69481 · docs: update README and add notes file". git log in the repo shows the commit, and Commit leaves the header once the tree is clean.
    • At 390 px, Commit moves into the thread menu right after the "Open workspace in …" rows and opens the same dialog.
    • Setting showGitChanges to false and back with bb settings general hides and restores Commit live.

AGENT GENERATED

🤖 Generated with Claude Code

Michael Yong and others added 5 commits October 27, 2026 14:52
Thread actions gain placement "header": a button in the open thread's
header that folds into the thread menu at narrow widths and stays out of
every other menu. Core's header renders header actions through the same
registry, and the Git plugin registers Commit, its dialog and queued
commit toasts there. app.slots.experimental_threadHeaderAction is retired
from the typings; existing plugins keep working and get a build warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The authoring-docs slot table no longer lists experimental_threadHeaderAction,
and the header-button section fits the 500-line reference cap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The registry's record carries a required placement, set in
useThreadActionRecords for core and plugin registrations alike, so the
collector and the registry no longer each fall back to "menu".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A disabled first header action no longer disables the whole split
button, dropdown rows honour their own disabled state, and rows are
keyed by action key instead of label.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/git-plugin-owns-the-header-git-actions-commit-thr_cihta272t4 branch from 2934919 to f64769d Compare October 27, 2026 21:53
@ymichael
ymichael merged commit bb9f6eb into main Oct 27, 2026
52 checks passed
@ymichael
ymichael deleted the bb/git-plugin-owns-the-header-git-actions-commit-thr_cihta272t4 branch October 27, 2026 22:04
ymichael added a commit that referenced this pull request Oct 27, 2026
)

## Human comments

## What was wrong

After #6388 moved Commit into the Git plugin, nothing in core needed
"Show Git changes and Commit button" except one fold. Core still owned
the setting in general settings (`AppSettings.showGitChanges`). The Git
plugin read it through `sdk.system.config()`. `ThreadDetailView` nulled
the `environment` it hands every thread context segment when the setting
was off, so the GitHub PR Status plugin's pull request segment hid along
with changed files. The `docs/api_to_audit.md` thread context segments
entry called this out as a Known coupling.

## What changed

- **The Git plugin gets two settings**, declared with
`bb.settings.define` in `plugins/git/server.ts` and read with
`useSettings()` (`plugins/git/ui/queries.ts`):
- `showGitChanges`, "Show Git changes above the composer", default
`true`. It gates the changed-files segment and its merge-base picker
(`useChangedFilesSegmentVisible`).
- `showCommitButton`, "Show Commit button", default **`false` for
everyone**, existing users included. It gates the Commit thread action
in the header and overflow menu (`commit-action.ts`, which drops its own
`system.config` subscription). **This is the one intended user-visible
change:** Commit disappears until a user turns it on. The old switch
can't tell an explicit `true` apart from the untouched default, so the
migration doesn't copy it here.
- **GitHub PR Status plugin gets `showPullRequest`.** Default `true`,
labelled "Show pull request above the composer".
`usePullRequestSegmentVisible` reads it. When it's off, the plugin skips
the PR read, just as the null environment did before. It gates only the
composer's pull request segment, which is all the Git switch hid for
this plugin. The Info tab's Pull request row was never gated and still
isn't.
- **Core's fold is gone.** `ThreadDetailView` passes
`threadEnvironmentId` straight through. `ExperimentalThreadEnvironment`
is no longer null because of a setting. Its SDK doc comment is updated,
and the plugin SDK is bumped to 0.6.93.
- **Removed from core:** the key in `appSettingsSchema`, its defaults
and update schemas, the `PUT /settings/general` merge, the General
switch (`SettingsView` and stories) and its settings-search entry. Both
new switches stay searchable because settings search indexes plugin
settings by label and description.
- **Migration `0147_git_and_pr_status_plugin_show_settings`.** This is a
custom Drizzle migration generated on current main, using the same
pattern as `0105_provider_settings_to_plugins`. It copies the saved
`app_settings_values.showGitChanges` into both `bb--git/showGitChanges`
and `bb--github-pr-status/showPullRequest` (an existing plugin row
wins), then deletes the old row. Users with no saved value get both
plugin defaults (`true`), which matches the old default. Nothing is
written for `showCommitButton`, so it starts off.
- **What an old client sending `showGitChanges` gets.** This follows the
provider-settings move: the key is deleted from the `.strict()`
general-settings schema. A `PUT /api/v1/settings/general` that still
includes it gets **400 `{"code":"invalid_request","message":"Invalid
input"}`**, and nothing is saved. In practice only an old client
toggling the old switch, or an old CLI running `bb settings general
showGitChanges …`, sends it. Clients send `{ ...cachedSettings, ...patch
}`, and after the upgrade the server's config no longer returns the key.
- **Docs and CLI:**
- `docs/configuration.md`: the general-settings row is removed and
there's a new "Git and GitHub PR Status plugins" section.
- `bb guide customization` points to `bb plugin config bb--git set
showGitChanges false`, `bb plugin config bb--git set showCommitButton
true` and `bb plugin config bb--github-pr-status set showPullRequest
false`.
- Each plugin's skill and PLUGIN_OVERVIEW now describe its setting. This
also replaces the Git overview's stale "Commit button and dialog stay in
core".
- In the plugin-authoring reference and `docs/api_to_audit.md` (thread
context segments), the environment-null-when-setting-off clause and the
Known coupling bullet are gone.

No server/daemon wire change.

## How you verified

- `pnpm exec turbo run typecheck lint --filter='...[origin/main]'`
passes.
- `turbo run test` passes for `@bb/db` (634), `bb-plugin-bb--git` (248),
`bb-plugin-bb--github-pr-status` (160), `@get-bb/plugin-sdk` (403),
`@bb/domain`, `@bb/templates` and `bb-plugin-bb-guide`.
- `@bb/server`: 3688/3689. The one failure was `builtin-plugins.test.ts`
"hot-reloads a source-layout builtin server", a 40 s file-watcher timing
test that ran while a dev instance was building. Re-run alone, the file
passes 28/28.
- `@bb/app`: the settings, thread-detail, promptbox banner, plugin and
settings-mutation tests pass (1193 across 126 files).
- New and changed tests:
- `migrate.test.ts`: a saved `showGitChanges: false` lands in both
plugins and the core row is removed.
- `PullRequestContextSegment.test.tsx`: the segment hides while
`showPullRequest` is off or loading.
- `commit-action.test.tsx`: Commit hides while `showCommitButton` is
off. It now reads plugin settings instead of mocking `system.config`.
- Real app on an isolated `pnpm dev` with a fresh data dir. The fixture
was a project checkout on PR #6405's branch with two uncommitted files.
- Default: the composer shows "PR #6405" and "Uncommitted · 2 files",
and the header shows Commit.
- Git off: changed files and Commit disappear and PR #6405 stays. PR off
with Git on: the PR disappears, and changed files and Commit stay. Both
off: all three are hidden. Both back on: all three return. Each of these
updated in the open thread tab without a reload, both when flipped from
the CLI and when clicking each switch on its plugin page (Settings →
Git, Settings → GitHub PR Status).
  - General settings no longer lists the switch.
- Follow-up commit (Commit split out), on `pnpm start:worktree` with a
project on this PR's branch and two uncommitted files:
    - Defaults show PR #6410 and the changed files, with no Commit.
- With `showCommitButton` on, Commit appears. Turning off
`showGitChanges` then hides the changed files and leaves Commit and the
PR.
- Back to defaults restores the starting state. Clicking Show Commit
button on Settings → Git shows Commit and then hides it again in the
open thread.
- Upgrade: on a copy of that DB with the 0147 record removed and
`showGitChanges=false` seeded, the real `migrate()` wrote `false` to
both plugin settings.
- An old-client `PUT /api/v1/settings/general` with `showGitChanges`
returned 400 `invalid_request`. The same payload without it returned
200.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Michael Yong <review@local>
Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Oct 28, 2026
## Human comments

## What was wrong

`invalidates` on a plugin RPC contract method only fired when a write
went through that RPC method (`invokeRpcHandler` →
`hub.notifyPluginChanged`, plus the calling client invalidating the
response's `invalidated` tags). Plugin CLI commands, agent tools and
background work usually call the plugin's functions directly, so the
server already has to call `bb.rpc.experimental_invalidate` where the
data changes. An app-made write then refreshed twice: once from the
broadcast and once from the client's own `invalidated` handling. The
rule is now that the server marks tags stale where the data changes, and
nothing else does.

## What changed

**First-party users.** All four already invalidated where the data
changes, so their declarations are just deleted. No new invalidate call
was needed:
- Git (`plugins/git/rpc-contract.ts`) `markViewed`, `clearViewed`,
`setMergeBase`: core emits `diff-viewed-changed` / `metadata-changed`,
and `environmentChanged` in `plugins/git/server.ts` invalidates the
viewed and status tags for watched environments. The CLI (`bb git viewed
mark|unmark`, `bb environment update --merge-base-branch`) goes through
the same events.
- GitHub PR Status (`plugins/github-pr-status/contract.ts`) `refresh`,
`markReady`, `markDraft`, `merge`: each ends in a store load, and
`createPullRequestStore`'s `publish` broadcasts the row's tag when the
row changed. The store covers these cases by itself. The old
`invalidates` refetch ran before that reload and read the old row back,
so it was a wasted request.
- Push notifications (`plugins/push-notifications/contract.ts`)
`threadNotifications.set`: `preferences.set` calls `publishSubtree`,
shared with `bb push-notifications thread --level`.
- Workflows (`plugins/workflows/src/ui-contract.ts`) `workflowStopRun`,
added by #6418: `service.stop` publishes `runs:<threadId>`, shared with
`bb workflows stop`.

**Retired the way #6388 retired `experimental_threadHeaderAction`:**
- `PluginRpcMethodContract` (`packages/plugin-sdk/src/rpc-contract.ts`)
extends `Omit<ContractTagDeclarations, "invalidates">`, so declaring it
in `defineRpcContract` is a type error. `ContractTagDeclarations` in
`@bb/domain` is untouched: core `defineRoute` descriptors keep
`invalidates`, and the edit stays one line for the parallel move of that
type into the SDK.
- It still works at runtime. `readRpcMethodContract`,
`invokeRpcHandler`, `rpcResponseTags` and the fake host are unchanged,
so already-built plugins broadcast and refresh as before.
- `bb-plugin-build` warns when a server source file inside the plugin's
own directory declares `invalidates` (`retiredRpcInvalidatesWarnings` in
`packages/plugin-build/src/retired-sdk-members.ts`). The warning names
the replacement. The check is limited to the server build and the
plugin's own directory: contracts are always registered on the server,
so the warning prints once, and bundled workspace packages such as
`@bb/server-contract`, whose core route descriptors use `invalidates`,
don't trigger it. `bb plugin build`/`dev` print it, and the server
writes it to the plugin log.
- `docs/api_to_audit.md`: the live-reads bullet states the one rule, and
there's a new **Retired RPC contract `invalidates`** entry with its
callers.

**Marketplace callers.** I scanned all 364 git repositories and 14 npm
packages behind the community marketplace's 469 entries (2026-10-28).
Five plugins in two repos declare it:
- kalindudc/bb-marketplace: **loom** (`src/rpc-tags.ts`, spread into its
contract), **shuttle** and **vantage** (`src/contract.ts`)
- smsunarto/bb-plugins: **gtd-sidebar** (`lib/rpc-contract.ts`) and
**kitchen-sink**

**Docs.** The SDK doc comments on `defineRpcContract` and
`ExperimentalRpcMutationState` are updated. The Plugin Guide's wire card
(`plugins/plugin-api-docs/src/surfaces.ts`) states the rule. The
bb-plugin-authoring skill gets a "Tags and invalidation" section in
`frontend-hooks-and-ui.md`; `backend-events.md` is at its 500-line cap,
so its refusal line only drops "publishes no invalidations". Plugin SDK
bumped to 0.6.95.

No server/daemon wire change.

## How you verified

- `pnpm exec turbo run typecheck lint` for `@get-bb/plugin-sdk`,
`@bb/plugin-build`, the Git, GitHub PR Status, push-notifications,
Workflows, plugin-api-docs and bb-guide plugins, `@bb/server` and
`@bb/app`: pass.
- `turbo run test` for the same plugins, `@get-bb/plugin-sdk` and
`@bb/plugin-build`: pass. `@bb/server`: 3692/3698 on the first run. The
skills-quality cap failure was mine (fixed by moving the section). The
other failures were three builtin-plugins hot-reload timing tests that
ran while a dev instance was building; both files pass alone (65/65).
- New tests:
- `build-plugin-app.test.ts`: a server whose own `tags.ts` declares
`invalidates` (property and method forms) builds, keeps the field, and
gets exactly one warning. A file outside the plugin root that declares
it doesn't warn.
- `retired-sdk-members.test.ts`: the pattern flags property, quoted-key
and method declarations, and ignores `tags`, `.invalidates(` calls and
`invalidated`.
- `rpc-query-host.test.tsx`: the optimistic-mutation test drops
`invalidates` and invalidates after acknowledgement, as the server does.
Predictions still hold through acknowledgement, roll back on failure,
and keep the read error on refresh failure.
- `plugin-wire.test.ts`: the untyped built fixture that still declares
`invalidates` is renamed as the compatibility test. It still broadcasts.
- Live run on an isolated `pnpm dev` (fresh data dir), a scratch repo
project, with a thread open in a headless browser. A `fetch` hook
recorded every `/rpc/` request after each action:

| Write | From | Refetches seen in the open tab | Tab updated without
reload |
  | --- | --- | --- | --- |
| `setMergeBase` | merge-base picker | 1 `status` (+344 ms) | Branch →
other |
| `setMergeBase` | `bb plugin rpc call bb--git setMergeBase` | 1
`status` | Branch → other |
| merge base | `bb environment update --merge-base-branch main` | 1
`status` | Branch → main |
| `markViewed` | Viewed checkbox | 1 `viewed` (+277 ms) | a.txt checked
|
  | `markViewed` | `bb git viewed mark` | 1 `viewed` | b.txt checked |
| `clearViewed` | `bb git viewed unmark` | 1 `viewed` | a.txt unchecked
|
  | `clearViewed` | Viewed checkbox | 1 `viewed` | b.txt unchecked |
| `threadNotifications.set` | thread menu → Notifications → Muted | 1
`threadNotifications.keyed` | Muted |
| `threadNotifications.set` | `bb push-notifications thread --level
input-only` | 1 `threadNotifications.keyed` | Needs input only |

The picker's extra `branches` read after a merge-base change is the
branch list re-reading with its new `selectedBranch` input, not a
duplicate.
- Legacy fixture: a path plugin whose contract still declares
`invalidates`. `bb plugin build` printed the warning for `contract.ts`
once, and the server wrote it to the plugin's log on install. Clicking
Bump on its page updated the count from 0 to 1. Its request log shows
`bump` followed by two `count` reads, the double refresh this removes
for first-party plugins.
- GitHub PR Status, against this PR (#6462) from a clone of its branch:

| Write | From | Refetches seen in the open tab | Tab updated without
reload |
  | --- | --- | --- | --- |
| `markReady` | composer segment, Mark ready | 1 `pullRequests` (+5.0 s,
after `gh` and the store reload) | Draft → Open, Merge shown |
| `markDraft` | `bb pull-request draft` | 1 `pullRequests` | Open →
Draft, Mark ready shown |
| `refresh` | `bb plugin rpc call bb--github-pr-status refresh` | 1
`pullRequests` | yes |
| `markReady` | `bb pull-request ready` | 1 `pullRequests` | Draft →
Open |

`merge` was not run: it would merge this PR. It shares `runAction` →
`store.refresh` with ready and draft. The `bb--git status` reads that
also appear after these actions come from the Git plugin's environment
events (`gh` touches the checkout), which this PR doesn't change.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 3, 2026
## Human comments

## What was wrong

Moving the composer (#6122) and git (#6165, #6157, #6388, #6410) into
plugins left dead code and duplicate implementations in core and in
neighbouring plugins. An audit of those moves (thread thr_7hk642w2es)
found code that could be deleted with no protocol bump, no plugin SDK
change and no change in behaviour. This PR implements the audit's steps
1 (pure deletions) and 2 (consolidations). Every item was re-checked
against the current code before it was deleted; the items that turned
out to change behaviour are left out and listed below.

## What changed

Two commits. Together they remove 643 lines net. No
`HOST_DAEMON_PROTOCOL_VERSION` change, no plugin SDK change, and no CLI
or config change.

**Step 1: deletions (+42 / −423, net −381)**
- `useUpdateEnvironment` (built but never mutated) and its always-false
`isPending` read in `ThreadDetailView`.
- `isGitDiffFixedPanelTab`, `EMPTY_ORDERED_MENTION_SUGGESTIONS`, the
`useCommandSuggestions().triggers` field that only echoed its input, and
the `maxHeight` prop on `ComposerBox`, which no caller passes (the max
height comes from `ComposerMaxHeightContext`).
- client-core's uncached `composerDraftFromPromptDraft`. `ComposerBox`
now uses the cached apps/app copy. The history object is rebuilt on
every render and drafts are compared by value, so the result is the
same.
- 9 unused `@tiptap/*` dependencies of `@bb/app`. `@tiptap/core` and
`@tiptap/pm` become devDependencies because only
`PromptBoxInternal.test.tsx` uses them.
- host-workspace's porcelain v1 quoted-path parser. Its only caller is
the conflict check, which reads just the two status letters.
- host-workspace's copy of the checkout admission lock (it now reuses
the one in `locks.ts`) and its copy of `throwIfProvisionAborted`. Also a
`withGitRefMutationLock` re-export nothing imports, and `export` on
helpers only used inside their own file.
- Stale docs: `vcs-process-admission.md` now cites protocol 255.
`api_to_audit.md` now says `ComposerBox` owns `submit`. The `app.css`
comment and the `bundle-budget.json` note no longer describe the
pre-plugin composer.

**Step 2: consolidations (+299 / −561, net −262)**
- Checkout-ref, uncommitted-changes and in-progress-operation inspection
had two implementations: host-workspace (used by the daemon's
`host.inspect_git_source`) and
`plugins/environment-project-checkout/host/git.ts`. Both now use one
implementation in `createGitQueries`
(`bb-environment-provider-host/workspace-git`), and the plugin's file is
deleted. Because it goes through each side's runner, the daemon keeps
its default git priority and the plugin keeps `background`. Every caller
already confirms a work tree before calling, so the result is identical;
the daemon just runs two fewer `git rev-parse` checks per inspection.
- `plugins/git/host/workspace-reads.ts` (−85):
- The HEAD-to-empty-tree fallback is now generic over the result type,
so the record-limited tracked diff reuses it instead of keeping its own
copy.
- One `rangeGitRunner`, one lstat/ENOENT helper and `sumNumstatLines`
replace the inline copies.
  - Local copies of contract types and unused exports are gone.
- Ladle's `makeWorkspaceStatus` is now built on
`bb-plugin-bb--git/testing`, keeping the same defaults.

**Planned items left out**
- **Server-contract "unused" schemas:** not dead. They are the source of
`EnvironmentDiffViewedResponse` and `EnvironmentActionApiError`, which
the SDK and `public-api.ts` use.
- **The `ComposerPluginActions` wrapper:** it discards any props a
plugin passes at runtime. Passing `ComposerActionsSlot` directly would
start honouring them.
- **One-off migrations for the git-era ids (`diff.toggle`, Info section
ids):** these would change behaviour.
- The UI-preference transform also runs on writes (`PUT /ui-preferences`
and `bb settings`).
- The keybinding `PUT` stores any command id and returns the overrides
read back through the read-time migration.
- A one-off database migration would stop converting legacy ids written
later, for example by a cached older client.
- **A fake segment instead of the real Git segment in core banner
tests:** those tests are the only coverage of the plugin's
`ChangedFilesSegmentView` (deferred list mount, merge-base action, file
buttons). A fake would drop that coverage unless the tests move into the
plugin, which is relocation rather than deletion.
- **Lifting the small boundary copies (`commit-errors.ts`,
overflow-mode, label-class and debounce constants) into shared-ui:**
each new shared-ui entry needs a 5-line `exports` block, and the copies
are 1–3-line constants or helpers with a different shape, so this would
add lines.
- **The shared-ui workspace-status fixture:** shared-ui can't depend on
the plugin's test builders, and #6935 deletes this fixture by moving its
modules into plugins/git.

## How you verified

- `pnpm exec turbo run typecheck lint` for `@bb/app`, `@bb/client-core`,
`@bb/host-workspace`, `bb-environment-provider-host`, `@bb/host-daemon`,
`bb-plugin-bb--git`, `bb-plugin-bb--composer`,
`bb-plugin-environment-git-worktree` and
`bb-plugin-environment-project-checkout`: all pass.
- `pnpm exec turbo run test` with the same filters: every package passes
after the rebase. Two `@bb/app` tests failed under a local load average
of about 50 and are not caused by this PR:
  - `PluginSettings.test.tsx` passes when run on its own.
- `lazy-plugin-renderers.cold-load.test.tsx` fails the same way on the
base commit.
- `pnpm exec turbo run build --filter=@bb/app` plus
`check-bundle-budget.mjs`: budget OK.
- `pnpm exec turbo run prepare:bundled` for the git, git-worktree and
project-checkout plugins: the host bundles build with the shared
helpers.
- The existing `getCheckoutRef` and `getWorkspaceGitOperation` tests
(bare repo, detached, unborn, merge and rebase conflicts) now run
against the shared implementation and pass.

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Nov 3, 2026
…him (#6942)

## Human comments

## What was wrong

`ladle build` in `apps/app` failed on main with
`"experimental_useRpcQuery" is not exported by
".ladle/plugin-sdk-app.ts"`. Ladle aliased `@get-bb/plugin-sdk/app` to
`.ladle/plugin-sdk-app.ts`, a hand-written destructure of
`pluginSdkAppImplementation`. Nothing typechecked it (`.ladle/` is
outside the app tsconfig), nothing compared it to `PluginSdkApp`, and CI
never builds Ladle. So each new SDK member was left out. By the time
#6388 added the Git plugin's commit dialog stories, which reach
`experimental_useRpcQuery` through `plugins/git/ui/queries.ts`, the shim
was 22 members short. Separately, every `promptbox/Prompt Box Internal`
story threw `Missing story mention token:
@apps/app/src/components/promptbox/PromptBoxInternal.tsx` while loading.
Two fixture strings still named `ComposerBox.tsx` while their mention
tokens named `PromptBoxInternal.tsx`.

## What changed

- Deleted `apps/app/.ladle/plugin-sdk-app.ts` and its Vite alias. Ladle
now resolves `@get-bb/plugin-sdk/app` to the real SDK source, as the app
does.
- Added `apps/app/.ladle/plugin-runtime.ts`, imported by the Ladle
global provider. It calls `installPluginRuntime()`, the path the app and
its plugin tests already use, then replaces the two composer-search
hooks with the story overrides. The SDK forwarders cover every
`PluginSdkApp` member, so there is no Ladle export list left to drift.
- `PromptBoxInternal.stories.tsx`: the two fixture strings now name
`PromptBoxInternal.tsx`.
- `.bb/skills/monthly-release-email/references/graphics.md`: the "patch
the shim by hand" tip now applies only to older tags that still have the
shim.

A follow-up PR adds the Ladle build to CI.

## How you verified

- On main (7130d96), `pnpm exec ladle build` in `apps/app` failed
with the error above. On this branch, rebased on ab2689a, it passes
and builds 255 stories.
- I served the built output and opened these stories in headless Chrome.
None had page errors:
- `plugins--git--commit-dialog--commit` and `--minimal` render the
commit dialog with branch, status and changed files.
  - `promptbox--prompt-box-internal--overview` and `--all-prompt-pills`
  - `plugins--composer--mentions--overview`
- In the PromptBoxInternal "live skills" composer, typing `/` lists the
story's stub skills (moss-hardening-review, github:gh-fix-ci, …). That
shows the story hook overrides reach the Composer plugin through the
real SDK forwarders.
- `pnpm exec turbo run typecheck lint --filter=@bb/app` passes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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