Skip to content

feat(gotcha): introduce advanced Go test runner with rich CI/CD integration - #1483

Open
Erik Osterman (Cloud Posse) (osterman) wants to merge 93 commits into
mainfrom
fix/gotcha-output-improvements
Open

Erik Osterman (Cloud Posse) (osterman) wants to merge 93 commits into
mainfrom
fix/gotcha-output-improvements

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Sep 16, 2025 •

Copy link
Copy Markdown
Member

what

Introducing Gotcha - a sophisticated Go test runner that transforms the testing experience with real-time progress tracking, beautiful terminal output, and comprehensive CI/CD integration.

Core Components

Command-Line Interface

  • gotcha stream - Real-time test execution with TTY-aware output
  • gotcha parse - Process existing go test -json output files
  • Intelligent argument passing with -- separator for go test flags
  • Comprehensive flag system with environment variable support

Terminal User Interface (TUI)

  • Interactive progress bars with real-time completion percentage
  • Animated spinners during test execution
  • Live test counters (passed/failed/skipped)
  • Package-level visualization with clear headers
  • Subtest analysis with inline statistics
  • Graceful TTY detection and degradation

CI/CD Integration

  • Native GitHub Actions support with job summaries
  • Automated PR comment posting with multiple strategies
  • GitLab CI, Bitbucket, Azure DevOps foundations
  • Platform-specific context detection
  • Adaptive comment sizing for GitHub's limits

Output Formats

  • Terminal output with color profiles (TrueColor → ANSI256 → ANSI → NoColor)
  • Markdown generation for documentation
  • GitHub-flavored markdown with collapsible sections
  • JSON output for further processing
  • Coverage reports with function-level detail

Test Management

  • Smart test filtering with automatic -run flag detection
  • Package discovery and organization
  • Subtest hierarchy visualization
  • Skip reason extraction and reporting
  • Build failure detection and reporting

Performance Features

  • Intelligent caching system for test counts
  • Streaming output with minimal buffering
  • Concurrent package execution support
  • Memory-efficient JSON parsing

why

Go's native test runner provides minimal feedback during test execution, making it difficult to:

  • Track progress in large test suites
  • Understand test failures in CI environments
  • Generate readable reports for stakeholders
  • Integrate with modern CI/CD platforms

Gotcha solves these problems by providing:

  1. Real-time feedback - Know exactly what's happening during test runs
  2. CI/CD integration - Automatic GitHub comments, job summaries, and adaptive formatting
  3. Beautiful output - Clear, organized results that are easy to understand
  4. Flexible operation - Works as a test runner or result processor
  5. Cross-platform support - Consistent behavior on Linux, macOS, and Windows

Technical Implementation

Architecture

  • Stream Processing Pipeline - Real-time JSON event processing from go test -json
  • Output Abstraction Layer - Unified interface for UI/Data streams with environment-specific routing
  • Coverage Analysis Engine - Function and statement-level coverage with mock exclusion
  • CI Provider Detection - Automatic platform detection with provider-specific features
  • Configuration System - Viper-based with clear precedence (CLI → ENV → Config → Defaults)

Key Technologies

  • Bubble Tea - Terminal UI framework for interactive progress tracking
  • Lipgloss - Terminal styling with adaptive color profiles
  • Cobra/Viper - CLI framework and configuration management
  • Go test -json - Streaming test event processing
  • GitHub GraphQL API - PR comment management and updates

Testing Infrastructure

  • 70+ test files with comprehensive coverage
  • Integration tests for all major workflows
  • Mock CI providers for testing
  • TUI harness for interactive mode testing
  • Platform-specific test handling

Features Implemented

✅ Stream Mode

  • Real-time test execution with progress tracking
  • TTY detection with automatic mode switching
  • Interactive TUI with progress bars and spinners
  • Headless mode for CI environments
  • Package-level organization and visualization
  • Subtest statistics and hierarchical display

✅ Parse Mode

  • Process existing JSON test output
  • Multiple output format generation
  • Coverage analysis and reporting
  • VCS platform integration

✅ CI/CD Integration

  • GitHub Actions with job summaries
  • PR comment posting with updates
  • Adaptive comment sizing
  • Multiple posting strategies (always, on-failure, skip-only)
  • Platform-specific context detection

✅ Configuration

  • YAML configuration files
  • Environment variable support
  • CLI flag overrides
  • Clear precedence rules
  • Cache management for performance

✅ Output Handling

  • Unified output interface (output.Writer)
  • Environment-specific routing
  • Color profile detection
  • Format-specific generators
  • Skip reason extraction and display

references

Testing

The implementation includes extensive testing:

  • Unit tests for all core components
  • Integration tests for CLI workflows
  • Mock providers for CI testing
  • TUI harness for interactive testing
  • Cross-platform compatibility tests
  • 30,000+ lines of code with comprehensive test coverage

