opa-compat-check
Skill48 starsChanged 5 months agoMITView on GitHub
Check OPA Rego version compatibility for rego-cpp. Use when: updating OPA version, checking for new OPA releases, auditing rego-cpp compatibility, planning OPA upgrade work, reviewing OPA release notes for rego-cpp impact. Fetches OPA release notes, compares with current rego-cpp support, and produces an actionable compatibility report.
- Deletes or force-pushes
In this repository7 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- code-reviewSkill
- finalize-prSkill
- multi-perspective-planningSkill
- regocpp-builtinsSkill
- rego-fuzzerSkill
- trieste-devSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Follow these steps in order.
- Very specific: line 24
Read the REGOCPP_OPA_VERSION variable from the root CMakeLists.txt:
- Distinctive: line 40
If the user specified a target version, use that instead of the latest.
- Very specific: line 42
If LATEST_VERSION equals CURRENT_VERSION, report that rego-cpp is up to date and stop.
- Very specific: line 73
Search src/builtins/ for the function name
- Very specific: line 74
Check src/builtins.cc lookup dispatch to see if the namespace is routed
- Very specific: line 75
Check src/builtins/builtins.hh for the namespace factory declaration
- Distinctive: line 190
If the workspace has a build directory and the OPA test suite available:
- Very specific: line 192
Remove the stale OPA clone: before reconfiguring: rm -rf build/opa
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OPA Rego Compatibility Check
Determine what changes (if any) rego-cpp needs to maintain compatibility with the latest OPA Rego release.
When to Use
- Checking if a new OPA version has been released since rego-cpp's last update
- Planning work to upgrade rego-cpp to a newer OPA version
- Auditing the current compatibility gap between rego-cpp and OPA
- Reviewing what changed in OPA that affects rego-cpp
Procedure
Follow these steps in order. Do not skip steps.
Step 1: Determine Current rego-cpp OPA Version
Read the REGOCPP_OPA_VERSION variable from the root CMakeLists.txt:
grep "REGOCPP_OPA_VERSION" CMakeLists.txtThis is the OPA version rego-cpp currently targets. Record it as CURRENT_VERSION.
Also read the VERSION file in the repo root to get the rego-cpp library version.
Step 2: Fetch Latest OPA Release Information
Fetch the OPA releases page to find the latest version and release notes:
- Fetch
https://github.com/open-policy-agent/opa/releaseswith query "latest release version" - Identify the latest stable release version. Record it as
LATEST_VERSION. - If the user specified a target version, use that instead of the latest.
If LATEST_VERSION equals CURRENT_VERSION, report that rego-cpp is up to date and stop.
Step 3: Fetch Release Notes for Each Intermediate Version
For each OPA version between CURRENT_VERSION (exclusive) and LATEST_VERSION (inclusive):
- Fetch
https://github.com/open-policy-agent/opa/releases/tag/v{VERSION}with query "release notes changes new features built-ins deprecations breaking changes Rego language" - Also fetch
https://www.openpolicyagent.org/docs/latest/policy-reference/with query "built-in functions list" to get the current built-in function catalog.
Collect all changes across versions.
Step 4: Categorize Changes by Impact Area
Sort every change into the categories below. Refer to change-surface.md for details on how each category maps to rego-cpp code.
| Category | What to Look For | rego-cpp Impact |
| New Built-in Functions | New entries in OPA's built-in function list | Add implementation in src/builtins/ |
| Modified Built-in Semantics | Changed behavior of existing built-ins | Update existing builtin impl |
| Deprecated Built-ins | Functions marked deprecated | Update is_deprecated() in src/builtins.cc |
| Removed Built-ins | Functions removed entirely | Remove from builtin registry |
| Language Syntax Changes | New keywords, operators, or grammar rules | Update parser in src/parse.cc, tokens in include/rego/rego.hh |
| Evaluation Semantics | Changes to how policies are evaluated | Update compiler passes or VM in src/virtual_machine.cc |
| Bundle Format Changes | Changes to OPA bundle structure | Update src/bundle.cc, src/bundle_json.cc, src/bundle_binary.cc |
| Conformance Test Changes | New or modified OPA test cases | Automatically picked up when version is bumped |
| No rego-cpp Impact | Go runtime changes, CLI changes, server changes, plugin API changes | Document as not applicable |
Step 5: Cross-reference with rego-cpp Built-in Coverage
For any new or modified built-ins, check whether rego-cpp already implements them:
- Search
src/builtins/for the function name - Check
src/builtins.cclookup dispatch to see if the namespace is routed - Check
src/builtins/builtins.hhfor the namespace factory declaration
Mark each new built-in as one of:
- Already implemented — no action needed
- Namespace exists, function missing — add to existing file
- New namespace — new file needed in
src/builtins/, plus registration
See builtin-pattern.md for the implementation pattern.
Step 6: Produce the Compatibility Report
Generate a structured report with the following sections:
# OPA Rego Compatibility Report
## Version Summary
- **rego-cpp version**: {from VERSION file}
- **Current OPA target**: {CURRENT_VERSION}
- **Latest OPA release**: {LATEST_VERSION}
- **Versions to bridge**: {list of intermediate versions}
## Required Changes
### New Built-in Functions
For each new built-in:
- Function signature (name, args, return type)
- Which `src/builtins/` file to modify or create
- Complexity estimate (trivial/moderate/complex)
### Built-in Semantic Changes
For each changed built-in:
- What changed and how
- Which file to modify
### Deprecations
For each deprecated item:
- Add to `is_deprecated()` list in `src/builtins.cc`
### Language Changes
For each syntax/grammar change:
- What changed in the grammar
- Parser modifications needed
- New tokens needed in `include/rego/rego.hh`
- Documentation updates needed in `README.md` grammar section
### Evaluation Changes
For each evaluation behavior change:
- Description of change
- Affected compiler passes or VM behavior
### Bundle Format Changes
For each format change:
- What changed
- Files to update
## Version Bump Checklist
- [ ] Update `REGOCPP_OPA_VERSION` in `CMakeLists.txt`
- [ ] Update OPA version reference in `README.md`
- [ ] Sync `README.md` grammar section with OPA grammar
- [ ] Update OPA version reference and grammar in wrapper docs:
- [ ] `wrappers/rust/regorust/README.md` ("We support v… of Rego" line; grammar is deferred to the main README)
- [ ] `wrappers/python/README.md` ("We support v… of Rego" line; grammar is deferred to the main README)
- [ ] `wrappers/dotnet/docs/introduction.md` ("largely compatible with v…" line)
- [ ] Implement new built-ins (list each)
- [ ] Update `is_deprecated()` for newly deprecated built-ins
- [ ] Apply parser changes (if any)
- [ ] Apply evaluation changes (if any)
- [ ] Run OPA conformance tests: `cmake --preset debug-clang-opa && ninja -C build && ctest --test-dir build -R opa`
- [ ] Update `CHANGELOG` with new version entry
- [ ] Update `VERSION` file
## No Impact (documented for completeness)
- List of OPA changes that don't affect rego-cppStep 7: Analyze OPA IR for Complex Features
For any language syntax changes or new internal built-ins identified in Step 4, use OPA's plan IR to understand the implementation before coding:
- Ensure latest OPA binary is available:
curl -L -o /tmp/opa https://github.com/open-policy-agent/opa/releases/download/v{LATEST_VERSION}/opa_linux_amd64_static chmod +x /tmp/opa /tmp/opa version # verify it matches LATEST_VERSION - Create minimal test policies in
.copilot/opa-ir-test/, one per feature:mkdir -p .copilot/opa-ir-test cat > .copilot/opa-ir-test/policy.rego << 'EOF' package test p := <feature expression using both constants and variables> EOF - Build and inspect the IR:
/tmp/opa build --bundle .copilot/opa-ir-test --target plan -e test/p -o .copilot/opa-ir-test/bundle.tar.gz mkdir -p .copilot/opa-ir-test/output && cd .copilot/opa-ir-test/output tar xzf ../bundle.tar.gz && python3 -m json.tool plan.json - Look for:
- New entries in
static.builtin_funcs— these are internal built-ins rego-cpp must implement - The exact calling convention (arg types, arity, return type)
- How undefined values are handled (e.g.,
BlockStmt+Setwrapping patterns) - Whether OPA's optimizer folds constant cases differently from variable cases (test both)
- New entries in
- Record findings in the compatibility report under the relevant section.
See change-surface.md § Analyzing OPA's IR for detailed examples.
Step 8: Validate Findings
If the workspace has a build directory and the OPA test suite available:
- Remove the stale OPA clone before reconfiguring:
rm -rf build/opa - Reconfigure:
cmake .. --preset debug-clang-opa(this re-clones at the new version tag) - Run targeted tests for specific areas during development:
Subdirectory names match OPA built-in names without separators (e.g.,./tests/rego_test -wf opa/v1/test/cases/testdata/v1/<subdir>regexfind,numbersrangestep,stringinterpolation). - Run the full conformance suite for final validation:
ctest -R rego_test_opa --output-on-failure
Important Notes
- OPA release notes are at
https://github.com/open-policy-agent/opa/releases - OPA built-in reference is at
https://www.openpolicyagent.org/docs/latest/policy-reference/ - The OPA conformance test suite is cloned from
https://github.com/open-policy-agent/opa/at the tag matchingREGOCPP_OPA_VERSION - rego-cpp only implements the Rego language and built-in functions. Changes to OPA's Go runtime, REST API, plugin system, or CLI tool do not apply.
- Some built-ins may be platform-dependent (e.g., time zone functions require
cpp_lib_chrono >= 201907L). Flag these in the report. http.sendis a stub in rego-cpp — new HTTP-related functionality is typically marked as a placeholder.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

