.NET: [BREAKING] Remove Support for Code-Gen in Declarative Workflows#6095
.NET: [BREAKING] Remove Support for Code-Gen in Declarative Workflows#6095peibekwe wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the .NET declarative workflow “code-gen/ejection” feature (T4 templates + ejection API + related tests/samples), keeping the runtime interpreter-based workflow execution path.
Changes:
- Removed the public
DeclarativeWorkflowBuilder.Eject(...)API and the internal code-gen builder implementation. - Deleted the T4 (
.tt) template set and the checked-in generated template.csoutputs underCodeGen/. - Removed code-gen focused unit tests and the
GenerateCodesample; disabled the remaining integration test that depended onEject.
Reviewed changes
Copilot reviewed 111 out of 111 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/WorkflowActionTemplateTest.cs | Removed base test class for code-gen template assertions. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetVariableTemplateTest.cs | Removed code-gen template unit test for SetVariable. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetTextVariableTemplateTest.cs | Removed code-gen template unit test for SetTextVariable. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/SetMultipleVariablesTemplateTest.cs | Removed code-gen template unit test for SetMultipleVariables. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessageTemplateTest.cs | Removed code-gen template unit test for RetrieveConversationMessage. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/RetrieveConversationMessagesTemplateTest.cs | Removed code-gen template unit test for RetrieveConversationMessages. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ResetVariableTemplateTest.cs | Removed code-gen template unit test for ResetVariable. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ProviderTemplateTest.cs | Removed code-gen provider template unit tests. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/InvokeAzureAgentTemplateTest.cs | Removed code-gen template unit test for InvokeAzureAgent. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/GotoTemplateTest.cs | Removed code-gen template unit test for GotoAction. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ForeachTemplateTest.cs | Removed code-gen template unit test for Foreach. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndDialogTest.cs | Removed code-gen template unit test for EndDialog. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EndConversationTest.cs | Removed code-gen template unit test for EndConversation. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/EdgeTemplateTest.cs | Removed code-gen edge template unit test. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/DeclarativeEjectionTest.cs | Removed end-to-end “ejection” compile/baseline test suite. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CreateConversationTemplateTest.cs | Removed code-gen template unit test for CreateConversation. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/CopyConversationMessagesTemplateTest.cs | Removed code-gen template unit test for CopyConversationMessages. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ContinueLoopTemplateTest.cs | Removed code-gen template unit test for ContinueLoop. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ConditionGroupTemplateTest.cs | Removed code-gen template unit test for ConditionGroup. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/ClearAllVariablesTemplateTest.cs | Removed code-gen template unit test for ClearAllVariables. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/BreakLoopTemplateTest.cs | Removed code-gen template unit test for BreakLoop. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/CodeGen/AddConversationMessageTemplateTest.cs | Removed code-gen template unit test for AddConversationMessage. |
| dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests.csproj | Excluded the code-gen integration test from compilation. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Microsoft.Agents.AI.Workflows.Declarative.csproj | Removed T4 preprocessing items for CodeGen templates. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/Interpreter/WorkflowCodeBuilder.cs | Removed internal workflow-to-C# code builder. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowBuilder.cs | Removed the public workflow “ejection” API surface. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/FormatMessageTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateValueExpressionTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateStringExpressionTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateRecordExpressionTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateListExpressionTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateIntExpressionTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateEnumExpressionTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/EvaluateBoolExpressionTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/Snippets/AssignVariableTemplate.tt | Removed code-gen T4 snippet. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplateCode.cs | Removed template backing code for SetVariable code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.tt | Removed SetVariable executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetVariableTemplate.cs | Removed generated output for SetVariable template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplateCode.cs | Removed template backing code for SetTextVariable code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.tt | Removed SetTextVariable executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetTextVariableTemplate.cs | Removed generated output for SetTextVariable template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplateCode.cs | Removed template backing code for SetMultipleVariables code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.tt | Removed SetMultipleVariables executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SetMultipleVariablesTemplate.cs | Removed generated output for SetMultipleVariables template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplateCode.cs | Removed template backing code for SendActivity code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.tt | Removed SendActivity executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/SendActivityTemplate.cs | Removed generated output for SendActivity template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplateCode.cs | Removed template backing code for workflow root executor code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.tt | Removed root executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RootTemplate.cs | Removed generated output for root template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplateCode.cs | Removed template backing code for RetrieveConversationMessage code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.tt | Removed RetrieveConversationMessage executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessageTemplate.cs | Removed generated output for RetrieveConversationMessage template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplateCode.cs | Removed template backing code for RetrieveConversationMessages code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.tt | Removed RetrieveConversationMessages executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/RetrieveConversationMessagesTemplate.cs | Removed generated output for RetrieveConversationMessages template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplateCode.cs | Removed template backing code for ResetVariable code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.tt | Removed ResetVariable executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ResetVariableTemplate.cs | Removed generated output for ResetVariable template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplateCode.cs | Removed template backing code for Question code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.tt | Removed Question executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/QuestionTemplate.cs | Removed generated output for Question template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplateCode.cs | Removed template backing code for workflow provider code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.tt | Removed workflow provider T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ProviderTemplate.cs | Removed generated output for provider template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplateCode.cs | Removed template backing code for ParseValue code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.tt | Removed ParseValue executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ParseValueTemplate.cs | Removed generated output for ParseValue template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplateCode.cs | Removed template backing code for InvokeAzureAgent code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.tt | Removed InvokeAzureAgent executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InvokeAzureAgentTemplate.cs | Removed generated output for InvokeAzureAgent template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplateCode.cs | Removed template backing code for executor instantiation code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.tt | Removed instance T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/InstanceTemplate.cs | Removed generated output for instance template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplateCode.cs | Removed template backing code for Foreach code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.tt | Removed Foreach executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ForeachTemplate.cs | Removed generated output for Foreach template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplateCode.cs | Removed template backing code for empty/delegate executor code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.tt | Removed empty/delegate T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EmptyTemplate.cs | Removed generated output for empty template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2TemplateCode.cs | Removed template backing code for EditTableV2 code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.tt | Removed EditTableV2 executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EditTableV2Template.cs | Removed generated output for EditTableV2 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplateCode.cs | Removed template backing code for edge wiring code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.tt | Removed edge T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/EdgeTemplate.cs | Removed generated output for edge template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplateCode.cs | Removed template backing code for default/delegate executor code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.tt | Removed default template T4. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/DefaultTemplate.cs | Removed generated output for default template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplateCode.cs | Removed template backing code for CreateConversation code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.tt | Removed CreateConversation executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CreateConversationTemplate.cs | Removed generated output for CreateConversation template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplateCode.cs | Removed template backing code for CopyConversationMessages code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.tt | Removed CopyConversationMessages executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CopyConversationMessagesTemplate.cs | Removed generated output for CopyConversationMessages template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplateCode.cs | Removed template backing code for ConditionGroup code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.tt | Removed ConditionGroup executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ConditionGroupTemplate.cs | Removed generated output for ConditionGroup template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/CodeTemplate.cs | Removed shared code-gen template base infrastructure. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplateCode.cs | Removed template backing code for ClearAllVariables code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.tt | Removed ClearAllVariables executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ClearAllVariablesTemplate.cs | Removed generated output for ClearAllVariables template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplateCode.cs | Removed template backing code for AddConversationMessage code-gen. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.tt | Removed AddConversationMessage executor T4 template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/AddConversationMessageTemplate.cs | Removed generated output for AddConversationMessage template. |
| dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/CodeGen/ActionTemplate.cs | Removed shared action-template code-gen base class. |
| dotnet/samples/03-workflows/Declarative/GenerateCode/Properties/launchSettings.json | Removed sample launch profiles for code generation. |
| dotnet/samples/03-workflows/Declarative/GenerateCode/Program.cs | Removed the GenerateCode sample app using Eject. |
| dotnet/samples/03-workflows/Declarative/GenerateCode/GenerateCode.csproj | Removed the GenerateCode sample project. |
| dotnet/agent-framework-dotnet.slnx | Removed the GenerateCode sample project from the .NET solution. |
There was a problem hiding this comment.
Automated Code Review
Reviewers: 4 | Confidence: 85%
✓ Correctness
No actionable issues found in this dimension.
✓ Security Reliability
No actionable issues found in this dimension.
✓ Test Coverage
The deletions are self-consistent—implementation code and its tests are removed together. The integration test file DeclarativeCodeGenTest.cs is excluded via rather than being deleted, which leaves dead code in the repo but creates no functional test coverage gap. No new behavior is introduced that would require new tests.
✗ Design Approach
This removal is not end-to-end yet. Deleting the
GenerateCodesample and the code-gen implementation is directionally consistent with the PR goal, but the repo still has tooling and public API surface that continue to advertise and invoke code generation, so the current approach leaves broken consumers behind instead of retiring the feature cleanly. The chunk shows the code-gen tests and T4 preprocessing being removed, but it does not actually remove the public code-gen surface:DeclarativeWorkflowBuilder.Eject(...)is still implemented indotnet/src/Microsoft.Agents.AI.Workflows.Declarative/DeclarativeWorkflowBuilder.cs:98-137, and the checked-in sample still calls it indotnet/samples/03-workflows/Declarative/GenerateCode/Program.cs:32-38. As written, this changes the validation/build plumbing around code-gen rather than removing support for the feature itself.
Flagged Issues
- Sample verification will break:
dotnet/eng/verify-samples/WorkflowSamples.cs:444-448still definesWorkflow_Declarative_GenerateCodewithProjectPath = "samples/03-workflows/Declarative/GenerateCode", anddotnet/.github/skills/verify-samples-tool/SKILL.md:176-180documents the same path. After this deletion, that verification path will fail looking for a project that no longer exists.
Automated review by peibekwe's agents
There was a problem hiding this comment.
Automated Code Review
Reviewers: 4 | Confidence: 89%
✓ Correctness
No actionable issues found in this dimension.
✓ Security Reliability
No actionable issues found in this dimension.
✓ Test Coverage
No actionable issues found in this dimension.
✗ Design Approach
I did not find other design issues in the files reviewed here that met the evidence bar.
Flagged Issues
- The sample-verification catalog (
dotnet/eng/verify-samples/WorkflowSamples.cs:444-448) still referencessamples/03-workflows/Declarative/GenerateCode, and the orchestrator (VerificationOrchestrator.cs:140-143) unconditionally runs every listed sample. With the GenerateCode project removed, this path is stale and CI sample verification will fail.
Automated review by peibekwe's agents
Motivation and Context
Removing support for code-gen.
Fixes #6094
Description
Code-gen was never great and suffered from interference around decision point on best solution.
Contribution Checklist