Repository navigation
Add browser-safe playground evaluator - #3630
dheerajodha wants to merge 6 commits into
Conversation
References EC-2222. Adds a narrow browser-local playground spike under hack/playground-wasm. The PoC compiles a small Go wrapper to WebAssembly, loads it from a static HTML page, and evaluates pasted Rego against pasted JSON or YAML input with OPA's Go APIs. This intentionally avoids the full Conforma CLI command path, OCI fetching, Sigstore, Rekor, and remote policy loading. The goal is to prove the in-browser rule authoring loop before deciding how much of ec validate input can be reused for production parity.
References EC-2222. Extends the browser-local playground spike so pasted Rego can contain multiple modules separated by # file markers and optional JSON/YAML data can be made available under data. This moves the PoC closer to real Conforma policy shapes where rule modules import helper packages and rely on policy data, while still intentionally avoiding EnterpriseContractPolicy resolution, remote policy fetching, and full ec validate input parity.
EC-2222: Add a Conforma-shaped playground fixture that exercises multiple Rego modules, helper imports, rule data, and structured deny/warn results. Document current parity boundaries and the next comparison needed against the real ec validate input path.
EC-2222: Add an equivalent local ec validate input fixture for the playground parity sample. Document the observed comparison: the failing input reports the same two violations and one warning, while the passing input succeeds with three checked rules in the CLI report.
EC-2222: Add a small pkg/playground evaluator in Conforma CLI that accepts inline Rego, inline JSON/YAML input, and optional inline JSON/YAML data for browser playground use. The package uses OPA directly plus Conforma's rule metadata parser to return Conforma-like violations, warnings, successes, and success-count without pulling in CLI, source-resolution, image, OCI, Sigstore, Rekor, Kubernetes, or Conftest paths.
EC-2222: Remove the old hack/playground-wasm prototype now that the standalone playground repo owns the UI and the CLI branch only needs the reusable pkg/playground evaluator.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
|
<!-- fullsend:risk-assessment --> DetailsNearly all metadata signals are low-risk, but a large blast radius designation elevates the change-size composite to 5; the two new files carry no git history to assess stability, yielding a moderate composite score of 2. |
ReviewFindingsHigh
Labels: PR adds new Go package (playground evaluator feature) Next steps:
|
| // | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package playground |
There was a problem hiding this comment.
[high] naming conventions
Missing //go:build unit build tag. Every test file in the repository carries a build constraint (//go:build unit or //go:build integration). Without this tag the tests run under a plain go test ./... invocation, bypassing the project's test isolation architecture.
Suggested fix: Add //go:build unit immediately after the SPDX line and before package playground.
Summary
Scope
This is not full ec validate input parity yet. It intentionally avoids EnterpriseContractPolicy source resolution, include/exclude filtering, OCI/image validation, Sigstore, Rekor, Kubernetes, and remote policy fetching. The goal is to provide the minimal Conforma-owned evaluator package that can compile to js/wasm for EC-2222.
Verification