From 81478e6ddd6ab5cd8a3de52582c548e064e50b7a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 29 Sep 2026 07:36:43 +0200 Subject: [PATCH] Pin the scheduler's progress report and the post-fence abort path Cargo-mutants on the previous commit missed the per-candidate progress flag and the post-fence branch selection in resume_candidate. A repeated error reports no progress; a dead candidate past the fence aborts; a wedged post-fence abort only waits. Co-Authored-By: Claude Sonnet 5 --- src/control_plane.rs | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/control_plane.rs b/src/control_plane.rs index 6904389..2efb9a2 100644 --- a/src/control_plane.rs +++ b/src/control_plane.rs @@ -11747,7 +11747,9 @@ mod tests { /// A workload whose candidate can neither be stopped nor recover: an abort /// that cannot finish its first step. - struct WedgedWorkload; + struct WedgedWorkload { + observe_fails: bool, + } impl WorkloadPort for WedgedWorkload { fn install( @@ -11789,6 +11791,7 @@ mod tests { activation: &IdunnRuntimeActivationRecord, prior: &WorkloadObservation, ) -> Result { + ensure!(!self.observe_fails, "the unit cannot be observed"); StillWorkload.observe(expected, activation, prior) } fn stop(&self, _: &WorkloadObservation) -> Result<()> { @@ -11801,7 +11804,9 @@ mod tests { #[test] fn one_wedged_pre_fence_abort_does_not_stop_the_scheduler() -> Result<()> { - let world = EngineFixture::with_workload(Arc::new(WedgedWorkload))?; + let world = EngineFixture::with_workload(Arc::new(WedgedWorkload { + observe_fails: false, + }))?; let wedged = transaction_at(&world, DeploymentPhase::Warming)?; world .engine @@ -11825,6 +11830,10 @@ mod tests { )? ); + // The first pass records the error and reports progress; the same + // error again changes nothing. + assert!(world.engine.resume_one_transaction()?); + assert!(!world.engine.resume_one_transaction()?); // Every tick answers: the wedged abort records its error and waits, // and the rest of the scheduler goes on to freeze the queued command. write_service_binding(&world)?; @@ -11844,6 +11853,29 @@ mod tests { Ok(()) } + #[test] + fn a_dead_candidate_past_the_fence_aborts_and_a_wedged_post_fence_abort_only_waits() -> Result<()> { + let world = EngineFixture::with_workload(Arc::new(WedgedWorkload { + observe_fails: true, + }))?; + let dead = transaction_at(&world, DeploymentPhase::AwaitingReady)?; + + // The candidate cannot be observed and can never run again, so the + // transaction abandons it after the fence. + world.engine.run_scheduler_tick()?; + assert!(record_of(&world, &dead.transaction_id)?.post_fencing_abort.is_some()); + + // Its abort cannot stop the unit: that is a resumable error, and the + // tick answers every time. + for _ in 0..3 { + world.engine.run_scheduler_tick()?; + } + let stuck = record_of(&world, &dead.transaction_id)?; + assert!(!stuck.is_terminal()); + assert!(stuck.last_error.is_some()); + Ok(()) + } + #[test] fn a_terminal_transaction_that_cannot_be_archived_does_not_stop_the_scheduler() -> Result<()> { let world = EngineFixture::with_workload(Arc::new(StillWorkload))?;