Skip to content

Follow macOS Finder aliases in the Files pane - #18191

Merged
gtritchie merged 16 commits into
mainfrom
feature/files-pane-finder-aliases
Jul 10, 2026
Merged

gtritchie merged 16 commits into
mainfrom
feature/files-pane-finder-aliases

Conversation

@gtritchie

@gtritchie gtritchie commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

Finder aliases are bookmark files rather than symlinks, so the Files pane listed them as opaque binary files and clicking one raised a "file is binary" error.

Note, this did not address Symlinks should have some visual indicator #9924, left as a separate work item.

Changes

  • macOS-only helpers isFinderAlias / resolveFinderAlias in SessionModuleContext.mm, using the NSURL bookmark APIs with no volume mounting and no UI. Symlinks are excluded, since the filesystem already follows them.
  • createFileSystemItem emits the resolved target as alias_target and reports the target's directory-ness in dir. Broken aliases keep the previous plain-file behavior; resolution failures are logged at debug level.
  • The client follows the target via FileSystemItem.resolveAliasTarget():
    • Files pane: click navigation and the Open commands, deduplicating by resolved path when an alias and its target are both selected
    • Web (GWT) file dialogs, used in server mode: row commit, the Open button on selected and typed items, and Choose Directory
  • On Linux and Windows the backend never emits alias_target, so behavior is unchanged.

Tests

  • 13 C++ gtests (FinderAliasTest) that create genuine bookmark files via CoreFoundation: detection (including symlink exclusion), resolution, broken-alias fallback, and the listing JSON contract
  • 5 GWT unit tests for resolveAliasTarget, run on all platforms via ant unittest
  • Playwright e2e: 4 desktop tests for the Files pane, 5 macOS server-mode tests for the web dialogs (local harness check), and a typed directory navigation test that runs in Linux server CI
  • Manually verified on macOS Desktop with file and folder aliases, including a broken alias

Fixes #18158.

gtritchie added 15 commits July 10, 2026 09:30
Finder aliases are bookmark files rather than symlinks, so the Files
pane listed them as opaque binary files and clicking one raised an
error. createFileSystemItem now detects aliases (NSURLIsAliasFileKey,
excluding symlinks), resolves them without mounting volumes or showing
UI, and emits the target path and directory-ness; the client follows
the resolved target on click. Unresolvable aliases keep the previous
plain-file behavior.

Addresses #18158
createFileSystemItem reports a directory alias with dir=true, so the
GWT file dialogs (used in server mode) treated one as a folder and
cd'd into the bookmark-file path, which fails. Extract the target
substitution into FileSystemItem.resolveAliasTarget() and apply it in
DirectoryContentsWidget.commitSelection, so dialog navigation follows
the alias target just like the Files pane.

Addresses #18158
Row commit was resolved in the previous commit, but the Open/Choose
buttons read the selection directly: FileDialog.getSelectedItem and
navigateIfDirectory re-derive the item via context_.itemForName,
OpenFileDialog.shouldAccept cd's into the selected directory, and
ChooseFolderDialog2.onSelection records the selected path. Resolve
the alias target at each of those points.

Addresses #18158
Covers row commit, the Open button on selected and typed directory
aliases, the Open button on a file alias, and Choose Directory on a
directory alias. Tagged @server_only (Desktop uses native dialogs)
and skipped off macOS.

Addresses #18158
The dialogs open in the session's last-browsed / working directory,
which other specs sharing the session may have moved. Navigate each
dialog to Home via its breadcrumb before selecting an alias.

Addresses #18158
Platform-independent coverage of the client-side alias substitution:
identity for regular files and directories, and target substitution
(path and directory-ness) for file and directory alias entries.

Addresses #18158
The Home crumb only exists when the browsed path is under ~, so
breadcrumb navigation was still order-dependent. Open File tests now
type '~' and accept (an explicit navigation shouldAccept supports from
any location); the Choose Directory test pins the R working directory
first, which is where Workbench.onSetWorkingDir opens the chooser.

Addresses #18158
The identity contract is that non-aliases come back unchanged, not as
rebuilt items that would drop metadata; compare references instead of
path and directory-ness.

Addresses #18158
onFileNavigation resolved aliases but the Open commands
(openFilesInSinglePane, openEachFileInColumns) passed raw selected
items to openFile, so opening a selected file alias loaded the
bookmark binary. Resolve in getUnopenedSelectedFiles' pre-process
loop, which both commands consume; a directory alias then skips like
any other directory. Covered by a new desktop e2e test.

Addresses #18158
resolveFinderAlias builds an Error carrying the alias path and the
NSError description, but its only caller discarded it, leaving corrupt
bookmarks or sandbox denials indistinguishable from non-aliases. Log
at debug level (a no-op by default) so the context reaches a consumer
without spamming per-file listings.

Addresses #18158
The JXA alias-creation block was duplicated across both alias specs
and swallowed failures at three layers (system2 status discarded, the
JXA write returning false with exit 0, executeInConsole blind to R
errors) -- an environmental problem surfaced as per-test visibility
timeouts that read like product bugs. Extract the fixture to
@utils/finder-aliases, check both failure channels, and assert an
ALIAS-SETUP-OK sentinel in beforeAll. Also replaces an ordinal
cross-test comment reference and corrects the dialog start-directory
comment (getDefaultFileDialogDir, not last-browsed).

Addresses #18158
FileDialog.navigateIfDirectory now cd's to the item's absolute path
instead of its relative name, a change that affects every platform but
was only exercised by the macOS-only alias suite. This spec covers the
plain-directory flow without a platform skip, so it runs in Linux
server CI. The openFileDialogAtHome helper moves to @utils/file-dialogs
for reuse.

Addresses #18158
getAliasTarget's doc implied null means not-an-alias, but broken
aliases also return null (the backend only emits alias_target on
successful resolution); the test mock's comment overstated it as a
complete mirror of the listing entry.

Addresses #18158
An alias and its target (or two aliases to one file) resolve to the
same path, and each duplicate made openEachFileInColumns spawn an
extra, empty source column that lingered after the document closed.
Gate the pre-process loop on a seen-paths set, mirroring the existing
rmdPath dedupe in the notebook branch. The new e2e test pins the
column count (probe showed 3 panels for one document before the fix).

Addresses #18158
@gtritchie gtritchie added this to the 2026.08 (Yellow Yarrow) milestone Jul 10, 2026
@posit-snyk-bot

posit-snyk-bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
1799 0 76 4
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ desktop-linux 455 0 14 1
✅ desktop-macos 450 0 19 1
✅ desktop-windows 455 0 16 1
✅ server-linux 439 0 27 1
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit afe43ae07ae2931ef8815fbe65c8851d2d28239c - Run #135

@gtritchie
gtritchie merged commit b131f15 into main Jul 10, 2026
24 checks passed
@gtritchie
gtritchie deleted the feature/files-pane-finder-aliases branch July 10, 2026 19:39
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.

Click to follow macOS/OSX aliases in file browser

2 participants