This PR represents a major step forward by providing a test runner that significantly improves the Go testing experience for both local development and CI/CD workflows.

@osterman

Copy link
Copy Markdown
Member Author

This PR contains the output-related fixes that were part of the larger #1431 PR. The scope has been narrowed to focus specifically on improving test output handling, fixing skip reason parsing, and ensuring proper CI/CD integration.

The main improvements include:

  • ✅ Skip reasons now properly appear in GitHub summaries
  • ✅ Consistent output handling through the interface
  • ✅ Fixed error message placement that was disrupting formatted output
  • ✅ Windows compatibility for the ptyrunner tool
  • ✅ Prevention of duplicate GitHub job summaries

All changes have been tested comprehensively with new test cases covering various skip reason patterns and output scenarios.

@osterman

Copy link
Copy Markdown
Member Author

This PR contains the output-related fixes that were part of the larger #1431 PR. The scope has been narrowed to focus specifically on improving test output handling, fixing skip reason parsing, and ensuring proper CI/CD integration.

The main improvements include:

  • ✅ Skip reasons now properly appear in GitHub summaries
  • ✅ Consistent output handling through the output.Writer interface
  • ✅ Fixed error message placement that was disrupting formatted output
  • ✅ Windows compatibility for the ptyrunner tool
  • ✅ Prevention of duplicate GitHub job summaries

All changes have been tested comprehensively with new test cases covering various skip reason patterns and output scenarios.

@github-actions github-actions Bot added the size/xl Extra large size PR label Sep 16, 2025
@mergify mergify Bot added the triage Needs triage label Sep 16, 2025
@mergify

mergify Bot commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify

mergify Bot commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

Warning

This PR exceeds the recommended limit of 1,000 lines.

Large PRs are difficult to review and may be rejected due to their size.

Please verify that this PR does not address multiple issues.
Consider refactoring it into smaller, more focused PRs to facilitate a smoother review process.

@github-actions

github-actions Bot commented Sep 16, 2025 •

Copy link
Copy Markdown

❌ Test Results (gotcha/ubuntu-latest)

Passed Failed Skipped Build Failed

❌ Build Failures (1)

Click to see packages that failed to build
Package Error
stream Build failed

Run locally to debug:

go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream

❌ Failed Tests (17)

Click to see failed tests
Test Package Duration
TestAnalyzeProcessFailure stream 0.00s
TestAnalyzeProcessFailure/build_constraints_exclude stream 0.00s
TestAnalyzeProcessFailure/cannot_find_module stream 0.00s
TestAnalyzeProcessFailure/cannot_find_package stream 0.00s
TestAnalyzeProcessFailure/compilation_error stream 0.00s
TestAnalyzeProcessFailure/go_command_not_found stream 0.00s
TestAnalyzeProcessFailure/no_Go_files stream 0.00s
TestAnalyzeProcessFailure/no_Go_files_alternative stream 0.00s
TestAnalyzeProcessFailure/normal_test_failure stream 0.00s
TestAnalyzeProcessFailure/package_not_found stream 0.00s
TestAnalyzeProcessFailure/permission_denied stream 0.00s
TestAnalyzeProcessFailure/signal_terminated stream 0.00s
TestAnalyzeProcessFailure/timeout stream 0.00s
TestAnalyzeProcessFailure/unknown_error stream 0.00s
TestExtractExitCode stream 0.00s
TestExtractExitCode/exit_status_2 stream 0.00s
TestExtractExitCode/non-exit_error stream 0.00s

Run locally to reproduce:

go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/build_constraints_exclude$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/cannot_find_module$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/cannot_find_package$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/compilation_error$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/go_command_not_found$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/no_Go_files$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/no_Go_files_alternative$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/normal_test_failure$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/package_not_found$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/permission_denied$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/signal_terminated$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/timeout$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/unknown_error$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestExtractExitCode$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestExtractExitCode/exit_status_2$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestExtractExitCode/non-exit_error$ -v

⏭️ Skipped Tests (9)

Click to see skipped tests
Test Package Reason
TestAllTestsFail_ShowFilter test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestAllTestsPass_ShowFilter test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestAnotherSkip test No reason provided
TestFilteredOutput_ShowsOnlyFailures test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestParser_HandlesEmptyCoverage test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestParser_WithRealGoTestOutput test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestShowFailedFilter_ParsesCorrectly test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestSkipExample test No reason provided
TestSkipReason test Skipping test: example skip with formatted reason - test number 42

📊 Test Coverage

