[codex] Stabilize sidebar sortable drag#295
Merged
Merged
Conversation
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.
💡 Change Scope
📝 What Does This PR Do?
This PR stabilizes sidebar sortable drag behavior across all three visible hierarchy levels: projects, spaces, and agents.
It replaces the previous mostly-local drag handling with one shared sidebar drag contract:
overtarget.Root cause: the sidebar had sortable behavior split across levels, used broad collision detection, and only rendered a project overlay. That made upward drag, cross-scope boundary behavior, and displacement animation depend too heavily on incidental DOM geometry.
🏗️ Large Change Spec (Required if "Large Change" is checked)
1. Context & Business Logic
Sidebar reorder should behave like a constrained sortable tree:
2. State Ownership & Invariants
State ownership:
DndContextowns the transient active drag item.Invariants:
SortableContext.itemsorder matches rendered order for each scope.DragOverlaystays mounted and swaps only its child content so drop animation can run.3. Verification Plan & Regression Layer
Lowest meaningful layers:
SidebarDnd.spec.tslocks sortable scope invariants and malformed drag payload rejection.Validation run:
pnpm checkpnpm test -- --run src/app/renderer/shell/components/SidebarDnd.spec.ts src/app/renderer/shell/components/Sidebar.spec.tsx src/app/renderer/shell/components/Sidebar.scroll.spec.tsx src/app/renderer/shell/utils/sidebarReorder.spec.tspnpm test:e2e -- tests/e2e/workspace-canvas.sidebar-drag-boundaries.spec.ts tests/e2e/workspace-canvas.sidebar-drag-motion.spec.ts --project electron --reporter=linepnpm test:e2e -- tests/e2e/workspace-canvas.sidebar-drag-reorder.spec.ts --project electron --reporter=linepnpm pre-commitfor the implementation commit: 249 passed, 47 skipped.pnpm pre-commitfor the changelog commit: exited 0 with 248 passed, 1 unrelated flaky retry pass, 47 skipped.pnpm test:e2e -- tests/e2e/workspace-canvas.header-chrome-stability.spec.ts --project electron --reporter=line: 1 passed after the unrelated flaky was observed.✅ Delivery & Compliance Checklist
pnpm pre-commitis completely green.CLA.md).DEVELOPMENT.mdarchitectural boundaries.📸 Screenshots / Visual Evidence
No review-only media is committed. Runtime evidence is covered by the new Playwright motion test, which measures overlay presence, overlay height, source opacity, target displacement, and final order for project, space, and agent drags.