From cda20870fd53e1f470a1af4b02a0631df150436d Mon Sep 17 00:00:00 2001 From: soul-probe Date: Wed, 30 Sep 2026 14:07:44 +0200 Subject: [PATCH] Odin tests: the write starts the next interval; unprojected correlations are withdrawn cargo-mutants survivors, both real gaps: - serving_pass with the timer condition inverted wrote every change on the next pass after a write; the interval test set the timer by hand on every pass and never saw the loop set it. A change right after a write now waits. - correlated_incarnations returning nothing left a correlation whose incarnation Idunn stopped projecting in place forever; the lib test refreshed that incarnation by name. The refresh pass now has to find it. Co-Authored-By: Claude Opus 5.5 --- crates/odin-daemon/src/main.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/odin-daemon/src/main.rs b/crates/odin-daemon/src/main.rs index b19eb48..ff75b2c 100644 --- a/crates/odin-daemon/src/main.rs +++ b/crates/odin-daemon/src/main.rs @@ -3012,12 +3012,37 @@ mod tests { assert_ne!(second.0, first.0, "one write once the interval passed"); assert_eq!(odin.file_records()?, odin.working_set()); - odin.timers.last_flush = None; + // The write itself starts the next interval: a change right after it + // waits. + provider_put(&odin, "ghostlight.doc.v1", "doc-late", vec![1])?; odin.pass()?; assert_eq!(file_identity(&odin.store)?, second, "and only one"); Ok(()) } + /// A correlation for an incarnation Idunn no longer projects is found + /// through the correlations Odin holds, and the refresh pass withdraws it. + #[test] + fn a_correlation_whose_incarnation_is_no_longer_projected_is_withdrawn() -> Result<()> { + let mut odin = activated_odin()?; + odin.pass()?; + let candidate = project_candidate_incarnation(&odin)?; + odin.state.borrow().refresh_all_correlations()?; + let correlations = || odin.stored_keys(OdinRuntimeTopologyCorrelationRecord::TYPE); + assert!(correlations()?.contains(&candidate.key())); + + odin.tamper_projection(|entries| { + entries + .into_iter() + .filter(|entry| entry.key != candidate.key()) + .collect() + })?; + odin.state.borrow().refresh_all_correlations()?; + assert!(!correlations()?.contains(&candidate.key())); + assert_eq!(correlations()?.len(), 1, "Odin's own stays"); + Ok(()) + } + /// An interval in which nothing changed writes nothing, however often the /// write is due. With nothing to write the write step reads nothing /// either, not even the lease: it is due on every pass until something