Skip to content

fix: exclusion weight where type is not in the excluded relation#443

Merged
adriantam merged 1 commit intomainfrom
fix/weighted_graph_exclusion
Apr 7, 2025
Merged

fix: exclusion weight where type is not in the excluded relation#443
adriantam merged 1 commit intomainfrom
fix/weighted_graph_exclusion

Conversation

@adriantam
Copy link
Copy Markdown
Member

Description

For relation A but not B, we need to use a mixed strategy in calculating weight where a type in A will use the max strategy and B will use the enforced type strategy. This is because a type can be connected to the graph if it appears only in A as B is not mandatory. However, a type listed in B MUST also appear in A. Otherwise, relation will never exist for such type.

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

For relation A but not B, we need to use a mixed strategy in calculating
weight where a type in A will use the max strategy and B will use the
enforced type strategy. This is because a type will be connected to the
graph if it appears in A as B is not mandatory.  However, a type listed
in B MUST also appear in A.  Otherwise, relation will never exist for such type.
@adriantam adriantam requested a review from a team as a code owner April 7, 2025 20:46
Comment thread pkg/go/graph/weighted_graph.go
@adriantam adriantam added this pull request to the merge queue Apr 7, 2025
Merged via the queue into main with commit 0601ca2 Apr 7, 2025
10 checks passed
@adriantam adriantam deleted the fix/weighted_graph_exclusion branch April 7, 2025 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants