Registry Mirror
Skip to content

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

While a sidebar search result was being dragged, editing the search could remove that result, and a later release over the composer still attached it as a thread reference. The sidebar now records which search result is held as soon as the press begins, even before it passes the drag threshold. It then cancels the drag in the same render that removes the result, so neither a held press nor a quick release can attach a result that is no longer shown.

Related: #44844, #21550

Reproduction on main

Commit 52682d10f9 (main). The composer adds a reference to the thread from the first search. Expected: The drag ends when its search result disappears, leaving the composer unchanged.

  1. Open a thread with an empty composer.
  2. Search for a different thread by title in the sidebar.
  3. Drag the result over the composer without releasing the mouse button.
  4. Replace the search text with a query that has no results.
  5. Replace the search text with a query that shows a different thread.
  6. Move the pointer within the composer while still holding the button.
  7. Release the mouse button over the composer.

The cause is at apps/web/src/components/Sidebar.tsx:3451. Ran pnpm scenarios:prove scripts/scenarios/sidebar-search-drag-ends-when-results-disappear.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean boat.dev VM, with expected 1 to be 0 in the output.

Evidence

Environment: Linux x64 on a boat.dev VM reset before each run, the repository's own tests.

Proven: the replacement test apps/web/src/components/Sidebar.drag.browser.test.tsx fails at the test commit 0da3c76985 and passes on the head 4b1ff31543, both on main e59f9db983.

Before After
Commit 0da3c76985 4b1ff31543
Result failed with "expected 'Thread search-target' to be null" passed
composer after replacing search results mid drag Before: composer after replacing search results mid drag Before: composer after replacing search results mid drag (changed region)
The composer adds a reference to the thread from the first search.
After: composer after replacing search results mid drag After: composer after replacing search results mid drag (changed region)
The drag ends when its search result disappears, leaving the composer unchanged.
failure Before: failure
Recording Before: recording After: recording

Tests

  • 0da3c76985 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed e59f9db9838fe0ad61d22d8e73fdfaf53f67ba5b passed on head.

Not in this change

  • The browser test cannot reproduce a release that lands before passive effects flush, so that timing case is protected by using a layout effect rather than by a test.
  • The browser test scrolls the composer into view because the test document does not clip the chat column; other drag tests may need the same if they aim at the composer.
  • Reorder drags in the main thread list still cancel from a passive effect when their row leaves the list; that path was not changed here.

Who did the work

  • Repro written by GPT 6.2 Sol, in Codex
  • Duplicate check judged by Claude Opus 5.5, in Claude Code
  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5

StiensWout and others added 3 commits December 3, 2026 07:15
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…esult

Track the held search result from the moment the press attaches and cancel
in a layout effect, so neither a pending press nor a release before passive
effects flush can attach a result that has left the search results.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Dec 3, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — The change cancels a sidebar search drag when its result disappears. It also adds a line-level lint suppression, which requires human review under the configured policy.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Sidebar now tracks a pending search-result drag and cancels it when the result disappears from active search results. A browser test checks that the drag ends and does not add the thread to the drop target.

Changes: Search-result drag cleanup

Layer / File(s) Summary
Track and cancel stale search-result drags
apps/web/src/components/Sidebar.tsx, apps/web/src/components/Sidebar.drag.browser.test.tsx
Sidebar records the pending search-result key, cancels the drag if the key is no longer present in active search results, and clears the key when the drag finishes. The browser test checks that the drag ghost disappears and that later pointer movement and release do not add the thread to the drop target.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: voltcrash, juliusmarminge

Merge Risk: Minimal · up to a4164

Dragging a sidebar search result that disappears from the results now cancels the drag instead of attaching the thread to the composer. No merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(web): sidebar search drags end when their result leaves the results" names the main change: a sidebar search-result drag now ends when its result disappears from the search results. The…
Description check Passed The description covers the problem, the change, the scope links, and verification. The Problem and Change sections explain that a sidebar search result stayed attached to the composer after it left th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(web): sidebar search drags end when their result leaves the results" names the main change: a sidebar search-result drag now ends when its result disappears from the search results. The Sidebar.tsx change tracks the pending drag key and cancels the drag when the key leaves the results, and the browser test checks this behavior. The title is specific, follows the conventional commit format in the template, and matches the changeset.

Full details: Description check

Explanation

The description covers the problem, the change, the scope links, and verification. The Problem and Change sections explain that a sidebar search result stayed attached to the composer after it left the results during a drag. The Verification section gives a reproduction on main, failing and passing commits for the new browser test, and a check command result. The Scope section links related issues #44844 and #21550 but does not state that the change is a bug fix for an issue, and the 'Problem' and 'Change' headings are not labeled as in the template. The author also gives a reasonable explanation of the timing edge case and what was not covered. Overall the description is mostly complete and follows the template structure.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4b1ff31 and a416442.

Files selected for processing: 2

  • apps/web/src/components/Sidebar.drag.browser.test.tsx
  • apps/web/src/components/Sidebar.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

juliusmarminge and others added 2 commits December 3, 2026 07:16
…3bf701a89ea

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants