Skip to content

Fix stale Project Explorer entries after case-only rename on case-insensitive filesystems - #15699

Draft
warp-factories[bot] wants to merge 1 commit into
masterfrom
factory/gh15698-case-only-rename-stale-tree-entry
Draft

Fix stale Project Explorer entries after case-only rename on case-insensitive filesystems#15699
warp-factories[bot] wants to merge 1 commit into
masterfrom
factory/gh15698-case-only-rename-stale-tree-entry

Conversation

@warp-factories

@warp-factories warp-factories Bot commented Sep 1, 2026

Copy link
Copy Markdown

Description

Fixes a bug where renaming a folder so that only its letter case changes (e.g. Company -> company) on a case-insensitive filesystem (default macOS APFS) leaves a stale, duplicate entry in the Project Explorer file tree.

Root cause: the filesystem watcher's debouncer (crates/watcher) can emit ambiguous ModifyKind::Name(RenameMode::Any) events for macOS renames, one per path involved. The code decided whether each such path was a create or a delete by calling Path::exists(). On a case-insensitive filesystem, Path::exists() resolves case-insensitively, so for a case-only rename both the old-case and new-case paths report as existing. Both then get treated as creates, and neither as a delete, leaving the stale old-case entry behind permanently (collapsing/re-expanding the tree does not clear it, matching the report).

An ordinary rename (different name entirely) isn't affected, because the old path genuinely stops existing under any case.

Fix: added path_exists_with_exact_case, which checks the parent directory's actual listing for an exact-case match instead of relying on Path::exists()'s case-insensitive resolution, and used it at that call site.

Linked Issue

Fixes #15698

  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes). (Not applicable — this is a backend file-watcher fix with no UI changes.)

Testing

Added unit tests in crates/watcher/src/lib_tests.rs:

  • path_exists_with_exact_case_matches_the_exact_case_only / path_exists_with_exact_case_is_false_for_a_missing_path: directly test the new helper's exact-case matching contract.
  • case_only_rename_is_treated_as_delete_of_old_case_and_create_of_new_case: an end-to-end test of deduplicate_and_merge_raw_notifier_events reproducing the reported scenario (old-case path routed to deleted, new-case path routed to added).

Ran cargo test -p watcher, cargo clippy -p watcher --all-targets --all-features -- -D warnings, and rustfmt --check on the changed files — all pass. Also verified cargo build/cargo clippy still succeed for the downstream repo_metadata crate (with the local_fs feature) that consumes this watcher code.

  • I have manually tested my changes locally with ./script/run (not possible in this sandboxed, headless environment — validated via the automated tests above instead)

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

CHANGELOG-BUG-FIX: Fixed a bug where renaming a folder so only its letter case changes (e.g. Company -> company) on a case-insensitive filesystem left a stale duplicate entry in the Project Explorer file tree.

…ensitive filesystems

On case-insensitive filesystems (e.g. default macOS APFS), `Path::exists()`
resolves case-insensitively. When the filesystem watcher's debouncer emits
ambiguous `ModifyKind::Name(RenameMode::Any)` events for a case-only rename
(e.g. `Foo` -> `foo`), both the old-case and new-case paths report as
existing, so both are (incorrectly) treated as creates and neither as a
delete. This leaves a stale, duplicate entry in the file tree.

Add `path_exists_with_exact_case`, which checks the parent directory's
actual listing for an exact-case match instead of relying on
`Path::exists()`'s case-insensitive resolution, and use it at that call
site.

Fixes #15698
@warp-factories

warp-factories Bot commented Sep 1, 2026

Copy link
Copy Markdown
Author

This PR was generated with Warp.

Comment @warp-factory on this PR to send it follow-up work.

View run View conversation View GitHub Issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project Explorer keeps a stale row after a case-only rename on case-insensitive APFS (macOS)

0 participants