Repository navigation
fix: preserve typed scalar rule paths and Program JSON round trips - #833
Open
Maksym (maksym-mishchenko) wants to merge 3 commits into
Open
Maksym (maksym-mishchenko) wants to merge 3 commits into
Maksym (maksym-mishchenko) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e136eee-6922-4fa1-af3e-f294cac94ddf
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Repeated unary scalar indices can be canonicalized and registered as valid typed paths.
1 open finding
What changed in this PR
Preserves typed scalar rule paths across interpreter/RVM execution and Program JSON round trips.
Changes:
- Adds typed path parsing, registration, lookup, and WITH handling.
- Adds marked JSON encoding for typed keys, sets, and Undefined.
- Expands regression coverage and documentation.
| File | Description |
|---|---|
src/compiled_policy.rs |
Stores typed path components. |
src/interpreter.rs |
Handles typed rules and WITH overrides. |
src/interpreter/target/resolve.rs |
Uses typed target paths. |
src/languages/rego/compiler/references.rs |
Matches typed RVM references. |
src/languages/rego/compiler/rules.rs |
Registers typed rule-tree paths. |
src/parser.rs |
Parses static scalar components. |
src/rvm/program/rule_tree.rs |
Stores and checks typed keys. |
src/rvm/program/serialization/json.rs |
Adds typed Program JSON encoding. |
src/utils.rs |
Adds typed path utilities. |
src/value/mod.rs |
Adds typed nested-object construction. |
tests/engine/mod.rs |
Tests interpreter and compiled behavior. |
tests/rvm/compiler.rs |
Tests typed conflict handling. |
tests/rvm/rego/mod.rs |
Tests serialization and VM reuse. |
tests/rvm/rego/cases/scalar_path_identity.yaml |
Adds scalar-path fixtures. |
docs/grammar.md |
Documents typed rule paths. |
docs/rvm/architecture.md |
Documents Program JSON encoding. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e136eee-6922-4fa1-af3e-f294cac94ddf
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e136eee-6922-4fa1-af3e-f294cac94ddf
Comment on lines
+745
to
+749
| for (path, expected) in [ | ||
| ("data.policy.items[1].blocked", Value::Bool(true)), | ||
| ("data.policy.items[1.0].blocked", Value::Bool(true)), | ||
| ("data.policy.items[\"1\"].blocked", Value::Bool(false)), | ||
| ] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Follow-up to merged #827, addressing the deferred scalar-path review findings.
Changes
1versus string"1"WITH suppression in the interpreter and compiled-policy path, including nested rollback and reuse. RVM WITH remains unsupported.literalsandrule_treeJSON, with strict errors for malformed marked payloads.Compatibility
value_encoding: "typed-keys-v1"is emitted only when these Program fields need it. Marker-absent legacy JSON retains its existing behavior; marked payloads require the updated reader. Package grammar, the global Value serializer, Number model, binary format, public ABI, dependencies and feature definitions are unchanged.Validation
On main
042af3awith Rust 1.95.0:cargo xtask ci-debug,cargo xtask fmt --check,cargo xtask clippy,cargo xtask test-no-std, FFI namespace tests (4 passed), and Azure-policy integration (325 passed). Strict Clippy includes all-target/all-feature, no-default and FFI/Java/Python/WASM stages. The no_std gate builds the existing thumbv7m-none-eabi harness; this is not an all-nine shipped-native or embedded-RVM runtime certification.No changes to #827 review threads; no global numeric semantics or new RVM WITH support.