Skip to content

Keep Explorer move drops on their source host - #26836

Closed
nwparker wants to merge 7 commits into
nwparker/managed-terminal-file-drop-ownerfrom
nwparker/managed-explorer-move-drop-owner
Closed

nwparker wants to merge 7 commits into
nwparker/managed-terminal-file-drop-ownerfrom
nwparker/managed-explorer-move-drop-owner

Conversation

@nwparker

@nwparker nwparker commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Dragging a remote file into desktop Files could move a different desktop file at the same address. Files now refuses the move and says “Move files from the same host as this workspace.” Same-host moves still work on desktop and managed hosts.

What Changed

Directory-row and background drops pass the decoded drag-source owner into the existing move handler. Before moving or asking editors to save, the handler compares that owner with both cached source and destination owners. Background destinations use their directory-cache owner. The existing workspace-generation checks, editor transaction, undo/redo, path limits and self-drop protection remain in use. Terminal and Explorer drops share the same host comparison, including nested SSH server identity. The refusal is translated in all six locales.

The Docker lane runs both real Explorer drop cases. Main (#26838) now contains the existing catalog-recovery fixture correction: a desktop checkout makes its host-header assertion exercise two populated hosts; the sidebar intentionally omits headers for a single populated host. The original host-name and folder-owner assertions remain.

Why

An absolute path identifies a file only on its host. Looking up the dragged path in the destination tree can find an unrelated file. Checking the existing source metadata preserves the file's actual owner and reuses the terminal-drop rule. Transferring files between hosts would need a separate copy flow.

Linked Issue

Found during SSH/Remote testing; internal contribution, no separate issue. Stacked on #26830 to reuse its optional nested-SSH source namespace. Merge #26830 first. Parent is rebased onto main 049bf808ab24. Latest child head 39f779916c32d0b03c0a350ba4363edb5ea9b1d9 follows parent faee64cc483f; both fix cancelled toast-animation proof waits, and the parent fixes missing source metadata in the header positive fixture. Production assertions remain intact.

Visual Proof

Before: an actual managed Files row supplies its runtime owner. The desktop drop moves DESKTOP_MOVE_OWNER into MOVE_DESTINATION, while independent managed reads still return REMOTE_MOVE_OWNER. The moved desktop file is opened through Files below.

Before

After: the same drop shows the refusal, leaves the desktop source intact and creates no destination file.

After

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Exercised hidden macOS Electron renderers and an owned Linux Docker SSH host. HTML5 drag events use the actual source row and destination surface, followed by independent filesystem/server reads. This does not claim a physical OS drag journey.

  • Matching rebuilt parent fails after moving the desktop marker; seven ownership regressions fail on the parent.

  • 172 focused tests across 14 files pass: source/destination provenance, nested SSH namespaces, unknown owners, stale generations, guarded undo/redo, row/background metadata dispatch, terminal compatibility, editor moves, native imports and CI routing.

  • Both rendered Explorer cases pass all three repetitions each, six total in 1.5 minutes. Every case verifies cross-host refusal plus desktop and managed same-host moves, with actual owner metadata and source/destination contents.

  • Full pnpm tc, pnpm exec oxlint, changed-code quality, localization catalogs, fresh CLI/relay/Electron builds and commit hooks pass.

  • The broader conversion/update/stdio/port/catalog/idle/reboot/menu/terminal-drop/Explorer-drop suite passes all 15 cases, with zero skips, in four minutes: explorer-move-owner-broader-runtime.log.

  • Latest rebased fixture follow-up passes 114 affected tests / nine files (including the unchanged memory test), full typecheck, changed-code quality, fresh E2E build and hooks. Both Explorer cases and the inherited terminal case each pass all three real rendered repetitions: nine total, zero skips, 2.1 minutes.

Review

P1 / Medium merge risk; parent #26830 is also Medium. Self-review checked rejection before writes and editor-save requests, cached directory provenance, same-host acceptance, namespace collisions, stale generations, undo/redo, bounded decoding, folder workspaces, localization and platform assumptions. No remaining production findings. CodeRabbit reviewed the complete 22-file child diff at 453ccaf24255 and reports no actionable comments / Minimal reviewer risk. The project merge-risk estimate stays Medium because the shared owner comparison also serves terminal drops. Previous-head CI failed on the inherited header fixture and cancelled toast-animation waits in both drop specs. Those fixtures are corrected. The unchanged flatten-retained-slice heap threshold also failed in Node shard 5/5; it passes in the latest local affected suite, with no speculative product change. CodeRabbit’s latest review explicitly covers 39f779916c32d0b03c0a350ba4363edb5ea9b1d9 and reports no actionable comments / Minimal reviewer risk. Fresh CI remains queued or running. The generic docstring-coverage warning remains, following the repository’s concise-comment rule.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No RPC, stream opcode or persistent-state change. The source metadata remains version 1; the optional server field comes from #26830. Native Windows and physical OS drags have not been exercised locally. All mutation fixtures are disposable and owned by the tests.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred). Local gates are listed above; CI covers remaining checks.

@nwparker
nwparker requested a review from brennanb2025 as a code owner October 9, 2026 10:12
@nwparker
nwparker force-pushed the nwparker/managed-explorer-move-drop-owner branch from 7247e2b to 453ccaf Compare October 9, 2026 10:21
@nwparker

nwparker commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

The final branch is 453ccaf2425539eaeb1695f30a9e47be8ddf2d9c, rebased onto parent #26830 at 059769d7f3266b2ef2ee66303611573020b92416. The catalog fixture correction moved into the parent; a full-tree comparison confirms the child is identical to the tested 7247e2bd0d16 tree.

The shared owner comparison is also used by the terminal-drop fix. Local review found no remaining production issues. Validation: 172 unit tests across 14 files, both actual Explorer cases repeated three times each, and all 15 broader SSH cases pass. The parent independently passes its rebuilt 13-case lane. Before/after images and parent-red/final-green receipts are in the PR description.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 54269942-dbf2-4fd0-9962-17ce20f5f7ed

📥 Commits

Reviewing files that changed from the base of the PR and between 453ccaf and 39f7799.


📒 Files selected for processing (1)
  • tests/e2e/ssh-orcad-explorer-move-owner.spec.ts

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



📝 Walkthrough

Walkthrough

File-explorer drag-and-drop now passes source host and workspace metadata to the move handler. The handler checks source and destination ownership before a move and reports a translated error when hosts do not match. A shared host-matching function also validates terminal drops. Tests cover metadata propagation, host validation, and managed workspace moves. CI routes the new Docker-backed end-to-end test through the dedicated OrCAD job.


Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 39f77

No merge-blocking issue was identified in the reviewed change; normal checks remain appropriate.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the main change: preventing Explorer move drops across different hosts.
Description check Passed The description is complete and relevant. It covers the user impact, implementation, rationale, testing, visual proof, review status, platform limitations, and checklist. The linked issue section expl…


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker force-pushed the nwparker/managed-terminal-file-drop-owner branch from 059769d to faee64c Compare October 9, 2026 11:01
@nwparker
nwparker force-pushed the nwparker/managed-explorer-move-drop-owner branch from 453ccaf to 39f7799 Compare October 9, 2026 11:05
@nwparker

nwparker commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Updated child 39f779916c32d0b03c0a350ba4363edb5ea9b1d9 follows parent faee64cc483f on main 049bf808ab24. CI fixture failures are fixed: real source identity on the header positive drag, and cancellation-tolerant screenshot waits with explicit full-opacity checks. Direct refusals and real source/destination content assertions remain.

114 affected tests / nine files, typecheck/changed-quality/build/hooks pass. Both Explorer cases and the terminal case each pass three actual renderer/shell repetitions (9/9, zero skips, 2.1 minutes). The original unchanged memory-threshold CI failure is documented and passes locally without a product patch.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nwparker
nwparker force-pushed the nwparker/managed-terminal-file-drop-owner branch from faee64c to f84c269 Compare October 9, 2026 11:39
@OrcaWin
OrcaWin force-pushed the nwparker/managed-terminal-file-drop-owner branch from f84c269 to b0b0ce3 Compare October 9, 2026 17:37
@OrcaWin

OrcaWin commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Closing this one. Thanks for the careful work, but the cost-benefit doesn't hold up.

  • No real in-app way to trigger it. Orca has one main window, and the Files panel only shows the active workspace. Nothing switches workspaces while you hover during a drag. So a drag that reaches Files always starts in the same workspace. The repro gets around this by clicking the sidebar in the middle of a synthetic drag, which a real mouse drag can't do.
  • The remaining case is narrow and undoable. The only real route is a drag from a second Orca instance, or a crafted drag, carrying a path that exists at exactly the same absolute path in this workspace. If the path isn't already a row in this Files tree, the existing owner guard refuses the move. So the worst outcome is a visible file moving inside its own workspace, which undo reverses.
  • The fix has a big downside. It refuses every Files move unless the drag's source stamp matches this panel's owner lookup. Source-control rows stamp through a different resolver than Files rows, and same-host SSH moves were not exercised. Any mismatch would break ordinary moves, which is worse than the bug.
  • It is too large for the payoff. It is about 1,470 lines, including CI/e2e routing, a refactor of the terminal-drop check that was just merged in Keep workspace file drops on the terminal's host #26830, and six locale strings. It also conflicts with main now.

If cross-instance drags turn out to matter, a smaller follow-up could refuse a drop only when it carries a stamp naming a different host. That would never block an unstamped same-workspace move.

@OrcaWin OrcaWin closed this Oct 10, 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.

2 participants