From 9c421f87ae2589fbedd50190176d460ce7e7cd1c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:44:57 +0000 Subject: [PATCH] Remove root workflow-specific Go tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../audit_workflows_repo_memory_test.go | 40 ---------- pkg/workflow/campaign_trigger_test.go | 45 ----------- ...y_agentrx_trace_optimizer_workflow_test.go | 33 --------- .../daily_byok_ollama_workflow_test.go | 37 ---------- .../daily_compiler_quality_workflow_test.go | 43 ----------- .../daily_model_inventory_workflow_test.go | 40 ---------- ...ly_safe_output_integrator_workflow_test.go | 74 ------------------- .../detection_workflow_frontmatter_test.go | 46 ------------ 8 files changed, 358 deletions(-) delete mode 100644 pkg/workflow/audit_workflows_repo_memory_test.go delete mode 100644 pkg/workflow/daily_agentrx_trace_optimizer_workflow_test.go delete mode 100644 pkg/workflow/daily_byok_ollama_workflow_test.go delete mode 100644 pkg/workflow/daily_compiler_quality_workflow_test.go delete mode 100644 pkg/workflow/daily_model_inventory_workflow_test.go delete mode 100644 pkg/workflow/daily_safe_output_integrator_workflow_test.go delete mode 100644 pkg/workflow/detection_workflow_frontmatter_test.go diff --git a/pkg/workflow/audit_workflows_repo_memory_test.go b/pkg/workflow/audit_workflows_repo_memory_test.go deleted file mode 100644 index 92a4cb717f4..00000000000 --- a/pkg/workflow/audit_workflows_repo_memory_test.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build !integration - -package workflow - -import ( - "os" - "strings" - "testing" -) - -func TestAuditWorkflowsSourceUsesExpandedRepoMemoryCategories(t *testing.T) { - workflowContent, err := os.ReadFile("../../.github/workflows/audit-workflows.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - - workflowContentStr := string(workflowContent) - - expectedSnippets := []string{ - "Repo Memory", - "workflow-trends.json", - "known-issues.json", - "recommendations.json", - "anomalies.json", - "metrics-summary.json", - "stable IDs", - "recurrence and persistence counters", - "cross-referenced across days", - } - - for _, snippet := range expectedSnippets { - if !strings.Contains(workflowContentStr, snippet) { - t.Fatalf("expected workflow source to contain %q", snippet) - } - } - - if strings.Contains(strings.ToLower(workflowContentStr), "cache memory") { - t.Fatalf("expected workflow source to use repo memory terminology") - } -} diff --git a/pkg/workflow/campaign_trigger_test.go b/pkg/workflow/campaign_trigger_test.go index df4f5aa0b90..083aadd8d73 100644 --- a/pkg/workflow/campaign_trigger_test.go +++ b/pkg/workflow/campaign_trigger_test.go @@ -104,48 +104,3 @@ tools: }) } } - -// TestCampaignGeneratorWorkflow specifically tests the agentic-campaign-generator workflow -// to ensure it compiles correctly with the labeled event type. -// The workflow uses 'labeled' event with the 'create-agentic-campaign' label filter -// to trigger campaign creation. -func TestCampaignGeneratorWorkflow(t *testing.T) { - compiler := NewCompiler() - - // Test compilation of the actual agentic-campaign-generator workflow - workflowPath := "../../.github/workflows/agentic-campaign-generator.md" - - // Check if file exists - if _, err := os.Stat(workflowPath); os.IsNotExist(err) { - t.Skip("agentic-campaign-generator.md not found, skipping test") - } - - // Compile the workflow - err := compiler.CompileWorkflow(workflowPath) - if err != nil { - t.Fatalf("Failed to compile agentic-campaign-generator workflow: %v", err) - } - - // Read the generated lock file - lockFile := stringutil.MarkdownToLockFile(workflowPath) - lockBytes, err := os.ReadFile(lockFile) - if err != nil { - t.Fatal(err) - } - lockContent := string(lockBytes) - - // Verify the labeled event type is present - if !strings.Contains(lockContent, "- labeled") { - t.Error("Expected 'labeled' event type in agentic-campaign-generator lock file") - } - - // Verify opened is not present (we switched from opened to labeled) - if strings.Contains(lockContent, "- opened") { - t.Error("Unexpected 'opened' event type in agentic-campaign-generator lock file - workflow should use 'labeled' event") - } - - // Verify the label name filter is present - if !strings.Contains(lockContent, "create-agentic-campaign") { - t.Error("Expected 'create-agentic-campaign' label filter in campaign-generator lock file") - } -} diff --git a/pkg/workflow/daily_agentrx_trace_optimizer_workflow_test.go b/pkg/workflow/daily_agentrx_trace_optimizer_workflow_test.go deleted file mode 100644 index 40fa976f6f8..00000000000 --- a/pkg/workflow/daily_agentrx_trace_optimizer_workflow_test.go +++ /dev/null @@ -1,33 +0,0 @@ -//go:build !integration - -package workflow - -import ( - "os" - "strings" - "testing" -) - -func TestDailyAgentRxTraceOptimizerWorkflowAllowsPythonNativeDependencies(t *testing.T) { - sourceContent, err := os.ReadFile("../../.github/workflows/daily-agentrx-trace-optimizer.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - - sourceContentStr := string(sourceContent) - if !strings.Contains(sourceContentStr, "allowed: [defaults, python-native, github]") { - t.Fatalf("expected workflow source to allow the python-native ecosystem for AgentRx installation") - } - - lockContent, err := os.ReadFile("../../.github/workflows/daily-agentrx-trace-optimizer.lock.yml") - if err != nil { - t.Fatalf("failed to read compiled workflow: %v", err) - } - - lockContentStr := string(lockContent) - for _, expected := range []string{"index.crates.io", "static.crates.io", "pypi.org"} { - if !strings.Contains(lockContentStr, expected) { - t.Fatalf("expected compiled workflow to allow %q for AgentRx installation", expected) - } - } -} diff --git a/pkg/workflow/daily_byok_ollama_workflow_test.go b/pkg/workflow/daily_byok_ollama_workflow_test.go deleted file mode 100644 index 0611d5c343d..00000000000 --- a/pkg/workflow/daily_byok_ollama_workflow_test.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build !integration - -package workflow - -import ( - "os" - "strings" - "testing" -) - -func TestDailyByokOllamaWorkflowHasReadinessAndAllowlist(t *testing.T) { - sourceContent, err := os.ReadFile("../../.github/workflows/daily-byok-ollama-test.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - source := string(sourceContent) - - if !strings.Contains(source, "- name: Verify Ollama BYOK readiness") { - t.Fatalf("expected source workflow to include an explicit Ollama readiness step") - } - if !strings.Contains(source, "ollama list | grep -Fq \"$OLLAMA_MODEL\"") { - t.Fatalf("expected source workflow to verify the required Ollama model is available") - } - if !strings.Contains(source, "curl -sf http://localhost:11434/v1/models") { - t.Fatalf("expected source workflow to probe /v1/models before the agent runs") - } - - lockContent, err := os.ReadFile("../../.github/workflows/daily-byok-ollama-test.lock.yml") - if err != nil { - t.Fatalf("failed to read compiled workflow: %v", err) - } - lock := string(lockContent) - - if !strings.Contains(lock, "host.docker.internal:11434") { - t.Fatalf("expected compiled workflow firewall allow-list to include host.docker.internal:11434") - } -} diff --git a/pkg/workflow/daily_compiler_quality_workflow_test.go b/pkg/workflow/daily_compiler_quality_workflow_test.go deleted file mode 100644 index 90a6d3ce46d..00000000000 --- a/pkg/workflow/daily_compiler_quality_workflow_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//go:build !integration - -package workflow - -import ( - "os" - "strings" - "testing" -) - -func TestDailyCompilerQualityWorkflowRequiresExplicitSafeOutputCompletion(t *testing.T) { - sourceContent, err := os.ReadFile("../../.github/workflows/daily-compiler-quality.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - - sourceContentStr := string(sourceContent) - for _, expected := range []string{ - " noop:", - "**Before finishing, confirm you called either `create_discussion` or `noop`.**", - "Keep the final `create_discussion.body` under **9 KB / 9000 bytes**.", - "Limit the report to the **top 3** strengths, **top 3** issues, and **top 3** recommended actions", - } { - if !strings.Contains(sourceContentStr, expected) { - t.Fatalf("expected workflow source to contain %q", expected) - } - } - - lockContent, err := os.ReadFile("../../.github/workflows/daily-compiler-quality.lock.yml") - if err != nil { - t.Fatalf("failed to read compiled workflow: %v", err) - } - - lockContentStr := string(lockContent) - for _, expected := range []string{ - "Tools: create_discussion, missing_tool, missing_data, noop", - "{{#runtime-import .github/workflows/daily-compiler-quality.md}}", - } { - if !strings.Contains(lockContentStr, expected) { - t.Fatalf("expected compiled workflow to contain %q", expected) - } - } -} diff --git a/pkg/workflow/daily_model_inventory_workflow_test.go b/pkg/workflow/daily_model_inventory_workflow_test.go deleted file mode 100644 index 0862c9bffeb..00000000000 --- a/pkg/workflow/daily_model_inventory_workflow_test.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build !integration - -package workflow - -import ( - "os" - "strings" - "testing" -) - -func TestDailyModelInventoryWorkflowFetchesReflectInAgentPrompt(t *testing.T) { - lockContent, err := os.ReadFile("../../.github/workflows/daily-model-inventory.lock.yml") - if err != nil { - t.Fatalf("failed to read compiled workflow: %v", err) - } - - lockContentStr := string(lockContent) - - if strings.Contains(lockContentStr, "- name: Fetch Copilot reflect inventory") { - t.Fatalf("expected compiled workflow to avoid pre-job Copilot reflect fetch step") - } - - sourceContent, err := os.ReadFile("../../.github/workflows/daily-model-inventory.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - sourceContentStr := string(sourceContent) - - if !strings.Contains(sourceContentStr, "### Step 0: Fetch Copilot Models from API Proxy") { - t.Fatalf("expected workflow prompt to include Copilot reflect fetch Step 0") - } - - if !strings.Contains(sourceContentStr, "curl -fsS http://api-proxy:10000/reflect") { - t.Fatalf("expected workflow prompt to fetch Copilot reflect data from api-proxy") - } - - if !strings.Contains(sourceContentStr, "the `billing.multiplier` field as the authoritative ET multiplier value") { - t.Fatalf("expected workflow prompt to use billing.multiplier from reflect as the primary source of truth") - } -} diff --git a/pkg/workflow/daily_safe_output_integrator_workflow_test.go b/pkg/workflow/daily_safe_output_integrator_workflow_test.go deleted file mode 100644 index 4533f3ad828..00000000000 --- a/pkg/workflow/daily_safe_output_integrator_workflow_test.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build !integration - -package workflow - -import ( - "os" - "strings" - "testing" -) - -func TestDailySafeOutputIntegratorHasToolBudgetAwareness(t *testing.T) { - sourceContent, err := os.ReadFile("../../.github/workflows/daily-safe-output-integrator.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - - sourceContentStr := string(sourceContent) - for _, expected := range []string{ - "If you are approaching the tool call limit, emit a partial result immediately rather than continuing to gather more data.", - "Process at most **20 missing types** per run.", - } { - if !strings.Contains(sourceContentStr, expected) { - t.Fatalf("expected daily-safe-output-integrator to contain tool budget awareness guidance %q", expected) - } - } -} - -func TestDailySafeOutputIntegratorIncludesTempCoverageScriptAllowlist(t *testing.T) { - sourceContent, err := os.ReadFile("../../.github/workflows/daily-safe-output-integrator.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - - sourceContentStr := string(sourceContent) - bashSectionStart := strings.Index(sourceContentStr, " bash:\n") - if bashSectionStart == -1 { - t.Fatal("expected workflow source to contain a bash tool allowlist") - } - bashSectionEnd := strings.Index(sourceContentStr[bashSectionStart:], " cli-proxy: true") - if bashSectionEnd == -1 { - t.Fatal("expected workflow source bash tool allowlist to end before cli-proxy") - } - bashSection := sourceContentStr[bashSectionStart : bashSectionStart+bashSectionEnd] - if !strings.Contains(bashSection, " - \"*\"") { - t.Fatal("expected bash allowlist to include wildcard access") - } - if !strings.Contains(bashSection, " - cat > /tmp/gh-aw/agent/*.py") { - t.Fatal("expected bash allowlist to include temporary coverage script creation") - } - - for _, expected := range []string{ - "- Create that temporary script with the edit tool or the allowed `cat > /tmp/gh-aw/agent/*.py` bash command, then run it with `python3`.", - "- Do not retry alternate shell-redirection paths; use only the allowed `/tmp/gh-aw/agent/` path.", - } { - if !strings.Contains(sourceContentStr, expected) { - t.Fatalf("expected workflow source guidance to contain %q", expected) - } - } - - lockContent, err := os.ReadFile("../../.github/workflows/daily-safe-output-integrator.lock.yml") - if err != nil { - t.Fatalf("failed to read compiled workflow: %v", err) - } - - lockContentStr := string(lockContent) - for _, expected := range []string{ - "--allow-all-tools", - "{{#runtime-import .github/workflows/daily-safe-output-integrator.md}}", - } { - if !strings.Contains(lockContentStr, expected) { - t.Fatalf("expected compiled workflow to contain %q", expected) - } - } -} diff --git a/pkg/workflow/detection_workflow_frontmatter_test.go b/pkg/workflow/detection_workflow_frontmatter_test.go deleted file mode 100644 index 9df54832d87..00000000000 --- a/pkg/workflow/detection_workflow_frontmatter_test.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build !integration - -package workflow - -import ( - "os" - "strings" - "testing" - - "github.com/github/gh-aw/pkg/parser" -) - -func TestDuplicateCodeDetectorWorkflowEnablesDetection(t *testing.T) { - sourceContent, err := os.ReadFile("../../.github/workflows/duplicate-code-detector.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - - result, err := parser.ExtractFrontmatterFromContent(string(sourceContent)) - if err != nil { - t.Fatalf("failed to parse workflow frontmatter: %v", err) - } - - features, ok := result.Frontmatter["features"].(map[string]any) - if !ok { - t.Fatal("expected Duplicate Code Detector workflow to define features in frontmatter") - } - if enabled, ok := features["gh-aw-detection"].(bool); !ok || !enabled { - t.Fatal("expected Duplicate Code Detector workflow to enable gh-aw-detection in frontmatter") - } -} - -func TestDetectionAnalysisReportDocumentsAgenticTokenAuditOptOut(t *testing.T) { - sourceContent, err := os.ReadFile("../../.github/workflows/detection-analysis-report.md") - if err != nil { - t.Fatalf("failed to read workflow source: %v", err) - } - - sourceContentStr := string(sourceContent) - if !strings.Contains(sourceContentStr, "Daily Agentic Workflow AIC Usage Audit") { - t.Fatal("expected detection analysis report to mention the Daily Agentic Workflow AIC Usage Audit opt-out") - } - if !strings.Contains(sourceContentStr, "source-managed") || !strings.Contains(sourceContentStr, "should not be reported as misconfigured") { - t.Fatal("expected detection analysis report to document a source-managed opt-out from name-based misconfiguration checks") - } -}