diff --git a/pkg/workflow/agentic_workflow_test.go b/pkg/workflow/agentic_workflow_test.go index 2ce535cc00f..cd81cef01a9 100644 --- a/pkg/workflow/agentic_workflow_test.go +++ b/pkg/workflow/agentic_workflow_test.go @@ -75,7 +75,7 @@ func TestAgenticWorkflowsSyntaxVariations(t *testing.T) { c := testCompiler() // Extract tools from frontmatter - tools := extractToolsFromFrontmatter(frontmatter) + tools := extractToolsMapFromFrontmatter(frontmatter) // Merge tools mergedTools, err := c.mergeToolsAndMCPServers(tools, make(map[string]any), "") @@ -268,7 +268,7 @@ func TestAgenticWorkflowsErrorCases(t *testing.T) { c := testCompiler() // Extract tools from frontmatter - tools := extractToolsFromFrontmatter(frontmatter) + tools := extractToolsMapFromFrontmatter(frontmatter) // Merge tools mergedTools, err := c.mergeToolsAndMCPServers(tools, make(map[string]any), "") @@ -360,7 +360,7 @@ func TestAgenticWorkflowsNilSafety(t *testing.T) { } } -// TestAgenticWorkflowsExtractToolsEdgeCases tests edge cases in extractToolsFromFrontmatter +// TestAgenticWorkflowsExtractToolsEdgeCases tests edge cases in extractToolsMapFromFrontmatter func TestAgenticWorkflowsExtractToolsEdgeCases(t *testing.T) { tests := []struct { name string @@ -418,11 +418,11 @@ func TestAgenticWorkflowsExtractToolsEdgeCases(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - // Test that extractToolsFromFrontmatter doesn't panic + // Test that extractToolsMapFromFrontmatter doesn't panic var result map[string]any assert.NotPanics(t, func() { - result = extractToolsFromFrontmatter(tt.frontmatter) - }, "extractToolsFromFrontmatter should handle edge cases without panicking") + result = extractToolsMapFromFrontmatter(tt.frontmatter) + }, "extractToolsMapFromFrontmatter should handle edge cases without panicking") // Verify the expected result if tt.expectTools { @@ -432,7 +432,7 @@ func TestAgenticWorkflowsExtractToolsEdgeCases(t *testing.T) { "extracted tools should contain agentic-workflows for: %s", tt.description) } else { // ExtractMapField returns empty map (not nil) when field is missing or invalid - assert.NotNil(t, result, "extractToolsFromFrontmatter should always return non-nil map") + assert.NotNil(t, result, "extractToolsMapFromFrontmatter should always return non-nil map") assert.Empty(t, result, "should return empty tools map for: %s", tt.description) } }) diff --git a/pkg/workflow/compiler_orchestrator_tools.go b/pkg/workflow/compiler_orchestrator_tools.go index 9de0fb90adc..59724e13397 100644 --- a/pkg/workflow/compiler_orchestrator_tools.go +++ b/pkg/workflow/compiler_orchestrator_tools.go @@ -175,7 +175,7 @@ func (c *Compiler) resolveToolsConfiguration( importsResult *parser.ImportsResult, agenticEngine CodingAgentEngine, ) (*mergedToolsData, error) { - topTools := extractToolsFromFrontmatter(result.Frontmatter) + topTools := extractToolsMapFromFrontmatter(result.Frontmatter) if err := ValidateToolsSection(topTools); err != nil { return nil, err } @@ -185,7 +185,7 @@ func (c *Compiler) resolveToolsConfiguration( return nil, fmt.Errorf("failed to expand includes for tools: %w", err) } allIncludedTools := strings.Join(nonEmptyStrings(importsResult.MergedTools, includedTools), "\n") - mcpServers := extractMCPServersFromFrontmatter(result.Frontmatter) + mcpServers := extractMCPServersMapFromFrontmatter(result.Frontmatter) resolvedMCPServers, err := c.mergeImportedMCPServers(mcpServers, importsResult.MergedMCPServers) if err != nil { return nil, err @@ -264,7 +264,7 @@ func (c *Compiler) extractToolTimeouts(tools map[string]any) (string, string, er } func (c *Compiler) resolveRuntimes(frontmatter map[string]any, importsResult *parser.ImportsResult) (map[string]any, bool, error) { - topRuntimes := extractRuntimesFromFrontmatter(frontmatter) + topRuntimes := extractRuntimesMapFromFrontmatter(frontmatter) orchestratorToolsLog.Printf("Merging runtimes") runtimes, err := mergeRuntimes(topRuntimes, importsResult.MergedRuntimes) if err != nil { diff --git a/pkg/workflow/copilot_git_commands_integration_test.go b/pkg/workflow/copilot_git_commands_integration_test.go index c82e68c71d5..7995b6f0c4b 100644 --- a/pkg/workflow/copilot_git_commands_integration_test.go +++ b/pkg/workflow/copilot_git_commands_integration_test.go @@ -119,7 +119,7 @@ func (c *Compiler) parseCopilotWorkflowMarkdownContentWithToolArgs(content strin safeOutputs := c.extractSafeOutputsConfig(result.Frontmatter) // Extract and process tools - topTools := extractToolsFromFrontmatter(result.Frontmatter) + topTools := extractToolsMapFromFrontmatter(result.Frontmatter) topTools = c.applyDefaultTools(topTools, safeOutputs, nil, nil) // Build basic workflow data for testing diff --git a/pkg/workflow/expression_extraction.go b/pkg/workflow/expression_extraction.go index 21e1d7a6df4..f2307cb4320 100644 --- a/pkg/workflow/expression_extraction.go +++ b/pkg/workflow/expression_extraction.go @@ -493,7 +493,7 @@ func SubstituteImportInputs(content string, importInputs map[string]any) string } path := matches[1] // Resolve potentially dotted path (e.g. "config.apiKey" for object inputs) - if value, found := resolveImportInputPath(importInputs, path); found { + if value, found := resolveImportInputByPath(importInputs, path); found { strValue := marshalImportInputValue(value) expressionExtractionLog.Printf("Substituting github.aw.%s.%s with value: %s", inputCategory, path, strValue) return strValue @@ -529,11 +529,11 @@ func marshalImportInputValue(value any) string { return fmt.Sprintf("%v", value) } -// resolveImportInputPath resolves a potentially dotted key path from the importInputs map. +// resolveImportInputByPath resolves a potentially dotted key path from the importInputs map. // For scalar inputs ("count"), it looks up importInputs["count"] directly. // For object sub-key paths ("config.apiKey"), it looks up importInputs["config"]["apiKey"], // supporting one level of nesting as defined by import-schema object types. // Returns the resolved value and true on success, or nil and false when the path is not found. -func resolveImportInputPath(importInputs map[string]any, path string) (any, bool) { +func resolveImportInputByPath(importInputs map[string]any, path string) (any, bool) { return importinpututil.ResolvePathValue(importInputs, path) } diff --git a/pkg/workflow/firewall_workflow_test.go b/pkg/workflow/firewall_workflow_test.go index f91b115641a..1b22991d9d3 100644 --- a/pkg/workflow/firewall_workflow_test.go +++ b/pkg/workflow/firewall_workflow_test.go @@ -98,7 +98,7 @@ func TestFirewallWorkflowCompilation(t *testing.T) { c.SetSkipValidation(true) // Extract and verify tools - tools := extractToolsFromFrontmatter(frontmatter) + tools := extractToolsMapFromFrontmatter(frontmatter) if _, exists := tools["web-fetch"]; !exists { t.Error("web-fetch tool should be present in firewall workflow") } diff --git a/pkg/workflow/frontmatter_extraction_metadata.go b/pkg/workflow/frontmatter_extraction_metadata.go index 87309069916..4442f4cc245 100644 --- a/pkg/workflow/frontmatter_extraction_metadata.go +++ b/pkg/workflow/frontmatter_extraction_metadata.go @@ -301,17 +301,17 @@ func (c *Compiler) extractToolsStartupTimeout(tools map[string]any) (string, err return "", nil } -// extractToolsFromFrontmatter extracts tools section from frontmatter map -func extractToolsFromFrontmatter(frontmatter map[string]any) map[string]any { +// extractToolsMapFromFrontmatter extracts tools section from frontmatter map +func extractToolsMapFromFrontmatter(frontmatter map[string]any) map[string]any { return ExtractMapField(frontmatter, "tools") } -// extractMCPServersFromFrontmatter extracts mcp-servers section from frontmatter -func extractMCPServersFromFrontmatter(frontmatter map[string]any) map[string]any { +// extractMCPServersMapFromFrontmatter extracts mcp-servers section from frontmatter +func extractMCPServersMapFromFrontmatter(frontmatter map[string]any) map[string]any { return ExtractMapField(frontmatter, "mcp-servers") } -// extractRuntimesFromFrontmatter extracts runtimes section from frontmatter map -func extractRuntimesFromFrontmatter(frontmatter map[string]any) map[string]any { +// extractRuntimesMapFromFrontmatter extracts runtimes section from frontmatter map +func extractRuntimesMapFromFrontmatter(frontmatter map[string]any) map[string]any { return ExtractMapField(frontmatter, "runtimes") } diff --git a/pkg/workflow/git_commands_integration_test.go b/pkg/workflow/git_commands_integration_test.go index f8016088cf3..4660c66188a 100644 --- a/pkg/workflow/git_commands_integration_test.go +++ b/pkg/workflow/git_commands_integration_test.go @@ -196,7 +196,7 @@ func (c *Compiler) parseWorkflowMarkdownContentWithToolsString(content string) ( safeOutputs := c.extractSafeOutputsConfig(result.Frontmatter) // Extract and process tools - topTools := extractToolsFromFrontmatter(result.Frontmatter) + topTools := extractToolsMapFromFrontmatter(result.Frontmatter) topTools = c.applyDefaultTools(topTools, safeOutputs, nil, nil) // Extract cache-memory config diff --git a/pkg/workflow/tools_types_test.go b/pkg/workflow/tools_types_test.go index fa5218849b8..59166fc9b00 100644 --- a/pkg/workflow/tools_types_test.go +++ b/pkg/workflow/tools_types_test.go @@ -359,7 +359,7 @@ func TestPlaywrightConfigParsing(t *testing.T) { }) } -func TestExtractToolsFromFrontmatter(t *testing.T) { +func TestExtractToolsMapFromFrontmatter(t *testing.T) { frontmatter := map[string]any{ "tools": map[string]any{ "github": nil, @@ -370,7 +370,7 @@ func TestExtractToolsFromFrontmatter(t *testing.T) { }, } - result := extractToolsFromFrontmatter(frontmatter) + result := extractToolsMapFromFrontmatter(frontmatter) if len(result) != 2 { t.Errorf("expected 2 tools, got %d", len(result)) @@ -390,7 +390,7 @@ func TestExtractToolsFromFrontmatter(t *testing.T) { } } -func TestExtractMCPServersFromFrontmatter(t *testing.T) { +func TestExtractMCPServersMapFromFrontmatter(t *testing.T) { frontmatter := map[string]any{ "tools": map[string]any{ "github": nil, @@ -401,7 +401,7 @@ func TestExtractMCPServersFromFrontmatter(t *testing.T) { }, } - result := extractMCPServersFromFrontmatter(frontmatter) + result := extractMCPServersMapFromFrontmatter(frontmatter) if len(result) != 2 { t.Errorf("expected 2 MCP servers, got %d", len(result)) @@ -421,7 +421,7 @@ func TestExtractMCPServersFromFrontmatter(t *testing.T) { } } -func TestExtractRuntimesFromFrontmatter(t *testing.T) { +func TestExtractRuntimesMapFromFrontmatter(t *testing.T) { frontmatter := map[string]any{ "tools": map[string]any{ "github": nil, @@ -432,7 +432,7 @@ func TestExtractRuntimesFromFrontmatter(t *testing.T) { }, } - result := extractRuntimesFromFrontmatter(frontmatter) + result := extractRuntimesMapFromFrontmatter(frontmatter) if len(result) != 2 { t.Errorf("expected 2 runtimes, got %d", len(result))