Files
zed/crates/recent_projects/Cargo.toml
T
Hamish Clark c62f92d6aa workspace: Fix cross-host workspace reuse (#64145)
# Objective

Prevent remote open requests from reusing a retained workspace connected
to a different host when both hosts contain the same absolute path.

A window can contain workspaces from multiple locations. Previously, the
window qualified for reuse when any retained workspace matched the
requested host, but path scoring subsequently considered every workspace
in that window. As a result, a workspace from another host could win.

This is a reworked and simplied version of the fix in
https://github.com/zed-industries/zed/pull/62561

## Solution

Filter each retained workspace by the requested location before scoring
its paths.

Workspace-location matching is centralized while preserving the existing
connection semantics:

- SSH matches by host, username, and port.
- WSL matches by distribution name because usernames are not
consistently populated.
- Docker matches by container ID.
- Mock connections match by ID.

## Testing

- Added a regression test with two distinct mock remote identities in
one window.
- Confirmed the regression test fails with the production fix stashed:
  - `a matching path on another remote must not satisfy the request`
- Confirmed the test passes with the fix:
- `cargo test -p recent_projects
test_find_existing_workspace_does_not_reuse_workspace_from_another_remote
--no-fail-fast`
- Confirmed the centralized remote identity tests pass:
  - `cargo test -p remote remote_identity --no-fail-fast`

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed remote paths sometimes reusing a workspace connected to a
different host.

Co-authored-by: Hamish <hamishc@users.noreply.github.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2026-10-05 09:49:47 +00:00

74 lines
2.0 KiB
TOML

[package]
name = "recent_projects"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lints]
workspace = true
[lib]
path = "src/recent_projects.rs"
doctest = false
[features]
default = []
test-support = ["remote/test-support", "remote_connection/test-support", "project/test-support", "workspace/test-support"]
[dependencies]
anyhow.workspace = true
chrono.workspace = true
askpass.workspace = true
db.workspace = true
dev_container.workspace = true
editor.workspace = true
extension_host.workspace = true
fs.workspace = true
futures.workspace = true
fuzzy_nucleo.workspace = true
gpui.workspace = true
language.workspace = true
log.workspace = true
menu.workspace = true
node_runtime.workspace = true
open_path_prompt.workspace = true
ordered-float.workspace = true
paths.workspace = true
picker.workspace = true
project.workspace = true
release_channel.workspace = true
remote.workspace = true
remote_connection.workspace = true
semver.workspace = true
serde_json.workspace = true
settings.workspace = true
telemetry.workspace = true
ui.workspace = true
util.workspace = true
workspace.workspace = true
worktree.workspace = true
zed_actions.workspace = true
indoc.workspace = true
[target.'cfg(target_os = "windows")'.dependencies]
windows-registry.workspace = true
[dev-dependencies]
editor = { workspace = true, features = ["test-support"] }
extension.workspace = true
fs.workspace = true
gpui = { workspace = true, features = ["test-support"] }
http_client.workspace = true
language = { workspace = true, features = ["test-support"] }
picker = { workspace = true, features = ["test-support"] }
project = { workspace = true, features = ["test-support"] }
release_channel.workspace = true
remote = { workspace = true, features = ["test-support"] }
remote_connection = { workspace = true, features = ["test-support"] }
remote_server.workspace = true
rpc.workspace = true
serde_json.workspace = true
settings = { workspace = true, features = ["test-support"] }
workspace = { workspace = true, features = ["test-support"] }