From 80db5db6c0d9f7804fee2e3fa19145bddd99df81 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 16 Sep 2026 12:17:42 +0200 Subject: [PATCH] Give the derivation test a directory of its own Soul F4. The derivation test wrote its stale copies into one shared temp directory and cleared it first with `remove_dir_all(...).ok()`. The clear was best-effort and unverified: a held handle refuses the delete on Windows, `.ok()` swallows the refusal, and a previous run's file survives in a directory whose path the failure message invites the reader to copy from. The mutation suite runs M8 and M11 against this test and never cleans up after them, so the leftovers it would hide are mutated schemas no committed type produces. The directory is now per-run, named by process id and nanosecond, so there is no sharing to defend and the clear and its `.ok()` are gone rather than hardened. It is still created only when something is stale, so a passing run leaves nothing behind. Co-Authored-By: Claude Opus 5 --- epiphany-pipeline/src/lib.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/epiphany-pipeline/src/lib.rs b/epiphany-pipeline/src/lib.rs index 89677b42..00732180 100644 --- a/epiphany-pipeline/src/lib.rs +++ b/epiphany-pipeline/src/lib.rs @@ -1293,12 +1293,19 @@ mod tests { fn pipeline_published_schemas_match_derivation() -> Result<()> { let published = Path::new(env!("CARGO_MANIFEST_DIR")).join("../schemas/cultnet"); let index: serde_json::Value = serde_json::from_slice(&std::fs::read(published.join("index.json"))?)?; - let derived_dir = std::env::temp_dir().join("epiphany-pipeline-schemas"); - // Emptied first, so what is left in it is what this run derived. A - // previous run's leftovers -- a mutation run's especially -- are not - // this derivation, and copying one of those into `schemas/cultnet` - // publishes a schema no Rust type produces. - std::fs::remove_dir_all(&derived_dir).ok(); + // A directory this run alone writes, so everything in it is what this + // run derived. A previous run's leftovers -- a mutation run's + // especially, since those deliberately derive schemas no committed type + // produces -- are not this derivation, and copying one of those into + // `schemas/cultnet` publishes a schema no Rust type produces. A shared + // directory cleared first would have to defend that clear against a + // held handle; an unshared one has nothing to defend. The directory is + // only created when something is stale, so a passing run leaves none. + let derived_dir = std::env::temp_dir().join(format!( + "epiphany-pipeline-schemas-{}-{}", + std::process::id(), + std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH)?.as_nanos() + )); let mut stale = Vec::new(); for kind in PipelineKind::ALL { let file = format!("{}.schema.json", kind.type_id());