Skip to content

Add app-wide plugin overlay slot - #2966

Merged
ymichael merged 5 commits into
mainfrom
bb/support-floating-plugin-panels-thr_9g3ffzhksz
Sep 2, 2026
Merged

ymichael merged 5 commits into
mainfrom
bb/support-floating-plugin-panels-thr_9g3ffzhksz

Conversation

@ymichael

@ymichael ymichael commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Plugins had no additive React surface for persistent app-wide floating UI. A content script can create a separate React root, but that root sits outside the BB plugin, router, query, and sidebar provider tree, forcing plugins to reproduce RPC, realtime, settings, and route access. Portaling from an unrelated host slot preserves React context, but using the exclusive thread-list replacement for an overlay prevents legitimate sidebar replacements from coexisting.

What changed

Added the experimental app.slots.experimental_appOverlay registration and app-level host mount. Overlays are additive, mount through PluginSlotMount beneath the existing app providers, retain SDK hooks and route state through React portals, preserve plugin stylesheet lifetime, and isolate crashes to the failing overlay. Added collector and frontend test-harness support, SDK declarations and examples, the experimental API audit entry, Plugin Guide inventory/card/wireframe coverage, and authoring documentation. Bumped the plugin SDK contract from 0.4.38 to 0.4.39 so plugins can require a host that provides the new surface. This is app-local frontend and SDK behavior, so HOST_DAEMON_PROTOCOL_VERSION is unchanged.

How you verified

  • Added tests for registration validation and duplicate IDs, app definition transport, plugin/router/query context through a document-body portal, RPC/settings/navigation behavior, additive sibling crash isolation, and portal stylesheet lifetime.
  • Ran node .github/workflows/check-plugin-sdk-version.mjs.
  • Ran pnpm exec turbo run build:types --filter=@get-bb/plugin-sdk.
  • Ran pnpm exec turbo run update:sdk-inventory --filter=@bb/plugin-api-map and confirmed the committed inventory is stable.
  • Ran pnpm exec turbo run test typecheck --filter=@get-bb/plugin-sdk --filter=@bb/domain --filter=@bb/plugin-api-map --filter=@bb/app --filter=bb-plugin-plugin-api-docs: 13 tasks passed; the app suite reported 471 files and 3,776 passing tests.
  • Ran bb plugin build plugins/plugin-api-docs.
  • Exercised the overlay in an isolated headless Doobie browser profile; the system Chrome session was not used.

AGENT GENERATED

@ymichael

ymichael commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

@slopcop

@bb-slop-cop

bb-slop-cop Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am the Slop Cop. I am reviewing this pull request now.

I will check security, code quality, performance, architecture, and the complete product path. I will post one final review after these checks.

Comment thread apps/app/src/App.tsx Resolved

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Plain-English summary

This PR lets a plugin show floating controls across the entire app. These controls keep their state when the user changes routes.

It also adds the SDK contract, host mount, tests, author documents, and Plugin Guide data.

Findings

  1. High — The overlay lacks a required public context.

    PluginAppOverlays mounts outside AppLayout. The public sidebar actions hook needs ThreadActionsProvider, which exists only inside that layout.

    A plugin which calls experimental_useSidebarThreadActions() crashes and disappears. I reproduced this failure in the real dev app.

    This result also conflicts with the new audit text, which says that overlays keep sidebar context.

  2. Low — The Plugin Guide numbers do not follow the visual order.

    The new overlay is below the right-panel targets. However, its mark appears before those targets in the sequence.

    The displayed order is 11 below 12 through 14. The Guide requires a top-to-bottom order inside each column.

Security

I found no new security defect. Frontend plugins already run as trusted app code, and the collector validates each overlay registration.

Performance and architecture

I found no release-level performance defect. An unrelated plugin registration can render overlays again, but it does not mount them again.

The new host uses the existing collector, slot store, and slot boundary. I found no duplicate runtime path.

The public CapturedPluginApp type repeats the collector contract. It already omits commandPaletteActions on main, so a later change should remove this duplication.

Verification

  • All 3,776 app tests passed across 471 files.
  • The selected SDK, API map, app, and Plugin Guide tests and type checks passed.
  • The SDK declaration build and Plugin Guide build passed.
  • The SDK inventory generator produced no diff.
  • A temporary plugin mounted a portal once and kept its state across a route change.
  • The overlay disappeared after plugin disable and returned with new state after plugin enable.
  • Browser QA opened the new Guide target and its detail card.

I left two inline comments for the confirmed issues.

…lugin-panels-thr_9g3ffzhksz

# Conflicts:
#	packages/plugin-api-map/sdk-public-api.json
@ymichael

ymichael commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

@slopcop Both review findings are addressed in 5e92cb4, and the branch is updated with current main at d61ede3. Please re-review.

@ymichael

ymichael commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

@slopcop

@bb-slop-cop

bb-slop-cop Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am the Slop Cop. I am now reviewing this change for security, code quality, architecture, performance, and user behavior.

@bb-slop-cop

bb-slop-cop Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am the Slop Cop. I am reviewing this pull request for security, code quality, performance, architecture, and end-to-end behavior.

