From 366809e53a6e55815bf774f62f971627f5bef896 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 10:38:14 +0000 Subject: [PATCH 1/3] Initialize pull request for Daily Go Test Parallelizer From fa38aadbf64e95db3e53db0a05e6e8a5c1565a96 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 10:57:23 +0000 Subject: [PATCH 2/3] Initialize pull request for Daily Go Test Parallelizer From 6730ff22bb6b7e25a4e4e925495079b027fff376 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 10:57:24 +0000 Subject: [PATCH 3/3] Add t.Parallel() to safe Go tests in daily batch Analyzed 25 Go test files (pkg/cli/contribution_check_workflow_contract_test.go through pkg/cli/engine_secrets_test.go) via parallel-safety-checker sub-agents. Added t.Parallel() to top-level tests and table-driven subtests in 6 files confirmed safe (no shared process-wide state, temp-dir isolation, no timing dependencies): - contribution_check_workflow_contract_test.go - copilot_agent_test.go - copilot_metrics_fix_test.go - copilot_token_extraction_test.go - drain3_integration_test.go - effective_tokens_compliance_test.go 19 files were flagged unsafe due to os.Chdir/os.Setenv usage, package-level global mutation, shared mock functions, or unverifiable dependencies, and were left unchanged. Validated with go build, go vet, and go test -race for all modified test functions; confirmed pre-existing unrelated failures (TestKnownEngineImportsDownload_UsesRawGitHubURL, TestCreateBootstrapGitHubApp_CanceledContext, TestBootstrapHelperUtilities, TestRenderScheduleCalendarCell_UsesANSIInColorTerminal, TestRunCompileUpdateCheck) also occur on the base branch (sandbox lacks IPv6 loopback for httptest; pre-existing TTY color flakiness). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/cli/contribution_check_workflow_contract_test.go | 2 ++ pkg/cli/copilot_agent_test.go | 9 +++++++++ pkg/cli/copilot_metrics_fix_test.go | 3 +++ pkg/cli/copilot_token_extraction_test.go | 4 ++++ pkg/cli/drain3_integration_test.go | 8 ++++++++ pkg/cli/effective_tokens_compliance_test.go | 12 ++++++++++++ 6 files changed, 38 insertions(+) diff --git a/pkg/cli/contribution_check_workflow_contract_test.go b/pkg/cli/contribution_check_workflow_contract_test.go index 07ac0ed0fc3..3450580b615 100644 --- a/pkg/cli/contribution_check_workflow_contract_test.go +++ b/pkg/cli/contribution_check_workflow_contract_test.go @@ -13,6 +13,7 @@ import ( ) func TestContributionCheckWorkflowSafeOutputContract(t *testing.T) { + t.Parallel() repoRoot, err := gitutil.FindGitRoot() if err != nil { t.Skipf("Skipping test: not in a git repository: %v", err) @@ -36,6 +37,7 @@ func TestContributionCheckWorkflowSafeOutputContract(t *testing.T) { } func TestContributionCheckWorkflowAllowsRequiredShellCommands(t *testing.T) { + t.Parallel() repoRoot, err := gitutil.FindGitRoot() if err != nil { t.Skipf("Skipping test: not in a git repository: %v", err) diff --git a/pkg/cli/copilot_agent_test.go b/pkg/cli/copilot_agent_test.go index 456672496cc..4c4b643dc64 100644 --- a/pkg/cli/copilot_agent_test.go +++ b/pkg/cli/copilot_agent_test.go @@ -10,6 +10,7 @@ import ( ) func TestCopilotCodingAgentDetector_IsGitHubCopilotCodingAgent(t *testing.T) { + t.Parallel() tests := []struct { name string setupFunc func(string) error @@ -96,6 +97,7 @@ func TestCopilotCodingAgentDetector_IsGitHubCopilotCodingAgent(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() // Create temporary directory for test tmpDir, err := os.MkdirTemp("", "copilot-agent-test-*") if err != nil { @@ -125,6 +127,7 @@ func TestCopilotCodingAgentDetector_IsGitHubCopilotCodingAgent(t *testing.T) { } func TestParseCopilotCodingAgentLogMetrics(t *testing.T) { + t.Parallel() tests := []struct { name string logContent string @@ -213,6 +216,7 @@ Task step 1 complete for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() metrics := ParseCopilotCodingAgentLogMetrics(tt.logContent, false) if tt.expectedTurns > 0 && metrics.Turns != tt.expectedTurns { @@ -235,6 +239,7 @@ Task step 1 complete } func TestExtractToolName(t *testing.T) { + t.Parallel() tests := []struct { name string line string @@ -311,6 +316,7 @@ func TestExtractToolName(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() result := extractToolName(tt.line) if result != tt.expected { t.Errorf("Expected '%s', got '%s'", tt.expected, result) @@ -320,6 +326,7 @@ func TestExtractToolName(t *testing.T) { } func TestIntegration_CopilotCodingAgentWithAudit(t *testing.T) { + t.Parallel() // Create a temporary directory that simulates a GitHub Copilot coding agent run // NOTE: GitHub Copilot coding agent runs do NOT have aw_info.json (that's for agentic workflows) tmpDir, err := os.MkdirTemp("", "copilot-agent-integration-*") @@ -373,6 +380,7 @@ Tool call: github_create_pr } func TestReadLogHeader(t *testing.T) { + t.Parallel() tmpDir, err := os.MkdirTemp("", "log-header-test-*") if err != nil { t.Fatalf("Failed to create temp dir: %v", err) @@ -397,6 +405,7 @@ func TestReadLogHeader(t *testing.T) { } func TestWorkflowLogMetricsConversion(t *testing.T) { + t.Parallel() // Test that our metrics are compatible with workflow.LogMetrics logContent := ` Task iteration 1 diff --git a/pkg/cli/copilot_metrics_fix_test.go b/pkg/cli/copilot_metrics_fix_test.go index b7043c552cd..be516c6fe17 100644 --- a/pkg/cli/copilot_metrics_fix_test.go +++ b/pkg/cli/copilot_metrics_fix_test.go @@ -30,6 +30,7 @@ import ( // The fix adds an explicit filepath.SkipDir return when the walk visits a directory // named "workflow-logs", so only the agent artifact files are counted. func TestExtractLogMetricsExcludesWorkflowLogsDir(t *testing.T) { + t.Parallel() tempDir := t.TempDir() // Simulate a Copilot-CLI run directory @@ -72,6 +73,7 @@ func TestExtractLogMetricsExcludesWorkflowLogsDir(t *testing.T) { // counted "User:"/"Human:"/"Query:" patterns that do not appear in Copilot CLI debug logs. // The fix counts each "[DEBUG] data:" block as one API response (one turn). func TestCopilotDebugLogTurnsExtraction(t *testing.T) { + t.Parallel() tempDir := t.TempDir() awInfoContent := `{"engine_id": "copilot"}` @@ -143,6 +145,7 @@ func TestCopilotDebugLogTurnsExtraction(t *testing.T) { // TestCopilotDebugLogMultipleToolCalls verifies that multiple "Executing tool:" lines // produce correct call counts in ToolCalls. func TestCopilotDebugLogMultipleToolCalls(t *testing.T) { + t.Parallel() tempDir := t.TempDir() awInfoContent := `{"engine_id": "copilot"}` diff --git a/pkg/cli/copilot_token_extraction_test.go b/pkg/cli/copilot_token_extraction_test.go index 6d5e192c35f..9eea2720666 100644 --- a/pkg/cli/copilot_token_extraction_test.go +++ b/pkg/cli/copilot_token_extraction_test.go @@ -19,6 +19,7 @@ import ( // 2. Log file contains JSON blocks with token usage // 3. extractLogMetrics correctly parses and accumulates token counts func TestCopilotTokenExtractionFromLogs(t *testing.T) { + t.Parallel() tempDir := t.TempDir() // Create aw_info.json with copilot engine @@ -107,6 +108,7 @@ func TestCopilotTokenExtractionFromLogs(t *testing.T) { // TestCopilotTokenExtractionWithSingleResponse tests extraction with just one API response func TestCopilotTokenExtractionWithSingleResponse(t *testing.T) { + t.Parallel() tempDir := t.TempDir() // Create aw_info.json with copilot engine @@ -142,6 +144,7 @@ func TestCopilotTokenExtractionWithSingleResponse(t *testing.T) { // TestCopilotTokenExtractionWithNoUsageData tests when logs don't contain usage data func TestCopilotTokenExtractionWithNoUsageData(t *testing.T) { + t.Parallel() tempDir := t.TempDir() // Create aw_info.json with copilot engine @@ -171,6 +174,7 @@ func TestCopilotTokenExtractionWithNoUsageData(t *testing.T) { // TestCopilotTokenExtractionWithRealLogData tests token extraction with actual log data // from workflow run 20696085597 (Smoke Copilot test) func TestCopilotTokenExtractionWithRealLogData(t *testing.T) { + t.Parallel() // This test validates real log data if available realLogPath := "/tmp/run-20696085597/sandbox/agent/logs/session-dd1eedf4-2b6d-4373-942c-1447d5a6e00a.log" diff --git a/pkg/cli/drain3_integration_test.go b/pkg/cli/drain3_integration_test.go index 0051f7e4ff6..2f9e3eb826f 100644 --- a/pkg/cli/drain3_integration_test.go +++ b/pkg/cli/drain3_integration_test.go @@ -10,6 +10,7 @@ import ( ) func TestBuildDrain3Insights_NoEvents(t *testing.T) { + t.Parallel() // A ProcessedRun with no meaningful events should return no insights. processedRun := ProcessedRun{} metrics := MetricsData{} @@ -20,6 +21,7 @@ func TestBuildDrain3Insights_NoEvents(t *testing.T) { } func TestBuildDrain3Insights_BasicRun(t *testing.T) { + t.Parallel() processedRun := ProcessedRun{ Run: WorkflowRun{ DatabaseID: 42, @@ -51,6 +53,7 @@ func TestBuildDrain3Insights_BasicRun(t *testing.T) { } func TestBuildDrain3Insights_WithErrors(t *testing.T) { + t.Parallel() processedRun := ProcessedRun{ Run: WorkflowRun{ DatabaseID: 99, @@ -83,6 +86,7 @@ func TestBuildDrain3Insights_WithErrors(t *testing.T) { } func TestBuildDrain3Insights_StageSequenceEvidence(t *testing.T) { + t.Parallel() processedRun := ProcessedRun{ Run: WorkflowRun{ DatabaseID: 7, @@ -111,6 +115,7 @@ func TestBuildDrain3Insights_StageSequenceEvidence(t *testing.T) { } func TestBuildDrain3InsightsMultiRun_Empty(t *testing.T) { + t.Parallel() insights := buildDrain3InsightsMultiRun(nil) assert.Empty(t, insights, "expected no insights for nil runs slice") @@ -119,6 +124,7 @@ func TestBuildDrain3InsightsMultiRun_Empty(t *testing.T) { } func TestBuildDrain3InsightsMultiRun_MultipleRuns(t *testing.T) { + t.Parallel() runs := []ProcessedRun{ { Run: WorkflowRun{ @@ -167,6 +173,7 @@ func TestBuildDrain3InsightsMultiRun_MultipleRuns(t *testing.T) { } func TestBuildAgentEventsFromProcessedRun(t *testing.T) { + t.Parallel() pr := ProcessedRun{ Run: WorkflowRun{ DatabaseID: 5, @@ -200,6 +207,7 @@ func TestBuildAgentEventsFromProcessedRun(t *testing.T) { } func TestBuildDrain3Insights_IncludedInAuditData(t *testing.T) { + t.Parallel() // Verify that buildAuditData appends drain3 insights to ObservabilityInsights. processedRun := ProcessedRun{ Run: WorkflowRun{ diff --git a/pkg/cli/effective_tokens_compliance_test.go b/pkg/cli/effective_tokens_compliance_test.go index 7e10b24d844..ece9a41f489 100644 --- a/pkg/cli/effective_tokens_compliance_test.go +++ b/pkg/cli/effective_tokens_compliance_test.go @@ -31,6 +31,7 @@ import ( // T-ET-001: Single invocation with all four token classes produces correct base_weighted_tokens. // Spec §4.3: base_weighted_tokens = (w_in × I) + (w_cache × C) + (w_out × O) + (w_reason × R) func TestETCompliance_T_ET_001_SingleInvocationBaseWeightedTokens(t *testing.T) { + t.Parallel() weights := types.TokenClassWeights{ Input: 1.0, CachedInput: 0.1, @@ -46,6 +47,7 @@ func TestETCompliance_T_ET_001_SingleInvocationBaseWeightedTokens(t *testing.T) // T-ET-002: Single invocation ET equals m × base_weighted_tokens. // Spec §4.4: effective_tokens = m × base_weighted_tokens func TestETCompliance_T_ET_002_SingleInvocationEffectiveTokens(t *testing.T) { + t.Parallel() weights := types.TokenClassWeights{ Input: 1.0, CachedInput: 0.1, @@ -61,6 +63,7 @@ func TestETCompliance_T_ET_002_SingleInvocationEffectiveTokens(t *testing.T) { // T-ET-003: Zero-value token classes do not affect the result. // Spec §4.3: zero-valued classes contribute zero to the sum. func TestETCompliance_T_ET_003_ZeroValueTokenClasses(t *testing.T) { + t.Parallel() weights := types.TokenClassWeights{ Input: 1.0, CachedInput: 0.1, @@ -75,6 +78,7 @@ func TestETCompliance_T_ET_003_ZeroValueTokenClasses(t *testing.T) { // T-ET-004: Custom weights are applied when default weights are overridden. // Spec §4.2: implementations MAY override default weights but MUST disclose them. func TestETCompliance_T_ET_004_CustomWeightsApplied(t *testing.T) { + t.Parallel() custom := types.TokenClassWeights{ Input: 2.0, // overridden CachedInput: 0.5, // overridden @@ -93,6 +97,7 @@ func TestETCompliance_T_ET_004_CustomWeightsApplied(t *testing.T) { // T-ET-010: Multi-invocation ET_total equals the sum of per-invocation ET values. // Spec §5.1: ET_total = Σ (m_i × base_weighted_tokens_i) func TestETCompliance_T_ET_010_MultiInvocationETTotal(t *testing.T) { + t.Parallel() weights := types.TokenClassWeights{Input: 1.0, CachedInput: 0.1, Output: 4.0, Reasoning: 4.0} // Invocation 1: model-a, m=2.0, I=500, C=200, O=150, R=0 → base=1120, ET=2240 @@ -114,6 +119,7 @@ func TestETCompliance_T_ET_010_MultiInvocationETTotal(t *testing.T) { // T-ET-011: raw_total_tokens equals the sum of all raw tokens across all invocations. // Spec §5.2: raw_total_tokens = Σ (I_i + C_i + O_i + R_i) func TestETCompliance_T_ET_011_RawTotalTokens(t *testing.T) { + t.Parallel() // Invocation 1: I=500, C=200, O=150, R=0 → raw=850 // Invocation 2: I=300, C=0, O=100, R=0 → raw=400 // Invocation 3: I=200, C=100, O=250, R=0 → raw=550 @@ -125,6 +131,7 @@ func TestETCompliance_T_ET_011_RawTotalTokens(t *testing.T) { // T-ET-012: total_invocations count includes root, sub-agents, and tool-triggered calls. // Spec §5.3: all invocations (root + sub-agents + tool-triggered) MUST be counted. func TestETCompliance_T_ET_012_TotalInvocationsCount(t *testing.T) { + t.Parallel() // Simulated invocation list: 1 root + 2 sub-agents = 3 total invocationIDs := []string{"root", "retrieval", "synthesis"} assert.Len(t, invocationIDs, 3, "T-ET-012: total_invocations must include root + all sub-agents") @@ -137,6 +144,7 @@ func TestETCompliance_T_ET_012_TotalInvocationsCount(t *testing.T) { // T-ET-020: Root node has parent_id = null. // Spec §6.2: the root invocation MUST have parent_id = null. func TestETCompliance_T_ET_020_RootNodeParentIDNull(t *testing.T) { + t.Parallel() type invocationNode struct { ID string ParentID *string @@ -148,6 +156,7 @@ func TestETCompliance_T_ET_020_RootNodeParentIDNull(t *testing.T) { // T-ET-021: All sub-agent nodes reference a valid parent_id. // Spec §6.3: each sub-agent invocation MUST reference a valid parent_id. func TestETCompliance_T_ET_021_SubAgentParentIDValid(t *testing.T) { + t.Parallel() parentID := "root" type invocationNode struct { ID string @@ -163,6 +172,7 @@ func TestETCompliance_T_ET_021_SubAgentParentIDValid(t *testing.T) { // usage.input_tokens, usage.cached_input_tokens, usage.output_tokens, // usage.reasoning_tokens, derived.base_weighted_tokens, derived.effective_tokens. func TestETCompliance_T_ET_022_NodeSchemaRequiredFields(t *testing.T) { + t.Parallel() type modelInfo struct { Name string `json:"name"` CopilotMultiplier float64 `json:"copilot_multiplier"` @@ -207,6 +217,7 @@ func TestETCompliance_T_ET_022_NodeSchemaRequiredFields(t *testing.T) { // T-ET-030: Summary object is present in all conforming responses. // Spec §7: a conforming response MUST include a summary object. func TestETCompliance_T_ET_030_SummaryObjectPresent(t *testing.T) { + t.Parallel() type summaryObject struct { TotalInvocations int `json:"total_invocations"` RawTotalTokens int `json:"raw_total_tokens"` @@ -233,6 +244,7 @@ func TestETCompliance_T_ET_030_SummaryObjectPresent(t *testing.T) { // T-ET-031: Summary values are consistent with per-invocation data. // Spec §7: summary.effective_tokens MUST equal Σ per-invocation effective_tokens. func TestETCompliance_T_ET_031_SummaryConsistentWithInvocations(t *testing.T) { + t.Parallel() weights := types.TokenClassWeights{Input: 1.0, CachedInput: 0.1, Output: 4.0, Reasoning: 4.0} perInvocationET := []float64{