Skip to content
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

Ambiguity reporting does not account for effects of Without query filters, leading to false positives #4381

Open
alice-i-cecile opened this issue Mar 31, 2022 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior D-Complex Quite challenging from either a design or technical perspective. Ask for help!

Comments

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Mar 31, 2022

Bevy version

0.7.0 dev, also reproduced in #4299.

What you did

(This test is from #4299), but the same failure occurs on main)

    fn with_filtered_component_system(_query: Query<&mut A, With<B>>) {}
    fn without_filtered_component_system(_query: Query<&mut A, Without<B>>) {}

    #[test]
    fn filtered_components() {
        let mut world = World::new();
        let mut test_stage = SystemStage::parallel();

        test_stage
            .add_system(with_filtered_component_system)
            .add_system(without_filtered_component_system);

        assert_eq!(
            test_stage.n_ambiguities(&mut world, ExecutionOrderAmbiguities::Forbid),
            0
        );
    }

What you expected to happen

This test should pass, as it is impossible for the two systems to access the same data.

What actually happened

It fails, and an ambiguity is detected.

Additional context

This is ultimately related to a lack of a clear model for how system access should be handled: read #3119.

This is correctly computed on the basis of hypothetical data access (which should be world agnostic, #4364).
However, the model used isn't strong enough: it's computed purely on the basis of Access<ComponentId>, and cannot account for the effects of query filtering in this way.

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events D-Complex Quite challenging from either a design or technical perspective. Ask for help! labels Mar 31, 2022
@alice-i-cecile
Copy link
Member Author

Another ambiguity was spuriously ignored in #7383.

We should warn if ambiguities are ignored when no ambiguity exists to automatically catch these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior D-Complex Quite challenging from either a design or technical perspective. Ask for help!
Projects
None yet
Development

No branches or pull requests

1 participant