Skip to content

Document existing test coverage for compiler_yaml_main_job.go#14284

Closed
Copilot wants to merge 1 commit intomainfrom
copilot/create-test-file-for-compiler-yaml
Closed

Document existing test coverage for compiler_yaml_main_job.go#14284
Copilot wants to merge 1 commit intomainfrom
copilot/create-test-file-for-compiler-yaml

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Issue #14159 requested creation of compiler_yaml_main_job_test.go. Investigation found the file already exists with comprehensive coverage exceeding all specified criteria.

Coverage Analysis

File metrics:

  • Source: 685 lines
  • Tests: 820 lines
  • Ratio: 1.20:1 (50% above 0.8:1 target)
  • Functions: 11 test functions, 48+ subtests
  • Status: All passing

Coverage by area:

  • Repository import checkout: 14 test cases across 3 functions
  • Runtime deduplication: 5+ test cases (additional coverage in runtime_setup_test.go)
  • Custom steps insertion: 9 test cases across 2 functions
  • Utility functions: 13 test cases for parseRepositoryImportSpec() and sanitizeRefForPath()
  • Additional: Dev mode builds, orchestration, step ordering, edge cases

Architecture

Runtime deduplication logic properly separated into dedicated runtime_setup_test.go rather than monolithic test file. This follows single responsibility principle and improves maintainability.

Recommendation

Close issue as already completed. No code changes required.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Create dedicated test file for compiler_yaml_main_job.go</issue_title>
<issue_description>## Description

The compiler_yaml_main_job.go file (612 lines) is a critical component for workflow compilation but lacks a dedicated test file. Currently, main job generation is tested only indirectly through integration tests, making it harder to validate edge cases and regression test specific behaviors.

Current State

  • File: pkg/workflow/compiler_yaml_main_job.go
  • Size: 612 lines
  • Test coverage: No dedicated test file (tested indirectly via compiler_yaml_test.go)
  • Risk: Complex logic with inadequate unit test coverage

Impact

Without dedicated tests:

  • Edge cases in main job generation may not be covered
  • Regression testing requires running full integration tests (slow)
  • Difficult to isolate and test individual step generation functions
  • Changes to main job logic risk breaking workflows

Suggested Changes

Create pkg/workflow/compiler_yaml_main_job_test.go with focused unit tests for:

  1. Repository import checkout generation

    • Test parsing of import specs (owner/repo@ref format)
    • Test checkout step generation with different refs
    • Test merge script generation
  2. Runtime deduplication logic

    • Test runtime version deduplication across steps
    • Test handling of conflicting runtime versions
  3. Custom steps insertion

    • Test insertion of custom steps at correct positions
    • Test handling of before/after step positioning
  4. Helper function testing

    • parseRepositoryImportSpec() - Test various import formats
    • sanitizeRefForPath() - Test ref sanitization logic

Files Affected

  • New file: pkg/workflow/compiler_yaml_main_job_test.go
  • Existing: pkg/workflow/compiler_yaml_main_job.go (no changes needed)

Success Criteria

  • Dedicated test file created with table-driven tests
  • Test coverage for repository import checkout generation
  • Test coverage for runtime deduplication logic
  • Test coverage for custom steps insertion
  • Test coverage for utility functions
  • All tests pass: go test -v ./pkg/workflow/ -run TestCompilerYamlMainJob
  • Test/source ratio approaches 0.8:1 (recommended threshold)

Priority

Medium - Main job generation is critical path, needs direct unit tests for maintainability

Estimated Effort

2-4 hours

Source

Extracted from multiple compiler quality analysis discussions:

Identified as high priority in both reports due to missing test coverage for critical compilation path.

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 8, 2026, 5:17 AM UTC

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add dedicated test file for compiler_yaml_main_job.go Document existing test coverage for compiler_yaml_main_job.go Feb 7, 2026
Copilot AI requested a review from pelikhan February 7, 2026 05:30
@pelikhan pelikhan closed this Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Create dedicated test file for compiler_yaml_main_job.go

2 participants