Metric Coverage Details
Statement Coverage 51.7% 🟡 (excluded 103 mock files)
Function Coverage 68.3% 🟡 278/407 functions covered
⏱️ Slowest Tests (20)
Test Package Duration % of Total
TestHandleTestComplete tui 6.00s 14.3%
TestTUIWithTeatest test 4.01s 9.6%
TestRetryLogic github 4.00s 9.6%
TestFindExistingCommentErrorCases github 3.00s 7.2%
TestFindExistingCommentErrorCases/API_error github 3.00s 7.2%
TestRetryLogic/failure_after_all_retries github 3.00s 7.2%
TestTUIWithTeatest/process_test_events test 2.01s 4.8%
TestHandleTestComplete/sets_exit_code_from_message tui 2.00s 4.8%
TestTUIPackageTracking test 2.00s 4.8%
TestTUIWithTeatest/test_output_capture test 2.00s 4.8%
TestHandleTestComplete/preserves_non-zero_exit_code tui 2.00s 4.8%
TestHandleTestComplete/closes_JSON_file_if_open tui 2.00s 4.8%
TestParseCoverageProfileEnhanced coverage 1.13s 2.7%
TestRetryLogic/success_after_retry github 1.00s 2.4%
TestParseCoverageProfile coverage 0.90s 2.2%
TestParseCoverageProfileEnhanced/enhanced_coverage_with_mocks_excluded coverage 0.62s 1.5%
TestParseTestJSONEnhanced/test_with_coverage_file parser 0.54s 1.3%
TestParseTestJSONEnhanced parser 0.54s 1.3%
TestParseCoverageProfile/valid_coverage_profile_with_mocks_excluded coverage 0.52s 1.2%
TestParseCoverageProfileEnhanced/enhanced_coverage_with_mocks_included coverage 0.51s 1.2%
📦 Package Summary (18 packages)
Package Tests Total Duration Avg Duration
github 68 14.50s 0.21s
tui 108 12.00s 0.11s
test 50 10.02s 0.20s
coverage 91 4.12s 0.05s
parser 84 1.08s 0.01s
markdown 115 0.06s 0.00s
git 14 0.03s 0.00s
gotcha 321 0.03s 0.00s
ci 19 0.00s 0.00s
config 78 0.00s 0.00s
output 9 0.00s 0.00s
types 31 0.00s 0.00s
cache 9 0.00s 0.00s
logger 16 0.00s 0.00s
stream 151 0.00s 0.00s
utils 101 0.00s 0.00s
output 35 0.00s 0.00s
mock 24 0.00s 0.00s

Total Time: 7.26s

@github-actions

github-actions Bot commented Sep 16, 2025 •

Copy link
Copy Markdown

❌ Test Results (gotcha/macos-latest)

Passed Failed Skipped Build Failed

❌ Build Failures (1)

Click to see packages that failed to build
Package Error
stream Build failed

Run locally to debug:

go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream

❌ Failed Tests (17)

Click to see failed tests
Test Package Duration
TestAnalyzeProcessFailure stream 0.00s
TestAnalyzeProcessFailure/build_constraints_exclude stream 0.00s
TestAnalyzeProcessFailure/cannot_find_module stream 0.00s
TestAnalyzeProcessFailure/cannot_find_package stream 0.00s
TestAnalyzeProcessFailure/compilation_error stream 0.00s
TestAnalyzeProcessFailure/go_command_not_found stream 0.00s
TestAnalyzeProcessFailure/no_Go_files stream 0.00s
TestAnalyzeProcessFailure/no_Go_files_alternative stream 0.00s
TestAnalyzeProcessFailure/normal_test_failure stream 0.00s
TestAnalyzeProcessFailure/package_not_found stream 0.00s
TestAnalyzeProcessFailure/permission_denied stream 0.00s
TestAnalyzeProcessFailure/signal_terminated stream 0.00s
TestAnalyzeProcessFailure/timeout stream 0.00s
TestAnalyzeProcessFailure/unknown_error stream 0.00s
TestExtractExitCode stream 0.00s
TestExtractExitCode/exit_status_2 stream 0.00s
TestExtractExitCode/non-exit_error stream 0.00s

Run locally to reproduce:

go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/build_constraints_exclude$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/cannot_find_module$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/cannot_find_package$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/compilation_error$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/go_command_not_found$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/no_Go_files$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/no_Go_files_alternative$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/normal_test_failure$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/package_not_found$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/permission_denied$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/signal_terminated$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/timeout$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestAnalyzeProcessFailure/unknown_error$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestExtractExitCode$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestExtractExitCode/exit_status_2$ -v
go test github.com/cloudposse/atmos/tools/gotcha/pkg/stream -run ^TestExtractExitCode/non-exit_error$ -v

⏭️ Skipped Tests (9)

