Repository navigation
fix(sidebar): let a board card be dragged back out of its folder - #16365
Conversation
In board view a session filed in a folder had no drag path back to the top level: the root-lane unfile targets are dnd-kit droppables that render only inside the list view's DndContext, while a board card drags with native HTML5 DnD, so nothing in a board called the unfile offer. Each column now renders a dashed "Drop here to remove from folder" strip at its foot while a filed card is in flight, wired to the same moveByDrag(key, null) offer list view uses, so the wording and the undo bar carry over. The strip is a target of its own and stops propagation: a release on a status lane still only retags, a release on a folder header still only files, and a filed card stays retaggable without leaving its folder. A native-drag mirror (useNativeSessionDrag) tracks the card in flight, read at the window on drop and dragend because a drop that moves the card remounts it and the browser's dragend then lands on a detached node. The dragged row is kept mounted for the same reason. Fixes #16271
GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 5.6 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- website/src/pages/ChatSidebar.tsx:6459 -- Rejected unfile operations fail silently BLOCKING -- website/src/pages/ChatSidebar.tsx:6459 -- Feature map omits the board unfile gesture Adjudication (Opus 5) — is blocking on each finding proportionate?F1 — LOW: a rejected F2 — Below LOW: documentation completeness only; no runtime, data or user-visible consequence, nothing to recover from. False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS The macrotask drop-reset postdates the captured frames; verify one strip drop in a real browser on the final head. [DESIGN-REVIEWED] ac8a845 Description read[DESCRIPTION-READ] 06f031174c3fe9c8b419e789a16f5945537eddaf4260de6700a44c67b8080ed9 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Verify the drop in a real browser on this head: the recorded frames predate the macrotask-delayed reset, and jsdom cannot exercise that dispatch ordering. The one browser-behavior premise (window capture What this change shipsInventory (6 items) — 6 justifiedIntent: FIX — a session filed in a folder can be dragged back to the top level from board view, which only list view offered before.
[FIRST-PRINCIPLES-REVIEWED] ac8a845 Description read[DESCRIPTION-READ] 96a3b48a0898bfa716770e911266877b7ec99810df9d4cd45e5d6e9ff985a790 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Fable 5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS Unfile strips claim the foot of every column, so a filed card's existing retag release low in a lane now unfiles instead of retagging. Watch
Suggestions
[UX-REVIEWED] ac8a845 Description read[DESCRIPTION-READ] cc82334d306b0e277fe41de8a1764b7d20f43503b1833cbd5ec33947e9323c4f That sha256 names everything this verdict read: the PR description, plus the 13 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
|
|
|
iamwhatever
left a comment
There was a problem hiding this comment.
Reviewed: a native drop strip appears only while a filed card is dragged and stops propagation, so a release does exactly one thing; it reuses moveByDrag(k, null), so list view's undo bar comes with it. Drag state clears on dragend, a delayed reset after drop, and row unmount (the reset is pinned by a test); an unknown key does nothing, so no card ends up nowhere. Non-blocking: the strip is mouse-only (the row menu covers keyboard users), and a lane change mid-drag removes the strip for the rest of that drag.
Problem / Motivation
Goal: In the sidebar's board view, a session that sits in a folder can be dragged back to the top level, the same way it can in list view.
Bug fix. With tag columns configured, a session card filed in a folder cannot be dragged out of it: dragging the card over a column's empty space or its ungrouped area shows no drop highlight, and the card snaps back on release. List view has this gesture (the empty root space, and the dashed "Drop here to remove from folder" box), and it ends with an undo bar; the board offers no drag path out of a folder at all.
Why it matters
Filing a session into a folder by drag works in both layouts, but only list view offers the symmetric drag back out. A board user has to leave the board, or open the row menu and pick "No folder (root)", to undo a drag they made in two seconds. The asymmetry reads as a broken feature, not a missing one: the same card, the same grab, and nothing lights up.
Not a goal
pages.chatSidebar.drop_here_to_remove_from_folderkey.ChatPaneDropZoneis the other list-view-only landing of the same cause (a dnd-kit droppable a natively dragged card cannot reach) and stays a board gap after this PR; the issue and the ruling scope this fix to unfiling.What changed (motivation → approach → change)
Symptom: in board view nothing calls the unfile path. Root cause: the root-lane drop targets (
root-lane,root-group,RootDropHint) are dnd-kit droppables that only render inside the list view'sDndContext, while a board card drags with native HTML5 DnD; the only native drop handlers in a board were the folder header (files the card) and the column surface (retags it on a status lane).Approach: mechanism-level for the unfile gesture only (the board's other missing landing, the chat-pane drop, is named under Not a goal), and the first of the three options the pipeline comment lays out, the least ambiguous: a dedicated drop strip in each column, shown only while a FILED card is in flight, so one release does one thing and a filed card can still be retagged without leaving its folder. Unfiling on the ungrouped area, or folding unfile into the retag, were rejected for that reason.
Change:
website/src/pages/chat-sidebar/dnd/targets.tsx: aBoardUnfileDropStripbesideRootDropHint, same wording and look as a compact strip. Its native handlers act only on a session card (text/plain) and stop propagation, so the column's ownonDropnever also sees that release; a column reorder passes through.website/src/pages/chat-sidebar/dnd/useSidebarDrag.ts: auseNativeSessionDraghook, the native counterpart of theactiveDragmirror (which carries only dnd-kit drags and whose reconciler clears any mirror noDndContextreports). The row reports the start; the drag has three ends. A windowdragendresets at once. A windowdropresets one macrotask later, because the window's capture listener runs before React's root listener and a browser flushes React's sync update in the microtask checkpoint between the two, which would unmount the strip under the release before its ownonDropran (same shape as the chat pane's file-drop overlay). And the dragged row's own unmount resets, because a card whose lane changes mid-drag remounts under another column and a cancel after that firesdragendat a detached node neither the window nor React hears.website/src/pages/ChatSidebar.tsx: the row's nativeonDragStartreports the key (onNativeDragStart) and its unmount cleanup reports the end of a drag it started (onNativeDragEnd), both stable so the row memo holds; the dragged row iskeepMountedlike a dnd-kit one; every board column renders the strip at its foot, outside the scroller so it stays in reach however far the lane is scrolled, wired to the existingmoveByDrag(k, null)offer so the undo bar is list view's. The column body's "No onDrop here" note names both folder targets so it stays true.website/src/test/ChatSidebar.ownerComposition.test.ts: the new owner hook listed at its call position inCALL_ORDER.Overlap with #15997 (parent-folder drop targets in list view, which edits the same two source files):
git merge-treeof this head against its head957f456a34reports exactly one conflict, the shared import line inChatSidebar.tsxwhere both PRs add a name to the./chat-sidebar/dnd/targetsimport; the two insertions intargets.tsx(its overlay beforeRootDropHint, this strip after it) and everything else merge clean. Whichever lands second keeps both names there.Backwards compatibility
Compatible: the change only adds a drop target that renders while a filed card drags in board view; every existing drop (folder header, status-lane retag, list-view root targets) keeps its handler and its behavior, and no API, key, type or string is renamed or removed.
Removes nothing: the diff adds a component, a hook and a prop and edits one comment; it deletes no path, record, validator or key.
Tests
website/src/test/ChatSidebar.boardUnfileDrop.test.tsx(new, 7 tests), written first and run against main, where 4 of the first 5 fail; the first failing assertion reads:What each test locks in:
setSlotFolder(key, null)), arms list view's undo bar, and the strip is gone once the release lands;dropSlotToColumnnot called), and a release on the column body still retags and leaves the folder alone;dropdoes not reset the drag mirror synchronously while adragenddoes. Added after the local GPT review lane found that an immediate reset would, in a real browser, unmount the strip under the release and skip itsonDrop; the pin fails against that first version. jsdom runs no microtask checkpoint mid-dispatch, which is why the drop test alone could not catch it;ChatSidebar.ownerComposition.test.tspins the new hook's call position. Also run green:ChatSidebar.rowMemo,ChatSidebar.moveUndo,ChatSidebar.boardStateLanes.Manual verification
Frames below come from a real pod of this worktree: the fixtures (two status tags and their columns, an
Archivefolder, one filed card per column and one unfiled card) were seeded through the pod's own API, the drag is dispatched as nativedragstart/dragover/dropevents, and "before" is main's own build staged into the same pod. The frames were taken on the head before the local review round; that round changed only when the drag mirror resets after a release (one macrotask later), so the strip, the drop and the undo bar they show are unchanged. The pod is released. Gate notes:npm run jscpdfound 0 clones; the full website vitest run was cut by the shared host's budget after 1518 of 2177 files with one failure,hoverVariantPolicy.test.ts, which was red on the base this branch was cut from and is fixed on current main (#16227); after the rebase onto that main it passes here too.scripts/local-gate.py: the frontend related set (108 files, 1034 tests) passes; the backend cross-surface guard (50284 tests) has 43 failures, 42 of them failing identically on the pristine main clone (test_cloud_source.py,test_pipeline_conductor_skill_contract.py: the sandbox's root ownership and spec gate, nothing this diff touches) and one lock-retry timing test that passes on rerun.tsc,eslint --max-warnings 0, the i18n, phantom-classes and restyle-ratchet gates pass. Local review, one round, lanes one at a time on the pinned CI models where available (both thegpt-5.6-solandclaude-opus-5pins were unavailable, so those two lanes ran on a substitute model and local green is weaker than server green): the GPT lane returned PASS with the deferred-reset finding, the Opus lane returned PASS with the lingering-mirror finding, both fixed in this head and each pinned by a test; the First Principles lane returned CONCERNS on the previous head (a reader-lessdata-unfile-dropattribute, deleted; the fix's scope and the remaining sibling gap unnamed, now stated under What changed and Not a goal) and PASS on this head. A focused verifier confirmed both lane findings closed with no new issue, noting one trade-off outside the normal path: when a card's lane changes mid-drag, the strips now leave as the card remounts instead of lingering after the cancel, and the card can be dragged again from its new lane. The comment-history gate scans Python only; the TypeScript comments this diff adds follow its rule by hand.Screenshots / video
Board view while a filed card is being dragged. Before: nothing to drop on, the card snaps back. After: every column shows the strip, and the one under the pointer lights up.
A column with no drag in flight is unchanged (before / after, dark / light)
Related Issues
Fixes #16271
Pattern harvest
Rule candidate: review-prompt
Pattern: a drop target registered with one drag system (a dnd-kit droppable) is unreachable from a surface whose items drag with another (native HTML5 DnD); when a lane switches drag mechanism, every target the old one offered needs a counterpart or the gesture silently has no landing.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement