Skip to content

[test-parallel] Add t.Parallel() to safe top-level Go tests in pkg/cli codemod suite - #53491

Merged
pelikhan merged 1 commit into
mainfrom
go-test-parallelizer-batch-20260817-fe48637abc399c5a
Aug 17, 2026
Merged

[test-parallel] Add t.Parallel() to safe top-level Go tests in pkg/cli codemod suite#53491
pelikhan merged 1 commit into
mainfrom
go-test-parallelizer-batch-20260817-fe48637abc399c5a

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Daily automated pass adding t.Parallel() to top-level Go test functions in pkg/cli where it is demonstrably safe, per the round-robin batch starting after pkg/cli/codemod_safe_output_dispatch_repository_key_test.go.

Analysis

  • All codemod_*.go Apply implementations were inspected directly and confirmed to be pure closures: they operate only on local content/frontmatter inputs and package-level regexp.MustCompile(...) vars (safe for concurrent reads, no mutation). Their tests are safe to parallelize.
  • codespace_test.go: added t.Parallel() only to TestIs403PermissionError and TestGetCodespacePermissionErrorMessage. TestIsRunningInCodespace uses t.Setenv and was left untouched.
  • commands_utils_test.go: added to top-level tests using per-test temp dirs / pure string inputs and no process-wide state. Left unparallelized where table-driven subtests share a tmpDir and could not be proven collision-free without further changes.

Explicitly skipped (not modified)

  • commands_compile_workflow_test.go, commands_file_watching_test.go, commands_test.go, commands_new_test.go - use os.Chdir, global os.Stderr redirection, package-global version state, or other cross-test process-wide dependencies.

Validation

  • go test -race ./pkg/cli/... targeted at all modified top-level tests - all pass.
  • go test ./pkg/cli/... (full suite) - only pre-existing, environment-related failures remain (TestRunCompileUpdateCheck needs a local TCP port, TestRenderScheduleCalendarCell_UsesANSIInColorTerminal needs a TTY); reproduced identically on main without these changes, confirming they are unrelated to this PR.

No test behavior, assertions, or production code were changed - only t.Parallel() additions in the selected batch.

Generated by Daily Go Test Parallelizer · auto · 150.6 AIC · ⌖ 14 AIC · ⊞ 7.6K ·

  • expires on Aug 20, 2026, 1:01 PM UTC-08:00

Analyzed 25 test files (batch starting after last processed file
pkg/cli/codemod_safe_output_dispatch_repository_key_test.go) and added
t.Parallel() to top-level test functions confirmed safe:

- All codemod_*.go Apply implementations are pure closures operating on
  local content/frontmatter with only compiled regexp package vars
  (thread-safe for concurrent reads), so their tests are safe to run
  in parallel.
- codespace_test.go: added only to TestIs403PermissionError and
  TestGetCodespacePermissionErrorMessage (TestIsRunningInCodespace
  uses t.Setenv and was left untouched).
- commands_utils_test.go: added to top-level tests that use per-test
  temp dirs and no process-wide state; left subtests unparallelized
  where isolation could not be verified.

Skipped commands_compile_workflow_test.go, commands_file_watching_test.go,
commands_test.go, and commands_new_test.go due to os.Chdir/os.Setenv/
package-global state and other cross-test dependencies identified during
review.

Verified with 'go test -race' targeted at all modified tests (pass) and
a full 'go test ./pkg/cli/...' run showing only pre-existing, unrelated
failures (network-port-bound TestRunCompileUpdateCheck and TTY-detection
TestRenderScheduleCalendarCell_UsesANSIInColorTerminal), reproduced
identically on main without these changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review August 17, 2026 21:05
Copilot AI balanced review requested due to automatic review settings August 17, 2026 21:05
@pelikhan
pelikhan merged commit f7c344f into main Aug 17, 2026
@pelikhan
pelikhan deleted the go-test-parallelizer-batch-20260817-fe48637abc399c5a branch August 17, 2026 21:05
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Ponytail Reviewer completed successfully!

Lean already. Ship. Reviewed the full diff (102 additions, 0 deletions): every changed line is a single t.Parallel() call added to existing test functions, with no other modifications. No abstractions, wrappers, dependencies, or speculative flexibility introduced.

Generated by Ponytail Reviewer for #53491

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Design Decision Gate 🏗️ failed during design decision gate check.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Security scanning failed for PR Code Quality Reviewer. Review the logs for details.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /tdd — changes are safe and well-reasoned; approving.

📋 Analysis

Key Observations

  • TestIsRunningInCodespace correctly left un-parallelized (t.Setenv makes it unsafe)
  • ✅ All table-driven subtests that received a parallel top-level create their own tmpDir via testutil.TempDir(t, ...) — no shared state
  • ✅ Subtests remain sequential within parallel top-level functions, which is the correct pattern
  • ✅ PR description clearly explains the safety analysis for each file

No correctness issues found in the changed lines.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 21.8 AIC · ⌖ 12.6 AIC · ⊞ 7.8K
Comment /matt to run again

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds safe top-level parallelism to pkg/cli Go tests, reducing suite runtime without changing test behavior or production code.

Changes:

  • Parallelizes isolated codemod tests.
  • Parallelizes pure or temp-directory-isolated CLI utility and Codespaces tests.
  • Leaves process-global tests sequential.
Show a summary per file
File Description
pkg/cli/commands_utils_test.go Parallelizes isolated utility tests.
pkg/cli/codespace_test.go Parallelizes pure Codespaces helpers.
pkg/cli/codemod_workflow_dispatch_required_test.go Parallelizes workflow-dispatch codemod tests.
pkg/cli/codemod_user_rate_limit_test.go Parallelizes rate-limit migration tests.
pkg/cli/codemod_upload_assets_test.go Parallelizes upload-assets migration tests.
pkg/cli/codemod_top_level_env_secrets_test.go Parallelizes secret-detection codemod tests.
pkg/cli/codemod_toolset_singular_test.go Parallelizes toolset migration tests.
pkg/cli/codemod_timeout_minutes_test.go Parallelizes timeout migration tests.
pkg/cli/codemod_steps_run_secrets_env_test.go Parallelizes step-expression migration tests.
pkg/cli/codemod_slash_command_test.go Parallelizes slash-command migration tests.
pkg/cli/codemod_serena_mcp_location_test.go Parallelizes Serena location migration tests.
pkg/cli/codemod_serena_import_test.go Parallelizes Serena import migration tests.
pkg/cli/codemod_schema_file_test.go Parallelizes schema-file codemod tests.
pkg/cli/codemod_schedule_test.go Parallelizes schedule migration tests.
pkg/cli/codemod_sandbox_runtime_profile_test.go Parallelizes runtime-profile migration tests.
pkg/cli/codemod_sandbox_mcp_internal_test.go Parallelizes sandbox MCP migration tests.
pkg/cli/codemod_sandbox_agent_test.go Parallelizes sandbox-agent migration tests.
pkg/cli/codemod_sandbox_agent_false_removal_test.go Parallelizes agent-false removal tests.
pkg/cli/codemod_safe_output_require_title_prefix_test.go Parallelizes title-prefix migration tests.
pkg/cli/codemod_safe_output_merge_pr_constraints_test.go Parallelizes merge-constraint migration tests.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 20/20 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR correctly adds t.Parallel() to top-level test functions and their subtests across the codemod test suite in pkg/cli. The changes are purely mechanical — no range-loop variable capture issues, no shared mutable state, no side-effecting setup that would be unsafe under parallelism. LGTM ✅

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 17.5 AIC · ⌖ 8.77 AIC · ⊞ 5.7K

@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v0.87.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants