Skip to content

Give the Git and GitHub PR Status plugins their own show settings - #6410

Merged
ymichael merged 2 commits into
mainfrom
bb/git-and-github-pr-status-plugins-own-their-show-thr_w9e5zkyr67
Oct 27, 2026
Merged

ymichael merged 2 commits into
mainfrom
bb/git-and-github-pr-status-plugins-own-their-show-thr_w9e5zkyr67

Conversation

@ymichael

@ymichael ymichael commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

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 Keep the timeline pinned when content collapses for a single task #6405's branch with two uncommitted files.
    • Default: the composer shows "PR Keep the timeline pinned when content collapses for a single task #6405" and "Uncommitted · 2 files", and the header shows Commit.
    • Git off: changed files and Commit disappear and PR Keep the timeline pinned when content collapses for a single task #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 Give the Git and GitHub PR Status plugins their own show settings #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

Michael Yong and others added 2 commits October 27, 2026 16:23
"Show Git changes and Commit button" moves from core general settings to
the Git plugin (showGitChanges), and the GitHub PR Status plugin gets its
own showPullRequest setting for the composer's pull request segment. Core
no longer folds the setting into ExperimentalThreadEnvironment; each
plugin hides its own UI. Migration 0147 copies the saved value into both
plugins and retires the general-settings row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
showGitChanges now gates only the composer's changed-files segment.
A new showCommitButton setting (default off for everyone) gates the
Commit thread action in the header and overflow menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ymichael
ymichael force-pushed the bb/git-and-github-pr-status-plugins-own-their-show-thr_w9e5zkyr67 branch from 20cdd5f to 47d427d Compare October 27, 2026 23:24
@ymichael
ymichael merged commit 27ea546 into main Oct 27, 2026
51 checks passed
@ymichael
ymichael deleted the bb/git-and-github-pr-status-plugins-own-their-show-thr_w9e5zkyr67 branch October 27, 2026 23:34
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 <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