Skip to content

Delete composer and git move leftovers from core - #6937

Merged
ymichael merged 2 commits into
mainfrom
bb/delete-composer-and-git-move-leftovers-steps-1-a-thr_wtka9cryqd
Nov 3, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/delete-composer-and-git-move-leftovers-steps-1-a-thr_wtka9cryqd

Conversation

@ymichael

@ymichael ymichael commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

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 Move Git-only workspace status modules from shared-ui into the git plugin #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

ymichael and others added 2 commits November 3, 2026 12:57
- Remove useUpdateEnvironment, which was built but never mutated, and its
  always-false isPending read in ThreadDetailView.
- Remove isGitDiffFixedPanelTab, EMPTY_ORDERED_MENTION_SUGGESTIONS, the
  echoed useCommandSuggestions().triggers field, and ComposerBox's
  never-passed maxHeight prop.
- Use apps/app's cached composerDraftFromPromptDraft in ComposerBox and drop
  the uncached client-core copy.
- Drop nine unused @tiptap/* dependencies from @bb/app; @tiptap/core and
  @tiptap/pm stay as devDependencies for PromptBoxInternal.test.tsx.
- Replace host-workspace's porcelain v1 quoted-path parser with a check of
  the two status letters, which is all the conflict check reads.
- Reuse locks.ts's checkout admission lock and transcript.ts's
  throwIfProvisionAborted instead of host-workspace copies; drop a dead
  withGitRefMutationLock re-export and file-internal exports.
- Correct stale docs and comments (protocol 255, ComposerBox owns submit,
  host ultracode decoration, bundle-budget note).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Implement checkout-ref, dirty and in-progress-operation inspection once
  in createGitQueries, so the daemon's host.inspect_git_source and the
  project-checkout plugin share it while each keeps its own git priority.
  Both callers already confirm a work tree first, so dropping the extra
  ensureGitRepo probe leaves results unchanged. getAbsoluteGitDir and
  pathExists move there too.
- In the Git plugin's workspace reads, make the HEAD-to-empty-tree fallback
  generic over the result type so the record-limited diff reuses it, share
  one rangeGitRunner, one lstat helper and sumNumstatLines, and drop local
  copies of contract types and unused exports.
- Build Ladle's makeWorkspaceStatus on the Git plugin's testing builders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ymichael
ymichael merged commit 688364f into main Nov 3, 2026
51 checks passed
@ymichael
ymichael deleted the bb/delete-composer-and-git-move-leftovers-steps-1-a-thr_wtka9cryqd branch November 3, 2026 21:31
ymichael added a commit that referenced this pull request Nov 3, 2026
…es (#6948)

## Human comments

## What was wrong

#6937 replaced the checkout inspection in `environment-project-checkout`
(current ref, uncommitted changes, in-progress operation, conflicts)
with the shared implementation in
`bb-environment-provider-host/workspace-git`. Before the plugin runs
`git switch` in a user's real checkout, the host's `assertSwitchable`
uses that inspection to refuse a switch on a detached HEAD, during a
merge or rebase, with conflicts, or with uncommitted changes. Only the
uncommitted-changes refusal had a host test against a real repository.
The server-side `validate` refusals are tested with mocked
`inspectCheckout` results, so no plugin test ran the shared inspection
on real detached, merge, conflict or rebase states.

## What changed

Test-only. `plugins/environment-project-checkout/host.test.ts` gains
four host tests. Each builds a real repository state, checks what
`inspectCheckout` reports, attaches with an existing-branch switch,
asserts the exact refusal message, and checks that HEAD did not move:

- detached HEAD → `checkout: detached`; refused as detached
- `merge --no-commit` in progress → `merge`, no conflicts; refused as
merge in progress
- conflicted merge → `merge`, with conflicts; refused for unresolved
conflicts
- conflicted rebase → `rebase`, with conflicts, `checkout: detached`.
git detaches HEAD during a rebase, so the detached check refuses it
first. That was also true before #6937; the test records it.

No production, protocol, SDK or CLI change.

## How you verified

- Removed each refusal in `host/checkout.ts` in turn:
  - Without the detached refusal, the detached and rebase tests fail.
  - Without the conflicts refusal, the conflicted-merge test fails.
  - Without the in-progress refusal, the merge-in-progress test fails.
- Without the dirty refusal, the existing uncommitted-changes test
fails.
- `pnpm exec turbo run test typecheck lint
--filter=bb-plugin-environment-project-checkout` passes.
- Ran it live on a fresh `pnpm start:worktree` instance (new data dir)
with scratch repos, using `bb thread spawn --environment-provider
project-checkout --environment-inputs
'{"branch":{"kind":"existing","name":"release"}}'`:
- Server `validate` returned HTTP 409 with: `Checkout blocked while HEAD
is detached` (detached), `…by uncommitted changes` (dirty), `…by an
in-progress merge` (merge), `…by unresolved conflicts` (conflicted
merge), `…while HEAD is detached` (rebase).
- Host `attach`: threads were spawned deferred while the repos were
clean, each repo was then broken, and the threads were dispatched.
Provisioning failed with: `Cannot checkout branch while the workspace is
on a detached HEAD` (detached and rebase), `…has uncommitted changes`,
`…merge is in progress`, `…merge has unresolved conflicts`.
- Every refused repo was unchanged: same HEAD and the same `git status`.
- A clean checkout switched to `release`. Provisioning logged "Switched
to branch release" and the environment was `ready` with `branchName:
release`.

> AGENT GENERATED

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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