Click to see skipped tests
Test Package Reason
TestAllTestsFail_ShowFilter test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestAllTestsPass_ShowFilter test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestAnotherSkip test No reason provided
TestFilteredOutput_ShowsOnlyFailures test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestParser_HandlesEmptyCoverage test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestParser_WithRealGoTestOutput test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestShowFailedFilter_ParsesCorrectly test Skipping integration test: set GOTCHA_ENABLE_INTEGRATION_TESTS=1 to run
TestSkipExample test No reason provided
TestSkipReason test Skipping test: example skip with formatted reason - test number 42

📊 Test Coverage

Metric Coverage Details
Statement Coverage 51.7% 🟡 (excluded 103 mock files)
Function Coverage 68.3% 🟡 278/407 functions covered
⏱️ Slowest Tests (20)
Test Package Duration % of Total
TestHandleTestComplete tui 6.01s 13.7%
TestTUIWithTeatest test 4.02s 9.2%
TestRetryLogic github 4.01s 9.2%
TestFindExistingCommentErrorCases github 3.00s 6.9%
TestFindExistingCommentErrorCases/API_error github 3.00s 6.9%
TestRetryLogic/failure_after_all_retries github 3.00s 6.9%
TestTUIWithTeatest/process_test_events test 2.01s 4.6%
TestHandleTestComplete/sets_exit_code_from_message tui 2.00s 4.6%
TestHandleTestComplete/preserves_non-zero_exit_code tui 2.00s 4.6%
TestTUIWithTeatest/test_output_capture test 2.00s 4.6%
TestTUIPackageTracking test 2.00s 4.6%
TestHandleTestComplete/closes_JSON_file_if_open tui 2.00s 4.6%
TestParseCoverageProfileEnhanced coverage 1.04s 2.4%
TestRetryLogic/success_after_retry github 1.00s 2.3%
TestRealClientMethods github 1.00s 2.3%
TestParseCoverageProfile coverage 0.75s 1.7%
TestParseCoverageProfileEnhanced/enhanced_coverage_with_mocks_excluded coverage 0.57s 1.3%
TestRealClientMethods/ListIssueComments_method_exists github 0.51s 1.2%
TestClientInterface github 0.51s 1.2%
TestClientInterface/client_0 github 0.51s 1.2%
📦 Package Summary (18 packages)
Package Tests Total Duration Avg Duration
github 68 17.02s 0.25s
tui 108 12.01s 0.11s
test 50 10.03s 0.20s
coverage 91 3.70s 0.04s
parser 84 0.68s 0.01s
markdown 115 0.20s 0.00s
git 14 0.12s 0.01s
gotcha 321 0.02s 0.00s
ci 19 0.01s 0.00s
logger 16 0.00s 0.00s
cache 9 0.00s 0.00s
utils 101 0.00s 0.00s
mock 24 0.00s 0.00s
stream 151 0.00s 0.00s
output 35 0.00s 0.00s
config 78 0.00s 0.00s
output 9 0.00s 0.00s
types 31 0.00s 0.00s

Total Time: 8.54s

@osterman Erik Osterman (Cloud Posse) (osterman) changed the title fix(gotcha): improve test output handling and skip reason parsing feat(gotcha): introduce advanced Go test runner with rich CI/CD integration Sep 16, 2025
- Add gotcha tool directory structure
- Configure build system with Makefile
- Set up linting with golangci-lint
- Initialize go.mod for dependency management
- Add README with tool overview
- Configure .gotcha.yaml for default settings

@github-advanced-security github-advanced-security 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.

golangci-lint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

- Add root command with global flags and configuration
- Implement 'stream' command for real-time test execution
- Implement 'parse' command for processing JSON output
- Add stream orchestrator for execution coordination
- Add GitHub integration for PR comments and job summaries
- Configure Viper-based configuration system
- Add ptyrunner for terminal emulation support
- pkg/stream: Real-time test streaming and processing
- pkg/ci: Multi-platform CI/CD provider detection and integration
- pkg/cache: Intelligent test count caching system
- pkg/config: Configuration management and environment detection
- pkg/output: Unified output abstraction layer
- pkg/types: Core data structures and interfaces
- pkg/utils: Shared utilities and helpers
- pkg/constants: Application-wide constants
- pkg/errors: Centralized error definitions
- internal/tui: Terminal UI with Bubble Tea framework
- internal/parser: JSON output parsing and analysis
- internal/markdown: Markdown generation for reports
- internal/coverage: Coverage analysis and reporting
- internal/output: Output formatting and routing
- internal/logger: Structured logging with Charm
- internal/git: Git operations for PR context
- Add integration tests for CLI commands
- Add TUI harness for interactive mode testing
- Add test fixtures for various scenarios
- Add mock service implementations
- Add test helpers and utilities
- Add cross-platform test handling
- Add GitHub summary integration tests
- Add Product Requirements Document (PRD) for gotcha
- Add Claude AI development agents and commands
- Document architecture and design decisions
- Include test plans and acceptance criteria
- Add implementation notes and guidelines
- Add GitHub workflow for gotcha testing
- Update main Makefile with gotcha targets
- Update project README to include gotcha
- Configure .gitignore for gotcha artifacts
- Update go.mod with gotcha dependencies
- Add CI debug documentation
- Add TUI testing demo script
- Add detailed documentation for features
- Include usage examples and guides
@osterman

