Diff two Rego policies
rego_policy_diffEvaluate the same query against two Rego policies in parallel and report whether results match, with raw outputs and differing paths to verify refactors or locate divergences.
Instructions
Evaluate the same query against two policies (or two versions of the same policy) and compare the results. Both evaluations run in parallel. Returns equal: true/false, the raw result from each side, and changedPaths -- the dot/bracket paths that differ. Useful for verifying that a refactor preserves behavior, or understanding exactly where two policies diverge. Each side takes either inline source (sourceA/sourceB) or a file/directory path (pathA/pathB). The same input and query are used for both evaluations; pass inputs to compare on many input documents in one call, and dataPaths to load the data the policies read.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | No | Inline input document (JSON). Mutually exclusive with inputPath. | |
| pathA | No | File or directory path for policy A. Must be inside an allowed root. Mutually exclusive with sourceA. | |
| pathB | No | File or directory path for policy B. Must be inside an allowed root. Mutually exclusive with sourceB. | |
| query | Yes | The query to evaluate against both policies, e.g. "data.example.allow". | |
| inputs | No | Up to 50 input documents to compare the two policies on, in place of `input`/`inputPath`. The result is `batch`, one entry per input in order, and `differing` counts the inputs on which the policies disagree. A policy that does not compile fails the call once; a runtime error on one input is reported in its entry. | |
| sourceA | No | Inline Rego source for policy A. Mutually exclusive with pathA. | |
| sourceB | No | Inline Rego source for policy B. Mutually exclusive with pathB. | |
| dataPaths | No | Additional data or policy paths loaded for both evaluations. Each must be inside an allowed root. | |
| inputPath | No | Path to a JSON input file. Must be inside an allowed root. Mutually exclusive with input. | |
| v0CompatibleA | No | Read policy A as Rego v0 (`--v0-compatible`), the syntax before OPA 1.0. Set this and leave `v0CompatibleB` off to compare a legacy policy with its migrated copy. | |
| v0CompatibleB | No | Read policy B as Rego v0 (`--v0-compatible`). |