Odin test: with nothing to write, the next change is written on the next pass

Pins the rule that only an attempted write starts the flush interval: a due
write with nothing to write leaves the next change to land on the first pass
after it. Kills the mutant that starts the interval on every due pass.

Soul finding 5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-30 16:48:12 +02:00
commit 749c6b9bbe

View file

@ -3210,6 +3210,26 @@ mod tests {
Ok(())
}
/// A due write with nothing to write does not start the interval: the next
/// change is written on the first pass after it.
#[test]
fn with_nothing_to_write_the_next_change_is_written_on_the_next_pass() -> Result<()> {
let mut odin = activated_odin()?;
odin.pass()?;
let written = file_identity(&odin.store)?;
odin.timers.last_projection_refresh = Some(Instant::now());
odin.timers.last_heartbeat = Some(Instant::now());
odin.timers.last_flush = ago(1_100);
odin.pass()?;
assert_eq!(file_identity(&odin.store)?, written, "nothing to write");
odin.heartbeat()?;
odin.pass()?;
assert_ne!(file_identity(&odin.store)?, written, "the change is written at once");
assert_eq!(odin.file_records()?, odin.working_set());
Ok(())
}
/// The lease is checked at the write itself: lost between a change and
/// its write, the write is not made and Odin ends.
#[test]