Repository navigation
Conversation
On macOS, terminal::platform::init() unconditionally chdirs the process to the user's home directory with no restoration. Workspace:: new called it on every construction with no #[cfg(not(test))] guard, so the first test in the binary that constructed a Workspace (there are dozens in workspace/view_tests.rs) permanently relocated the whole test process's cwd to $HOME. Every later test in the same process that resolved a relative path against the crate-root cwd then failed non-deterministically depending on test scheduling. Gate the call so it only runs outside test builds, matching the existing #[cfg(not(test))] pattern already used elsewhere in this crate for other process-global side effects (block.rs, context_chips/logging.rs, keyboard.rs). Closes warpdotdev#13980
test_resolve_command reads the ambient process PATH via resolve_executable, but carried no #[serial_test::serial] marker. pane_group::pane::local_harness_launch_tests temporarily overrides PATH via an RAII EnvVarGuard and is already serialized against the crate's other PATH/HOME-mutating tests. Without joining that same group, test_resolve_command could run concurrently with those tests and observe a PATH pointing only at a temp directory, failing its pwd/env lookups. This is a secondary, narrower contributor alongside warpdotdev#13980's cwd leak (fixed separately in workspace/view.rs) — this test's relative-path assertion was cwd-sensitive, while its PATH-based assertions were independently exposed to this race. Refs warpdotdev#13980
|
Every PR must be linked to a same-repo issue before Oz can review it. This PR is linked to #13980, but no linked issue is marked See the contribution guidelines for the full readiness model. Powered by Oz |
There was a problem hiding this comment.
Every PR must be linked to a same-repo issue before Oz can review it.
This PR is linked to #13980, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.
See the contribution guidelines for the full readiness model.
Powered by Oz
|
Hi @fbartho — a reviewer requested changes on this PR and it hasn't had activity from you in 7 days. When you get a chance, please push updates or reply to the review so a reviewer can take another look. Without activity, this PR will be automatically closed after 14 days of inactivity. |
|
(Just commenting so stale-bot doesn't think this is dead). |
1 similar comment
|
(Just commenting so stale-bot doesn't think this is dead). |
|
Hi @fbartho — a reviewer requested changes on this PR and it hasn't had activity from you in 7 days. When you get a chance, please push updates or reply to the review so a reviewer can take another look. Without activity, this PR will be automatically closed after 14 days of inactivity. |
|
This PR is still a valid fix. The upstream ticket is still awaiting maintainer review, please advise @oss-maintainers? |
|
Hi @fbartho — a reviewer requested changes on this PR and it hasn't had activity from you in 7 days. When you get a chance, please push updates or reply to the review so a reviewer can take another look. Without activity, this PR will be automatically closed after 14 days of inactivity. |
|
Temporarily closing in until the linked issue #13980 gets processed. |
Closes #13980
Description
Workspace::new(view.rs) unconditionally calledterminal::platform::init(), which on macOS (platform.rs) doesenv::set_current_dir(home_dir)with no restoration. The first test in a shared process that constructs aWorkspacepermanently relocates the whole test binary's cwd to$HOME— a first-writer-wins process-global side effect (same shape as #13974's cache cluster, via the OS cwd instead of a static). Every later test resolving a crate-relative path then fails depending on scheduling:test_load_local/test_load_before_session(open../README.md),test_resolve_command(resolves../script/run).Fix
#[cfg(not(test))]on theplatform::init()call site inWorkspace::new, matching the crate's existing pattern for process-global side effects under test (block.rs,context_chips/logging.rs,keyboard.rs).platform::init()itself is untouched — its non-test callers keep it.Secondary fix
test_resolve_commandalso reads the ambientPATHwith no synchronization against the already-#[serial]PATH-overriding tests inpane_group::pane::local_harness_launch_tests; added the same marker so it joins that serial group. Independent of the cwd leak, and would otherwise still flake.Linked Issue
ready-to-specorready-to-implement.Testing
Full crate suite under plain
cargo test -p warp --lib(nextest's per-process isolation masks this class):Before:
FAILED. 5779 passed; 13 failed— including all three ticketed tests, panic sites matching the ticket verbatim (markdown len assertion,dunce::canonicalizeNotFound,Option::unwrap()on None).After:
FAILED. 5782 passed; 10 failed— the three ticketed tests all pass; the remaining 10 are pre-existing and tracked in the sibling flake tickets (terminal::view: 5 tests fail in full-suite runs due to leaked global FeatureFlag state (AgentView never reset) #13972–workspace::view: test_terminal_model_isnt_leaked fails under full-suite load — detached PTY reader thread outlives tab close #13975).cargo clippy -p warp --lib --tests: zero warnings.I have manually tested my changes locally with
./script/runAgent Mode