Skip to content

Add source-aware policy params declaration detection - #826

Open
Maksym (maksym-mishchenko) wants to merge 3 commits into
microsoft:mainfrom
maksym-mishchenko:maksym-mishchenko-wi-3749964-api-delivery
Open

Maksym (maksym-mishchenko) wants to merge 3 commits into
microsoft:mainfrom
maksym-mishchenko:maksym-mishchenko-wi-3749964-api-delivery

Conversation

@maksym-mishchenko

@maksym-mishchenko Maksym (maksym-mishchenko) commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Policy loaders need to identify policy-authored params rule heads before injecting assignment parameters; evaluating params misses conditional declarations. Add a nonexecuting HasPolicyParams(sourcePath) API across Rust, FFI, and C# that inspects only the uniquely matched loaded source. It detects default, function, set, and descendant rule heads without rejecting references or generated bridge rules, and reports missing, ambiguous, or unclassifiable sources as errors.

Maksym Mishchenko and others added 2 commits September 25, 2026 12:12
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 25, 2026 15:12

@kusha Mark Birger (kusha) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maksym (@maksym-mishchenko) Could we make this check generic instead of hard-coding params? I’d call it HasDeclaredRuleRootedAt(sourcePath, rootName) and use HasDeclaredRuleRootedAt(sourcePath, "params") here. It should keep the current behavior: inspect declarations in that source, count params and its descendants, including defaults, without evaluating the rules.

@anakrish

Copy link
Copy Markdown
Collaborator

Maksym (@maksym-mishchenko) I second Mark's suggestion. It is better to make this generic. Also, ensure that we can detect rules that have prefixes. e.g metadata.parameters.

Accept exact dotted declaration prefixes without evaluating rules, preserving source grammar, parser context, resource limits, and native/managed error precedence.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@maksym-mishchenko

Copy link
Copy Markdown
Contributor Author

I changed it to HasDeclaredRuleRootedAt(sourcePath, rootName). "params" works as before. "metadata.parameters" matches that rule and its children, but not metadata.other. Defaults count too; the check doesn’t run the rules.

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