Skip to content

feat: support effective package override during policy loading - #821

Open
Maksym (maksym-mishchenko) wants to merge 4 commits into
microsoft:mainfrom
maksym-mishchenko:maksym-mishchenko-rvm-package-override-feasibility
Open

Maksym (maksym-mishchenko) wants to merge 4 commits into
microsoft:mainfrom
maksym-mishchenko:maksym-mishchenko-rvm-package-override-feasibility

Conversation

@maksym-mishchenko

Copy link
Copy Markdown
Contributor

Summary

  • Add opt-in effective-package loading to the Rust Engine, C ABI, and C# Engine. A bare dotted path such as tenant.authz determines interpreter/RVM package identity, entrypoints, and package introspection while retaining original policy source and diagnostics.
  • Preserve existing APIs and leave explicit data.* references and imports unchanged; C# RVM callers use Program.CompileFromEngine.

Validation

  • Focused Rust engine 9/9 and RVM compiler 17/17; focused FFI 2/2 and C# 3/3.
  • Pre-commit build, formatting, and Clippy passed; pre-push checks and OPA conformance (2,875 cases, 0 failures) passed.
  • A broader C# run passed 86 tests before an execution-timer test timed out; full C# suite is not claimed green. Override-specific RVM collision and absolute-Undefined cases are not separately asserted.

Work item: WI 3763339.

Maksym Mishchenko and others added 2 commits September 23, 2026 13:50
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@maksym-mishchenko
Maksym (maksym-mishchenko) marked this pull request as ready for review September 23, 2026 15:42
@anakrish

Copy link
Copy Markdown
Collaborator

Maksym (@maksym-mishchenko) Can you describe the usecase for this?

@maksym-mishchenko

Maksym (maksym-mishchenko) commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Maksym (Maksym (@maksym-mishchenko)) Can you describe the usecase for this?

Sure, Anand Krishnamoorthi (@anakrish)

In our ERP policy-loading flow, we need to compile a Rego policy with RVM under a different package namespace from the one declared in its source. The override lets us choose that namespace at load time without changing the stored policy text. We don’t need to rewrite absolute references or imports.

For example, a policy may declare package authz and define allow. We can load it with the effective package erp.policy_123, compile it with RVM, and evaluate data.erp.policy_123.allow. The stored Rego source still says package authz; we choose the runtime namespace when loading it.

@anakrish

Copy link
Copy Markdown
Collaborator

The same can be achieved by compiling:

package erp.policy_123
allow := data.authz.allow

Won't the above work for you?

Also why do you want to "compile a Rego policy with RVM under a different package namespace from the one declared in its source"?

Maksym Mishchenko added 2 commits September 25, 2026 17:02
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f3ddf258-ed55-43f9-a073-ae0c2ea911cf
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f3ddf258-ed55-43f9-a073-ae0c2ea911cf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants