-
Notifications
You must be signed in to change notification settings - Fork 107
Add unknown_entities method to PartialResponse #1557
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
Add unknown_entities method to PartialResponse #1557
Conversation
12461ea
to
53cf049
Compare
Looking more at the API, there are many other methods that map the inner result via For example, say I'm interested in the policy ids that are definitely satisfied: let satisfied: HashSet<PolicyId> = cedar_response
.definitely_satisfied()
.map(|policy| policy.id().clone())
.collect(); Well, you if you have lots of satisfied policies then there's lots of extra work in pretty printing that stuff. |
Hi @vladcebo , thanks for the PR!
Yes, it sounds like at the very least we should test the assumption that pretty-printing is cheaper than building the |
cedar-policy/rfcs#95 should be an independent implementation in parallel to the existing PE. Besides, there's no explicit unknown in TPE. So, we should be fine here. |
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 65.22% Status: FAILED ❌ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 81.38% Status: PASSED ✅ Details
|
Introduces unknown_entities method to the PartialResponse. Signed-off-by: Vlad <[email protected]>
53cf049
to
c9ac0c8
Compare
Added a test for coverage 👍 |
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 95.24% Status: PASSED ✅ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 81.59% Status: PASSED ✅ Details
|
Thanks for the contribution, @vladcebo ! I'll merge it now. |
Signed-off-by: Vlad <[email protected]>
Introduces unknown_entities method to the PartialResponse.
Description of changes
Introduces a method
uknown_entities
on thePartialResponse
.During partial evaluation, knowing unknown entity ids can help clients to fetch the missing entities
and run the evaluation again.
This is achievable using the existing code via:
Unfortunately this is slow for large policy sets due to
Policy::from_ast
relying on pretty printing.so calling that in a loop doing entity discovery is just very expensive.
Issue #, if available
N/A
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
cedar-policy
(e.g., addition of a new API).I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec
(choose one, and delete the other options):I confirm that
docs.cedarpolicy.com
(choose one, and delete the other options):