Skip to content

Move Git-only workspace status modules from shared-ui into the git plugin - #6935

Merged
ymichael merged 1 commit into
mainfrom
bb/move-git-only-shared-ui-modules-into-the-git-plu-thr_mnvcjfvu6j
Nov 3, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/move-git-only-shared-ui-modules-into-the-git-plu-thr_mnvcjfvu6j

Conversation

@ymichael

@ymichael ymichael commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

When the Git plugin moved out of core, about 4.1K lines went from apps/app into packages/shared-ui, which is still core. Three of those modules are used only by plugins/git, so core still owned plugin-only code: git-status-display, workspace-change-summary and workspace-changes-list. Outside the plugin, only apps/app stories and test fixtures use them. The audit that found them listed five modules. file-path-link and sdk-clipboard-copy still have core callers, so they stay: shared-ui's diff card header and default diff copy button use them, and core's GitDiffCard renders those.

What changed

  • The three modules and their tests moved from packages/shared-ui/src/components/ui/ to plugins/git/ui/. The source is unchanged apart from import paths.
  • The moved tests now use the plugin's existing testing.ts builders, so shared-ui's 75-line structural copy, workspace-status-fixtures.ts, is deleted.
  • shared-ui loses three package.json export entries.
  • plugins/git now depends on @bb/thread-view (formatDiffStatsText). The plugin was already bundling it through shared-ui.
  • Plugin callers use local imports. The five apps/app stories and test fixtures that use these modules now import them by relative path into plugins/git/ui, like their existing plugin UI imports.

Diff with rename detection: +48/−129 across 25 files. The move itself takes about 1.1K lines out of shared-ui: 1,098 removed, 1,014 added in plugins/git.

No protocol, SDK, CLI or docs changes.

How you verified

  • Built the git plugin bundle and the core app before and after the move:

    • The plugin's app.js, app.css, host.js and server.js are byte-identical.
    • The core app's CSS files are byte-identical (same content hashes).

    So behaviour and styling are unchanged.

  • pnpm exec turbo run typecheck lint test --filter=@bb/shared-ui --filter=bb-plugin-bb--git --filter=@bb/app:

    • typecheck and lint pass (no errors).
    • shared-ui: 11 test files pass.
    • git plugin: 35 test files pass.
    • apps/app: 4 files failed in the full run on a heavily loaded machine (load average 75).
      • CommandPalette, PluginSettings and scroll-position-keeper.model pass when rerun on their own.
      • lazy-plugin-renderers.cold-load.test.tsx also fails on unmodified main (cbde50f2d9), so this PR didn't cause it.

AGENT GENERATED

🤖 Generated with Claude Code

…ugin

git-status-display, workspace-change-summary and workspace-changes-list
had no callers outside plugins/git apart from apps/app stories and test
fixtures, which already import the plugin's UI by relative path. They now
live in plugins/git/ui, their tests use the plugin's testing.ts builders,
and shared-ui's structural fixture copy and three export entries are gone.

file-path-link and sdk-clipboard-copy stay in shared-ui: the shared
git-diff card header and default copy renderer that core's GitDiffCard
uses depend on them.

The git plugin bundle (app.js, app.css, host.js, server.js) and the core
app CSS build are byte-identical before and after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit ab2689a into main Nov 3, 2026
51 checks passed
@ymichael
ymichael deleted the bb/move-git-only-shared-ui-modules-into-the-git-plu-thr_mnvcjfvu6j branch November 3, 2026 21:21
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]>
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