Improvements to execution order ambiguity reporting - #4299
alice-i-cecile wants to merge 113 commits into
Conversation
Comments
EDIT: I took a look, and it's not going to be nice. We need this information at SystemStage, but those are constructed from a
|
maniwani
left a comment
There was a problem hiding this comment.
Looks good. Thanks for following up on my request in the original PR. I also like that the resource is enabled and set to minimal by default.
Just a small nit about wording.
commented
Mar 23, 2022
|
Would it be interesting for CI purposes to have a way to exit the app with the number of conflicts as the status code? Or at least not 0 if there are conflicts |
commented
Mar 23, 2022
IMO the way to do this is to allow users to forbid ambiguities, at both a plugin and app level. This is fundamentally what we need for determinism. I think that's very much worth pursuing, but out of scope for this. |
1705039 to
c01cd76
Compare
commented
Mar 28, 2022
|
Is there a way to un-ignore the internal plugins? |
Yes. Change the ignore_crates field of That said, this whole design is eh... I'm going to see if I can come up with a more reasonable design for this. |
commented
Mar 28, 2022
I took a pass at this, and it's not going to be triviak. Current problems:
Blockers:
I think I can make this work though, and I think that hard-coding a list internally is the least bad solution. |
d841f38 to
870f3e8
Compare
| stage.run(&mut world); | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
This test is very fragile and hard to use due to the elaborate "label" reporting strategy.
I've done my best to replace the functionality over in the tests in ambiguity_detection.rs.
| self.executor.rebuild_cached_data(&self.parallel); | ||
| self.executor_modified = false; | ||
| } | ||
| self.initialize(world); |
There was a problem hiding this comment.
This functionality is useful to the public, so I refactored it out into its own method.
In the long-term I'd prefer a type-safe pattern for this sort of initialized vs uninitailized state, but that's way out of scope.
| debug_assert!(!self.systems_modified); | ||
|
|
||
| // TODO: remove all internal ambiguities and remove this logic | ||
| let ignored_crates = if report_level != ReportExecutionOrderAmbiguities::ReportInternal { |
There was a problem hiding this comment.
The alternative strategy, of making this a configurable field on a per plugin basis or otherwise enabling this resulted in a much more complex, less ergonomic API.
The hard-coded list still existed, it was just scattered across a dozen different files.
| } | ||
|
|
||
| /// Collapses a name returned by std::any::type_name to remove its module path | ||
| fn format_type_name(raw_name: &str) -> String { |
There was a problem hiding this comment.
This could probably be done with a single gnarly regex, but I'm not actually sure that would be more readable or maintainable.
There was a problem hiding this comment.
There's a function TypeRegistration::get_short_name that does something very similar to this function. Not sure if it matches exactly.
There was a problem hiding this comment.
This is an exact match. I've refactored this out into bevy_utils and reused it.
Thanks!
|
Since you're using |
commented
Mar 30, 2022
Probably. I'd like to use |
79466fd to
1720cf5
Compare
commented
Sep 3, 2022
|
Going to carve this up for easier reviewing and less rebasing hell. Based on the original PR description, let's carve this up as follows. Foundational:
Disjoint improvements:
Incremental:
Yeet (fixed by 2 of foundational work):
|

Context
This PR was largely completed by @alfonsolage in #2766. I've simply rebased it and put a few finishing touches on it to get it over the finish line.
Massive thanks and full credit for all his hard work.
Objective
Solution
WarnInternalreporting level, and included an example to thetoolsfolder that reports all of the Bevy-internal ambiguities. Should be helpful for developers until we quash the last few.Forbidreporting level, for developers who prefer to force themselves to fix ambiguities ASAP.Denyreporting level, which reports literally every ambiguity and panics, for applications that need true determinism.tracing'swarnanderrormacros, rather thanprintln.Changelog
Execution order ambiguity reporting has been significantly improved and a minimal report informing you of the number of ambiguous system pairs present in your schedule is now on by default.
It is now much easier to disable false positive ordering ambiguities, bevy-internal ambiguities are silenced by default and the output is much easier to read and act on.
Sample output:
Migration Guide
The
ReportExecutionOrderAmbiguitiesresource is nowExecutionOrderAmbiguities: you can adjust the level of the enum to match your preferred strictness level.The concept of "ambiguity sets" has been simplified away: simply use
.label(SharedLabel).ambiguous_with(SharedLabel)with a standardSystemLabelinstead.Status
Rebasing this is proving to be a disaster; I'm going to remake this, ideally in a series of small PRs.
Future work
If you think any of these are dealbreakers, do let me know. For now though, this PR is already way too large.
ReportInternalenum variant (Tracking issue: eliminate or explicitly silence all Bevy-internal execution order ambiguities #4377)