Copy link
Copy Markdown
Member Author

✅ Commit history has been cleaned up!

Successfully squashed 229 commits into 8 logical, well-organized commits:

  1. Initial setup - Tool infrastructure and configuration
  2. CLI commands - Core stream and parse commands
  3. Package implementations - All pkg/ modules
  4. Internal components - TUI, parser, markdown, coverage
  5. Test suite - Comprehensive tests and fixtures
  6. Documentation - PRD and development guides
  7. CI/CD integration - GitHub workflows and project integration
  8. Demo and guides - Usage examples and additional docs

The PR is now much cleaner and easier to review!

@github-actions

github-actions Bot commented Sep 16, 2025 •

Copy link
Copy Markdown

❌ Test Results (atmos/windows)

Passed Failed Skipped Build Failed

❌ Build Failures (2)

Click to see packages that failed to build
Package Error
exec Build failed
tests Build failed

Run locally to debug:

go test github.com/cloudposse/atmos/internal/exec
go test github.com/cloudposse/atmos/tests

❌ Failed Tests (3)

Click to see failed tests
Test Package Duration
TestYamlFuncTerraformOutput exec 1.81s
TestCLICommands tests 127.87s
TestCLICommands/!terraform.output_from_component_with_!env_function_test tests 1.30s

Run locally to reproduce:

go test github.com/cloudposse/atmos/internal/exec -run ^TestYamlFuncTerraformOutput$ -v
go test github.com/cloudposse/atmos/tests -run ^TestCLICommands$ -v
go test github.com/cloudposse/atmos/tests -run ^TestCLICommands/!terraform.output_from_component_with_!env_function_test$ -v

⏭️ Skipped Tests (28)

Click to see skipped tests
Test Package Reason
TestCollectComponentsDirectoryObjects_WithDuplicatePaths exec Skipping integration test that requires file system setup
TestCopyFile_FailChmod exec Skipping test: os.Chmod not effective on this platform
TestCreateTempDirectory exec Skipping permission check on Windows: Unix permissions not applicable
TestGetMatchesForPattern_ShallowNoMatch exec Skipping shallow no-match test on Windows: glob behavior differs
TestProcessDirEntry_Symlink exec Skipping symlink test on Windows: symlinks require special privileges
TestShouldExcludePath_Directory exec Skipping directory exclusion test on Windows: path handling differs
TestCustomGitGetter_Get_RemoveSymlinkError downloader Skipping read-only directory test on Windows: read-only semantics differ
TestGoGetterGet_File downloader Skipping file copying test on Windows: file system differences may cause issues
TestRemoveSymlinks downloader Skipping symlink tests on Windows: symlinks require special privileges
TestRemoveSymlinks_WalkError_Propagates downloader Skipping permission-based Walk error test on Windows: permissions work differently
TestExecuteListInstancesCmd/basic_command_execution list No reason provided
TestExecuteListInstancesCmd/command_with_upload_flag list No reason provided
TestProcessInstances/empty_config list No reason provided
TestProcessInstances/successful_processing list No reason provided
TestUploadInstances/empty_instances list No reason provided
TestUploadInstances/successful_upload list No reason provided
TestOriginalBehaviorWouldPrint merge No reason provided
TestNewGSMStore/with_credentials_from_env store No reason provided
TestGetComponentPath/sandbox_scenario_with_absolute_override utils Skipping test on Windows
TestPreconditionSkipping/EnvVar_missing_causes_skip tests No reason provided
TestPreconditionSkipping/Executable_missing_causes_skip tests No reason provided
TestPreconditionSkipping/File_path_missing_causes_skip tests No reason provided
TestRequireAWSProfile_NonExistent tests No reason provided
TestRequireGitRemoteWithValidURL_InvalidRemote tests No reason provided
TestRequireGitRemoteWithValidURL_NoRemotes tests No reason provided
TestRequireGitRepository_NotInRepo tests No reason provided
TestRequireNetworkAccess_InvalidURL tests No reason provided
TestRequireOCIAuthentication_WithoutToken tests No reason provided

📊 Test Coverage

Metric Coverage Details
Statement Coverage 4.8% 🔴 (excluded 4436 mock files)
Function Coverage 79.3% 🟡 1052/1326 functions covered
⏱️ Slowest Tests (20)
Test Package Duration % of Total
TestDescribeAffectedWithTargetRefClone describe 27.69s 6.4%
TestExecuteVendorPull exec 24.52s 5.6%
TestExecuteAtlantisGenerateRepoConfigAffectedOnly exec 24.07s 5.5%
TestExecuteTerraformAffectedWithDependents exec 23.03s 5.3%
TestCLICommands/atmos_vendor_pull_with_globs tests 20.96s 4.8%
TestCLICommands/atmos_vendor_pull_no_tty tests 20.51s 4.7%
TestCLICommands/atmos_vendor_pull tests 17.14s 3.9%
TestReadTerraformBackendS3_InvalidConfig terraform_backend 16.17s 3.7%
Test_ReadTerraformBackendS3Internal_Errors terraform_backend 16.01s 3.7%
TestVendorComponentPullCommand vender 12.96s 3.0%
TestExecuteVendorPullCommand exec 8.04s 1.8%
TestDescribeAffectedScenarios exec 7.01s 1.6%
TestExecuteTerraformGeneratePlanfile exec 5.86s 1.3%
TestCLITerraformClean tests 5.81s 1.3%
TestValidateStacksCommandWithRemoteAtmosManifestJsonSchema validate 5.16s 1.2%
TestExecuteTerraform_DeploymentStatus exec 4.25s 1.0%
TestReadTerraformBackendS3_InvalidConfig/invalid_backend_info_-_missing_bucket terraform_backend 4.08s 0.9%
TestReadTerraformBackendS3_InvalidConfig/invalid_backend_info_-_missing_region terraform_backend 4.03s 0.9%
TestReadTerraformBackendS3_InvalidConfig/backend_info_without_role_arn terraform_backend 4.03s 0.9%
TestReadTerraformBackendS3_InvalidConfig/backend_info_with_role_arn terraform_backend 4.02s 0.9%
📦 Package Summary (45 packages)
Package Tests Total Duration Avg Duration
tests 279 263.65s 0.94s
exec 556 133.49s 0.24s
terraform_backend 35 64.38s 1.84s
describe 25 45.73s 1.83s
vender 6 12.97s 2.16s
validate 7 8.31s 1.19s
atmos 2 6.72s 3.36s
pro 58 5.84s 0.10s
component 6 4.10s 0.68s
cmd 98 4.06s 0.04s
atlantis 4 3.46s 0.86s
downloader 84 2.88s 0.03s
list 205 2.47s 0.01s
testhelpers 23 2.20s 0.10s
spacelift 2 1.52s 0.76s
config 169 1.15s 0.01s
generate 1 1.03s 1.03s
stack 7 0.60s 0.09s
telemetry 87 0.56s 0.01s
git 17 0.43s 0.03s
utils 161 0.41s 0.00s
errors 5 0.27s 0.05s
datafetcher 12 0.19s 0.02s
utils 35 0.14s 0.00s
retry 12 0.11s 0.01s
flags 8 0.10s 0.01s
store 185 0.02s 0.00s
templates 6 0.02s 0.00s
aws 1 0.02s 0.02s
filetype 184 0.01s 0.00s
filematch 9 0.01s 0.00s
pager 82 0.01s 0.00s
format 23 0.01s 0.00s
validator 7 0.00s 0.00s
hooks 2 0.00s 0.00s
markdown 6 0.00s 0.00s
aws_utils 3 0.00s 0.00s
go-homedir 2 0.00s 0.00s
utils 13 0.00s 0.00s
schema 25 0.00s 0.00s
logger 60 0.00s 0.00s
dtos 22 0.00s 0.00s
version 8 0.00s 0.00s
merge 38 0.00s 0.00s
convert 41 0.00s 0.00s

Total Time: 136.37s

- Added proper test isolation by changing to temp directory
- Fixed TestGitHubSummaryNoDuplication failing due to leftover test-summary.md
- Added config.InitEnvironment() to ensure Viper picks up environment variables
- All GitHub summary tests now pass consistently
…verage display

The coverage tree display was missing the vertical connector (│) that visually links
files to their functions. This made the tree structure harder to read as the relationship
between files and their functions wasn't visually clear.

Added a vertical connector line that displays between each file and its functions,
properly continuing the tree structure for better visual hierarchy.
@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label Sep 16, 2025
- Downgrade Go version from 1.24.0 to 1.23 for golangci-lint compatibility
- Add missing test fixture file test.coverage.out with sample coverage data
- Fix test failures related to missing coverage profile fixtures
- Add nolint comment for GOTCHA_TEST_MODE os.Getenv (internal test flag)
- Fix all godot lint errors by adding missing periods to comments
- Fix comment/function mismatches where comments belonged to different functions
- Ensure all comments start with capital letters and end with periods
- Add comprehensive tests for handleTestComplete function
- Add tests for handleKeyMsg keyboard input handling
- Add tests for handleStreamOutput JSON processing
- Improve TUI package coverage from 46.8% to 50.9%
- Test exit code preservation and package status updates
Fixed a critical race condition where closing the signal channel would cause
the signal handler goroutine to receive a zero value, incorrectly setting the
interrupted flag and returning exit code 130 (SIGINT) even when tests passed.

