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

Add Entity Slicing using Entity Manifests to Cedar #1105

Closed
wants to merge 2 commits into from

Conversation

oflatt
Copy link
Contributor

@oflatt oflatt commented Jul 31, 2024

Description of changes

This PR allows users of Cedar to get an entity slice of an existing Entities store using the entity manifest.
Mainly this is useful for testing entity manifests. However, it may also be useful for users to load all entities in to memory, but only send a slice over the network to a server.

Later, I re-implemented most of this code in #1208. You can squash this code with all the PRs on top of it into one giant PR, or just review this and then review the replacement.

PR stack:
#1102 (Merged)
#1105 (This PR)
#1154
#1156
#1171
#1196
#1208

Issue #, if available

Checklist for requesting a review

The change in this PR is (choose one, and delete the other options):

  • A breaking change requiring a major version bump to cedar-policy (e.g., changes to the signature of an existing API).
  • A backwards-compatible change requiring a minor version bump to cedar-policy (e.g., addition of a new API).
  • A bug fix or other functionality change requiring a patch to cedar-policy.
  • A change "invisible" to users (e.g., documentation, changes to "internal" crates like cedar-policy-core, cedar-validator, etc.)
  • A change (breaking or otherwise) that only impacts unreleased or experimental code.

I confirm that this PR (choose one, and delete the other options):

  • Updates the "Unreleased" section of the CHANGELOG with a description of my change (required for major/minor version bumps).
  • Does not update the CHANGELOG because my change does not significantly impact released code.

I confirm that cedar-spec (choose one, and delete the other options):

  • Does not require updates because my change does not impact the Cedar formal model or DRT infrastructure.
  • Requires updates, and I have made / will make these updates myself. (Please include in your description a timeline or link to the relevant PR in cedar-spec, and how you have tested that your updates are correct.)
  • Requires updates, but I do not plan to make them in the near future. (Make sure that your changes are hidden behind a feature flag to mark them as experimental.)
  • I'm not sure how my change impacts cedar-spec. (Post your PR anyways, and we'll discuss in the comments.)

@oflatt
Copy link
Contributor Author

oflatt commented Jul 31, 2024

This PR stacks on top of #1102
It looks like I can't select that PR as a base branch since it's from my fork of Cedar.

@oflatt oflatt mentioned this pull request Jul 31, 2024
11 tasks
@oflatt
Copy link
Contributor Author

oflatt commented Aug 1, 2024

Looks like changing the API for cedar testing broke downstream dependencies build

@oflatt oflatt force-pushed the oflatt-entity-slicing branch from 9a1ad2c to d01fc15 Compare August 1, 2024 18:54
@oflatt oflatt force-pushed the oflatt-entity-slicing branch 6 times, most recently from 2c99077 to a1243fc Compare August 27, 2024 17:30
@oflatt oflatt changed the base branch from main to oflatt/entity-manifest-minimal-cedar-repo August 27, 2024 20:00
@oflatt oflatt force-pushed the oflatt-entity-slicing branch 2 times, most recently from e02a451 to cb1188b Compare August 27, 2024 20:23
@oflatt oflatt force-pushed the oflatt/entity-manifest-minimal-cedar-repo branch from 2445b74 to ad8e43b Compare August 27, 2024 20:24
@oflatt oflatt requested a review from cdisselkoen August 28, 2024 16:07
@oflatt oflatt mentioned this pull request Aug 28, 2024
11 tasks
@oflatt oflatt force-pushed the oflatt-entity-slicing branch 2 times, most recently from 2592e0b to 1b72442 Compare August 28, 2024 21:34
@oflatt oflatt force-pushed the oflatt/entity-manifest-minimal-cedar-repo branch from ad8e43b to 3604eba Compare August 28, 2024 21:36
@oflatt oflatt force-pushed the oflatt-entity-slicing branch from 1b72442 to 7d3b2e7 Compare August 28, 2024 21:39
@oflatt oflatt mentioned this pull request Aug 30, 2024
11 tasks
@oflatt oflatt changed the base branch from oflatt/entity-manifest-minimal-cedar-repo to main September 3, 2024 18:17
Signed-off-by: oflatt <[email protected]>

fix up after rebase

Signed-off-by: oflatt <[email protected]>

more bad rebase cleanup

Signed-off-by: oflatt <[email protected]>

more small cleanup

Signed-off-by: oflatt <[email protected]>

some cleanup

Signed-off-by: oflatt <[email protected]>

separate entity slicing from manifest file

Signed-off-by: oflatt <[email protected]>

remove simple entity loader for now

Signed-off-by: oflatt <[email protected]>

exhaustive

Signed-off-by: oflatt <[email protected]>

fix up testing infra with feature flag

Signed-off-by: oflatt <[email protected]>

nits

Signed-off-by: oflatt <[email protected]>

fix up should panic

Signed-off-by: oflatt <[email protected]>

remove use of panic from testing infra

Signed-off-by: oflatt <[email protected]>

nits

Signed-off-by: oflatt <[email protected]>

entity manifest cfg

Signed-off-by: oflatt <[email protected]>

make errors more reusable

Signed-off-by: oflatt <[email protected]>

revert cedar testing changes

Signed-off-by: oflatt <[email protected]>

fmt

Signed-off-by: oflatt <[email protected]>
@oflatt oflatt force-pushed the oflatt-entity-slicing branch from 7d3b2e7 to 484a00c Compare September 3, 2024 18:23
@@ -318,6 +318,49 @@ pub struct Entity {
}

impl Entity {
/// The implementation of [`Eq`] and [`PartialEq`] for
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the feature flag to core as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or generally, do you need changes to core at all? It seems you can put everything into the validator.

@shaobo-he-aws
Copy link
Contributor

Closed in favor of a single PR.

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