Skip to content

fix(sidebar): let a board card be dragged back out of its folder - #16365

Merged
iamwhatever merged 1 commit into
mainfrom
fix/16271-board-unfile-drop-target
Oct 3, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
fix/16271-board-unfile-drop-target

Conversation

@pepmach

@pepmach pepmach commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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

  • No change to list view's drop targets, wording or undo bar; the board reuses them.
  • No change to the column body's own drop (a card released on a status lane is retagged, exactly as before) or to the folder-header drop (a card released on a folder is filed, exactly as before).
  • No new user-facing string: the strip reuses the existing pages.chatSidebar.drop_here_to_remove_from_folder key.
  • No drop of a board card onto the open chat pane as a reference. ChatPaneDropZone is 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.
  • No backend change.

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's DndContext, 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: a BoardUnfileDropStrip beside RootDropHint, 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 own onDrop never also sees that release; a column reorder passes through.
  • website/src/pages/chat-sidebar/dnd/useSidebarDrag.ts: a useNativeSessionDrag hook, the native counterpart of the activeDrag mirror (which carries only dnd-kit drags and whose reconciler clears any mirror no DndContext reports). The row reports the start; the drag has three ends. A window dragend resets at once. A window drop resets 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 own onDrop ran (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 fires dragend at a detached node neither the window nor React hears.
  • website/src/pages/ChatSidebar.tsx: the row's native onDragStart reports 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 is keepMounted like 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 existing moveByDrag(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 in CALL_ORDER.

Overlap with #15997 (parent-folder drop targets in list view, which edits the same two source files): git merge-tree of this head against its head 957f456a34 reports exactly one conflict, the shared import line in ChatSidebar.tsx where both PRs add a name to the ./chat-sidebar/dnd/targets import; the two insertions in targets.tsx (its overlay before RootDropHint, 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:

AssertionError: the column renders its unfile strip while the filed card drags: expected null to be truthy

What each test locks in:

  • the strip appears when a filed card starts dragging, and not before;
  • dropping on it calls the unfile write (setSlotFolder(key, null)), arms list view's undo bar, and the strip is gone once the release lands;
  • a release on the strip never also retags (dropSlotToColumn not called), and a release on the column body still retags and leaves the folder alone;
  • a card that is not in a folder shows no strip;
  • a drag that ends without a drop takes the strip down;
  • (hook-level) a window drop does not reset the drag mirror synchronously while a dragend does. 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 its onDrop; 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;
  • the dragged card leaving the DOM mid-drag ends the drag: once the card is back, filed, with no drag in flight, no strip comes back with it. Added after the local Opus review lane found the mirror could outlive a cancelled drag whose card changed lane; the pin fails with that end removed.

ChatSidebar.ownerComposition.test.ts pins 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 Archive folder, one filed card per column and one unfiled card) were seeded through the pod's own API, the drag is dispatched as native dragstart/dragover/drop events, 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 jscpd found 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 the gpt-5.6-sol and claude-opus-5 pins 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-less data-unfile-drop attribute, 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.

Dark Light
Before, mid-drag before, dark, dragging before, light, dragging
After, mid-drag after, dark, dragging after, light, dragging
After, dropped (undo bar) after, dark, dropped after, light, dropped
A column with no drag in flight is unchanged (before / after, dark / light)
Dark Light
Before, idle before, dark, idle before, light, idle
After, idle after, dark, idle after, light, idle

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

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
@pepmach
pepmach requested a review from a team October 3, 2026 02:52
@pepmach
pepmach requested a review from a team as a code owner October 3, 2026 02:52
@pepmach
pepmach requested a review from iamwhatever October 3, 2026 02:52
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings (all downgraded on adjudication)

GPT 5.6 flagged blocking issues on ac8a8459d8ab435b62765aa154be2d50dd65a0b0; Opus 5 adjudication downgraded every one of them to advisory. Adjudication downgraded all 2 blocking finding(s) to advisory: the remedy each one requires is disproportionate to the harm it prevents. Read them as advice, not as merge conditions.

This comment is updated in place on each push.

Review details

BLOCKING -- website/src/pages/ChatSidebar.tsx:6459 -- Rejected unfile operations fail silently
onUnfile={k => moveByDrag(k, null)}
Rejected folder update -> rollback-only mutation handler -> card snaps back without an error notice.
Anchor: errors-use-error-notice
Fix: Route the rejection to the existing board ErrorNotice.

BLOCKING -- website/src/pages/ChatSidebar.tsx:6459 -- Feature map omits the board unfile gesture
{boardDraggingFiledSession && <BoardUnfileDropStrip ... />}
New board drop path -> unchanged Sessions feature-map row -> documented ownership is incomplete.
Anchor: feature-map-correctness
Fix: Update the Sessions row to include the board unfile drop strip.

