feat: implement rfc 104 cedar entity syntax - #2478
Conversation
|
oof. will look at these failed checks. |
implements cedar entity syntax as defined in [rfc 104](https://github.com/cedar-policy/rfcs/blob/main/text/0104-entity-data-syntax.md) Signed-off-by: aron hommas <aronhomm@amazon.com>
There was a problem hiding this comment.
Pull request overview
Implements the experimental RFC 104 “Cedar entity data syntax” end-to-end: parsing entity data from Cedar syntax into Entities, formatting Entities back to Cedar syntax, and wiring the new format through the public API and CLI behind the cedar-entity-syntax feature flag.
Changes:
- Added a Cedar entity-syntax parser (LALRPOP) + AST →
Entitiesconversion, plus pretty-printing (Entities→ Cedar text) incedar-policy-core. - Exposed new experimental public APIs
Entities::from_cedar_str()/Entities::to_cedar_string()and associated error types incedar-policy. - Added CLI support for selecting entity input format via
--entities-format cedar, plus associated tests and changelog updates.
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cedar-policy/src/api/err.rs | Adds public error types/re-exports for Cedar entity-syntax parsing/formatting under feature flag |
| cedar-policy/src/api.rs | Adds Entities::from_cedar_str() / Entities::to_cedar_string() plus a public-API round-trip regression test |
| cedar-policy/CHANGELOG.md | Documents the new experimental entity-syntax API/CLI additions |
| cedar-policy/Cargo.toml | Adds cedar-entity-syntax to experimental feature set and wires core feature |
| cedar-policy-core/src/entities.rs | Exposes entities::cedar_syntax module behind feature flag |
| cedar-policy-core/src/entities/cedar_syntax.rs | New module wiring for parser/formatter/conversion code (plus tests) |
| cedar-policy-core/src/entities/cedar_syntax/ast.rs | New AST types for entity data syntax |
| cedar-policy-core/src/entities/cedar_syntax/err.rs | New parse/conversion error types (miette diagnostics) |
| cedar-policy-core/src/entities/cedar_syntax/parser.rs | New LALRPOP-backed parser entrypoint and error collection |
| cedar-policy-core/src/entities/cedar_syntax/grammar.lalrpop | New entity data syntax grammar (lexer + parser productions) |
| cedar-policy-core/src/entities/cedar_syntax/to_entities.rs | New AST → internal Entity conversion incl. namespace-aware reference resolution |
| cedar-policy-core/src/entities/cedar_syntax/fmt.rs | New pretty-printer for emitting Cedar entity data syntax |
| cedar-policy-core/src/entities/cedar_syntax/test.rs | New parser/conversion/round-trip/error tests and JSON↔Cedar golden pairs |
| cedar-policy-core/src/entities/cedar_syntax/testfiles/** | New golden test inputs/expected JSON outputs covering features/edge cases |
| cedar-policy-core/Cargo.toml | Adds cedar-entity-syntax feature and includes it in experimental |
| cedar-policy-core/build.rs | Runs LALRPOP generation for entity syntax when feature is enabled |
| cedar-policy-cli/src/utils/entities.rs | Adds EntitiesFormat + structured clap args to support JSON vs Cedar entity input |
| cedar-policy-cli/src/utils.rs | Re-exports entities utilities publicly for crate consumers/tests |
| cedar-policy-cli/src/command/{authorize,evaluate,check_parse,partial_eval,visualize}.rs | Switches commands to use the new structured entities args (and optional entities) |
| cedar-policy-cli/tests/sample.rs | Updates integration tests to construct new entities arg structs |
| cedar-policy-cli/CHANGELOG.md | Documents --entities-format cedar under experimental feature |
| cedar-policy-cli/Cargo.toml | Wires cedar-entity-syntax into the CLI’s experimental feature set |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 85.43% Status: PASSED ✅ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 88.23% Status: PASSED ✅ Details
|
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 85.43% Status: PASSED ✅ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 88.23% Status: PASSED ✅ Details
|
also addresses other copilot review feedback. Signed-off-by: aron hommas <aronhomm@amazon.com>
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 84.88% Status: PASSED ✅ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 88.32% Status: PASSED ✅ Details
|
Description of changes
implements cedar entity syntax as defined in rfc
104
Issue #, if available
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec(choose one, and delete the other options):I confirm that
docs.cedarpolicy.com(choose one, and delete the other options):cedar-docs. PRs should be targeted at astaging-X.Ybranch, notmain.)( ^ should this be done for experimental features? )