Skip to content

Give bb's own registrations one owner id and drop their private-state imports - #7893

Merged
ymichael merged 1 commit into
mainfrom
bb/core-contributions-boundary-prototype-candidates-thr_sd3apyw3f9
Nov 20, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/core-contributions-boundary-prototype-candidates-thr_sd3apyw3f9

Conversation

@ymichael

@ymichael ymichael commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb registers some of its own UI (message time, the Info tab, thread actions, the parent-thread context segment) in the same shape a plugin uses. Those registrations carried two owner ids: message time and the Info tab used core, while thread actions and the parent segment used bb--core. The old core id is also stored in users' saved panel tabs (plugin-fixed:core:info). Separately, thread actions and the parent segment read private app state (a jotai split-layout atom, route state, a zod schema with a private options list, a private clipboard helper) where the SDK already hands plugins a hook for the same thing.

What changed

  • One owner id. CORE_PLUGIN_ID = "bb--core" lives in @bb/domain, and collectCoreContributionSlots (apps/app/src/lib/core-contributions.ts) stamps it on every core registration. The thread-action registry now maps core and plugin entries the same way, with no core branch. Message metadata, the secondary panel, panel tabs, Info-tab navigation and PaneThreadActionCommandHandler compare against the constant.

  • Saved Info tabs convert on read. plugin-fixed:core:info becomes plugin-fixed:bb--core:info through client-core's existing legacy-tab path (packages/client-core/src/panel/fixed-panel-tabs-state.ts). The bb guide's thread-inspection text is updated.

  • Private imports replaced with the functions plugins get:

    Where Before After
    Open in split splitLayoutAtom + useRouteState useSidebarSplitLayout + useBbContext
    Notify parent zod schema + PARENT_NOTIFICATIONS_OPTIONS local satisfies Record<…> label map
    Copy link copyToClipboardWithToast copyToClipboard + appToast
    Parent segment useThreadContextKind from PluginThreadContextCard the same hook from thread-context-card-pane.ts
    Parent segment class PROMPT_STACK_INLAY_SEGMENT_CLASS CONTEXT_CARD_SEGMENT_CLASS (same value)

    useBbContext, useSidebarSplitLayout and useThreadContextKind move into small modules (plugin-bb-context.ts, plugin-split-layout.ts, thread-context-card-pane.ts) so core's boot code does not pull in the larger SDK hook modules. plugin-sdk-app-impl.tsx serves the same functions to plugins.

  • bb--core checks that stay: MessageMetadata renders core entries outside PluginSlotMount (the mount would load plugin CSS and bind PluginContext for bb--core); ThreadSecondaryPanel doesn't record bb--core as a panel's plugin provider; the Info-tab checks remain while the Info body is core-fed; the bb--core/pin|read|archive command bindings remain.

No user-visible change. The public-SDK boundary (apps/app/src/core-contributions/, its lint rule and the build-time @get-bb/plugin-sdk/app binding) that this PR originally carried is split out to a draft that waits on this one.

How you verified

  • pnpm exec turbo run typecheck lint --filter=@bb/app --filter=@bb/client-core --filter=@bb/domain --filter=@bb/templates: 10/10.
  • turbo run test for @bb/client-core, @bb/domain, @bb/templates; @bb/app vitest over src/lib, src/components/{thread,plugin,secondary-panel,promptbox} and src/views/thread-detail: 376 files, 4206 tests passed. New tests cover the core → bb--core Info-tab conversion.
  • Live on pnpm start:worktree at this commit: message time renders with its full-date tooltip; the thread actions menu lists Copy link, Pin, Mark unread, Notifications, Rename, Regenerate title, Archive, Delete; Copy link shows "Thread link copied"; a plugin-fixed:core:info tab written into thread_tabs opens as the Info tab (the stored row keeps the old id until the client next saves the tab state, and converts again on every read). No page errors.

AGENT GENERATED

🤖 Generated with Claude Code

… imports

