fix(swift-ios): open workspace file links - #5803
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
6cf32bb to
fa75b83
Compare
ce45355 to
faccbb2
Compare
|
@t3dotgg Macroscope has completed on the final head |
faccbb2 to
025cfc5
Compare
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR introduces new workspace file link navigation functionality (~960 lines), including path resolution logic, a UIKit link overlay, and sheet-based file previews. New user-facing features of this scope warrant human review. Additionally, there are unresolved comments about path handling edge cases. You can customize Macroscope's approvability policy. Learn more. |
025cfc5 to
e85cc0d
Compare
5ddc475 to
2ce2933
Compare
|
@t3dotgg Ready for your review against the current SwiftUI branch. Final head 2ce2933; all executable current-head CI is green, focused/full native and integrated evidence are in the PR body, and all review threads are resolved. MacroScope correctness passed on the identical reviewed tree and approvability defers this user-facing change to human review. |
4cb3307 to
497f54f
Compare
|
Rebuilt as one focused commit on the exact current Theo SwiftUI head ( Final behavior uses one reusable workspace containment resolver, keeps remote links unchanged, rejects traversal/authority/custom-scheme/outside-root paths with feedback, handles line/column suffixes, preserves selectable transcript text, and routes taps correctly after cell reuse. Verification:
Conflict classification: branch-history only; no upstream feature duplicate. |
2ce2933 to
6640d9c
Compare
|
Dependent follow-up is now preserved separately at Verification: 21 focused tests; full native 331 pass / one pre-existing skip; integrated iPhone 17 proof; Direct Opus review was unavailable due confirmed HTTP 429 before inference; no independent verdict is claimed. |
| } | ||
|
|
||
| private var workspaceRoot: String? { | ||
| currentThread.worktreePath |
There was a problem hiding this comment.
an empty or whitespace-only worktreePath wins this coalescing expression and prevents fallback to the valid project path. the resolver then rejects the empty root, so transcript file links fail for these threads. trim and require a non-empty worktree path before falling back to the project path.
| } | ||
|
|
||
| guard !destination.path.isEmpty, | ||
| !destination.path.contains(":"), |
There was a problem hiding this comment.
this unconditionally rejects drive-qualified windows paths such as C:/repo/Sources/App.swift:42. the surrounding absolute-path and containment logic also assumes POSIX / roots, but the iOS client supports remote windows environments and the shared composer serializer explicitly normalizes windows paths. normalize according to the remote workspace root, including drive letters and separators, then apply the same containment check. add a windows-root regression test.
|
Updated frozen head: |
0a42fd8 to
c6b03c9
Compare
|
Refreshed this branch onto current The environment-specific provider catalog remains authoritative when present. Legacy snapshots now fall back to Verification on exact head
A fresh direct Claude Opus 5 high review was attempted after the test pass. The process exited 1 because the session quota is exhausted until 04:50 AEST. No independent review is claimed for this refreshed head. |
| } | ||
| .sheet(item: $linkedFile) { link in | ||
| NavigationStack { | ||
| FeatureFilePreviewView( |
There was a problem hiding this comment.
🟡 Medium Chat/ThreadDetailView.swift:108
Directory links open a failing “File unavailable” preview instead of the existing directory browser. FeatureWorkspaceFileLink.entry loses the directory kind by marking every resolved path as .file, and this sheet always constructs FeatureFilePreviewView, whose load() calls readFile; preserve the resolved kind and route directory entries to FeatureFileDirectoryView (with the appropriate path/title).
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/swift-ios/Features/Chat/ThreadDetailView.swift around line 108:
Directory links open a failing “File unavailable” preview instead of the existing directory browser. `FeatureWorkspaceFileLink.entry` loses the directory kind by marking every resolved path as `.file`, and this sheet always constructs `FeatureFilePreviewView`, whose `load()` calls `readFile`; preserve the resolved kind and route directory entries to `FeatureFileDirectoryView` (with the appropriate path/title).
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c6b03c9. Configure here.
|
Closing this version while I rebuild the upstream contribution set from the latest base. Clean versions are coming soon. |

What changed
UICollectionViewcells while preserving text selection across linked text.:line[:column], and opens the existing Files preview.This is deliberately limited to transcript → existing Files preview. It does not add recursive navigation between Markdown file previews or change server, wire, web, React Native, signing, or release behavior.
Base:
pingdotgg/t3code:t3code/rebuild-mobile-app-swiftate55c7ffd1(owner PR #5178).Reviewed head:
2ce29335a0a9e8a820a5c0d89da4434a8d0e9242(tree-identical metadata refresh after an unrelated WebKit simulator flake).Why
SwiftUI
Text(AttributedString)links hosted throughUIHostingConfigurationwere rendered as links but did not reliably receive taps. The overlay is limited to linked glyphs and disables its own hit testing while text-selection mode is active, so transcript scrolling and selection remain unchanged.Ambiguous dotted bare destinations such as
README.md:42can also be custom URL schemes, so they remain on the system path; use the explicit relative form./README.md:42. Slash-containing relative paths and conventional extensionless names such asMakefile:12remain supported.UI evidence
Before:
After — exact rebased head opening the existing workspace preview:
Full-resolution MP4
Verification
T3CodeTests/FeatureToolStateTests: passed again on the final reviewed head (21 test cases, 0 failed).CONTRIBUTING.md:1transcript link was exposed as a semantic link target and openedworkspace-file-previewwith the expected file.git diff --check: passed; rebase preserved the feature patch exactly.org.example:123, ambiguous bare-file, explicit-relative-file, and conventional extensionless-file cases. Cursor's text-selection finding is fixed by disabling only the invisible link overlay's hit testing while selection mode is active. MacroScope correctness passed on the identical reviewed tree, Cursor passed on the final metadata-only head, and MacroScope approvability defers this user-facing change to human review.ProjectFaviconStoreTests.svgFaviconsAreRasterizedBeforeCaching()iOS 27 WebKit GPU-process timeout. The commit metadata was refreshed to rerun CI; tree SHA69cd4cae8fe3e8606ea34f00cd3efd65548271e8and stable patch IDdcaf0513e45ce447433da2c650bc93c573d788e8are unchanged.Checklist
Built with GPT-5.6 Sol in the Codex harness.
Note
Medium Risk
New path parsing and workspace boundary checks must reject traversal and out-of-root paths; link overlay touch handling interacts with text selection in recycled cells, though both areas have broad tests.
Overview
Makes workspace file links in native chat markdown tappable and routes them into the existing Files preview sheet, while https links still use the system browser.
Markdown gains an optional
onOpenURLcallback, aMarkdownOpenURLDispositionhelper (unhandledfile:URLs are discarded instead of opening externally), and a UIKit link hit-test overlay on linked text so taps work inside recycled transcript cells; the overlay turns off during Select text mode.Thread detail resolves taps via new
FeatureWorkspaceFileLink/FeatureWorkspaceFileLinkRoutelogic (POSIX, Windows, UNC, relative paths,:line[:column], workspace containment) and shows an alert when a link looks like a workspace path but is rejected.A small provider label fix stops using global
snapshot.providerswhenprovidersByEnvironmentexists but has no entry for the thread’s environment.Reviewed by Cursor Bugbot for commit 5b37739. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Open workspace file links from markdown messages in the iOS chat transcript
MarkdownLinkInteractionView(UIKit) with precise glyph-level hit-testing for inline links, bridged into SwiftUI viaMarkdownLinkInteractionOverlay; link taps are disabled while text selection is active.FeatureWorkspaceFileLinkto validate and normalize POSIX, Windows drive, and UNC paths, preventing workspace escapes and stripping line/column positions.FeatureThread.homeProviderLabelandHomeThreadRowContextto fall back to the global providers list when the environment-scoped catalog is missing.Macroscope summarized 5b37739.
Delivery: direct
Validated against Theo commit: f98cab5
Depends on: none
Merge order: this PR only
Validation status: Mergeable with runnable checks green; requested review changes remain. The unrelated Vercel authorization failure is a maintainer-side gate.