[GPT-REVIEWED] ac8a845
[BLOCK-MERGE-DOWNGRADED] ac8a845

Adjudication (Opus 5) — is blocking on each finding proportionate?

F1 — LOW: a rejected setSlotFolder rolls the slot's folder_id back (website/src/hooks/useMoveSlotToFolder.ts:52-59), so the card visibly returns to its folder and the drag can simply be repeated; no false confirmation appears either, since the undo offer goes live only on the server ack (website/src/hooks/useMoveUndo.ts:124-135).
Conditions confirmed: the new strip calls the pre-existing moveByDrag (website/src/pages/ChatSidebar.tsx:6459 → useSidebarDrag.ts:165-182 → apply/assignToFolder at useSidebarDrag.ts:119,144), whose silence is shared with the untouched board folder-header drop (ChatSidebar.tsx:3424) and the list-view drops (useSidebarDrag.ts:408-409).
Real fix: either migrate the shared useMoveSlotToFolder to expose error state and thread it through useSidebarMoveUndo into board-level ErrorNotice (+ askAgent decision, i18n key) for all four call sites, or add a board-only error channel serving this one gesture while its mirror gesture stays silent — cross-module work or a single-path mechanism, against a visible self-correcting failure.

F2 — Below LOW: documentation completeness only; no runtime, data or user-visible consequence, nothing to recover from.
Conditions confirmed: feature-map-correctness requires a row change for a page/handler added or deleted or a <Route> registration added or removed (AUTOSDE.yaml:20-38) — this diff adds none, and the gate's own contract states an edit-only diff is deliberately out of the map's scope (scripts/check_feature_map.py:13-23); the Sessions row already assigns pages/chat-sidebar/ — "the owners of its … board, drag and drop" — to docs/system-specs/modules/history.md rather than enumerating gestures (docs/feature-map/README.md:68), which is where dnd/targets.tsx lives.
Real fix: prose grown into an already-vast row for a gesture the row delegates elsewhere — the "unrelated map churn" the same rule rejects, plus the standing expectation that every UI gesture tweak now edits the map, against no harm.

[ADJUDICATION] ac8a8459d8ab435b62765aa154be2d50dd65a0b0 total=2 uphold=0 downgrade=2
DOWNGRADE F1 website/src/pages/ChatSidebar.tsx:6459 reason=disproportionate-remedy
DOWNGRADE F2 website/src/pages/ChatSidebar.tsx:6459 reason=disproportionate-remedy
[GPT-ADJUDICATED] ac8a8459d8ab435b62765aa154be2d50dd65a0b0

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ac8a8459d8ab435b62765aa154be2d50dd65a0b0: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of ac8a8459d8ab435b62765aa154be2d50dd65a0b0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of ac8a8459d8ab435b62765aa154be2d50dd65a0b0 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 drop → microtask checkpoint → React root listener) is corroborated by an existing shipped sibling, useChatFileDrop's deferred onWindowDrop reset at website/src/components/ChatDropOverlay.tsx:49, which carries the same rationale — so it is derived, not inherited. Defect provenance is checkable: the PR ships ChatSidebar.boardUnfileDrop.test.tsx, whose strip assertion plainly fails on base where no strip exists. The one unfixed sibling of the root cause (ChatPaneDropZone, counted: 1, grepped targets.tsx) is declared and deferred under Not a goal.

What this change ships

Inventory (6 items) — 6 justified

Intent: FIX — a session filed in a folder can be dragged back to the top level from board view, which only list view offered before.

  1. While a filed card drags in board view, each column shows a dashed "Drop here to remove from folder" strip; dropping there unfiles with list view's undo bar — justified
  2. A release on the strip only unfiles; the column body's retag and folder-header filing behave exactly as before — justified
  3. The dragged card stays rendered for the whole drag instead of being virtualized away — justified
  4. A cancelled drag whose card changed lanes mid-flight takes the strips down instead of leaving them on screen — justified
  5. New internal drag mirror (useNativeSessionDrag, two optional row props) — justified; consumer count 1 (ChatSidebar.tsx), grepped useNativeSessionDrag
  6. The column-body "No onDrop here" comment now names both folder drop paths — justified

[FIRST-PRINCIPLES-REVIEWED] ac8a845

Description read

[DESCRIPTION-READ] 96a3b48a0898bfa716770e911266877b7ec99810df9d4cd45e5d6e9ff985a790

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

UX Review (Fable 5) — 🟡 CONCERNS

