From 74a0870c23bc8c0061ecde2cfb22edfc18f70692 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 14:39:28 +0000 Subject: [PATCH 1/3] Initialize pull request for Daily Go Test Parallelizer From 4e2935f5ec070e9ba0260db2bfd652d22e3d0421 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 14:57:47 +0000 Subject: [PATCH 2/3] Initialize pull request for Daily Go Test Parallelizer From 7c9cd86d798efc02661d4527a74cedf987091ec3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 14:57:49 +0000 Subject: [PATCH 3/3] test: add t.Parallel() to safe tests in pkg/cli Added t.Parallel() to top-level tests and table-driven subtests in frontmatter_formatting_test.go, grant_test.go, help_text_test.go, helpers_json_test.go, and importpath_test.go after verifying each has no process-wide state, shared globals, or unsafe loop-variable capture. Verified with go test -race and full package suite (pre-existing network-sandbox failures unrelated to this change confirmed via git stash comparison). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/cli/frontmatter_formatting_test.go | 16 ++++++++++++++++ pkg/cli/grant_test.go | 7 +++++++ pkg/cli/help_text_test.go | 1 + pkg/cli/helpers_json_test.go | 3 +++ pkg/cli/importpath_test.go | 4 ++++ 5 files changed, 31 insertions(+) diff --git a/pkg/cli/frontmatter_formatting_test.go b/pkg/cli/frontmatter_formatting_test.go index d88b83031ae..9e193b34510 100644 --- a/pkg/cli/frontmatter_formatting_test.go +++ b/pkg/cli/frontmatter_formatting_test.go @@ -9,6 +9,7 @@ import ( // TestFormattingPreservation tests that frontmatter operations preserve comments, blank lines, and formatting func TestFormattingPreservation(t *testing.T) { + t.Parallel() originalContent := `--- on: workflow_dispatch: @@ -30,6 +31,7 @@ engine: claude This is test content.` t.Run("RemoveFieldFromOnTrigger preserves formatting", func(t *testing.T) { + t.Parallel() result, err := RemoveFieldFromOnTrigger(originalContent, "stop-after") if err != nil { t.Fatalf("Unexpected error: %v", err) @@ -68,6 +70,7 @@ This is test content.` }) t.Run("SetFieldInOnTrigger preserves formatting", func(t *testing.T) { + t.Parallel() result, err := SetFieldInOnTrigger(originalContent, "stop-after", "+72h") if err != nil { t.Fatalf("Unexpected error: %v", err) @@ -106,6 +109,7 @@ This is test content.` }) t.Run("UpdateFieldInFrontmatter preserves formatting", func(t *testing.T) { + t.Parallel() result, err := UpdateFieldInFrontmatter(originalContent, "source", "test/repo@v1.0.0") if err != nil { t.Fatalf("Unexpected error: %v", err) @@ -147,7 +151,9 @@ This is test content.` // // was updated to engine: copilot but the child " id: claude" line remained, producing invalid YAML. func TestUpdateFieldInFrontmatterBlockMapping(t *testing.T) { + t.Parallel() t.Run("replace block-mapped engine with scalar value removes child lines", func(t *testing.T) { + t.Parallel() content := `--- engine: id: claude @@ -182,6 +188,7 @@ permissions: }) t.Run("replace block-mapped engine with deeper nesting removes all child lines", func(t *testing.T) { + t.Parallel() content := `--- engine: id: claude @@ -211,6 +218,7 @@ source: owner/repo/workflow.md@main }) t.Run("replace scalar engine still works correctly", func(t *testing.T) { + t.Parallel() content := `--- engine: claude permissions: @@ -236,6 +244,7 @@ permissions: }) t.Run("update preserves nested fields with same name", func(t *testing.T) { + t.Parallel() content := `--- steps: - name: test @@ -265,7 +274,9 @@ source: owner/repo/workflow.md@old // TestRemoveFieldFromOnTriggerEdgeCases tests edge cases for field removal func TestRemoveFieldFromOnTriggerEdgeCases(t *testing.T) { + t.Parallel() t.Run("remove field that doesn't exist", func(t *testing.T) { + t.Parallel() content := `--- on: issues: @@ -286,6 +297,7 @@ permissions: }) t.Run("remove field from workflow without on block", func(t *testing.T) { + t.Parallel() content := `--- permissions: contents: read @@ -303,6 +315,7 @@ permissions: }) t.Run("field with similar prefix should not match", func(t *testing.T) { + t.Parallel() content := `--- on: workflow_dispatch: @@ -326,6 +339,7 @@ on: }) t.Run("on with inline value should not be treated as block", func(t *testing.T) { + t.Parallel() content := `--- on: push permissions: @@ -344,6 +358,7 @@ permissions: }) t.Run("multiline field value should be fully removed", func(t *testing.T) { + t.Parallel() content := `--- on: workflow_dispatch: @@ -373,6 +388,7 @@ on: }) t.Run("inline comment with multiple colons should be preserved", func(t *testing.T) { + t.Parallel() content := `--- on: workflow_dispatch: diff --git a/pkg/cli/grant_test.go b/pkg/cli/grant_test.go index 0c61cc55b64..1019854961d 100644 --- a/pkg/cli/grant_test.go +++ b/pkg/cli/grant_test.go @@ -12,6 +12,7 @@ import ( ) func TestGrantDisplayFindings_NilOutput(t *testing.T) { + t.Parallel() count, err := grantDisplayFindings("test-image:latest", nil) if err != nil { t.Fatalf("Expected no error for nil output, got: %v", err) @@ -22,6 +23,7 @@ func TestGrantDisplayFindings_NilOutput(t *testing.T) { } func TestGrantDisplayFindings_WithDeniedPackages(t *testing.T) { + t.Parallel() output := &grantOutput{} output.Run.Targets = []grantTargetResult{ { @@ -62,6 +64,7 @@ func TestGrantDisplayFindings_WithDeniedPackages(t *testing.T) { } func TestRunGrantOnLockFiles_NoLockFiles(t *testing.T) { + t.Parallel() err := runGrantOnLockFiles([]string{}, false, false) if err != nil { t.Errorf("Expected no error for empty lock file list, got: %v", err) @@ -69,6 +72,7 @@ func TestRunGrantOnLockFiles_NoLockFiles(t *testing.T) { } func TestGrantPolicyFile(t *testing.T) { + t.Parallel() policyFile, err := grantPolicyFile() if err != nil { t.Fatalf("Expected grant policy file, got: %v", err) @@ -79,6 +83,7 @@ func TestGrantPolicyFile(t *testing.T) { } func TestGrantRunOnImageRejectsInvalidImageRef(t *testing.T) { + t.Parallel() tmpDir := t.TempDir() policyFile := filepath.Join(tmpDir, "policy.yaml") require.NoError(t, os.WriteFile(policyFile, []byte("policy: true\n"), 0o644)) @@ -97,6 +102,7 @@ func TestGrantRunOnImageRejectsInvalidImageRef(t *testing.T) { for _, tt := range testCases { t.Run(tt.name, func(t *testing.T) { + t.Parallel() _, err := grantRunOnImage(tt.imageRef, policyFile, false) require.Error(t, err) require.ErrorContains(t, err, tt.want) @@ -105,6 +111,7 @@ func TestGrantRunOnImageRejectsInvalidImageRef(t *testing.T) { } func TestGrantRunOnImageVerboseCommandEscapesImageRef(t *testing.T) { + t.Parallel() tmpDir := t.TempDir() policyFile := filepath.Join(tmpDir, "policy file.yaml") require.NoError(t, os.WriteFile(policyFile, []byte("policy: true\n"), 0o644)) diff --git a/pkg/cli/help_text_test.go b/pkg/cli/help_text_test.go index 8678459ebee..b39552fe85b 100644 --- a/pkg/cli/help_text_test.go +++ b/pkg/cli/help_text_test.go @@ -8,6 +8,7 @@ import ( ) func TestWorkflowIDExplanation(t *testing.T) { + t.Parallel() // Test that the constant is not empty if WorkflowIDExplanation == "" { t.Error("WorkflowIDExplanation should not be empty") diff --git a/pkg/cli/helpers_json_test.go b/pkg/cli/helpers_json_test.go index 142e0646b55..5b07919b8af 100644 --- a/pkg/cli/helpers_json_test.go +++ b/pkg/cli/helpers_json_test.go @@ -10,7 +10,9 @@ import ( ) func TestMarshalIndentJSONOrWrap(t *testing.T) { + t.Parallel() t.Run("marshals value as indented JSON", func(t *testing.T) { + t.Parallel() data, err := marshalIndentJSONOrWrap(map[string]string{"a": "b"}, "test value") require.NoError(t, err) assert.JSONEq(t, `{"a":"b"}`, string(data)) @@ -18,6 +20,7 @@ func TestMarshalIndentJSONOrWrap(t *testing.T) { }) t.Run("wraps error with context", func(t *testing.T) { + t.Parallel() _, err := marshalIndentJSONOrWrap(make(chan int), "test value") require.Error(t, err) assert.Contains(t, err.Error(), "failed to marshal test value to JSON") diff --git a/pkg/cli/importpath_test.go b/pkg/cli/importpath_test.go index 2e612f2ad33..9f9e5eed3da 100644 --- a/pkg/cli/importpath_test.go +++ b/pkg/cli/importpath_test.go @@ -15,6 +15,7 @@ import ( // workflowspec paths are returned unchanged, "/" prefix paths become repo-relative // strings, and relative paths are cleaned and forward-slash normalised. func TestResolveImportPath_ImportsOpts(t *testing.T) { + t.Parallel() tmpDir := t.TempDir() workflowDir := filepath.ToSlash(filepath.Join(tmpDir, "workflows")) @@ -58,6 +59,7 @@ func TestResolveImportPath_ImportsOpts(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() result := resolveImportPath(tt.importPath, workflowDir, opts) assert.Equal(t, tt.expected, result, "resolveImportPath(%q, %q, importsOpts) = %q", tt.importPath, workflowDir, result) @@ -69,6 +71,7 @@ func TestResolveImportPath_ImportsOpts(t *testing.T) { // section refs are stripped, workflowspec paths return "", and relative paths are // joined with baseDir. func TestResolveImportPath_RunPushOpts(t *testing.T) { + t.Parallel() tmpDir := t.TempDir() baseDir := filepath.Join(tmpDir, "workflows") require.NoError(t, os.MkdirAll(baseDir, 0755)) @@ -107,6 +110,7 @@ func TestResolveImportPath_RunPushOpts(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + t.Parallel() result := resolveImportPath(tt.importPath, baseDir, opts) assert.Equal(t, tt.expected, result, "resolveImportPath(%q, %q, runPushOpts) = %q", tt.importPath, baseDir, result)