Repository navigation
CLI tests: pass the state directory instead of setting NODESPACE_HOME - #4408
Merged
Merged
Conversation
…E_HOME The two in-process tests that dial a missing daemon set NODESPACE_HOME for the whole test process to keep the refusal-marker lookup hermetic. Add nodespace_cli::with_state_dir, a task-local state directory for failed dials (production lookups unchanged), and use it in those tests; add a test that the given directory's marker is the one reported. The launched_session daemons each set NODESPACE_HOME for the process, so under plain multi-threaded cargo test they overwrite each other (that file's no-project test failed every run, on main too). Serialize them with a mutex held for the daemon's life. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
mstomar125
force-pushed
the
cli-tests-no-env
branch
from
November 30, 2026 12:24
0cd8b12 to
63c8c2b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
nodespace_cli::with_state_dir(dir, fut): a task-local state directory for the refusal-marker lookup of failed dials. Nothing in the binary calls it, so production lookups are unchanged.connect_refused_returns_friendly_erroranda_daemon_that_is_not_running_is_its_own_outcome_and_exit_statuspass an empty directory through it;isolate_state_dir()(a process-wideset_var) is removed.connect_refused_reports_the_refusal_marker_in_the_given_state_dir.launched_sessiondaemons eachset_var("NODESPACE_HOME"); a mutex held for the daemon's life now serializes them.Why
A process-wide env change races with other tests under plain multi-threaded
cargo test(CI uses nextest, one process per test, so it was unaffected).Tests (plain
cargo test -p nodespace-cli --no-fail-fast, default threads, isolated HOME/NODESPACE_HOME under /tmp)incompatible-database.json(existing databasePath) in$NODESPACE_HOME/.nodespace: green.launched_session::a_launch_with_no_project_runs_in_a_private_folder_with_the_environment_set(158 passed, 1 failed).Mutation
Flake baseline (origin/main 6645d6a, launched_session group, default threads, 3 runs)
Failed 3/3 (5 passed, 1 failed) on the same no-project test at launched_session.rs:513, so the flake exists on main before this change, and in this environment it is deterministic rather than intermittent.
🤖 Generated with Claude Code