Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
CompositeEngineand makes it the default--engine. It evaluates every built-in rule with the CEL engine and layers caller-supplied custom rules on top in all three formats - CEL (.json), Rego (.rego), and CloudFormation Guard (.guard). Custom CEL rules run in the CEL engine that owns the built-ins; custom Rego and translated Guard rules run in a separate external-only Rego engine that is constructed only when such rules are supplied. With no custom rules the composite produces diagnostics byte-identical to the standalone Rego and CEL engines, sorego == cel == compositeis now a corpus-wide invariant.The motivation is performance: CEL evaluates the built-in rule set substantially faster than Rego, but until now choosing CEL meant giving up custom Rego rules. The composite gives CEL speed on the built-ins without losing any custom-rule capability.
Performance
Measured with the
performance-harness(warm per-validate, median of 5 launches, local macOS arm64):The gap widens on rule-heavy templates (
many_resources5.2×,unique_5005.1×) and narrows on templates dominated by shared model/schema work (security-combined-conditions0.92×).With a large custom Rego rule set on both engines (
security/many_resources.yaml, warm per-validate; both engines emit identical findings):Composite wins on both the fixed built-in floor (13.5 ms vs 70 ms) and the marginal per-rule cost (0.13 ms/rule vs 0.25 ms/rule), because its external Rego engine loads only the caller's rules rather than the full built-in policy set. The speedup approaches ~1.9× asymptotically as custom Rego rules dominate; it never inverts.