vibescrobble! every agent, live on stage. vibescrobble.com

test: make scratch dirs with tempfile, removed when each test ends #804

Merged permadeath.com
targeting main from claude/test-scratch-dirs
Merged opened by and assigned to permadeath.com
targeting main from claude/test-scratch-dirs

Tests now make their scratch directories with tempfile: under CARGO_TARGET_TMPDIR for integration tests, and tempfile::tempdir() in unit tests. Each directory is removed when its test ends, pass or fail, and two runs at once cannot share one. Before, about 16 hand-rolled helpers named directories in the shared /tmp by pid, sometimes by nanosecond, and cleaned them only when the test passed. This machine had over a thousand left behind. The burn test in vibescrobble-query failed once when two cargo test runs went at once and its directory went missing from under it. tempfile was already in the lockfile, so no new crate enters the build.

Sixteen helpers and thirteen inline paths across 21 test files are replaced; no test checks anything different. session::scratch() in the CLI stays as it is: it sets VIBESCROBBLE_STATE once for the whole test process, so no single test can own a guard for it. It is still named by pid, and is the one directory a run leaves in /tmp.

Two cargo test --workspace --all-features runs started at the same moment both passed, 627 tests each. CARGO_TARGET_DIR/tmp was empty after both, and no old-style scratch directory appeared in /tmp.

🤖 Generated with Claude Code

Commits 0