Repository navigation
refactor(shell): the local-open guard takes an owner, not settings - #27144
Conversation
isLocalPathOpenBlocked now takes the path's owning host (ExecutionHostId, an ExecutionHostOwnerMatch, or 'unresolved') and allows only 'local'. The settings parameter is gone, so every caller names its owner. Markdown link callers resolve the document's host from the catalog instead of falling back to the focused server; reveal keeps the focus check explicitly because the main process still refuses reveals while a server is focused.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The ownership change has no established merge-blocking issue. Normal validation can proceed. Pre-merge checks |
|
ELI5
Orca refuses to open a remote file with this computer's own apps, because the path names a file on another machine. That check used to look at which paired server you last focused. Now it looks at the machine that actually owns the file.
What Changed
Before (as a user):
After: the click opens the file when the document lives on this computer, and is refused when the document lives on an SSH host or a paired server, whatever server is focused. Reveal in Finder / File Explorer, "Open in" menus, the tab-bar absolute-path entry and the source-control ignore suggestion behave exactly as before.
Mechanism:
isLocalPathOpenBlockedno longer takessettings. It takes the path's owning host (ExecutionHostId, anExecutionHostOwnerMatch, or'unresolved') and allows onlylocal. Removing the parameter made the compiler list every caller, and each now names its owner:getLinkSourceLocalOpenOwner. A document that reports no SSH connection is checked against its workspace row in the catalog, because a paired-server workspace without a nested SSH target also reports no connection. Before, when the tab carried no owner, the focused server decided.getLocalPathOpenOwnerForRoute.isRevealInFileManagerBlockedkeeps the focused-server check explicitly, because the main process still refuses every reveal while a server is focused. The "Open in" menu now goes through it, so those menu items look the same as before. A follow-up PR moves that refusal in the main process to the file's owner and then removes the check.Why
The focused server says nothing about where a file lives. Some callers had worked around that by rewriting
settings.activeRuntimeEnvironmentIdto the owner before calling the guard. When no owner was known, those callers fell back to whatever server was focused. Changing the signature removes that workaround, and the compiler finds every caller. Leavingsettingsas an optional extra would have kept the fallback alive. Keeping the reveal check where the main process enforces it means this PR does not enable menu items that would then fail on click.Linked Issue
None. This is part of the work that routes actions by the host that owns them. The follow-up that moves the main-process refusal to the file's owner closes #16539.
Visual Proof
N/A. No UI changes. The only behaviour change is whether a modifier-click on a Markdown file link opens or shows the existing toast. Automated tests cover it.
Testing
pnpm tc,oxlintandpnpm run check:code-quality:changedpass.Focused vitest run over
src/renderer/src/{lib,components/editor,store/slices,components/right-sidebar,components/tab-bar,components/sidebar,components/terminal-pane}: 24107 passed.New acceptance test
rich-markdown-editor-click-routing.test.ts› "refuses a runtime-owned document even when the path exists locally" fails on origin/main (the file opens through the OS) and passes here. Its partner test: a local document with a server focused opens.local-path-open-guard.test.tsandlink-source-local-open-owner.test.tscover local, SSH, paired-server, missing/ambiguous owners and the unresolved sentinel.SSH: SSH-owned documents stay refused (owner
ssh:<target>). Folder workspaces resolve through the same catalog lookup. If the catalog cannot place a document, the click is refused rather than treated as local.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Renderer only. No IPC or wire change, and nothing persisted. Paths are not parsed here, so Windows and WSL are unaffected.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)