@ymichael

ymichael commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

@slopcop

@ymichael
ymichael merged commit 111af3b into main Sep 2, 2026
24 of 25 checks passed
@ymichael
ymichael deleted the bb/support-floating-plugin-panels-thr_9g3ffzhksz branch September 2, 2026 23:21

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Plain-English summary

This change lets a plugin add a floating interface that stays available across the application.

The plugin keeps its application state when the user changes pages. Each plugin overlay also has separate crash protection.

Result

I found no release-blocking issue at the requested commit.

The two earlier findings are fixed. The overlay now has the sidebar action context. The Plugin Guide now uses the correct visual order.

Security

I found no new security defect. An enabled frontend plugin already runs as trusted application code.

The change uses the existing identifier checks, plugin boundary, and crash isolation.

Quality and architecture

The change uses the existing slot store and mount path. It does not duplicate the separate content-script path.

I found one old type duplication in the SDK test harness. This change does not create that duplication.

Performance

I found no performance defect. The host keeps stable keys and shared style references.

Work increases in direct proportion to the number of registered overlays. The change adds no timer, loop, or route remount.

Verification

  • All 53 changed app tests passed.
  • All 127 tests from the unrelated initial failures passed when run again without the concurrent dev server.
  • The selected SDK, domain, API map, app, and Plugin Guide type checks passed.
  • The SDK version check passed.
  • A temporary plugin showed an overlay in the real dev application.
  • The overlay kept its count after navigation to Extensions and back.
  • The public sidebar action remained available through the portal.
  • Plugin disable removed the overlay. Plugin enable restored it with new state.
  • GitHub CI passed before the merge.

This review covers d61ede33b. I also checked the later label-only commit 83d2b8441 and found no issue.


return (
<div data-bb-plugin-app-overlays="" className="contents">
{appOverlays.map((slot) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Low: Existing overlays render again when the slot list changes.

PluginAppOverlays reads the full slot snapshot. Each flush creates a new overlay array, so this map renders every previous overlay again.

A production transform produced 36 renders for eight sequential registrations. This work can delay app start when an overlay has an expensive render path.

Please move one overlay into a memo component. Pass the stable slot object, and add a test for a second registration.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Plain-English summary

This PR gives trusted plugins a supported place for floating controls across the app.

These controls keep their React context and state when the user changes routes.

The PR also adds validation, crash isolation, test tools, author guides, and Plugin Guide coverage.

Finding

  1. Low — Existing overlays render again during later registrations.

    PluginAppOverlays reads the full slot snapshot. Each flush can render every prior overlay again.

    Eight sequential registrations produced 36 renders in a production transform. A memoized overlay row can prevent this extra work.

    I left one inline comment with the suggested change.

Security

I found no new security defect. Frontend plugins already run as trusted app code, and the collector validates each registration.

Code quality and architecture

The implementation reuses the collector, slot store, error boundary, and stylesheet lifecycle. It does not add a duplicate runtime path.

CapturedPluginApp still copies the collector result type and already omits commandPaletteActions. That defect existed before this PR.

A later refactor should derive that testing type from the collector result. I did not treat this as a PR finding.

The current head only adds a neutral Guide label after the requested commit. That later change needs no action.

Verification

  • Four focused app test files passed with 53 tests.
  • Two focused performance test files passed with seven tests.
  • The app and Plugin SDK type checks passed.
  • The SDK version check and the Plugin Guide build passed.
  • All visible GitHub checks passed.
  • Browser QA kept overlay state across a route change.
  • Browser QA also kept the sidebar action hook and one overlay mount.
  • The final GPT-5.6 review gate approved the change.

I reviewed commit d61ede33b37d93833cde8f45d7c464db2c12c17a.

ymichael added a commit that referenced this pull request Sep 3, 2026
## Human comments

## What was wrong

`PluginAppOverlays` subscribed to the full slot snapshot and rendered
every overlay directly from its list. Each slot-store notification
therefore rendered every existing overlay again even when its stable
slot object had not changed, causing sequential registrations to do
triangular render work. This addresses the low-priority finding from the
[app-overlay
review](#2966 (comment)).

## What changed

Extracted each overlay mount into a memoized component that receives the
stable overlay slot object. Adding or removing another plugin overlay
still updates the host list, while unchanged overlay subtrees skip the
parent-driven render. A plugin re-registration still supplies a new slot
object and generation key, preserving the existing replacement behavior.
Added a focused render-count regression test. This is app-local React
behavior with no server/daemon wire change, so
`HOST_DAEMON_PROTOCOL_VERSION` is unchanged.

## How you verified

- Added a regression test that registers a second overlay and verifies
the first overlay renders only once.
- `pnpm exec turbo run test --filter=@bb/app -- --run
src/components/plugin/PluginAppOverlays.test.tsx` — 3 tests passed.
- `pnpm exec turbo run typecheck --filter=@bb/app` — passed.
- `pnpm exec turbo run lint --filter=@bb/app` — passed with zero errors.
- `git diff --check` — passed.

> AGENT GENERATED
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