Skip to content

feat: add Azure Policy AST types#653

Merged
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:azure-policy-ast
Apr 1, 2026
Merged

feat: add Azure Policy AST types#653
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:azure-policy-ast

Conversation

@anakrish
Copy link
Copy Markdown
Collaborator

@anakrish anakrish commented Apr 1, 2026

Add span-annotated AST types for Azure Policy conditions and rules, plus string utility enhancements for case-insensitive policy matching.

AST types (ast/):

  • PolicyDefinition, PolicyRule with if/then/details structure
  • Condition enum: field conditions, value conditions, logical combinators (allOf, anyOf, not), and count expressions
  • Operator enums for all Azure Policy constraint operators (equals, contains, greater, matchInsensitively, etc.)
  • Expr enum for field references, literal values, template function calls, and policy function invocations
  • Value types with span tracking for error reporting

@anakrish anakrish requested a review from Copilot April 1, 2026 12:02
@anakrish anakrish force-pushed the azure-policy-ast branch 2 times, most recently from 8e86d77 to 3a86494 Compare April 1, 2026 12:06
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 foundational Azure Policy support types by introducing a span-annotated AST for policy definitions/rules/conditions and enhancing Azure Policy/ARM string comparison helpers for case-insensitive matching.

Changes:

  • Introduces languages::azure_policy::ast with span-tracked nodes for policy rules, constraints, operators, values, ARM template expressions, and count.
  • Updates Azure Policy string utilities to clarify/document casing semantics and adjusts key/value comparison helpers.
  • Refactors Unicode case folding implementation to use icu_casemap::CaseMapper.

Reviewed changes

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

Show a summary per file
File Description
src/languages/azure_policy/strings/mod.rs Adds documentation pointer for casing semantics.
src/languages/azure_policy/strings/keys.rs Adjusts ARM key comparison helpers (signature/param naming).
src/languages/azure_policy/strings/case_fold.rs Refactors full Unicode case folding implementation using CaseMapper.
src/languages/azure_policy/mod.rs Expands module docs, adds AST module export, and applies clippy allowances.
src/languages/azure_policy/ast/mod.rs Adds top-level Azure Policy AST definitions (rules, constraints, operators, fields, etc.).
src/languages/azure_policy/ast/value.rs Adds JSON/value/expression/count node types with span tracking.
Comments suppressed due to low confidence (1)

src/languages/azure_policy/mod.rs:12

  • The crate-level #![allow(...)] here applies to the entire azure_policy module (including aliases and strings), potentially masking new warnings outside the AST code. Consider scoping these clippy allowances more narrowly (e.g., to ast or specific files) so unrelated code still benefits from linting.
#[allow(clippy::pattern_type_mismatch)]
pub mod aliases;
pub mod ast;
pub mod strings;


💡 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 3 out of 3 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 azure-policy-ast branch 2 times, most recently from ae448df to f5fb53a Compare April 1, 2026 12:27
@anakrish anakrish requested a review from Copilot April 1, 2026 12:27
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 3 out of 3 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 azure-policy-ast branch 2 times, most recently from 1fbc8ce to 8e43f6a Compare April 1, 2026 12:41
@anakrish anakrish requested a review from Copilot April 1, 2026 12:41
@anakrish anakrish changed the title feat: add Azure Policy AST types and string utilities feat: add Azure Policy AST types Apr 1, 2026
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 3 out of 3 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 3 out of 3 changed files in this pull request and generated 3 comments.


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

Add span-annotated AST types for Azure Policy conditions and rules.

- PolicyDefinition, PolicyRule with if/then/details structure
- Condition enum: field conditions, value conditions, logical
  combinators (allOf, anyOf, not), and count expressions
- Operator enums for all 19 Azure Policy constraint operators
  (equals, contains, greater, matchInsensitively, etc.)
- Expr enum for field references, literal values (number, string,
  bool), template function calls, and policy function invocations
- Value types with span tracking for error reporting
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 3 out of 3 changed files in this pull request and generated 3 comments.


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

@anakrish anakrish requested a review from Copilot April 1, 2026 13:59
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 3 out of 3 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.

@anakrish anakrish marked this pull request as ready for review April 1, 2026 14:06
@anakrish anakrish merged commit 648ba40 into microsoft:main Apr 1, 2026
67 checks passed
@anakrish anakrish deleted the azure-policy-ast branch April 1, 2026 16:54
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