Skip to content

expose Eval function for custom partial eval#94

Merged
philhassey merged 3 commits intocedar-policy:mainfrom
jaredzhou:expose-eval
Jul 2, 2025
Merged

expose Eval function for custom partial eval#94
philhassey merged 3 commits intocedar-policy:mainfrom
jaredzhou:expose-eval

Conversation

@jaredzhou
Copy link
Copy Markdown
Contributor

Issue #, if available:
#91
Description of changes:

Copy link
Copy Markdown
Contributor

@philhassey philhassey left a comment

Choose a reason for hiding this comment

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

Looks good, just an ask for documentation. Also, you'll have to appease the DCO requirement. Here's a doc about it, I think it explains the gist:

https://www.secondstate.io/articles/dco/

"github.com/cedar-policy/cedar-go/x/exp/ast"
)

func Eval(n ast.IsNode, env eval.Env) (types.Value, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a one sentence piece of documentation that explains what this function does.

Copy link
Copy Markdown
Contributor

@philhassey philhassey Jun 25, 2025

Choose a reason for hiding this comment

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

Also a couple unit tests just to prove it works are needed. Since the internal implementation has all the exhaustive unit tests, I think even just a few would be nice. Maybe one that returns an error and one that does not.

Also, it looks like it does require an eval.Env which isn't publicly exposed, so you may need to expose that as well in this package. It'd be fine to have a type Eval = eval.Env and put a doc string above it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok, will fix these problems

jaredzhou added 2 commits July 1, 2025 16:30
Signed-off-by: jaredzhou <zhouzhenyu1313@163.com>
Signed-off-by: jaredzhou <zhouzhenyu1313@163.com>
philhassey added a commit to strongdm/cedar-go that referenced this pull request Jul 1, 2025
Addresses cedar-policy#94

Signed-off-by: philhassey <phil@strongdm.com>
@philhassey
Copy link
Copy Markdown
Contributor

Some linter has been updated and is now tripping on something. I've made a PR to address that and once it is merged I think this PR will pass the tests.

#95

philhassey added a commit to strongdm/cedar-go that referenced this pull request Jul 1, 2025
Addresses cedar-policy#94

Signed-off-by: philhassey <phil@strongdm.com>
@philhassey
Copy link
Copy Markdown
Contributor

If you merge from main back into your branch, I'm hopeful that the linters will pass now and I can merge this.

Signed-off-by: jaredzhou <zhouzhenyu1313@163.com>
Copy link
Copy Markdown
Contributor

@philhassey philhassey left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@philhassey philhassey merged commit 317238b into cedar-policy:main Jul 2, 2025
2 checks passed
@jaredzhou
Copy link
Copy Markdown
Contributor Author

thank you!

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