Skip to content

Conversation

@pmbittner
Copy link
Member

@pmbittner pmbittner commented Oct 13, 2025

This PR fixes a bug reported by @piameier.

The Configure relevance predicate for generating views falsely removed ELSE and ELIF branches. The reason was that the optimized implementation to mark nodes as relevant discarded an entire subtree as soon as that subtree's root was irrelevant (i.e., that root conflicted a given partial configuration). However, in such a case, we still have to check and test any ELSE or ELIF branches.

I implemented the first ever unit tests for views on trees and diffs to check that the bug is now fixed. The new test cases checks the implementation of Configure against a naive implementation called ConfigureSpec.

In the future, it might be great to

  • add more test cases
  • add specifications for other relevance predicates as well

This PR also contributes the new EliminateEmptyAlternatives transformer and required refactorings.

@pmbittner pmbittner requested a review from ibbem October 13, 2025 15:46
@pmbittner pmbittner self-assigned this Oct 13, 2025
@pmbittner pmbittner added the bug Something isn't working label Oct 13, 2025
@pmbittner pmbittner changed the base branch from main to develop October 13, 2025 15:46
... from VariationDiffTransformer
Previously, this method always crashed because addChildren assumes the
given children to have no parent. Yet, the children always had 'other'
as parent because we only removed them afterwards.
We have to create a copy of the children list because it is cleared by
some implementations of removeAllChildren(). So effectively, no children
were added via addChildren.
Copy link
Collaborator

@ibbem ibbem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work. I did not find any real issues.

Unfortunate that there are commits with failing CI in between. However (as discussed in a meeting), changing that would break downstream work that is already based on this. Hence, we can keep it like that.

Kind of unrelated: Do we check anywhere that a DiffNode has at most one ELIF/ELSE? I just checked and didn't find anything. I have a change ready but am kind of surprised that we do not check this yet.

Co-authored-by: ibbem <benjamin.moosherr@uni-ulm.de>
@pmbittner
Copy link
Member Author

Thank you for your review. I do not remember whether we check the ELSE/ELIF validity anywhere. If you have a fix, I am happy to take it. I guess that DiffNode::assertConsistency would be a good place? I was also a bit surprised seeing that we do not have VariationNode::assertConsistency.

These where interfaces without a real purpose.
@ibbem
Copy link
Collaborator

ibbem commented Oct 26, 2025

If you have a fix, I am happy to take it.

I'll open a separate PR.

I was also a bit surprised seeing that we do not have VariationNode::assertConsistency.

We do have VariationNode::assertConsistency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants