Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/cli/portfolio_analyst_workflow_contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
// unconfirmed-numeric Sentry fields. The tokens below are the stable contract
// surface; changing them requires updating both the workflow source and this test.
func TestPortfolioAnalystAvoidsInvalidSentryAggregations(t *testing.T) {
t.Parallel()
content, err := os.ReadFile(filepath.Join("..", "..", ".github", "workflows", "portfolio-analyst.md"))
if err != nil {
t.Fatalf("failed to read portfolio analyst workflow source: %v", err)
Expand Down Expand Up @@ -47,6 +48,7 @@ func TestPortfolioAnalystAvoidsInvalidSentryAggregations(t *testing.T) {
// The tokens below are the stable contract surface; changing them requires
// updating both the shared import and this test.
func TestSharedSentryImportFailsFastOnRepeatedQuery400s(t *testing.T) {
t.Parallel()
content, err := os.ReadFile(filepath.Join("..", "..", ".github", "workflows", "shared", "mcp", "sentry.md"))
if err != nil {
t.Fatalf("failed to read shared Sentry MCP import: %v", err)
Expand Down
2 changes: 2 additions & 0 deletions pkg/cli/pr_automerge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// TestWaitForWorkflowCompletionUsesSignalHandling verifies that WaitForWorkflowCompletion
// uses the signal-aware polling helper, which provides Ctrl-C support
func TestWaitForWorkflowCompletionUsesSignalHandling(t *testing.T) {
t.Parallel()
Comment on lines 13 to +14
// This test verifies that the function uses PollWithSignalHandling
// by checking that it times out correctly (a key feature of the helper)

Expand All @@ -30,6 +31,7 @@ func TestWaitForWorkflowCompletionUsesSignalHandling(t *testing.T) {
// propagates cancellation when the context is cancelled, so callers (e.g. the repeat loop)
// can detect an intentional interruption and stop immediately.
func TestWaitForWorkflowCompletion_ContextCancellation(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background())
// Cancel immediately so the poll loop exits on the first ctx.Done() check.
cancel()
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/pr_code_quality_reviewer_workflow_contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestPRCodeQualityReviewerWorkflowSubAgentModelContract(t *testing.T) {
t.Parallel()
repoRoot, err := gitutil.FindGitRoot()
if err != nil {
t.Skipf("Skipping test: not in a git repository: %v", err)
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/pr_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

func TestParsePRURL(t *testing.T) {
t.Parallel()
tests := []struct {
name string
url string
Expand Down Expand Up @@ -86,6 +87,7 @@ func TestParsePRURL(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
owner, repo, prNumber, err := parser.ParsePRURL(tt.url)

if tt.wantErr {
Expand Down Expand Up @@ -140,6 +142,7 @@ func TestPullRequestSupportsTransferAndAutomergeJSON(t *testing.T) {

// TestNewPRCommand tests that the PR command is created properly
func TestNewPRCommand(t *testing.T) {
t.Parallel()
cmd := NewPRCommand()

if cmd.Use != "pr" {
Expand Down Expand Up @@ -170,6 +173,7 @@ func TestNewPRCommand(t *testing.T) {

// TestNewPRTransferSubcommand tests that the transfer subcommand is created properly
func TestNewPRTransferSubcommand(t *testing.T) {
t.Parallel()
cmd := NewPRTransferSubcommand()

if cmd.Use != "transfer <pr-url>" {
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/pr_description_caveman_workflow_contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestPRDescriptionCavemanWorkflowSubAgentModelContract(t *testing.T) {
t.Parallel()
repoRoot, err := gitutil.FindGitRoot()
if err != nil {
t.Skipf("Skipping test: not in a git repository: %v", err)
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/pr_prefetch_cache_contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestSharedPRDiffDataFetchValidatesHeadSHAForCacheHit(t *testing.T) {
t.Parallel()
repoRoot, err := gitutil.FindGitRoot()
if err != nil {
t.Skipf("Skipping test: not in a git repository: %v", err)
Expand All @@ -29,6 +30,7 @@ func TestSharedPRDiffDataFetchValidatesHeadSHAForCacheHit(t *testing.T) {
}

func TestTopReviewWorkflowsHaveHeadAwarePRDataCacheKeys(t *testing.T) {
t.Parallel()
repoRoot, err := gitutil.FindGitRoot()
if err != nil {
t.Skipf("Skipping test: not in a git repository: %v", err)
Expand All @@ -51,6 +53,7 @@ func TestTopReviewWorkflowsHaveHeadAwarePRDataCacheKeys(t *testing.T) {
}

func TestImpeccableSkillsReviewerHasDeterministicSkillSelectionGuidance(t *testing.T) {
t.Parallel()
repoRoot, err := gitutil.FindGitRoot()
if err != nil {
t.Skipf("Skipping test: not in a git repository: %v", err)
Expand Down
14 changes: 14 additions & 0 deletions pkg/cli/project_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
)

func TestNewProjectCommand(t *testing.T) {
t.Parallel()
cmd := NewProjectCommand()
require.NotNil(t, cmd, "Command should be created")
assert.Equal(t, "project", cmd.Use, "Command name should be 'project'")
Expand All @@ -25,6 +26,7 @@ func TestNewProjectCommand(t *testing.T) {
}

func TestNewProjectNewCommand(t *testing.T) {
t.Parallel()
cmd := NewProjectNewCommand()
require.NotNil(t, cmd, "Command should be created")
assert.Equal(t, "new <title>", cmd.Use, "Command usage should be 'new <title>'")
Expand All @@ -43,6 +45,7 @@ func TestNewProjectNewCommand(t *testing.T) {
}

func TestProjectConfig(t *testing.T) {
t.Parallel()
tests := []struct {
name string
config ProjectConfig
Expand Down Expand Up @@ -80,6 +83,7 @@ func TestProjectConfig(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
assert.NotEmpty(t, tt.config.Title, "Project title should not be empty")
assert.NotEmpty(t, tt.config.Owner, "Project owner should not be empty")
assert.NotEmpty(t, tt.config.OwnerType, "Owner type should not be empty")
Expand All @@ -89,6 +93,7 @@ func TestProjectConfig(t *testing.T) {
}

func TestProjectNewCommandArgs(t *testing.T) {
t.Parallel()
cmd := NewProjectNewCommand()

tests := []struct {
Expand All @@ -115,6 +120,7 @@ func TestProjectNewCommandArgs(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
err := cmd.Args(cmd, tt.args)
if tt.shouldErr {
assert.Error(t, err, "Should return error for invalid arguments")
Expand All @@ -126,6 +132,7 @@ func TestProjectNewCommandArgs(t *testing.T) {
}

func TestProjectNewCommandFlags(t *testing.T) {
t.Parallel()
cmd := NewProjectNewCommand()

// Check standard flags
Expand All @@ -149,6 +156,7 @@ func TestProjectNewCommandFlags(t *testing.T) {
}

func TestParseProjectURL(t *testing.T) {
t.Parallel()
tests := []struct {
name string
url string
Expand Down Expand Up @@ -187,6 +195,7 @@ func TestParseProjectURL(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result, err := parseProjectURL(tt.url)
if tt.shouldErr {
assert.Error(t, err, "Should return error for invalid URL")
Expand All @@ -201,6 +210,7 @@ func TestParseProjectURL(t *testing.T) {
}

func TestEnsureSingleSelectOptionBefore(t *testing.T) {
t.Parallel()
tests := []struct {
name string
options []singleSelectOption
Expand Down Expand Up @@ -262,6 +272,7 @@ func TestEnsureSingleSelectOptionBefore(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result, changed := ensureSingleSelectOptionBefore(tt.options, tt.desired, tt.beforeName)
assert.Equal(t, tt.expectChanged, changed, "Changed status should match expectation")
assert.Len(t, result, tt.expectedLength, "Result length should match")
Expand Down Expand Up @@ -290,6 +301,7 @@ func TestEnsureSingleSelectOptionBefore(t *testing.T) {
}

func TestSingleSelectOptionsEqual(t *testing.T) {
t.Parallel()
tests := []struct {
name string
a []singleSelectOption
Expand Down Expand Up @@ -341,13 +353,15 @@ func TestSingleSelectOptionsEqual(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
result := singleSelectOptionsEqual(tt.a, tt.b)
assert.Equal(t, tt.expected, result, "Equality check should match expectation")
})
}
}

func TestProjectConfigWithProjectSetup(t *testing.T) {
t.Parallel()
tests := []struct {
name string
config ProjectConfig
Expand Down
11 changes: 11 additions & 0 deletions pkg/cli/redacted_domains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

func TestParseRedactedDomainsLog(t *testing.T) {
t.Parallel()
tests := []struct {
name string
logContent string
Expand Down Expand Up @@ -70,6 +71,7 @@ func TestParseRedactedDomainsLog(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
// Create a temporary file with the test content
tmpDir := t.TempDir()
logPath := filepath.Join(tmpDir, "redacted-urls.log")
Expand Down Expand Up @@ -100,13 +102,15 @@ func TestParseRedactedDomainsLog(t *testing.T) {
}

func TestParseRedactedDomainsLog_FileNotFound(t *testing.T) {
t.Parallel()
_, err := parseRedactedDomainsLog("/nonexistent/path/redacted-urls.log", false)
if err == nil {
t.Error("expected error for non-existent file, got nil")
}
}

func TestAnalyzeRedactedDomains_DirectPath(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
logContent := "example.com\ntest.org\n"
logPath := filepath.Join(tmpDir, "redacted-urls.log")
Expand All @@ -129,6 +133,7 @@ func TestAnalyzeRedactedDomains_DirectPath(t *testing.T) {
}

func TestAnalyzeRedactedDomains_AgentOutputsPath(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
agentOutputsDir := filepath.Join(tmpDir, "agent_outputs")
if err := os.MkdirAll(agentOutputsDir, 0755); err != nil {
Expand Down Expand Up @@ -156,6 +161,7 @@ func TestAnalyzeRedactedDomains_AgentOutputsPath(t *testing.T) {
}

func TestAnalyzeRedactedDomains_FullArtifactPath(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
fullPath := filepath.Join(tmpDir, "agent_outputs", "tmp", "gh-aw")
if err := os.MkdirAll(fullPath, 0755); err != nil {
Expand Down Expand Up @@ -183,6 +189,7 @@ func TestAnalyzeRedactedDomains_FullArtifactPath(t *testing.T) {
}

func TestAnalyzeRedactedDomains_NoLogFile(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()

analysis, err := analyzeRedactedDomains(tmpDir, false)
Expand All @@ -196,6 +203,7 @@ func TestAnalyzeRedactedDomains_NoLogFile(t *testing.T) {
}

func TestAnalyzeRedactedDomains_RecursiveSearch(t *testing.T) {
t.Parallel()
tmpDir := t.TempDir()
// Create a nested directory structure
nestedDir := filepath.Join(tmpDir, "some", "nested", "path")
Expand Down Expand Up @@ -228,6 +236,7 @@ func TestAnalyzeRedactedDomains_RecursiveSearch(t *testing.T) {
}

func TestRedactedDomainsAnalysis_ConsoleRendering(t *testing.T) {
t.Parallel()
// Test that the Domains field is rendered in console output
analysis := &RedactedDomainsAnalysis{
TotalDomains: 3,
Expand All @@ -253,6 +262,7 @@ func TestRedactedDomainsAnalysis_ConsoleRendering(t *testing.T) {
}

func TestRedactedDomainsLogSummary_ConsoleRendering(t *testing.T) {
t.Parallel()
// Test that the Domains field in RedactedDomainsLogSummary is rendered in console output
summary := &RedactedDomainsLogSummary{
TotalDomains: 2,
Expand All @@ -271,6 +281,7 @@ func TestRedactedDomainsLogSummary_ConsoleRendering(t *testing.T) {
}

func TestRedactedDomainsAnalysis_EmptyDomains(t *testing.T) {
t.Parallel()
// Test that empty domains list is handled correctly (omitempty)
analysis := &RedactedDomainsAnalysis{
TotalDomains: 0,
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/repo_error_messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

// TestRepoSlugErrorMessages verifies that repository slug format errors include examples
func TestRepoSlugErrorMessages(t *testing.T) {
t.Parallel()
tests := []struct {
name string
repoSlug string
Expand Down Expand Up @@ -54,6 +55,7 @@ func TestRepoSlugErrorMessages(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
// Test ensureTrialRepository function
err := ensureTrialRepository(tt.repoSlug, "", false, false, false)

Expand All @@ -74,6 +76,7 @@ func TestRepoSlugErrorMessages(t *testing.T) {

// TestParseRepoSpecErrorMessages verifies that parseRepoSpec errors include examples
func TestParseRepoSpecErrorMessages(t *testing.T) {
t.Parallel()
tests := []struct {
name string
repoSpec string
Expand Down Expand Up @@ -107,6 +110,7 @@ func TestParseRepoSpecErrorMessages(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
_, err := parseRepoSpec(tt.repoSpec)

if err == nil {
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/run_input_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestGetWorkflowInputs(t *testing.T) {
t.Parallel()
tests := []struct {
name string
lockContent string
Expand Down Expand Up @@ -73,6 +74,7 @@ jobs:

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
// Create a temporary directory
tmpDir := t.TempDir()
tmpFile := filepath.Join(tmpDir, "test-workflow.md")
Expand Down Expand Up @@ -115,6 +117,7 @@ jobs:
}

func TestValidateWorkflowInputs(t *testing.T) {
t.Parallel()
tests := []struct {
name string
lockContent string
Expand Down Expand Up @@ -309,6 +312,7 @@ jobs:

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
// Create a temporary directory
tmpDir := t.TempDir()
tmpFile := filepath.Join(tmpDir, "test-workflow.md")
Expand Down
Loading
Loading