Skip to content

Register message time as a core contribution behind a public-SDK boundary - #7925

Merged
ymichael merged 3 commits into
mainfrom
bb/core-contribution-boundary-thr_u28fqhpn8k
Nov 23, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/core-contribution-boundary-thr_u28fqhpn8k

Conversation

@ymichael

@ymichael ymichael commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Core's plugin-shaped registrations (message time, thread actions, the parent-thread segment) can import anything in the app, so nothing shows that a plugin could build the same thing, and nothing stops core from using capabilities the SDK lacks.

What changed

  • Boundary. New lint rule bb/core-contribution-imports (scripts/oxlint-plugin.mjs, enabled in .oxlintrc.json for apps/app/src/core-contributions/**). Files there may import only public @get-bb/plugin-sdk entry points, the @bb/shared-ui subpaths that packages/plugin-registry publishes, React and npm packages, and each other. It bans jotai, @tanstack/react-query and react-router, whose plugin copies cannot see bb's store, cache or router, and allows only a default definePluginApp export.
  • Message time moves to core-contributions/message-time.tsx. MessageTime and its formatters move to @bb/shared-ui/message-time, a new registry item (r/message-time.json).
  • Build-time SDK binding. vite-core-plugin-sdk-app.ts (app, Vitest and Ladle configs) resolves @get-bb/plugin-sdk/app for app source to lib/core-plugin-sdk-app.ts, which re-exports the functions pluginSdkAppImplementation serves to plugins. The runtime facade installs after first paint, so core code calling an SDK member while rendering would otherwise throw. core-plugin-sdk-app.test.ts pins each export to that object. Tests, stories and src/test/ keep the runtime path. Thread actions and the parent segment switch their imports to @get-bb/plugin-sdk/app.
  • Binding guard. TypeScript checks imports against the full SDK, but the binding exports only the members core uses, so an unbound member typechecked and was undefined under Vitest. New lint rule bb/core-plugin-sdk-app-binding reads the binding's exports and rejects app-source value imports, re-exports, and namespace, default and dynamic imports of @get-bb/plugin-sdk/app that reach past them. Type imports, tests, stories and src/test/ are exempt, matching the resolver.

This lands as scaffolding with one resident. Thread actions and the parent-thread segment move into core-contributions/ in follow-ups as their SDK gaps close. Archive/Delete is already closed by #7961. Still open:

  • Thread actions: toasts with core's behaviour (appToast, showMutationErrorToast) and thread hrefs (getThreadLocationPath).
  • Parent-thread segment: a thread link (NavLink), live thread data and focus handoff, and an inline mode for experimental_ThreadTitleText.
  • Info tab: its body comes from core through private context.

How you verified

  • Before: on main, adding jotai, @/components/ui/app-toast and @bb/domain imports to core's message-time registration passes oxlint (exit 0). After: each is reported, as is a named export; @bb/shared-ui/button and @bb/shared-ui/lib/utils are allowed.
  • Before the binding guard: importing experimental_useRpc from @get-bb/plugin-sdk/app in app source passed tsc and was undefined in Vitest. After: packages/scripts/test/oxlint-core-plugin-sdk-app-binding.test.mjs covers unbound named imports, namespace, default, re-export, export * and dynamic imports (reported) and bound members, type-only imports and the root SDK entry (allowed).
  • pnpm exec turbo run typecheck lint --filter='...[origin/main]': 94/94. turbo run test --filter=@bb/scripts --filter=@bb/plugin-registry passes.
  • @bb/app vitest over src/lib/core-plugin-sdk-app.test.ts, src/components/thread/timeline, src/lib/thread-actions, ThreadActionsMenu.test.tsx and src/components/promptbox/banner: 58 files, 684 tests passed.
  • pnpm start:worktree production build: message time ("10:08 AM") renders in the hover action row of a real thread.

AGENT GENERATED

🤖 Generated with Claude Code

Base automatically changed from bb/core-contributions-boundary-prototype-candidates-thr_sd3apyw3f9 to main November 20, 2026 22:01
ymichael and others added 3 commits November 23, 2026 10:13
…dary

Files in apps/app/src/core-contributions may import only what a plugin gets:
public @get-bb/plugin-sdk entry points, @bb/shared-ui subpaths that
packages/plugin-registry publishes, React and npm packages, and each other.
The bb/core-contribution-imports lint rule enforces this and bans jotai,
react-query and react-router, whose plugin copies cannot see bb's state.

Message time moves into the folder; MessageTime and its formatters move to
@bb/shared-ui/message-time as a registry item. For app source, a Vite
resolver binds @get-bb/plugin-sdk/app to lib/core-plugin-sdk-app.ts, which
re-exports the implementations plugins get, so core can call them before the
plugin runtime installs after first paint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nding

App source resolves @get-bb/plugin-sdk/app to src/lib/core-plugin-sdk-app.ts,
which exports only the members core uses, while TypeScript checks imports
against the full SDK. A member the binding lacks typechecked and was undefined
under Vitest. bb/core-plugin-sdk-app-binding reads the binding's exports and
rejects value imports, re-exports, namespace, default and dynamic imports that
reach past them; type imports, tests, stories and src/test keep the runtime
path and are exempt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/core-contribution-boundary-thr_u28fqhpn8k branch from b2fc8c7 to 4a3fede Compare November 23, 2026 18:16
@ymichael
ymichael marked this pull request as ready for review November 23, 2026 18:17
@ymichael
ymichael merged commit a89f5d7 into main Nov 23, 2026
52 checks passed
@ymichael
ymichael deleted the bb/core-contribution-boundary-thr_u28fqhpn8k branch November 23, 2026 19:20
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