Skip to content

Fix symlinked root rename event handling - #58624

Merged
Veykril merged 3 commits into
zed-industries:mainfrom
tankztz:issue-58619-symlink-root-rename-test
Jun 5, 2026
Merged

Fix symlinked root rename event handling#58624
Veykril merged 3 commits into
zed-industries:mainfrom
tankztz:issue-58619-symlink-root-rename-test

Conversation

@tankztz

@tankztz tankztz commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #58619.

When a worktree is opened through a symlinked root, filesystem events can arrive rooted at either the opened symlink path or the canonical target path. The worktree event processing path already handled canonical target paths, but dropped events reported under the opened symlink root because it only derived relative paths from the canonical root.

This PR adds a regression test that opens /link -> /target, renames /link/subdir-a to /link/subdir-aa, and verifies subdir-aa/config.ini remains visible in the worktree. The production fix accepts event paths under the opened worktree root as a fallback when deriving relative paths.

Testing:

  • Verified the new regression test fails with only the test commit applied.
  • cargo test -p worktree --test integration test_renaming_subdir_under_symlinked_root_keeps_children
  • cargo test -p worktree --test integration test_symlinks_pointing_outside

@cla-bot

cla-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @tankztz on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jun 5, 2026
@tankztz

tankztz commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot

cla-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @tankztz on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot

cla-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot

cla-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @tankztz on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@tankztz

tankztz commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 5, 2026
@cla-bot

cla-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@tankztz
tankztz force-pushed the issue-58619-symlink-root-rename-test branch from ad7cba7 to 3ede1ae Compare June 5, 2026 07:04
@tankztz tankztz changed the title Add symlinked root rename regression test Fix symlinked root rename event handling Jun 5, 2026
@tankztz
tankztz force-pushed the issue-58619-symlink-root-rename-test branch from 0f1fab3 to b936e32 Compare June 5, 2026 07:31
@tankztz

tankztz commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Testing performed:

  • Verified the new regression test fails before the production fix. With only the test commit applied (370607c76c), test_renaming_subdir_under_symlinked_root_keeps_children times out waiting for the renamed child file to reappear.
  • Verified the same test passes after the fix commit (b936e32514).
  • Also ran an adjacent symlink watcher regression test to check the existing symlink mapping path still behaves as expected.

Commands run:

cargo test -p worktree --test integration test_renaming_subdir_under_symlinked_root_keeps_children
cargo test -p worktree --test integration test_symlinks_pointing_outside

Both focused tests pass on the final branch.

@tankztz
tankztz marked this pull request as ready for review June 5, 2026 07:59

@Veykril Veykril left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Veykril
Veykril enabled auto-merge June 5, 2026 08:13
@zed-industries-bot

Copy link
Copy Markdown
Contributor
Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 98efe56

1 similar comment
@zed-industries-bot

Copy link
Copy Markdown
Contributor
Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 98efe56

@Veykril
Veykril added this pull request to the merge queue Jun 5, 2026
Merged via the queue into zed-industries:main with commit 6933562 Jun 5, 2026
33 checks passed
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
Fixes zed-industries#58619.

When a worktree is opened through a symlinked root, filesystem events
can arrive rooted at either the opened symlink path or the canonical
target path. The worktree event processing path already handled
canonical target paths, but dropped events reported under the opened
symlink root because it only derived relative paths from the canonical
root.

This PR adds a regression test that opens `/link -> /target`, renames
`/link/subdir-a` to `/link/subdir-aa`, and verifies
`subdir-aa/config.ini` remains visible in the worktree. The production
fix accepts event paths under the opened worktree root as a fallback
when deriving relative paths.

Testing:

- Verified the new regression test fails with only the test commit
applied.
- `cargo test -p worktree --test integration
test_renaming_subdir_under_symlinked_root_keeps_children`
- `cargo test -p worktree --test integration
test_symlinks_pointing_outside`
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Fixes zed-industries#58619.

When a worktree is opened through a symlinked root, filesystem events
can arrive rooted at either the opened symlink path or the canonical
target path. The worktree event processing path already handled
canonical target paths, but dropped events reported under the opened
symlink root because it only derived relative paths from the canonical
root.

This PR adds a regression test that opens `/link -> /target`, renames
`/link/subdir-a` to `/link/subdir-aa`, and verifies
`subdir-aa/config.ini` remains visible in the worktree. The production
fix accepts event paths under the opened worktree root as a fallback
when deriving relative paths.

Testing:

- Verified the new regression test fails with only the test commit
applied.
- `cargo test -p worktree --test integration
test_renaming_subdir_under_symlinked_root_keeps_children`
- `cargo test -p worktree --test integration
test_symlinks_pointing_outside`
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Fixes zed-industries#58619.

When a worktree is opened through a symlinked root, filesystem events
can arrive rooted at either the opened symlink path or the canonical
target path. The worktree event processing path already handled
canonical target paths, but dropped events reported under the opened
symlink root because it only derived relative paths from the canonical
root.

This PR adds a regression test that opens `/link -> /target`, renames
`/link/subdir-a` to `/link/subdir-aa`, and verifies
`subdir-aa/config.ini` remains visible in the worktree. The production
fix accepts event paths under the opened worktree root as a fallback
when deriving relative paths.

Testing:

- Verified the new regression test fails with only the test commit
applied.
- `cargo test -p worktree --test integration
test_renaming_subdir_under_symlinked_root_keeps_children`
- `cargo test -p worktree --test integration
test_symlinks_pointing_outside`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Renaming a subfolder under a symlinked folder makes its files disappear (reopen doesn't fix it)

3 participants