Skip to content

Commit 36476f0

Browse files
committed
fix review comments from reviewer
1 parent febe0ed commit 36476f0

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

tests/test_workspace_path_thread_safety.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ def setUp(self):
3434
self.path_b = os.path.join(self.tmp, "storage-b")
3535
os.makedirs(self.path_a)
3636
os.makedirs(self.path_b)
37-
self.allowed_resolved = {
38-
os.path.realpath(self.path_a),
39-
os.path.realpath(self.path_b),
40-
}
37+
# Match resolve_workspace_path() (expand_tilde only — no realpath).
38+
self.allowed_resolved = {self.path_a, self.path_b}
4139
self._prior_workspace_env = os.environ.pop("WORKSPACE_PATH", None)
4240
self.addCleanup(self._restore_workspace_env)
4341
self.addCleanup(set_workspace_path_override, None)
44-
set_workspace_path_override(None)
42+
# With WORKSPACE_PATH popped and override None, this is resolve()'s
43+
# "override cleared" path — used by test_concurrent_clear_and_set.
4544
self.fallback_resolved = resolve_workspace_path()
4645

4746
def _restore_workspace_env(self):

utils/workspace_path.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from .path_helpers import expand_tilde_path
1111

1212
# Module-level override set via POST /api/set-workspace (or --base-dir).
13-
# All reads and writes are serialized by _workspace_path_lock so threaded
14-
# WSGI workers (gunicorn --threads, waitress, etc.) cannot observe torn
15-
# state between set_workspace_path_override and resolve_workspace_path.
13+
# Reads and writes are serialized by _workspace_path_lock so threaded WSGI
14+
# workers (gunicorn --threads, waitress, etc.) always see the latest override
15+
# from another thread and resolve_workspace_path's snapshot+expand stays consistent.
1616
_workspace_path_lock = threading.Lock()
1717
_workspace_path_override: str | None = None
1818

0 commit comments

Comments
 (0)