Merge 'simulator: Fix shrinking' from Pedro Muniz

When shrinking, the depending table should first start with the
dependencies from the overall property first. I broke this in my
previous Sim Connections PR.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #3203
This commit is contained in:
Pekka Enberg
2025-09-19 08:29:49 +03:00
committed by GitHub
2 changed files with 5 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ use super::property::{Property, remaining};
pub(crate) type ResultSet = Result<Vec<Vec<SimValue>>>;
#[derive(Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct InteractionPlan {
pub(crate) plan: Vec<Interactions>,
}

View File

@@ -1,5 +1,3 @@
use indexmap::IndexSet;
use crate::{
SandboxedResult, SimulatorEnv,
generation::{
@@ -19,13 +17,14 @@ impl InteractionPlan {
// - Shrink to multiple values by removing random interactions
// - Shrink properties by removing their extensions, or shrinking their values
let mut plan = self.clone();
// let failing_property = &self.plan[failing_execution.interaction_index];
let mut depending_tables = IndexSet::new();
let all_interactions = self.interactions_list_with_secondary_index();
// Index of the parent property where the interaction originated from
let secondary_interactions_index = all_interactions[failing_execution.interaction_index].0;
// Index of the parent property where the interaction originated from
let failing_property = &self.plan[secondary_interactions_index];
let mut depending_tables = failing_property.dependencies();
{
let mut idx = failing_execution.interaction_index;
loop {