language
language copied to clipboard
Fix: correctly assign weights for intersections with multiple direct types
Description
Currently, there is a bug when assigning weights to intersection operations involving more than two direct terminal types. Two examples illustrate this issue:
First, the user3 type should be pruned from the edge because that type assignment does not exist on both sides of the and operation.
Secondly, and more serious, the types on both sides of the and are balanced but only the user3 weight exists on the edge.
NOTE: This changes causes the TestInvalidWeight1NotMatchingTerminalTypes test to fail but it begs the question about what the correct behavior is when types are unbalanced across the and operation; is it better to prohibit the model or quietly prune away the weights?
References
Review Checklist
- [ ] I have clicked on "allow edits by maintainers".
- [ ] I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
- [ ] The correct base branch is being used, if not
main - [ ] I have added tests to validate that the change in functionality is working as expected