Repository navigation
Route terminal file URL links to the OS - #7122
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a new ChangesFile URL Routing Policy
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 24 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (24 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR extracts the terminal open-URL file-routing gate from
Confidence Score: 5/5Safe to merge — the change is a focused extraction of existing inline logic into a tested policy struct with a correct scheme short-circuit added. The routing logic is straightforward: a scheme guard bypasses cmux for all explicit-scheme inputs, and the remaining isLocalFileURL check matches the previous behavior minus the now-confirmed-dead localhost branch. The five unit tests cover the meaningful distinct cases, and the previously flagged dead branch and unused parameterization were both addressed in earlier commits. No actor isolation, blocking primitive, global state, or test-seam concerns were introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Terminal cmd-click\nrawOpenURLValue] --> B{hasExplicitURLScheme?\ne.g. file://, https://}
B -- yes --> C[return false\nOS / URL route]
B -- no --> D{target.url.isFileURL?}
D -- no --> C
D -- yes --> E{isLocalFileURL?\nhost nil or empty}
E -- no\nremote host --> C
E -- yes --> F[return true\ncmux file preview eligible]
F --> G{Settings / file existence\n/ workspace locality\n/ split checks}
G -- pass --> H[cmux file preview UI]
G -- fail --> C
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Terminal cmd-click\nrawOpenURLValue] --> B{hasExplicitURLScheme?\ne.g. file://, https://}
B -- yes --> C[return false\nOS / URL route]
B -- no --> D{target.url.isFileURL?}
D -- no --> C
D -- yes --> E{isLocalFileURL?\nhost nil or empty}
E -- no\nremote host --> C
E -- yes --> F[return true\ncmux file preview eligible]
F --> G{Settings / file existence\n/ workspace locality\n/ split checks}
G -- pass --> H[cmux file preview UI]
G -- fail --> C
Reviews (3): Last reviewed commit: "Cover hosted terminal file URL targets" | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@Packages/macOS/CmuxTerminalCore/Sources/CmuxTerminalCore/LinkRouting/TerminalOpenURLFileRoutingPolicy.swift`:
- Around line 22-25: Add coverage for the reachable host-based path in
TerminalOpenURLFileRoutingPolicy.isLocalFileURL by creating a test where
hasExplicitURLScheme(rawOpenURLValue) is false but target.url still has a
non-empty host, so the first guard in shouldRouteOpenURL does not short-circuit
the call. Verify the behavior of isLocalFileURL directly through the
TerminalOpenURLFileRoutingPolicy logic using a target.url that is file:// with
host data and a raw value without an explicit scheme, ensuring this branch is
actually exercised.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4e86a190-0dce-44a6-b9ed-953692231cdc
📒 Files selected for processing (2)
Packages/macOS/CmuxTerminalCore/Sources/CmuxTerminalCore/LinkRouting/TerminalOpenURLFileRoutingPolicy.swiftPackages/macOS/CmuxTerminalCore/Tests/CmuxTerminalCoreTests/TerminalOpenURLFileRoutingPolicyTests.swift
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Closes #7104
Summary
file://, bypass cmux file preview and continue to the external URL route.Tests
git diff --check origin/main...HEADpython3 scripts/swift_file_length_budget.pypython3 scripts/check-package-resolved-policy.py./scripts/lint-pbxproj-test-wiring.sh/Users/austinwang/manaflow/cmuxterm-hq/skills/autoreview/scripts/cmux-policy-check --mode branch --base origin/mainswift test --filter TerminalOpenURLFileRoutingPolicyTestsfromPackages/macOS/CmuxTerminalCore(blocked locally becauseGhosttyKit.xcframeworkis missing a binary artifact; did not run setup/build per no-build instruction).Regression structure
file://assertion is red.Summary by CodeRabbit
file://URL hosts.