Core stamped its plugin-shaped registrations with two owner ids, "core" and
"bb--core". CORE_PLUGIN_ID ("bb--core") now lives in @bb/domain and one
helper, collectCoreContributionSlots, stamps it, so the thread-action
registry maps core and plugin entries the same way. Info tabs saved as
plugin-fixed:core:info convert on read.

Thread actions and the parent-thread segment now read the same hooks the
SDK hands plugins (useBbContext, useSidebarSplitLayout, useThreadContextKind,
copyToClipboard) instead of jotai atoms, route state, a zod schema and a
private clipboard helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/core-contributions-boundary-prototype-candidates-thr_sd3apyw3f9 branch from 1a3a291 to 4041e04 Compare November 20, 2026 19:56
@ymichael ymichael changed the title Register bb's message time as a core contribution behind a public-SDK boundary Give bb's own registrations one owner id and drop their private-state imports Nov 20, 2026
@ymichael
ymichael merged commit af9b2f0 into main Nov 20, 2026
97 of 99 checks passed
@ymichael
ymichael deleted the bb/core-contributions-boundary-prototype-candidates-thr_sd3apyw3f9 branch November 20, 2026 22:01
ymichael added a commit that referenced this pull request Nov 21, 2026
## Human comments

## What was wrong

Two tests added in #7911, "fetches only the resolved commit instead of
the whole repository" and "falls back to a full clone when the server
refuses to serve the commit directly", sit in the same
`describe.concurrent` block of
`apps/server/test/services/plugins/plugin-install.test.ts`. Each one
configures git by writing
`GIT_CONFIG_COUNT`/`GIT_CONFIG_KEY_0`/`GIT_CONFIG_VALUE_0` into
`process.env`, then restores the old values. The plugin service has no
other way to receive git config: `runInstallCommand` spawns git with
`process.env`. When both tests overlap, the shallow test overwrites
`GIT_CONFIG_KEY_0` (`protocol.version` becomes `url.….insteadOf`) or its
restore deletes the variables. The fallback test's probe `git fetch
--depth 1 <repo> <sha>` then runs over protocol v2, which serves any
commit, so it succeeds. That produces the CI failure `AssertionError:
promise resolved "{ stdout: '', …(1) }" instead of rejecting` seen on
#7893 and #7869.

## What changed

- The two tests move into their own non-concurrent
`describe.skipIf(!hasGit)("git sources configured through the server
process environment")`, placed between the two concurrent suites. Vitest
runs a non-concurrent sibling as its own group, after the preceding
concurrent group finishes and before the next one starts
(`partitionSuiteChildren` in `@vitest/runner`). So nothing else in the
file runs while `process.env` holds their git config. Moving them out of
"git sources" is required: `describe.concurrent` makes the suite itself
concurrent, so "git sources" and "multi-plugin repositories" run in
parallel, and `test.sequential` inside "git sources" would still overlap
the other suite.
- The probe git commands (`git clone` and `git fetch`) get their config
through the child `env` option (`gitConfigEnv`) instead of
`process.env`. `withProcessGitConfig` now wraps only the
`service.install` call, which has no other config channel.
- Nothing else in the file mutates `process.env` inside a concurrent
block. The npm-config tests sit in sequential describes, and the file
already gets an isolated worker because it mutates `process.env`.

Test-only change; production code is untouched.

## How you verified

- Reproduced on main by running only the two tests, so they always
overlap: `vitest run test/services/plugins/plugin-install.test.ts -t
"fetches only the resolved commit|falls back to a full clone"` failed
**15/15** runs with the exact CI error (the fetch printed `* branch
<sha> -> FETCH_HEAD`).
- Same command with this change: **20/20** passed.
- Full file, 8 consecutive runs: 8/8 passed (64/64 tests each).
- `pnpm exec turbo run typecheck --filter=@bb/server` and `pnpm exec
turbo run test --filter=@bb/server --
test/services/plugins/plugin-install.test.ts` both passed.

> AGENT GENERATED

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

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