Skip to content

feat(rvm): implement Azure Policy condition evaluation#661

Merged
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:feat/rvm-policy-operators
Apr 8, 2026
Merged

feat(rvm): implement Azure Policy condition evaluation#661
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:feat/rvm-policy-operators

Conversation

@anakrish
Copy link
Copy Markdown
Collaborator

@anakrish anakrish commented Apr 6, 2026

Add VM support for Azure Policy's condition operators and allOf/anyOf
short-circuit logic, gated behind cfg(feature = "azure_policy").

Policy conditions (equals, contains, like, match, exists, and their
negations — 21 total) are encoded as a single PolicyCondition
instruction with a PolicyOp sub-opcode rather than bloating the
Instruction enum with 21 variants. The dispatch handles Azure Policy's
quirky comparison semantics: case-insensitive string comparison,
string↔number coercion, null vs undefined distinction, and element-wise
collection membership.

allOf/anyOf blocks use four instructions — LogicalBlockStart,
AllOfNext/AnyOfNext, and LogicalBlockEnd — that wire up a result
register and short-circuit on the first failing (allOf) or passing
(anyOf) child.

Helper functions for case-folded comparison, wildcard/glob matching, and
type coercion live in builtins::azure_policy::helpers.

Two YAML test suites (~2200 lines) exercise the full operator matrix and
the allOf/anyOf control flow.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Azure Policy condition evaluation support to the RVM, including all condition operators and structured allOf/anyOf short-circuit execution, gated behind feature = "azure_policy".

Changes:

  • Introduces consolidated Instruction::PolicyCondition with PolicyOp sub-opcodes, plus structured LogicalBlock* instructions for allOf/anyOf.
  • Implements Azure Policy comparison, containment, pattern matching, and existence semantics in the VM dispatch path (feature-gated).
  • Adds YAML VM test suites covering operator behavior and allOf/anyOf control flow.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/rvm/vm/suites/azure_policy/policy_operators.yaml Adds operator matrix tests for Azure Policy condition ops.
tests/rvm/vm/suites/azure_policy/policy_allof_anyof.yaml Adds structured instruction tests for allOf/anyOf short-circuiting.
src/rvm/vm/dispatch.rs Adds feature-gated execution for policy ops and logical blocks.
src/rvm/tests/vm.rs Runs Azure Policy YAML suites when azure_policy feature is enabled.
src/rvm/tests/instruction_parser.rs Parses the new policy/logical-block test instructions.
src/rvm/program/listing.rs Updates assembly listing naming/formatting for new instructions.
src/rvm/instructions/types.rs Adds PolicyOp and LogicalBlockMode enums.
src/rvm/instructions/mod.rs Adds new instruction variants to the main instruction enum.
src/rvm/instructions/display.rs Adds Display formatting for new instructions.
src/builtins/azure_policy/helpers.rs Adds helper functions for coercion, comparison, and pattern matching.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@anakrish anakrish force-pushed the feat/rvm-policy-operators branch from 7c02934 to 9f7dd59 Compare April 7, 2026 17:46
@anakrish anakrish requested a review from Copilot April 7, 2026 17:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@anakrish anakrish force-pushed the feat/rvm-policy-operators branch 2 times, most recently from 6a31c0c to 185f21b Compare April 7, 2026 20:39
@anakrish anakrish requested a review from Copilot April 7, 2026 20:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add VM support for Azure Policy's condition operators and allOf/anyOf
short-circuit logic, gated behind cfg(feature = "azure_policy").

Policy conditions (equals, contains, like, match, exists, and their
negations — 21 total) are encoded as a single PolicyCondition
instruction with a PolicyOp sub-opcode rather than bloating the
Instruction enum with 21 variants. The dispatch handles Azure Policy's
quirky comparison semantics: case-insensitive string comparison,
string↔number coercion, null vs undefined distinction, and element-wise
collection membership.

allOf/anyOf blocks use four instructions — LogicalBlockStart,
AllOfNext/AnyOfNext, and LogicalBlockEnd — that wire up a result
register and short-circuit on the first failing (allOf) or passing
(anyOf) child.

Helper functions for case-folded comparison, wildcard/glob matching, and
type coercion live in builtins::azure_policy::helpers.

Two YAML test suites (~2200 lines) exercise the full operator matrix and
the allOf/anyOf control flow.
@anakrish anakrish force-pushed the feat/rvm-policy-operators branch from 31aa333 to ed23f2b Compare April 7, 2026 21:38
@anakrish anakrish changed the title feat(rvm): Azure Policy condition operators and allOf/anyOf logic blocks feat(rvm): implement Azure Policy condition evaluation Apr 7, 2026
@anakrish anakrish marked this pull request as ready for review April 7, 2026 21:39
@anakrish anakrish merged commit 4d35744 into microsoft:main Apr 8, 2026
59 checks passed
@anakrish anakrish deleted the feat/rvm-policy-operators branch April 8, 2026 00:04
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.

3 participants