Skip to content

Keep imported document lookups lazy and reject cyclic rule dependencies - #745

Draft
Anand Krishnamoorthi (anakrish) with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-cyclic-references-behaviour
Draft

Anand Krishnamoorthi (anakrish) with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-cyclic-references-behaviour

Conversation

Copilot AI commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor
  • Resolve imported document references together with their requested suffix in the interpreter and RVM compiler, avoiding eager evaluation of unrelated package rules and false recursion errors.
  • Preserve component boundaries, including literal dotted keys, and carry evaluated string indices through lookup without scanning every rule.
  • Validate memoized-rule dependencies with an iterative graph walk so genuine cycles through cached rule indices are rejected while shared acyclic dependencies remain valid.
  • Add regressions for cross-package access, dynamic package selection, namespace boundaries, shadowing, false versus Undefined, non-string indices, and WITH override restoration. Keep the RVM's conservative rejection of potentially recursive dynamic leaf selection explicit.

Copilot AI changed the title [WIP] Fix behaviour differing from OPA on cyclic references Handle cross-package cyclic references without over-eager recursion in interpreter/RVM Jun 9, 2026
Copilot AI changed the title Handle cross-package cyclic references without over-eager recursion in interpreter/RVM Resolve cross-package data import recursion misclassification in interpreter and RVM Jun 9, 2026
Comment thread src/interpreter.rs Resolved
Copilot AI changed the title Resolve cross-package data import recursion misclassification in interpreter and RVM Refine active-rule deferral path matching; expand interpreter docs with concrete examples Jun 9, 2026
@anakrish
Anand Krishnamoorthi (anakrish) force-pushed the copilot/fix-cyclic-references-behaviour branch from 6cf77bb to d5d4bb1 Compare November 3, 2026 20:38
@anakrish Anand Krishnamoorthi (anakrish) changed the title Refine active-rule deferral path matching; expand interpreter docs with concrete examples Keep imported document lookups lazy and reject cyclic rule dependencies Nov 3, 2026
Resolve imported data references together with their requested suffix in
the interpreter and RVM compiler, rather than evaluating an entire
imported package before accessing its fields. Preserve component
boundaries and carry evaluated string indices through reference lookup
without rescanning every rule or deferring arbitrary active modules.

Track memoized rule calls and virtual-document dependencies during
compilation. Validate the complete graph iteratively so genuine cycles
through cached rule indices or previously discovered siblings still fail,
while shared acyclic dependencies remain valid.

Cover cross-package re-entry, dynamic package selection, literal dotted
components, namespace boundaries, false versus Undefined, local shadowing,
non-string indices, WITH override restoration, and genuine rule cycles.
Document the remaining conservative rejection of dynamic leaf selection
that can refer to a recursive rule.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7f67398a-2137-4392-a242-c237557566f3
@anakrish
Anand Krishnamoorthi (anakrish) force-pushed the copilot/fix-cyclic-references-behaviour branch from d5d4bb1 to 7878b1d Compare November 4, 2026 16:48
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.

Behaviour differing from OPA on cyclic references between multiple policies

2 participants