UX-level review of ac8a8459d8ab435b62765aa154be2d50dd65a0b0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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

  • Before this PR, releasing a filed card anywhere on a column retagged it; now {boardDraggingFiledSession && <BoardUnfileDropStrip/>} inserts a ≥36px band at every column's foot whose handlers stopPropagation, so a habitual low release unfiles instead of retagging — and a release on a foreign column's strip unfiles while the card stays in its origin column, not where it was dropped. Occasional (only filed-card drags ending in the foot band) × friction (wrong but undoable operation, undo bar in view) × every such drag. Smallest fix: a human confirms the hover ring is distinct enough in a real drag, or render the strip only in the dragged card's own column(s).

Suggestions

  • After the unfile the card remounts at a sort-determined root position (the blind reader: order changed, "no idea why"); fire the existing revealFlash on the moved row so the eye finds its landing spot.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed ac8a8459d8ab435b62765aa154be2d50dd65a0b0 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ac8a845

Verdict parsed from the review's SHA-scoped output markers for commit ac8a8459d8ab435b62765aa154be2d50dd65a0b0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ac8a8459d8ab435b62765aa154be2d50dd65a0b0: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 3, 2026
@pepmach

pepmach commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author
  • Rejected unfile operations fail silently (rebutted) span=c3bc99e7b8e9

The strip adds a caller, not a path: onUnfile={k => moveByDrag(k, null)} is the same offer the untouched board folder-header drop (website/src/pages/ChatSidebar.tsx:3424) and the list-view drops (website/src/pages/chat-sidebar/dnd/useSidebarDrag.ts:408-409) already call, and the silence lives in the shared useMoveSlotToFolder, which this diff does not change. A rejected write is not invisible there: onError rolls folder_id back (website/src/hooks/useMoveSlotToFolder.ts:52-59), so the card returns to its folder in view, and the undo bar never goes live for it because the offer arms only on the server ack (website/src/hooks/useMoveUndo.ts:124-135), so no false confirmation appears. errors-use-error-notice governs how a surfaced error renders, not whether this shared hook must surface one; giving it an error channel is a change to all four call sites and to list view, which the frozen goal excludes, and a board-only channel would make the strip louder than its mirror gesture. The code stays as is; the Opus adjudication reached the same reading (LOW, disproportionate remedy).

@pepmach

pepmach commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author
  • Feature map omits the board unfile gesture (rebutted) span=c3bc99e7b8e9

feature-map-correctness asks for a row change when a dashboard page or handler is added or deleted, or a <Route> registration changes (AUTOSDE.yaml:24-28). This diff does none of those: it edits three existing files under website/src/pages/ and adds one test under website/src/test/, and scripts/check_feature_map.py states in its own contract that "an edit-only diff never trips this" because the map describes ownership, not behaviour. The Sessions row already assigns pages/chat-sidebar/ as "the owners of its ... board, drag and drop" and points to docs/system-specs/modules/history.md (docs/feature-map/README.md:68), which is where dnd/targets.tsx and dnd/useSidebarDrag.ts live, so the row is still true. Growing that row with one gesture is the "unrelated map churn" the same rule rejects. The code and the map stay as they are; the Opus adjudication reached the same reading (below LOW).

@pepmach

pepmach commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author
  • Flash the moved row after the unfile so the eye finds it (rebutted) span=efeba73b879f

The strip reuses list view's unfile offer, and list view's own unfile has never flashed the moved row: the landing confirmation both views share is the undo bar the drop arms ("Moved to ... / Undo"), which names the move and takes it back in one click. There is also no flash-only entry to call: useSidebarReveal returns only revealFlash (website/src/pages/chat-sidebar/reveal.ts:303), and the one way to light a row is the requestSlotReveal request, which also clears every filter hiding the row, expands its ancestors and scroll-centres it, far more than a drop should do under the pointer. Taking the suggestion here means a new seam in the reveal hook plus a board-only behaviour list view lacks, the asymmetry this fix removes. Out of the frozen goal ("No change to list view's drop targets, wording or undo bar; the board reuses them"); a landing flash for drag moves in both views is a follow-up of its own.

@iamwhatever iamwhatever 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.

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.

@iamwhatever
iamwhatever enabled auto-merge (squash) October 3, 2026 06:07
@iamwhatever
iamwhatever merged commit bc90ac1 into main Oct 3, 2026
102 of 104 checks passed
@iamwhatever
iamwhatever deleted the fix/16271-board-unfile-drop-target branch October 3, 2026 06:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 3, 2026
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.

Board view: dragging a session out of a folder to the root has no drop target

2 participants