Skip to content

Comments

Complete Cedar Policy AST Implementation#3

Open
rebecca-odonoghue wants to merge 5 commits intomainfrom
policy-ast
Open

Complete Cedar Policy AST Implementation#3
rebecca-odonoghue wants to merge 5 commits intomainfrom
policy-ast

Conversation

@rebecca-odonoghue
Copy link
Collaborator

I've relocated the library from rsvp/lib to rsvp/policy-ast in anticipation of bringing in the datalog stuff.

I've also moved the git files that were generated in rsvp into the root directory because that's my preference.

I also renamed the artifact produced by the library to uq.pac.rsvp:policy-ast:1.0.0 because I think it makes more sense given the new project structure.

I am still writing tests and need to rebase onto main, but I am opening the PR so people can comment on the implementation if they want to.

@rebecca-odonoghue rebecca-odonoghue marked this pull request as draft February 17, 2026 08:27
Copy link
Collaborator

@kostyantynv kostyantynv left a comment

Choose a reason for hiding this comment

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

Thanks Bec, looks great. A few minor comments left for your discretion. Feel free to merge.

@kostyantynv kostyantynv marked this pull request as ready for review February 18, 2026 00:07
@rebecca-odonoghue
Copy link
Collaborator Author

@kostyantynv I have added the new visitors as we discussed, more info can be found in README. I haven't written any tests for them yet, but hopefully they are okay. I will write some more tests now and once that is done we can merge the PR.

@davmac314 FYI these are the pending AST changes, if you have any feedback or requests based on your usage.

@rebecca-odonoghue rebecca-odonoghue marked this pull request as draft February 18, 2026 01:19
@davmac314
Copy link
Collaborator

@davmac314 FYI these are the pending AST changes, if you have any feedback or requests based on your usage.

Looks fine to me

@davmac314
Copy link
Collaborator

Oh if the API changes again though could you please bump the version number (in build.gradle). No need for that this time since I'll grab these changes and use the API from this

* Fix immutable fields
* Fix .gitignore
* Re-add Guava dependency
@rebecca-odonoghue rebecca-odonoghue marked this pull request as ready for review February 18, 2026 06:49
@rebecca-odonoghue
Copy link
Collaborator Author

@kostyantynv I've noticed that the behaviour of "required" will be wrong because record attributes are required by default, and there is no difference between omitting the property in JSON or explicitly setting it to false. So, we will need to check the JSON to see if "required" is specified or not, rather than replying on gson for this.

For now, I am leaving it as-is.

I'm happy for this to be merged whenever, but you might want to look at the new changes first.

Note that the merge options have changed, even though it has "rebase and merge" as an option, I don't think it will need to actually rebase.

import uq.pac.rsvp.policy.ast.visitor.SchemaComputationVisitor;
import uq.pac.rsvp.policy.ast.visitor.SchemaVisitor;

public class EntityOrCommonType extends AttributeType {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on what we have discovered so far about cedar types, let's require a schema to reason about resolved types. This needs to be broken into an entity type and a common type (tracking a its record)

@@ -0,0 +1,109 @@
package uq.pac.rsvp.policy.ast.schema;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand that this corresponds to Entity definition, so perhaps it should be named as such, otherwise it looks like an ad-hoc type outside of the attribute hierarchy. Especially, considering that in a resolved there is an entity type. On a similar note, we'd need a definition for a common type as well

@@ -0,0 +1,79 @@
package uq.pac.rsvp.policy.ast.schema.attribute;
Copy link
Collaborator

Choose a reason for hiding this comment

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

That would be more convenient if we could split primitive types in respective sub-classes, e.g., StringPrimitiveType etc

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.

3 participants