The fix:
- Check if channel was closed before processing signal
- Check for nil signals
- Don't close the signal channel while goroutine may still be reading
- Let signal.Stop() handle preventing new signals

This resolves the issue where gotcha would report "Test run aborted" and
exit with code 130 even when all tests passed successfully.

Also added comprehensive test coverage:
- Added tests for stream reporter
- Added tests for coverage processor utilities
- Added tests for root command helpers
- Improved overall test coverage

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Comment thread tools/gotcha/internal/coverage/coverage.go Fixed
- Removed tests that were already in tree_display_test.go
- Simplified test imports to only include needed packages
- Fixed duplicate test function definitions

This resolves the build failures in CI for the coverage package tests.
The continue statement after logger.Fatal() was dead code since
logger.Fatal() calls os.Exit(1) and never returns. This was
confusing and suggested the developer might have misunderstood
the behavior of logger.Fatal().

The actual issue with gotcha reporting exit code 1 in CI when
all tests pass might be related to how gotcha captures subprocess
exit codes or handles the -json flag differently than native go test.

Removed the dead continue statement for code clarity.
When tests are skipped due to initialization issues (like git repo
not found in CI), we were logging with logger.Error(). While this
doesn't directly affect the exit code, it may interact with test
runners or CI environments in unexpected ways.

Changed to logger.Info() for consistency with other skip scenarios
and to avoid any potential issues with error-level logging during
test initialization.
… action

Properly log both the error condition AND the skip action:
- logger.Error() for actual failures (can't find working dir, can't find git repo)
- logger.Info() for the action taken (tests will be skipped)

This provides better debugging information while being semantically correct
about what are errors vs informational messages.
- Add context-based command execution for better cancellation
- Improve exit code extraction with signal detection
- Handle CI environments where go test may exit 1 despite passing tests
- Add proper goroutine cleanup with wait groups
- Improve thread safety for interrupted flag with mutex
- Clean up temporary test files and backups
@mergify

mergify Bot commented Sep 23, 2025

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added conflict This PR has conflicts and removed conflict This PR has conflicts labels Sep 23, 2025
Resolved conflicts:
- .github/workflows/test.yml: Kept both testacc-cover command and ATMOS_TEST_SKIP_PRECONDITION_CHECKS env var
- internal/exec/vendor_utils_test.go: Used the new precondition checks from main branch
- Update main go.mod from Go 1.24.6 to 1.25.0 to match go.work
- Remove outdated toolchain directive
- Fix naked return in gotcha formatters.go to be explicit
- All modules now consistently use Go 1.25.0
…ded versions

- Replace hardcoded go-version: "1.25" with go-version-file: go.mod in test-tools.yml
- All workflows now consistently read Go version from go.mod
- This ensures workflows automatically use the correct Go version when go.mod is updated
- No more manual workflow updates needed when upgrading Go versions
- Change GitHub Actions workflow to use 'make testacc-ci' instead of 'make testacc-cover'
- The testacc-ci target properly uses gotcha with stream command for test output
- This ensures acceptance tests run with gotcha's enhanced reporting and GitHub integration
- The gotcha binary will be automatically built and installed via Makefile dependencies
- Fix golangci-lint issues in pro.go, stack_processor_utils.go
- Add static error definitions to errors/errors.go
- Fix comment formatting (godot linter)
- Refactor duplicate code in api_client.go
- Add tests for pro.go functions to improve coverage
- Split complex function to reduce cyclomatic complexity
@mergify

mergify Bot commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Sep 25, 2025
- Fix golangci-lint issues (err113 errors, godot comment periods)
- Refactor duplicate code in api_client.go using shared method
- Add static error definitions to errors package
- Add test coverage for pro.go CLI argument parsing
- Add test coverage for gotcha stream package functions
- Improve stream package coverage from 32.1% to 37.7%
- Fix formatting issues with go-fumpt
Resolved conflicts:
- errors/errors.go: Merged error definitions from both branches
- internal/exec/pro.go: Added missing imports and used static errors
- internal/exec/pro_test.go: Took main branch version with comprehensive tests
- internal/exec/stack_processor_utils.go: Kept enhanced error formatting with merge context
- pkg/pro/api_client.go: Removed duplicate errors, kept refactored structure
- pkg/utils/slice_utils.go: Fixed function naming and comments
@mergify mergify Bot removed the conflict This PR has conflicts label Sep 25, 2025
@mergify

