Skip to content

feat(opa-proto): support proto-format plan bundles (opa build --format=proto)#110

Draft
sspaink wants to merge 4 commits into
open-policy-agent:mainfrom
sspaink:worktree-proto-plan-bundles
Draft

feat(opa-proto): support proto-format plan bundles (opa build --format=proto)#110
sspaink wants to merge 4 commits into
open-policy-agent:mainfrom
sspaink:worktree-proto-plan-bundles

Conversation

@sspaink

@sspaink sspaink commented Jul 8, 2026

Copy link
Copy Markdown
Member

Adds support for reading protobuf-format plan bundles produced by opa build --format=proto (plan.pb / .manifest.pb), decoding them into the existing IR model so they evaluate identically to their JSON counterparts.

Proto bundles keep data.json as JSON, so proto support is an optional add-on alongside a JSON provider (e.g. opa-jackson), not a replacement.

Closes #101

opa build --format=proto isn't in a tagged OPA release yet, so go.mod is pinned to a temporary commit (f6092b9ce, ~v1.19.0-dev; PRs open-policy-agent/opa#8825 and #8775).

sspaink added 2 commits July 7, 2026 15:32
…t=proto)

Add a new opa-proto module that decodes protobuf-format plan bundles
(plan.pb / .manifest.pb) into the existing IR model, so bundles built with
`opa build --format=proto` evaluate identically to their JSON counterparts.
Proto bundles keep data.json as JSON, so opa-proto is an optional add-on
alongside a JSON provider rather than a replacement.

opa-proto module:
- Vendored plan.proto / manifest.proto (Java bindings generated via
  protobuf-gradle-plugin + protobuf-java 4.x).
- PlanMapper (all 34 IR statement types), ManifestMapper, and StructConverter.
- ProtoBundleReader implementing the new optional ProtoBundleDecoder SPI.

opa-evaluator:
- ProtoBundleDecoder SPI (optional, zero-or-one).
- BundleFormat: filename constants + mixed-format rejection matching OPA.
- InputStreamSource + BundleAssembler.loadPlanAndManifest: shared
  detect/validate/route logic so loaders only do file discovery.
- Services.loadAtMostOne: one shared ServiceLoader helper (dedups three copies).
- PROTO_DECODER resolved lazily so proto misconfiguration cannot break
  JSON-only bundle loading.

Loaders/CLI:
- FileSystemBundleLoader and TarballBundleLoader detect .pb and route through
  the shared path.
- CLI depends on opa-proto at runtime so it can read proto bundles.

Version pinning:
- Pin the OPA version in tools/generate-compliance-tests/go.mod (single source
  of truth) and re-vendor .proto via the native vendorProtoSchemas Gradle task;
  CI verify-proto-vendor guards against drift.

Tests: proto-vs-JSON evaluation parity, mixed-format rejection, manifest
omitempty fidelity, numeric-type parity, and malformed-plan handling.

Closes open-policy-agent#101

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
…-bundles

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>

# Conflicts:
#	opa-evaluator/src/main/java/io/github/open_policy_agent/opa/bundle/BundleAssembler.java
#	opa-evaluator/src/main/java/io/github/open_policy_agent/opa/mapper/AnnotationIntrospectors.java
Comment thread .github/workflows/pull-request.yml Fixed
Comment thread .github/workflows/pull-request.yml Fixed
Comment thread .github/workflows/pull-request.yml Fixed
Comment thread .github/workflows/pull-request.yml Fixed
Comment thread .github/workflows/pull-request.yml Fixed
sspaink added 2 commits July 8, 2026 11:06
…ndor

Address zizmor findings on the verify-proto-vendor job: pin all four
actions to commit SHAs (blanket-pinning policy) and set
persist-credentials: false on checkout, matching the rest of the workflow.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
…-bundles

# Conflicts:
#	.github/workflows/pull-request.yml
#	opa-services/src/main/java/io/github/open_policy_agent/opa/bundle/TarballBundleLoader.java
#	tools/generate-compliance-tests/go.mod
#	tools/generate-compliance-tests/go.sum
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.

Support proto-format plan bundles (opa build --format=proto)

2 participants