You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the opa/compile package and the opa build command (which is implemented on top of the compile package) guarantees that emitted bundles are semantically equivalent to the input .rego files provided by the caller. This means that any query that could be run against the provided .rego files can also be run against the emitted bundle. This is nice in cases where the bundle is to be fed back into OPA, because callers of OPA can be unaware of any optimizations to the bundle.
On the other hand, in some cases, it's not possible to produce a semantically equivalent bundle because of limitations like the one discussed in #4411. For example:
In many compiler use cases, the consumer may not require semantically equivalent bundles. In those cases, we should relax the requirement on the compile package. A simple option like --prune-unused on opa build and a similar option on the compile package would be enough.
The text was updated successfully, but these errors were encountered:
With `.WithPruneUnused(true)`, the compiler (of the compile package) no longer
collects dependents of its entrypoints.
The resulting bundle, if used with the wasm target, will no longer be
semantically equivalent to the bundle built with the rego target.
Since we're unable to have entrypoints for functions, this allows building
modules that we couldn't build before. See open-policy-agent#5035.
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
* compile: allow opt-out of dependents gathering
With `.WithPruneUnused(true)`, the compiler (of the compile package) no longer
collects dependents of its entrypoints.
The resulting bundle, if used with the wasm target, will no longer be
semantically equivalent to the bundle built with the rego target.
Since we're unable to have entrypoints for functions, this allows building
modules that we couldn't build before.
Fixes#5035.
* cmd/build: expose new configurable via --prune-unused
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Currently the opa/compile package and the
opa build
command (which is implemented on top of the compile package) guarantees that emitted bundles are semantically equivalent to the input .rego files provided by the caller. This means that any query that could be run against the provided .rego files can also be run against the emitted bundle. This is nice in cases where the bundle is to be fed back into OPA, because callers of OPA can be unaware of any optimizations to the bundle.On the other hand, in some cases, it's not possible to produce a semantically equivalent bundle because of limitations like the one discussed in #4411. For example:
Will fail to build w/ entrypoint x/p because the function
f
refers to the entrypoint (0402892d8ee5a223453ee41cf4bfad446f11aea2):In many compiler use cases, the consumer may not require semantically equivalent bundles. In those cases, we should relax the requirement on the compile package. A simple option like
--prune-unused
onopa build
and a similar option on the compile package would be enough.The text was updated successfully, but these errors were encountered: