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 <noreply@anthropic.com>
This commit is contained in:
soul-probe 2026-09-30 14:07:44 +02:00
commit cda20870fd

View file

@ -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