Skip to content

.NET: Validate declarative message properties and improve action errors - #8119

Open
Manjunath Janardhan (manjunathshiva) wants to merge 2 commits into
microsoft:mainfrom
manjunathshiva:fix/8015-declarative-validation
Open

Manjunath Janardhan (manjunathshiva) wants to merge 2 commits into
microsoft:mainfrom
manjunathshiva:fix/8015-declarative-validation

Conversation

@manjunathshiva

Copy link
Copy Markdown
Contributor

Motivation & Context

A misspelled property such as activity.test or prompt.test is retained as extension data by the YAML reader. Workflow construction succeeds, and the workflow can emit an empty message instead of reporting the typo. Invalid template expressions also surface an outer exception that identifies the action but omits the underlying error.

Description & Review Guide

  • What are the major changes? Validate message-template extension properties during workflow construction and report the unknown names together with the owning action ID and type. Include the underlying exception message in runtime action failures while preserving the inner exception. Add regressions for both SendActivity and Question, runtime expression diagnostics, supported template properties, action extensions, and the Topic/Local alias.
  • What is the impact of these changes? Misspelled message properties fail during Build with a DeclarativeModelException. A runtime invalid-member error now includes both #output (SendActivity) and the Power Fx diagnostic for 'Test'. Dynamic expressions continue to be evaluated at execution; this change does not introduce general static expression validation or reject the supported Topic alias.
  • What do you want reviewers to focus on? The validation boundary around message templates: action-level extensions such as Question's autoSend remain supported. The reproduction uses {Local.ToolResponse.Test}; the automated triage example activity: =System.LastMessage.Test is emitted as literal text in my local reproduction.

Full solution build completed with zero warnings or errors. The affected declarative test project passed all 882 tests on .NET 10. Tests use LANG=en_US.UTF-8 and LC_ALL=en_US.UTF-8: three existing date-parsing cases also fail with unchanged declarative code under this machine's default locale. The full .NET 10 unit run passed: 7,205 passed, 65 skipped, zero failures. Local hosting tests also required DOTNET_HOSTBUILDER__RELOADCONFIGONCHANGE=false and permission for the Foundry test host to create its local state directory. Formatting and style checks passed.

Related Issue

Fixes #8015

No competing open PR or human implementation claim was found in the issue discussion or linked timeline when preparing this draft.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Copilot AI 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.

🟢 Approval recommended

The focused implementation matches the stated requirements and includes appropriate regression coverage.

Pull request overview

Adds early validation for invalid declarative message properties and improves runtime action diagnostics.

Changes:

  • Rejects unknown message-template properties during workflow construction.
  • Includes underlying exception details in action failures.
  • Adds regression coverage for validation, extensions, expressions, and aliases.
File summaries
File Description
DeclarativeWorkflowBuilder.cs Validates message-template extension properties.
DeclarativeActionExecutor.cs Adds underlying error details to failures.
DeclarativeValidationTests.cs Covers validation and runtime diagnostics.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net workflows Usage: [Issues, PRs], Target: Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: YAML validation is weak in some cases. Declarative.dll errors misleading or not self explainable

2 participants