-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
🐛 Fixes PropagateStop and PropagateOver #21622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
|
I actually made propagatestop include the target since sometimes you want to take it on the stopped entity, and you can always add a propagateover as well if you don’t want it on that entity. It’s hard to include the entity otherwise (you’d have to add stop to all your children). I’ll check the propagateover behaviour tomorrow. Edit to add: if we choose to keep propagating onto the stop entity I definitely agree the docs should be more explicit |
|
Yes, I figured that was the intent, since that also makes sense to me. Unfortunately that isn't what the code was doing, which gave me some headache where I couldn't tell why this wasn't working in my project. So this fixes that behavior. |
|
I added more explanation to the main post to show the expected and intended behavior (as I understand it) as well as some additional comments and questions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apologies, in my previous comment i didn't have the code in front of me. i see now that the behaviour i described is not what it was actually doing. i fully agree that pushing C onto the PropagateStop::<C>-holder is better behaviour, and confirm the implementation does that with your changes.
to ensure cleanup doesn't also remove any separately applied C?
i think you're right. it looks like an entity with (PropagateOver::<C>, C) will have the C removed if the ancestor's Propagate::<C> is removed, as the removal is done in propagate_inherited without checking if there's a PropagateOver::<C>. we should probably process removals separately in propagate_output.
|
Updates tests with more cases and pushed some code to solve those. It still doesn't handle some other edge cases I can think of (like multiple PropagateOver in a row when one is removed) |
Objective
Fixes #21620
Ensures
PropagateStopworks as documented. At it stands,PropagateStop<C>is described as only preventing it's Children from inheritingCbut in practice that entity itself would not inheritC.Makes
PropagateOverwork. It just plain didn't work at all.Solution
Adjusted the flow to prevent recursively inheriting
InheritedwhenPropagateStoppresent, as opposed to not accessingPropagateStopentities entirely.Skips applying
CwhenInherited<C>andPropagateOver<C>are on the entity.Testing
I updated the tests first to verify the test cases. They were incomplete and didn't pass once checking for the proper end state.
After verifying those were not functioning, trimmed and adjusted code until it functioned.
Fuller Explanation
To my understanding of the goals (and my implementation) the idea is that the result of these components would be like
While the previous (incorrect by my measure) appeared to be
So of note: The
PropagateOver<C>is still gettingInherited<C>in this current adjustment. I believe it was doing that before, but I didn't fully understand the reasoning for theInherited<C>at all? I guess it's to properly mark that theCis an inherited one, so maybe I do need to remove it onPropagateOver<C>as well, to ensure cleanup doesn't also remove any separately appliedC?I didn't look closely at what all the other tests are attempting to test (or if they are correctly testing those) to evaluate if other changes need to be made.
if
PropagateOver<C>doesn't haveInherited<C>and is reparented, would it be simple to ensure that its children have theirInherited<C>removed/updated properly?Looking at the code more, chances are this can be simplified a lot with the use of AncestorIter and DescendentIter, but I am not sure if jumping into a fuller refactor makes sense at this moment as opposed to attempting to fix this immediate issue and following up with a bigger refactor?
thoughts?