Repository navigation
fix(parser)!: reject negated assignment and unification - #933
Open
Anand Krishnamoorthi (anakrish) wants to merge 4 commits into
Open
Anand Krishnamoorthi (anakrish) wants to merge 4 commits into
Anand Krishnamoorthi (anakrish) wants to merge 4 commits into
Conversation
Require == for negated equality while retaining positive bindings inside nested queries. Track intentional OPA compatibility rejections separately from runtime conformance passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 84271ec2-b466-4cfe-bf58-848f4dceb842
Keep a focused Rust regression for query diagnostics and engine recovery; use existing YAML runners for parser rejection and cross-engine positive cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 84271ec2-b466-4cfe-bf58-848f4dceb842
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Nested parse fallbacks can discard the new == guidance, and refreshing the passing list would drop arithmetic and negation conformance coverage from CI.
2 open issues
What changed in this PR
This PR tightens Regorus’s Rego parser to reject direct negated assignment and unification while preserving positive bindings inside nested queries. The unification restriction intentionally differs from OPA.
Changes:
- Reject negated
:=and=with guidance to use==. - Add parser and cross-engine regressions, and migrate affected differential tests to equality.
- Document the restriction and report expected OPA compatibility rejections separately from conformance passes.
| File | Description |
|---|---|
tests/rvm/rego/comprehension_failure_differential.rs |
Updates negated comparisons to use ==. |
tests/parser/mod.rs |
Adds rejection diagnostics and valid nested-binding regressions across engines. |
tests/opa.rs |
Separately checks and counts intentional compatibility rejections. |
src/parser.rs |
Rejects negated bindings and preserves errors for not-led queries. |
docs/grammar.md |
Explains the restriction and supported nested bindings. |
Review effort: Max
Treat negated-binding admission failures as terminal across parser fallbacks. Cover nested rejections behind a positive outer binding and retain passing OPA folders with intentional compatibility rejections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 84271ec2-b466-4cfe-bf58-848f4dceb842
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The negated-unification compatibility break lacks a release warning and migration guidance, while the formal grammar and conformance documentation still contradict the new behavior.
3 open issues
2 resolved since last review
Review effort: Max
Align both grammar productions, reference lists, and the railroad diagram with the negated-binding restriction. Document the intentional OPA conformance exception and migration in the unreleased changelog. BREAKING CHANGE: Direct negated assignment and unification are rejected, including previously accepted OPA-compatible unification. For negated equality, migrate not x = value to not x == value. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 84271ec2-b466-4cfe-bf58-848f4dceb842
Anand Krishnamoorthi (anakrish)
marked this pull request as ready for review
November 10, 2026 19:09
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.


Changes
Reject direct negated
:=and=with a diagnostic recommending==for negated equality. Positive bindings inside nested queries remain supported.This intentionally restricts negated
=even where OPA accepts it. Update grammar documentation, parser regressions, and affected conformance tests.Validation
Both independent local reviews passed. Parser and cross-engine regression tests, debug CI, formatting/clippy/build checks, and no_std checks passed. Six intentional OPA compatibility rejections are checked separately from conformance passes.