Skip to content

Commit

Permalink
fix(planning): detrimental loop through transition value
Browse files Browse the repository at this point in the history
  • Loading branch information
Shi-Raida committed Dec 9, 2024
1 parent 919fc56 commit 9412b4d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions planning/planning/src/chronicles/analysis/detrimental_supports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,19 @@ fn gather_detrimental_supports(

if !external_contributors.contains(transition_value) && transition_value_is_unique && transition_is_initial
{
// we have our single transition value,
// mark as detrimental all transitions to it.
// proof: any transition to it must be preceded by transition from it (with no other side effects)
for t1 in supported(transition_value) {
for t2 in supporters(transition_value) {
// We have our single transition value.
// Mark all transition cycles `useful -> transition_value -> useful` as detrimental.
// Proof: There is not need to go through the transition value to reach
// the useful value again with no other intermediate value.
for t1 in supporters(transition_value) {
for t2 in supported(transition_value) {
if t1.post == t2.pre {
// this is a transition from `transition_value -> useful_value -> transition_value`
println!(
" => Detrimental: {} -> {} -> {}",
t1.pre.format(pb),
t1.post.format(pb),
t2.post.format(pb)
);
detrimentals.insert(CausalSupport::transitive(t1, t2));
}
}
Expand Down

0 comments on commit 9412b4d

Please sign in to comment.