Skip to content

Conversation

@cdisselkoen
Copy link
Contributor

Description of changes

Rewrites SymCC's extractor.rs to better correspond to Lean's Extractor.lean. In the process, fixes a bug (the added test case in this PR was failing but is now fixed).

Issue #, if available

Checklist for requesting a review

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

  • A bug fix or other functionality change requiring a patch to cedar-policy.

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

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.

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.

Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
Comment on lines -73 to +108
default: udf.default.clone(),
arg: udf.arg.clone(),
out: udf.out,
default: match &udf.out {
TermType::Set { ty } => factory::set_of([], (**ty).clone()),
_ => udf.default,
},
..udf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suspect this in particular is the bug fix

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, before it used the default value in the model instead of setting it to the empty set for entities not in the footprint. Can line 106 ever happen? The ancestor function always returns a Set and this only gets called for ancestors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it probably can't, so putting anything is sound. We just do what the Lean does, and therefore enjoy the Lean soundness proofs

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

Coverage Report

Head Commit: 87187a67cc80a085ed432e7833993138d2bbf61d

Base Commit: aaedd654284259d7a2d7a1aa976d0dd885668c23

Download the full coverage report.

Coverage of Added or Modified Lines of Rust Code

Required coverage: 80.00%

Actual coverage: 97.30%

Status: PASSED ✅

Details
File Status Covered Coverage Missed Lines
cedar-policy-symcc/src/symcc/extractor.rs 🟢 36/37 97.30% 106

Coverage of All Lines of Rust Code

Required coverage: 80.00%

Actual coverage: 86.12%

Status: PASSED ✅

Details
Package Status Covered Coverage Base Coverage
cedar-language-server 🟢 4724/5106 92.52% --
cedar-policy 🟡 3762/5146 73.11% --
cedar-policy-cli 🔴 767/1193 64.29% --
cedar-policy-core 🟢 21998/25296 86.96% --
cedar-policy-formatter 🟢 906/1080 83.89% --
cedar-policy-symcc 🟢 6341/6853 92.53% --
cedar-wasm 🔴 0/28 0.00% --

Comment on lines +1390 to +1391
assert_implies(&mut compiler, &pset1, &pset2, &envs).await;
assert_does_not_imply(&mut compiler, &pset2, &pset1, &envs).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume these also assert something about the decoded counter example?

Assuming it does, it might still be useful to have a direct test for decoding a supposed cycle. (easier to debug if it starts failing, can't change depending on cvc5 version or change to the smt query).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they check that the counterexample's request and entities both validate against the schema (although they do not actually check the authorization behavior of the counterexample).

I'll look into making a unit test for decoding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Spent an hour and cannot get a test which succeeds with the right footprint and fails with the wrong footprint -- must be doing something wrong when trying to initialize the SymEnv and Interpretation that SymEnv::extract() requires. Will delay this testing idea to a future PR.

Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Coverage Report

Head Commit: 6f43ed784aafc00a23f0de1652f4f78adbd402ac

Base Commit: aaedd654284259d7a2d7a1aa976d0dd885668c23

Download the full coverage report.

Coverage of Added or Modified Lines of Rust Code

Required coverage: 80.00%

Actual coverage: 97.44%

Status: PASSED ✅

Details
File Status Covered Coverage Missed Lines
cedar-policy-symcc/src/symcc/concretizer.rs 🟢 2/2 100.00%
cedar-policy-symcc/src/symcc/extractor.rs 🟢 36/37 97.30% 106

Coverage of All Lines of Rust Code

Required coverage: 80.00%

Actual coverage: 86.13%

Status: PASSED ✅

Details
Package Status Covered Coverage Base Coverage
cedar-language-server 🟢 4724/5106 92.52% 92.52%
cedar-policy 🟡 3765/5146 73.16% 73.11%
cedar-policy-cli 🔴 767/1193 64.29% 64.29%
cedar-policy-core 🟢 21998/25296 86.96% 86.96%
cedar-policy-formatter 🟢 906/1080 83.89% 83.89%
cedar-policy-symcc 🟢 6341/6853 92.53% 92.53%
cedar-wasm 🔴 0/28 0.00% 0.00%

@cdisselkoen cdisselkoen merged commit 2d6b095 into main Jan 8, 2026
23 checks passed
@cdisselkoen cdisselkoen deleted the cdisselkoen/symcc-extractor branch January 8, 2026 16:37
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.

4 participants