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

docs: add documentation on Check algorithm #1360

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

docs: add documentation on Check algorithm #1360

wants to merge 12 commits into from

Conversation

jon-whit
Copy link
Member

@jon-whit jon-whit commented Feb 12, 2024

Description

This adds some documentation to our docs that describes how the internal Check resolution algorithm works inside of the internal/graph package.

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

@jon-whit jon-whit requested a review from a team as a code owner February 12, 2024 14:49
docs/check/overview.md Outdated Show resolved Hide resolved
docs/check/overview.md Outdated Show resolved Hide resolved

* **Subproblem** - an FGA query that is contingent on one or more evaluations of nested relationship evaluations (including itself).

* **Dispatch** - refers to the process of evaluating a nested subproblem in order to resolve some parent subproblem.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* **Dispatch** - refers to the process of evaluating a nested subproblem in order to resolve some parent subproblem.
* **Dispatch** - refers to the process of evaluating a nested subproblem in order to resolve one or more parent subproblems.

i don't see a significant difference between expansion and dispatch's definitions. Suggest removing one of them and using one of both terms everywhere in this doc. And if you pick expand i suggest explaining in this doc the difference between Check API and Expand API

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term "expansion" in the scope of this Check doc is not to be confused with the Expand API. I've added some more text that hopefully clarifies the distinction when it comes to the semantics of how we use the term "expand" vs "dispatch" when we talk about FGA queries. Let me know what you think with the updates 👍

docs/check/overview.md Outdated Show resolved Hide resolved
docs/check/overview.md Outdated Show resolved Hide resolved
docs/check/overview.md Outdated Show resolved Hide resolved

> ℹ️ The term "permission" is used above, but from here forward we will formally refer to permissions simply as relationships. A users/subject has a permission if they have the relationship, and a relationship can be realized through one or more relationship rewrites.

### Direct Relationships
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Direct Relationships
### Model with Direct Relationships. Example Check

here and elsewhere. I skipped through all these thinking that they were going to explain what these terms meant, only to realize that these actually have examples of Check resolutions :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do explain the term "Direct Relationships" below. Specifically, we say

If a relation can be directly assigned or given/shared with a specific user/subject, then we refer to it as a "direct relationship". Direct relationships are any of those relationships that, for a particular authorization model, can be written to an FGA Store using the Write API.

The content of the doc is organized by rewrite rule categories. There are 2 categories - direct rewrite rules and set rewrite rules. The set rewrite rules compose other set rewrite rules and/or direct rewrite rules. Self (e.g. direct relationships), computed userset, and TTU encompass the direct rewrite rules. Union, intersection, and exclusion encompass the set rewrite rules.

The purpose of this section was to a) outline the direct rewrite rules and what they do, specifically in this subsection for direct relationships and b) provide examples of them. I feel like the content as is adequately portrays the intent.

docs/check/overview.md Outdated Show resolved Hide resolved
Copy link
Contributor

@poovamraj poovamraj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just starting to work on this doc. I'd rename this from overview.md to README.md as Github directly opens files named README when we enter the folder as shown here - https://github.com/openfga/openfga/tree/concurrency-controls-in-check-docs/docs/check

docs/check/overview.md Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.23%. Comparing base (57dd34c) to head (5443078).
Report is 5 commits behind head on main.

Current head 5443078 differs from pull request most recent head d61894b

Please upload reports for the commit d61894b to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1360      +/-   ##
==========================================
+ Coverage   86.20%   86.23%   +0.03%     
==========================================
  Files          87       87              
  Lines        8259     8259              
==========================================
+ Hits         7119     7121       +2     
+ Misses        805      804       -1     
+ Partials      335      334       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jon-whit jon-whit requested review from a team as code owners May 15, 2024 06:13
docs/check/README.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love this drawing!

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.

None yet

3 participants