From 9aa71c944beaade935c284257a286895a761005e Mon Sep 17 00:00:00 2001 From: Imko Marijnissen Date: Fri, 23 Oct 2026 08:48:52 +0200 Subject: [PATCH] fix: debug checks failing when testing proof processor --- pumpkin-proof-processor/Cargo.toml | 3 ++ .../src/deduction_propagator.rs | 30 +++++++++++-------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/pumpkin-proof-processor/Cargo.toml b/pumpkin-proof-processor/Cargo.toml index eb7bf1190..c531cc0ca 100644 --- a/pumpkin-proof-processor/Cargo.toml +++ b/pumpkin-proof-processor/Cargo.toml @@ -27,5 +27,8 @@ escargot = "0.5.15" pumpkin-checker = { path = "../pumpkin-checker" } regex = "1.12.3" +[features] +debug-checks = ["pumpkin-core/debug-checks"] + [lints] workspace = true diff --git a/pumpkin-proof-processor/src/deduction_propagator.rs b/pumpkin-proof-processor/src/deduction_propagator.rs index 7e380876b..bae8c1357 100644 --- a/pumpkin-proof-processor/src/deduction_propagator.rs +++ b/pumpkin-proof-processor/src/deduction_propagator.rs @@ -164,25 +164,29 @@ impl Propagator for DeductionPropagator { let num_unassigned_predicates = self.nogood.len() - num_assigned_predicates; - assert!( - !(self.propagation_priority > Priority::VeryLow - && matches!( - self.propagation_mode, - DeductionPropagationMode::OnlyUnitPropagation - ) - && num_unassigned_predicates == 0), - "It should not be possible for an unmarked deduction to unit propagate - and cause a conflict, as a failure should have been declared by - the `DeductionPropagator` that does conflict detection, - which has a higher priority than its unit propagating counterpart." - ); + // The debug checks of the core run this propagator in isolation, so then it also has to + // detect conflicts when doing unit propagation. + let detects_conflicts = matches!( + self.propagation_mode, + DeductionPropagationMode::OnlyConflictDetection + ) || cfg!(feature = "debug-checks"); + match self.propagation_mode { - DeductionPropagationMode::OnlyConflictDetection if num_unassigned_predicates == 0 => { + _ if detects_conflicts && num_unassigned_predicates == 0 => { return Err(Conflict::Propagator(PropagatorConflict { conjunction: self.nogood.iter().copied().collect(), inference_code: self.inference_code.clone(), })); } + DeductionPropagationMode::OnlyUnitPropagation if num_unassigned_predicates == 0 => { + assert!( + self.propagation_priority <= Priority::VeryLow, + "It should not be possible for an unmarked deduction to unit propagate + and cause a conflict, as a failure should have been declared by + the `DeductionPropagator` that does conflict detection, + which has a higher priority than its unit propagating counterpart." + ); + } DeductionPropagationMode::OnlyUnitPropagation if num_unassigned_predicates == 1 => { let unassigned_predicate = self .nogood