pub fn default_session_dir(id: &str) -> PathBufExpand description
Where the default session directory lives when the user hasn’t
passed --session-path. Three cases:
-
Normal invocation (installed binary, user shell): the session lands at
<cwd>/logs/<id>. This is the documented, long-standing user-facing behavior. -
In-process tests that pre-sandboxed cwd (e.g.
checkpoint_resume_staircasein_dir(tmp, runner::run)):<cwd>/logs/<id>is already inside the test’s tempdir sandbox, so leave it alone — the test reads back from<cwd>/logs/latestand would be broken by a redirect. -
Cargo-spawned invocation where cwd lands inside the workspace (
cargo testintegration tests that spawnnmbrsas a subprocess without--session-path, pluscargo run --bin nmbrsruns from the workspace root): the default would otherwise be the user-visible<workspace>/logs/<id>, and thesession-keeprotation would evict real run sessions. Redirect into$TMPDIR/nmbrs-sessions/<id>—.cargo/config.tomlalready pointsTMPDIRat<workspace>/target/test-tmp, so cargo-spawned sessions live intarget/test-tmp/alongside other test artifacts. Seefeedback_tests_no_project_root.
Tests that want to read back their session contents must
still pass --session-path to a known path — this
fallback is the blast-radius limiter, not a substitute for
explicit sandboxing.