Skip to content

PoC: Return the same evaluation errors from TPE as from concrete evaluation#2162

Draft
luxas wants to merge 1 commit intocedar-policy:mainfrom
luxas:tpe_with_real_evaluation_errors
Draft

PoC: Return the same evaluation errors from TPE as from concrete evaluation#2162
luxas wants to merge 1 commit intocedar-policy:mainfrom
luxas:tpe_with_real_evaluation_errors

Conversation

@luxas
Copy link
Contributor

@luxas luxas commented Feb 16, 2026

Description of changes

Draft PR, I need to double-check some of the logic here still and add some more unit tests, but it should be good enough to discuss at least. What do you think about this rewrite? I think it could help make the code between TPE and the concrete evaluator more similar and hopefully comparable, especially when the older partial-eval is deprecated and removed from the concrete evaluator.

Discussed this with @john-h-kastner-aws. The idea is to return a concrete error whenever the concrete evaluator would, and just exactly the same error as the concrete evaluator would. However, cases like <residual> && <error> do not fold to <error>, as <residual> could evaluate to another error.

Also noted that the stack overflow check was not added to TPE. Also I'm trying to make the errors nice by preserving the Loc information, but it seems like I need to do some other thing still to produce nice reports in miette to show where the error came from.

Fixes: #1736

(at least part of, we could add the Diagnostics in a follow-up PR)

Checklist for requesting a review

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

  • A change (breaking or otherwise) that only impacts unreleased or experimental code.

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

Not sure, do you want a release note for this one? I can add one.

  • 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):

  • 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.)

Would you be interested in updating cedar-spec with a theorem that the errors should be the same between concrete and TPE?

I confirm that docs.cedarpolicy.com (choose one, and delete the other options):

  • Does not require updates because my change does not impact the Cedar language specification.

…uation

Signed-off-by: Lucas Käldström <lucas.kaldstrom@upbound.io>
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.

Return (a superset of) EvaluationError from TPE evaluation

1 participant