Repository navigation
Restore optimistic sidebar updates and group archive Undo - #5045
Merged
Merged
Conversation
ymichael
added a commit
that referenced
this pull request
Oct 6, 2026
## Human comments ## What was wrong In the sidebar's By project mode, project groups were treated as unrestricted drop destinations. Dragging a pinned or child thread onto another project's header or row could show a valid landing affordance and attempt to unpin or detach the thread, even though the drop cannot change its project. ## What changed Track each project group's project ID, including the personal Threads container, and reject mismatched destinations during collision detection and drop resolution. Invalid destinations no longer highlight or show landing previews, and releasing there leaves the thread unchanged. Drops into the thread's own project and supported cross-project parent/child links remain available. No wire, CLI, or public SDK changes. Also align the cache-owner import registry with the sidebar group owner introduced in #5045: declare its six imports and remove the stale projectsQueryKey allowance from the thread state owner. ## How you verified - Added four regression cases covering another project's header and row, an empty project, and the personal Threads group. Each checks that a valid prior target clears and dropping causes no mutation. - `pnpm exec turbo run test --filter=bb-plugin-thread-list -- app/dnd/useSectionThreadDnd.test.ts app/dnd/useSectionThreadDnd.projection.test.tsx`: 62 passed, including existing cross-project nesting coverage. - `pnpm exec turbo run typecheck lint --filter=bb-plugin-thread-list`: passed; lint reports 9 existing warnings and no errors. - Real browser mouse drags in an isolated source app: another project and an empty project show no drop indicators or preview; dropping preserves project and pin state. Dropping onto the thread's own project unpins it, and the placement survives reload. - Reproduced the cache-owner registry CI failure locally, then verified all 3 registry checks pass after the update: `pnpm exec turbo run test --filter=@bb/app -- src/hooks/cache-owners/cache-owner-registry.test.ts`. The 62 drag checks also pass after merging current main. - Prepared and started `pnpm start:worktree` with labeled test projects and threads for manual review. > AGENT GENERATED
ymichael
added a commit
that referenced
this pull request
Nov 3, 2026
## Human comments ## What was wrong `@bb/app` had grown to 657 test files and 6,809 tests. Many tests checked a contract that another test already covered more strongly. Others only exercised wiring, tested a third-party library, or held assertions that could not fail. A few production `export`s and one parameter existed only for these tests. This made the suite slower to run and maintain without catching any extra bugs. ## What changed Test files only, apart from removing test-only exports. Net −1,077 test lines across 58 files (+290 / −1,367), four whole files deleted, and 6,809 → 6,750 tests. Production changes are +8 / −11 across 7 files, with no behaviour change. **Removed** - **Duplicates:** the raw-thread-id title tests that #5261 copied into `ThreadTitleMentions.resources.test.ts` but never removed from the original. Also sibling tests repeating the same setup and assertion, and mocked copies of scenarios that already run through the real code: `composer-submissions`, `app-toast-title-overflow`, OnboardingGate, AddMachineDialog expiry, ToolsView banners, provider-icon, plugin-slots, the cache-owner rename, pin acknowledgement, the CommandPalette settings page, QuestionForm, and the PromptBox/composer-contract rejection. - **Wiring and constant pins:** small helpers tested directly when their only caller is tested (`resolveUrlOpenTarget`, `parseLifecycleError`, `buildAudioInputConstraints`, `resolvePaneArrangementLabel`); realtime registry rows that `satisfies Record<…>` already enforces at typecheck; a snapshot-identity check covered by a stricter structural-sharing test. - **Third-party only:** `src/test/virtualizer-scroll-lifecycle.test.tsx` tested `@tanstack/virtual-core` and guarded a repo patch that #5951 removed. Upstream now cancels the timer itself. - **Vacuous:** a lifecycle-error row varying `hasPath`, which no code reads; BrowserTabDeck rows that pass either way; a FollowUpPromptBox placeholder test whose two placeholders were the same string; a dead `vi.mock` of a module the code under test never imports. - **Test-only production seams:** dropped `export` from `buildAudioInputConstraints`, `buildDevWebSocketUrl`, `resolveUrlOpenTarget`, `parseLifecycleError`, `threadTitleTextSegments` and `resolvePaneArrangementLabel`. Removed `getSecondaryPanelChromeStackClassName`'s `hasGitDiffToolbar` parameter; its only caller passed `false`. **Repaired** (assertions that could not fail) - `plugin-bound-sdk`: the test promised cache updates but only checked call shape. It now asserts that a created section reaches the sidebar cache before `create` resolves. That behaviour (#5045) had no test before. - `split-layout/ops`: `if (root.type === "split")` guards could skip every resize-clamp assertion; they now throw on a non-split root. - `provider-icon`: `toBeDefined()` on a non-optional return replaced with real `ariaLabel` checks. - `use-composers`: the test named "lock or paint" now also exercises `setTextEffect`. - `ThreadMetadataContent`: `path: null` let the "provisioning" test pass without its status check. - Terminal UTF-8 split glyph: this tested the browser's `TextDecoder`. It now writes through `writeTerminalOutput` into a real xterm. - Early `focusEnd`, the voice transition while hidden or under reduced motion, and the model-picker cycle-chord exception could all pass with the guarded code removed. They now fail when it is. - `dev-websocket-url` now goes through `buildBrowserWebSocketUrl`, which also covers the production fallback URL. ## How you verified - **Mutation checks.** Three independent reviewers worked on dedicated worktrees of `main` and of this branch. For every removed or merged test, they wrote the bug it caught as a mutation of the production code. They confirmed the old test fails on `main` and that a remaining test fails on this branch, then restored the source. - About 110 mutations were run. 18 removals turned out to be the only guard on their contract; 16 of those were restored. - The most important restoration: a known raw thread id must display as its title through the synchronous `resolveThreadTitleDisplayText`. The rendered pills hide this bug, but the AppLayout title, archived-threads settings and the parent-thread picker show it. - Other restorations: the Meta+Enter `aria-keyshortcuts` label, QueuedMessagesList open/close reporting and overflow toggling, older touch actions at the former width threshold, the touch-selection menu side (#6567), the terminal-view unmount, the plugin update-action icon, the marketplace icon in AddPluginDialog, the ReuseEnvironmentPicker secondary text, the app chrome row-height token, the focused notification on title Show more, the mapper's unread-error indicator, the `useThreadStorageLocation` fetch, the thread invalidation `maxWait` bounds, and the sidebar info-tab id. - Two gaps were left out on purpose: the `hasPath` lifecycle row (no code reads `hasPath`) and a single `shrink-0` class pin. - Each repaired assertion was shown to fail under a mutation that the old assertion let through. - **Baseline** at 51d8ddc: `pnpm exec turbo run test --filter=@bb/app` ran 6,809 tests, with 6 failures at machine load ~89. All six pass when run alone or at normal load. - **After rebasing onto origin/main:** `pnpm exec turbo run lint typecheck test --filter=@bb/app` gave 0 lint errors, a clean typecheck, and 6,740 of 6,750 tests passing (9 skipped). - The one failure, `CommandPalette` "runs an available shortcut … after closing and restoring focus", timed out opening the palette at load ~79. It failed the same way in the baseline run on `main`. - It passes in five isolated reruns, two of them uncached (`--force`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
The sidebar plugin migration replaced several host mutation hooks with direct SDK calls, bypassing optimistic cache updates for worktree-group archiving, restoring threads, and pinned moves. Project/machine renaming and project/section removal also waited for server updates. Nested archive/delete operations could leave descendants visible, and pinned drag previews could settle back into stale ordering.
Environment-group archiving also used a plain Sonner success toast rather than BB's shared archive feedback, so its styling differed and it had no Undo action.
What changed
0.6.24and require that version in the thread-list plugin. No server/daemon wire, database, or CLI contract changes.How you verified
Regression tests failed before their fixes for pending SDK writes, pinned-order settlement, nested family removal, and missing group Undo.
Focused Turbo verification passed:
@bb/app,bb-plugin-thread-list,@get-bb/plugin-sdk, and the affected Plugin Guide package;git diff --check.Browser verification against
pnpm start:worktreeconfirmed optimistic group archive, pinned move, restore, project/section rename and removal, and machine rename. Held requests proved updates happened before responses; injected failures verified rollback. A real group archive → Undo restored both threads, confirmed through the server API.