From e7f16c179b2ae97d1fb0df5157f9c39e47af1ca1 Mon Sep 17 00:00:00 2001 From: claude Date: Mon, 13 Jul 2026 16:33:19 +0200 Subject: [PATCH] fix(test): anchor the knob-lab scaffold under CARGO_TARGET_TMPDIR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit built_scale_project() scaffolded ~66 MB (built node crate) into a pid-suffixed tempdir, so its wipe-before-scaffold never hit a previous run's copy: one leaked directory per test-binary run. 159 of those (~10 GB) filled the host's 16 GB /tmp tmpfs to 100%, breaking every std::env::temp_dir() consumer. A fixed name under CARGO_TARGET_TMPDIR (real disk, reclaimed by cargo clean) makes the existing wipe reclaim the previous run — steady state is exactly one directory. Trade-off: two concurrent cargo-test invocations over the same checkout collide on the fixed name, the documented pre-existing caveat class for this suite (#223). closes #257 --- crates/aura-cli/tests/project_sweep_campaign.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/aura-cli/tests/project_sweep_campaign.rs b/crates/aura-cli/tests/project_sweep_campaign.rs index 1ac77d8..35d848d 100644 --- a/crates/aura-cli/tests/project_sweep_campaign.rs +++ b/crates/aura-cli/tests/project_sweep_campaign.rs @@ -63,11 +63,15 @@ fn aura_in(dir: &Path, args: &[&str]) -> Output { /// `blueprints/scaled_open.json`. Returns the project dir. `OnceLock` so the /// expensive scaffold+build happens once per test binary; the node crate's /// path-dep resolves into this checkout (the baked engine root), like -/// `project_new.rs`. +/// `project_new.rs`. The base is a FIXED name under `CARGO_TARGET_TMPDIR` +/// (real disk, reclaimed by `cargo clean`), not a pid-suffixed tempdir: the +/// wipe below must hit the PREVIOUS run's copy, else every test-binary run +/// leaks the ~66 MB built scaffold — 159 of those filled the 16 GB /tmp +/// tmpfs to 100 % (#257). fn built_scale_project() -> &'static PathBuf { static BUILT: OnceLock = OnceLock::new(); BUILT.get_or_init(|| { - let base = std::env::temp_dir().join(format!("aura-235-{}", std::process::id())); + let base = Path::new(env!("CARGO_TARGET_TMPDIR")).join("aura-235-knob-lab"); let _ = std::fs::remove_dir_all(&base); std::fs::create_dir_all(&base).expect("create scaffold base");