[test-parallel] Add t.Parallel() to safe cross-run audit and agent example tests - #52860
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[test-parallel] Add t.Parallel() to safe cross-run audit and agent example tests#52860github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Analyzed 25 test files in pkg/cli (batch after add_description_test.go). Added t.Parallel() to: - TestAgentFriendlyOutputFailureScenario (audit_agent_example_test.go): pure struct construction, no shared state - 18 tests in audit_cross_run_test.go: buildCrossRunAuditReport/render/logs-command tests operating on local values with no env, filesystem, or shared-global mutation Left unparallelized: tests using os.Chdir, os.Setenv/t.Setenv, package-level mock globals, os.Stderr/os.Stdout reassignment, or external CLI/network dependencies (see sub-agent analysis). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Daily Go test parallelizer run analyzing a batch of 25
pkg/clitest files (round-robin, starting afterpkg/cli/add_description_test.go).Files analyzed (batch)
add_gitattributes_test.go,add_integration_test.go,add_interactive_engine_test.go,add_interactive_git_test.go,add_interactive_orchestrator_test.go,add_interactive_schedule_test.go,add_interactive_secrets_test.go,add_interactive_workflow_test.go,add_no_args_test.go,add_package_manifest_test.go,add_skill_rewrite_test.go,add_source_test.go,add_wildcard_test.go,add_wizard_command_test.go,add_wizard_tuistory_integration_test.go,add_workflow_pr_test.go,add_workflow_resolution_manifest_ref_test.go,add_workflow_resolution_redirect_test.go,audit_agent_example_test.go,audit_agent_output_test.go,audit_agentic_analysis_test.go,audit_ambient_context_test.go,audit_comparison_test.go,audit_concurrency_test.go,audit_cross_run_test.go.Changes made
pkg/cli/audit_agent_example_test.go: addedt.Parallel()toTestAgentFriendlyOutputFailureScenario— it only constructs localWorkflowRun/audit data values and has no shared state (the sibling test in the same file,TestAgentFriendlyOutputExample, was left untouched because a subtest reassigns the globalos.Stderr).pkg/cli/audit_cross_run_test.go: addedt.Parallel()to 18 top-level tests (TestBuildCrossRunAuditReport_*,TestRenderCrossRunReport*,TestNewLogsCommand_HasFormatFlag,TestLogsCommand_FormatPrecedence,TestLogsCommand_RepoParsingWithHost,TestBuildMetricsTrend_*,TestBuildDrain3InsightsFromCrossRunInputs_*) — all operate purely on locally-constructed values/report structs with no environment, filesystem, or shared-global mutation.TestRenderPrettyMetricsTrend_IncludesDurationWithoutTokenswas left alone because it reassigns globalos.Stderr.Left unchanged (unsafe)
Files/tests using
os.Chdir,os.Setenv/t.Setenv, package-level mock function globals,os.Stderr/os.Stdoutreassignment, external CLI/network dependencies (git, gh, npx/tuistory, PTY sessions), or fixed shared binaries were intentionally left withoutt.Parallel()per the safety rules.Validation
go build ./...— passes.go test -race ./pkg/cli/... -run '<all newly-parallel tests>'— all pass.go test ./pkg/cli/...— only two pre-existing, unrelated failures remain (TestRenderScheduleCalendarCell_UsesANSIInColorTerminal,TestConfirmRunAddedWorkflow_ContextCancelled), both environment-dependent (terminal color /ghauth) and untouched by this change.t.Parallel()additions in the two files above, no other changes.State persisted to cache for next round-robin run:
last_file = pkg/cli/audit_cross_run_test.go.