Skip to content

Fix environment grouping across custom sidebar sections - #3943

Closed
ymichael wants to merge 1 commit into
mainfrom
bb/fix-custom-organization-grouping-bug-thr_ujg7746gj3
Closed

ymichael wants to merge 1 commit into
mainfrom
bb/fix-custom-organization-grouping-bug-thr_ujg7746gj3

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

With sidebar organization set to Custom and By environment enabled, environment groups were built before custom sections. The first thread in each environment determined the section for the entire group, so other threads sharing that environment appeared in the wrong section or outside their assigned sections.

What changed

Partition root thread nodes by section before grouping environments in custom organization mode. Threads sharing an environment now group only within their own section, including the unsectioned bucket. Preserve parent/child trees and existing project organization behavior. Add regression coverage for grouping enabled/disabled, separate sections sharing an environment, unsectioned threads, missing section definitions, descendants, and section counts.

How you verified

  • Ran the new tests against the original implementation: two regression cases failed; all 300 client-core tests pass with the fix.
  • pnpm exec turbo run test typecheck --filter=@bb/client-core — passed.
  • pnpm exec turbo run test --filter=@bb/app -- sidebarDropPreviewPlacement — all five tests passed.
  • Started the branch with pnpm start:worktree using a fresh isolated database. Captured before/after browser screenshots using four synthetic idle threads sharing one environment across two sections and the unsectioned bucket.
  • Verified source bb CLI section moves, clearing a section, and readback against that server; browser reloads preserved the correct assignments.
  • Verified actual browser interactions for grouping off/on, By project, and section collapse/expand. Each fixture thread remained reachable exactly once; restored Custom + By environment for manual QA.
  • git diff --check — passed.

AGENT GENERATED

@ymichael

Copy link
Copy Markdown
Collaborator Author

Superseded by #3946, which includes this PR's section-aware environment grouping implementation and regression tests alongside worktree group/member dragging. The combined branch passes all 300 client-core tests, 78 focused app tests, and both package typechecks.

@ymichael ymichael closed this Sep 19, 2026
ymichael added a commit that referenced this pull request Sep 21, 2026
…#3946)

## Human comments

## What was wrong

Worktree group headers and their member rows did not participate in
sidebar dragging, and the header shared an identifier with its first
thread. Custom sidebar sections were also applied after environment
grouping, so one member's section determined where the whole group
appeared. When dragging an expanded group into an empty Threads section,
hidden source children could become the final drop target even while the
destination preview remained visible, cancelling the move.

## What changed

- Enable dragging expanded or collapsed worktree groups between custom
sections and Threads, moving their represented threads while preserving
parent relationships.
- Give group headers distinct drag IDs and enable independent member and
nested-child dragging through the existing thread move, detach, and
nesting behavior.
- Partition root nodes by section before grouping environments in Custom
organization. Preserve parent/child trees and existing By project
behavior; threads sharing an environment group only within their own
section or the unsectioned bucket.
- Exclude the dragged group's header and descendants from collision
candidates so hidden source rows cannot steal an empty-section drop.

Includes and supersedes #3943, retaining its grouping implementation and
regression coverage. Uses existing SDK thread updates and CLI section
assignments; no server/daemon wire changes.

## How you verified

- `pnpm exec turbo run test typecheck --filter=@bb/client-core` — all
300 tests and typecheck passed on the combined branch.
- `pnpm exec turbo run test --filter=@bb/app -- useSectionThreadDnd
ProjectRow.interactions ProjectThreadTree.disclosure
sidebarDropPreviewPlacement` — all 78 tests passed on the combined
branch.
- `pnpm exec turbo run typecheck --filter=@bb/app` — passed.
- Regression coverage includes separate sections sharing an environment,
grouping enabled/disabled, unsectioned threads, missing section
definitions, descendants and counts, independent member moves, and
hidden-child collision handling for pointer overlap and nearest-target
fallback.
- Used actual Chromium mouse input against `pnpm start:worktree` and the
source BB CLI to verify expanded/collapsed group moves, moves between
sections and back into Threads, nested-child detachment, independent
first-member moves, nesting, Escape cancellation, ordinary-thread
dragging, and reload persistence.
- Reproduced the empty-Threads failure, repeated the same pointer path
after the fix, and confirmed both members' section IDs cleared while
unrelated threads stayed unchanged. Also verified the collapsed-group
case.
- Rebased onto `b1f94e0795` and resolved the environment-header conflict
while retaining inline rename and drag behavior.
- Current focused coverage passes: 300 client-core tests, 50
changed-area sidebar tests, 82 isolated Command Palette/Plugin Settings
tests, and app/client-core typechecks.
- Repeated production-build QA with `pnpm start:worktree`, real Chromium
mouse dragging, source `bb` CLI state reads, reload persistence,
connected server/daemon health, and the remote BB Connect origin.

<details>
<summary>Bundle impact</summary>

The worktree-group drag behavior adds 1.4 KiB to the raw boot payload.
The raw allowance increases by 2 KiB; the compressed cap stays at 419.0
KiB. Current output is 1697.9 KiB raw and 416.9 KiB Brotli, and the
exact bundle-budget check passes.

</details>

Safari/iOS touch dragging was not tested.

> 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