Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

Rule portability across policy engines (OPA/Rego) without a second rule language #13

Open

Description

@kinlane

Make rules portable to other policy engines — starting with OPA/Rego — without turning the specification into a second policy language.

The distinction this issue depends on

Two things get conflated constantly and the specification should hold them apart explicitly:

  • Multi-format is what you lint. Aggressively yes — that work is elsewhere.
  • Multi-policy-language is how the rule is expressed. The specification stays one language. Adding alternative rule bodies to the format would fork it into dialects and destroy the portability the whole exercise exists to create.

So this issue is not "let people write Rego inside a ruleset." It is: can a ruleset written in this format be evaluated by, or translated into, an engine an organization already runs?

Why it matters

Plenty of organizations already run a general-purpose policy engine for infrastructure, authorization, and admission control, with the review process, audit trail, and on-call rotation that comes with it. Asking them to operate a second, unrelated policy language purely for API descriptions is a real adoption cost, and one that is often paid by not adopting.

There is also a governance argument. A rule that can be evaluated in the same engine as the rest of an organization's policy is a rule that can appear in the same audit and the same reporting as the rest of the organization's policy.

The work

1. Establish what is translatable. A rules-to-Rego mapping study covering the format's actual surface: given selection, the built-in function set, severity, resolved, aliases, extends. The honest output of this is a three-way split — mechanically translatable, translatable with a documented shim, and not translatable. That last bucket is the interesting one, because it is where the format has made assumptions that only its own runtime satisfies.

2. Make sure the specification does not stand in the way. Anywhere the specification describes behaviour in terms of one runtime's internals rather than in terms of inputs and outputs, a second engine cannot implement it. That is a specification defect regardless of whether anyone ever writes the second engine.

3. Define what a translation may claim. A translated ruleset that produces different diagnostics is not the same ruleset. Conformance has to be the arbiter — a translator is conforming if its output passes the conformance suite for the cases it claims to cover, and honest about the ones it does not.

4. Keep the routing question out of the format. A host tool may perfectly well route evaluation to a different engine. That is an integration decision made by the tool, invisible to the ruleset. The specification should make that possible and then say nothing else about it.

Deliverables

  • A published mapping study: what translates cleanly, what needs a shim, what does not translate
  • Specification defects raised for anything only expressible in terms of one runtime
  • A statement in the conformance section of what a translating implementation may claim
  • Optionally, a proof-of-concept translation of a small real ruleset, with the diagnostics diffed against the reference implementation

Anyone running a general-purpose policy engine alongside API linting today: how you have wired the two together is the input this needs most.

Activity

  1. added
    roadmap
    maturity:discussing
    on Jul 31, 2026
  2. kinlane commented on Aug 21, 2026

    @kinlane
    ContributorAuthor

    From office hours, 2026-08-21. This issue was filed as a portability question. It is also a
    present-tense competitive one.

    People have already left

    • Enterprises that stopped trusting Spectral and its steward have moved to OPA, and are
      expanding the scope of what OPA policy covers beyond what they were using Spectral for.
    • Another group has moved to Cedar (AWS).

    This is not a hypothetical future where a policy engine might be nice to support. Some of the
    addressable users of this specification are gone, and the ones who left did not leave for a
    better rule language — they left because they did not believe the thing they were depending on
    was going to be maintained. Which is what this whole project is about.

    The counterweight, and it should be a stated constraint

    The room was unanimous on the other side, and this is worth recording as a design constraint
    rather than a matter of taste:

    • Rego has a steep learning curve, and there were no ready-made API rulesets for it — "when
      I was working with it there were none." Powerful once you are in; expensive to get in.
    • The YAML authoring experience is the feature. When a JavaScript ruleset format was
      introduced and users were asked to move to it, at least two people on this call simply
      refused, and one of them maintains an independent ruleset used by a standards body.
    • LLM assistance does not dissolve the argument. "Even with LLMs helping with the writing of
      things like this, you're still going to have some people doing reviewing. So it's still
      important to make it readable and understandable."
      Generation is not the bottleneck; review
      is.
    • YAML and JSON are portable in a way a code-shaped rule language is not. If the goal is
      independent implementations in other languages, you can find a parser for both in every major
      language. That is a direct argument for keeping the authoring format declarative even if the
      evaluation becomes pluggable.

    Where that lands this issue

    The framing that survives the session is not "should rules be written in Rego." It is:

    Can the tooling carry a swappable policy engine underneath a declarative authoring format —
    in the same way the path language should become swappable?

    Same shape as the JSON Path question now filed as #28: keep the thing people write stable,
    make the thing that evaluates it replaceable. Worth working through whether that is actually
    achievable or whether the rule semantics are too tied to the evaluator to survive the swap.

    Related: #28 (the JSON Path / RFC 9535 question), #20.


    Filed from the office hours of 2026-08-21. Full notes: #34.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maturity:discussingroadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions