render: snapshot store temp dir is unique per store (test parallel flake)
CI / Build & test (Linux) (push) Successful in 23m2s
CI / Build & test (Windows) (push) Successful in 30m53s

Tests run in parallel inside one process; each GraphSnapshotStore::new()
used the same 'oakrender-snapshots-<pid>' root, so one test's cleanup()
deleted another test's live snapshot — the
acquire_rewrite_forces_file_rewrite_on_same_key flake on the 16-core
Windows runner (file written, then exists() == false). Append a per-store
sequence number to the directory.
This commit is contained in:
2026-09-02 16:19:01 +08:00
parent 6b5b30fd36
commit 4ef5b3e31d
+16 -2
View File
@@ -287,9 +287,23 @@ struct SnapshotEntry {
}
impl GraphSnapshotStore {
/// Empty store rooted in the process temp directory.
/// Empty store rooted in the process temp directory. The directory is
/// unique per CALLER-subdirectory: tests run in parallel inside one
/// process, and a shared `oakrender-snapshots-<pid>` root let one
/// test's `cleanup()` delete another test's live snapshot (the
/// "acquire_rewrite_forces_file_rewrite_on_same_key" flake on the
/// high-core Windows runner — the file existed right after acquire,
/// then vanished).
pub fn new() -> Self {
let dir = std::env::temp_dir().join(format!("oakrender-snapshots-{}", std::process::id()));
let dir = std::env::temp_dir().join(format!(
"oakrender-snapshots-{}-{:x}",
std::process::id(),
{
use std::sync::atomic::{AtomicU64, Ordering};
static SEQ: AtomicU64 = AtomicU64::new(0);
SEQ.fetch_add(1, Ordering::Relaxed)
}
));
let _ = std::fs::create_dir_all(&dir);
Self {
entries: Mutex::new(HashMap::new()),