Fix system param validation for piped systems#18785
Fix system param validation for piped systems#18785alice-i-cecile merged 12 commits intobevyengine:mainfrom
Conversation
|
Looks fine, no point spending more time on this, since the full fix requires checking params inside each |
|
Won't doing eager validation like this re-introduce the issues from #16638 (comment)? If a user pipes a system that inserts a resource into a system with |
I was going to say that this is quite unlikely, since all of our existing validated parameters requires structural changes to invalidate, but system piping doesn't work for exclusive systems. I wrote a test: turns out at some point that changed! That said, I think this is a better tradeoff for now: piping exclusive systems or doing custom validated system params that are affected by an earlier system in the pipe feels quite rare. By contrast, the existing bug breaks a relatively common pattern (using validated params in a piped system) by changing the "everything is fine" behavior into a confusing panic. |
chescock
left a comment
There was a problem hiding this comment.
Yeah, breaking resource_exists::<MyRes>.and(do_stuff) is what seemed really bad, but I see you're doing this for pipe but not combinators, so this does seem like the right tradeoff!
Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
Yeah, I saw that doc test fail, stared at it for a while in dismay, and then gave up and reverted the change. That is a much harder fix than I want for "last minute during 0.16". |
MrGVSV
left a comment
There was a problem hiding this comment.
Not an ECS dev but the changes look good to me and has really solid tests.
# Objective - Piped systems are an edge case that we missed when reworking system parameter validation. - Fixes #18755. ## Solution - Validate the parameters for both systems, ~~combining the errors if both failed validation~~ by simply using an early out. - ~~Also fix the same bug for combinator systems while we're here.~~ ## Testing I've added a large number of tests checking the behavior under various permutations. These are separate tests, rather than one mega test because a) it's easier to track down bugs that way and b) many of these are `should_panic` tests, which will halt the evaluation of the rest of the test! I've also added a test for exclusive systems being pipeable because we don't have one and I was very surprised that that works! --------- Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
# Objective - Piped systems are an edge case that we missed when reworking system parameter validation. - Fixes bevyengine#18755. ## Solution - Validate the parameters for both systems, ~~combining the errors if both failed validation~~ by simply using an early out. - ~~Also fix the same bug for combinator systems while we're here.~~ ## Testing I've added a large number of tests checking the behavior under various permutations. These are separate tests, rather than one mega test because a) it's easier to track down bugs that way and b) many of these are `should_panic` tests, which will halt the evaluation of the rest of the test! I've also added a test for exclusive systems being pipeable because we don't have one and I was very surprised that that works! --------- Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
Objective
Singlecauses piped systems to panic #18755.Solution
combining the errors if both failed validationby simply using an early out.Also fix the same bug for combinator systems while we're here.Testing
I've added a large number of tests checking the behavior under various permutations. These are separate tests, rather than one mega test because a) it's easier to track down bugs that way and b) many of these are
should_panictests, which will halt the evaluation of the rest of the test!I've also added a test for exclusive systems being pipeable because we don't have one and I was very surprised that that works!