Partial evaluation optimization for production #95
Replies: 1 comment
-
Hi there! Thanks for the detailed question.
It's not experimental or work in progress, and any results of optimization leading to different output are bugs. Under the hood, it's using partial evaluation, which is also a bit of an ancient feature in OPA. All that said, there are certainly coverage blinds spots in our testing process when it comes to optimized bundles, which we should fix. (Contributions would be welcome as always, I think extending
This is correct, any n-ary function can be used as That change alone should not cause your optimized policies to fail, see this example. You could try extracing the optimized policy code, and run it against your input with tracing enabled to see what exactly goes wrong, maybe? 🔍 |
Beta Was this translation helpful? Give feedback.
-
Hello, I was wondering, if the optimization feature should be used for production setups?
At first it failed, because the built bundle's REGO-syntax was broken (v.0.34). Not optimized bundle worked fine, but with -O2 it failed to load in OPA. Generated files contained function calls without closing bracket and missing parameters.
Now I'm not sure, if it is a good idea to use it at all.
Now my implementation is mostly done, and I tried again (v0.35). The bundle loads, but doesn't produce the same result as the not optimized one. I can't share my code, but this simplified example:
Such a block is generated for each user and their topics.
This looks like assignments from function calls, get rewritten to have the assigned variable as additional parameter (See regex.match)? I did not find anything about that in the documentation.
But I'm confused by the trim_prefix having a string as 3rd parameter? Is that evaluated as equality comparison? Because all requests are rejected with optimization. Original code was
cn_value := trim_prefix(cn_part, "CN=")
Beta Was this translation helpful? Give feedback.
All reactions