Files
regorus/tests/rvm/rego/cases/builtins_cache.yaml
Anand Krishnamoorthi e3d23766ae feat: Ensure RVM caches deterministic builtins
Mirror interpreter implementation:
- use builtins::must_cache to determine whether builtin must be cached.
- reuse cached value when applicable
- clear the VM’s builtin cache whenever execution state resets to avoid leaking values across runs
- add a YAML regression for rand.intn set comprehensions and re-enable the rand cases in the OPA test suite

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2025-12-03 13:34:14 -06:00

16 lines
327 B
YAML

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
cases:
- note: builtin_rand_intn_cache_consistency
data: {}
modules:
- |
package test
rands := { rand.intn("seed", 100) | numbers.range(1, 100)[_] }
np := count(rands)
query: data.test.np
want_result: 1