Skip to content

[Code Quality] Create test file for compiler_yaml_main_job #14046

Closed as not planned

Description

@github-actions

Description

The compiler_yaml_main_job.go file (612 lines) lacks a dedicated test file. 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 (612 lines)
Test Coverage: No dedicated test file compiler_yaml_main_job_test.go
Testing Method: Indirect integration tests only via compiler_yaml_test.go

Why This Matters

  • Critical path: Main job generation is core workflow compilation logic
  • Edge cases: Hard to test specific behaviors (repository imports, runtime deduplication, custom steps)
  • Regression testing: Changes risk breaking existing workflows without direct unit tests
  • Code quality: Dedicated test file improves maintainability and catches issues early

Suggested Tests

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

  1. Repository import checkout generation

    • Test multiple repository imports
    • Test ref parsing (owner/repo@ref format)
    • Test sanitization of refs for paths
  2. Runtime deduplication logic

    • Test that duplicate runtime configurations are merged
    • Test version conflicts are detected
    • Test runtime setup step generation
  3. Custom steps insertion

    • Test custom steps are inserted at correct positions
    • Test step ID generation
    • Test conditional step execution
  4. Error handling

    • Test invalid repository import specs
    • Test malformed custom step configurations
    • Test missing required fields

Files Affected

  • pkg/workflow/compiler_yaml_main_job_test.go (new file)

Success Criteria

  • Test file created with comprehensive test coverage
  • Tests for repository import checkout generation
  • Tests for runtime deduplication logic
  • Tests for custom steps insertion
  • Tests for error handling paths
  • All tests pass with go test -v ./pkg/workflow/

Source

Extracted from Daily Compiler Code Quality Report discussion #13934

Priority

High - Main job generation is critical path and needs direct unit tests for regression safety.

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 7, 2026, 5:23 AM UTC

Activity

  1. github-actions commented on Feb 7, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-02-07T05:23:40.675Z.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions