From d092779336227cf36f34afeb922d261af9874c44 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 05:34:35 +0000 Subject: [PATCH 1/2] Initial plan From 9881ef9486c7b7aab545baa6c93e707311d13a7c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 05:55:48 +0000 Subject: [PATCH 2/2] Add test for HTTP MCP URL validation requirement Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/workflow/mcp_http_url_validation_test.go | 96 ++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 pkg/workflow/mcp_http_url_validation_test.go diff --git a/pkg/workflow/mcp_http_url_validation_test.go b/pkg/workflow/mcp_http_url_validation_test.go new file mode 100644 index 0000000000..fda0e45112 --- /dev/null +++ b/pkg/workflow/mcp_http_url_validation_test.go @@ -0,0 +1,96 @@ +package workflow + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +// TestHTTPMCPServerRequiresURL tests that HTTP MCP servers require a url field +func TestHTTPMCPServerRequiresURL(t *testing.T) { + tests := []struct { + name string + workflow string + expectError bool + errorText string + }{ + { + name: "HTTP MCP server without url should fail", + workflow: `--- +on: issues +permissions: + contents: read +engine: copilot +mcp-servers: + test-http: + type: http +--- + +# Test workflow +`, + expectError: true, + errorText: "missing property 'url'", + }, + { + name: "HTTP MCP server with url should pass", + workflow: `--- +on: issues +permissions: + contents: read +engine: copilot +mcp-servers: + test-http: + type: http + url: "https://example.com" +--- + +# Test workflow +`, + expectError: false, + }, + { + name: "HTTP MCP server with url only (inferred type) should pass", + workflow: `--- +on: issues +permissions: + contents: read +engine: copilot +mcp-servers: + test-http: + url: "https://example.com" +--- + +# Test workflow +`, + expectError: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // Create temporary workflow file + tmpDir := t.TempDir() + workflowPath := filepath.Join(tmpDir, "test.md") + if err := os.WriteFile(workflowPath, []byte(tt.workflow), 0644); err != nil { + t.Fatalf("Failed to write workflow file: %v", err) + } + + // Create compiler and try to compile the workflow + compiler := NewCompiler(false, "", "test") + err := compiler.CompileWorkflow(workflowPath) + + if tt.expectError { + if err == nil { + t.Errorf("Expected error but got none") + } else if tt.errorText != "" && !strings.Contains(err.Error(), tt.errorText) { + t.Errorf("Expected error to contain %q, got: %v", tt.errorText, err) + } + } else { + if err != nil { + t.Errorf("Unexpected error: %v", err) + } + } + }) + } +}