mergify Bot commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Sep 26, 2025
@github-actions github-actions Bot added the quality:not-ready One or more Quality Gate requirements are pending or failing label Oct 11, 2026
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Quality Gate   Quality Gate not ready

⏳ All CI checks and workflows — 8 CI results are unsuccessful; 0 are still pending.

✅ Codecov (current head)

⏳ CodeRabbit approval (current head) — CodeRabbit has not approved this commit.

⏳ Verified commit signatures — GitHub verified 20 of 93 commit signatures; 73 are missing or invalid.

⏳ Review threads resolved or dismissed — 3 review threads remain unresolved, including outdated threads.

⏳ Fewer than 150 changed files — This PR changes 228 files, exceeding CodeRabbit's review limit of 149.

✅ Benchmark report integrity

Current commit: f00e625dfa4e28bb80f9f29519d749c10150e416 · quality:not-ready

Quality Gate details
Gate Status Evidence
All CI checks and workflows Not ready check: github-actions/Acceptance Tests (windows-latest, windows): failure; check: github-actions/[gotcha] Lint: failure; check: github-actions/[gotcha] Test on macos-latest: failure; check: github-actions/[gotcha] Test on ubuntu-latest: failure; check: github-actions/[gotcha] Test on windows-latest: failure; check: github-advanced-security/golangci-lint: failure; workflow: .github/workflows/test-tools.yml: failure; workflow: .github/workflows/test.yml: failure
Codecov (current head) Passed codecov/patch: success; codecov/project: success
CodeRabbit approval (current head) Not ready Pending: CodeRabbit has not approved this commit
Verified commit signatures Not ready 20/93 commits have GitHub-verified signatures
Review threads resolved or dismissed Not ready 3 unresolved review threads (outdated threads still count)
Fewer than 150 changed files Not ready 228 changed files; maximum 149
Benchmark report integrity Passed No benchmark report processing error recorded for this head
🤖 Next steps for this PR
PR: https://github.com/cloudposse/atmos/pull/1483
Head: f00e625dfa4e28bb80f9f29519d749c10150e416

1. All CI checks and workflows
   Problem: 8 CI results are unsuccessful; 0 are still pending.
   Next: Open the logs for the unsuccessful results listed below. Fix the reported cause and rerun those jobs; for cancelled or infrastructure-failed jobs, verify the cause before retrying.
   Observed results (quoted data):
   - "check: github-actions/Acceptance Tests (windows-latest, windows)": "failure"
   - "check: github-actions/[gotcha] Lint": "failure"
   - "check: github-actions/[gotcha] Test on macos-latest": "failure"
   - "check: github-actions/[gotcha] Test on ubuntu-latest": "failure"
   - "check: github-actions/[gotcha] Test on windows-latest": "failure"
   - "check: github-advanced-security/golangci-lint": "failure"
   2 more results in the gate details.
   Evidence: https://github.com/cloudposse/atmos/pull/1483/checks

2. CodeRabbit approval (current head)
   Problem: CodeRabbit has not approved this commit.
   Next: Wait for CodeRabbit's current-head review. If no review is running, request one using the commands documented at https://docs.coderabbit.ai/guides/commands#manually-request-code-reviews.
   Evidence: https://github.com/cloudposse/atmos/pull/1483

3. Verified commit signatures
   Problem: GitHub verified 20 of 93 commit signatures; 73 are missing or invalid.
   Next: Find the PR commits whose signatures GitHub has not verified. Use the repository's signing workflow for your commits and coordinate any history rewrite with the author, then verify GitHub recognizes every signature.
   Evidence: https://github.com/cloudposse/atmos/pull/1483/commits

4. Review threads resolved or dismissed
   Problem: 3 review threads remain unresolved, including outdated threads.
   Next: Inspect unresolved review threads, including outdated ones. Address each finding and record the resolution; resolve the thread after the fix is verified, or have an authorized reviewer dismiss the obsolete review with a reason. Do not blindly resolve threads to make the gate pass.
   Evidence: https://github.com/cloudposse/atmos/pull/1483

5. Fewer than 150 changed files
   Problem: This PR changes 228 files, exceeding CodeRabbit's review limit of 149.
   Next: Move at least 79 changed files into a separate PR to reach at most 149 files, then request review again.
   Evidence: https://github.com/cloudposse/atmos/pull/1483/files

This branch has not been deployed

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

Labels

conflict This PR has conflicts needs-cloudposse Needs Cloud Posse assistance no-release Do not create a new release (wait for additional code changes) quality:not-ready One or more Quality Gate requirements are pending or failing size/xl Extra large size PR triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants