From c9498cbded801ddf083f2118d61e2bd1cef15b59 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Thu, 18 Jun 2026 16:18:13 -0700 Subject: [PATCH] Address Copilot review feedback: fix duplicate XML doc, make IsOrchestrationOwnedByWorkflow non-throwing, drop misleading Async suffix in test name Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../BuiltInFunctions.cs | 10 ++++++---- .../BuiltInFunctionsWorkflowRoutingTests.cs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs index d28d32040..478be50d6 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs @@ -657,10 +657,6 @@ internal static class BuiltInFunctions return functionName[HttpPrefix.Length..]; } - /// - /// Extracts the workflow name from the function definition name by stripping the - /// and the given suffix (e.g., "-status" or "-respond"). - /// /// /// Extracts the workflow name from the function definition name by stripping the /// and the given suffix (e.g., "-status" or "-respond"). @@ -683,6 +679,12 @@ internal static class BuiltInFunctions /// internal static bool IsOrchestrationOwnedByWorkflow(string orchestrationName, string functionName, string suffix) { + if (!functionName.StartsWith(HttpPrefix, StringComparison.Ordinal) || + !functionName.EndsWith(suffix, StringComparison.Ordinal)) + { + return false; + } + string workflowName = GetWorkflowName(functionName, suffix); string expectedOrchestrationName = WorkflowNamingHelper.ToOrchestrationFunctionName(workflowName); return string.Equals(orchestrationName, expectedOrchestrationName, StringComparison.OrdinalIgnoreCase); diff --git a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/BuiltInFunctionsWorkflowRoutingTests.cs b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/BuiltInFunctionsWorkflowRoutingTests.cs index 325c6059f..5c671d3d8 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/BuiltInFunctionsWorkflowRoutingTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Hosting.AzureFunctions.UnitTests/BuiltInFunctionsWorkflowRoutingTests.cs @@ -9,7 +9,7 @@ public sealed class BuiltInFunctionsWorkflowRoutingTests [InlineData("http-OrderProcessor-status", "-status", "OrderProcessor")] [InlineData("http-MyWorkflow-respond", "-respond", "MyWorkflow")] [InlineData("http-Multi-Dash-Name-status", "-status", "Multi-Dash-Name")] - public void GetWorkflowName_ReturnsCorrectNameAsync(string functionName, string suffix, string expectedWorkflowName) + public void GetWorkflowName_ReturnsCorrectName(string functionName, string suffix, string expectedWorkflowName) { // Act string result = BuiltInFunctions.GetWorkflowName(functionName, suffix);