Skip to content

[Code Quality] Refactor compiler_activation_jobs.go to reduce file size from 855 to ~400 lines #12675

Description

@github-actions

Description

The compiler_activation_jobs.go file has grown to 855 lines (44% over the recommended 600-line maximum), making it difficult to navigate and maintain. The file contains complex logic for building pre-activation and activation jobs with long functions (~250 lines each) that should be broken down into smaller, testable units.

Problems Identified

  1. File Size: 855 lines exceeds recommended maximum by 44%
  2. Function Length: buildPreActivationJob() is ~250 lines, buildActivationJob() is ~100+ lines
  3. Code Duplication: Repeated GitHub script generation patterns
  4. Maintainability: High cognitive load, difficult to navigate

Suggested Changes

Split the file into 2-3 focused modules:

Module 1: compiler_activation_pre.go (~300 lines)

  • Pre-activation job building logic
  • Permission check steps
  • Stop-time check steps
  • Skip condition steps

Module 2: compiler_activation_main.go (~350 lines)

  • Main activation job logic
  • Activation expression building
  • Output configuration

Module 3: compiler_activation_helpers.go (~200 lines)

  • Shared helper functions like containsRole()
  • Common step generation patterns
  • Expression builder utilities

Files Affected

  • pkg/workflow/compiler_activation_jobs.go (855 lines - split into 2-3 files)
  • pkg/workflow/compiler_activation_jobs_test.go (update imports)

Success Criteria

  • Each resulting file is ≤ 400 lines
  • All existing tests pass without modification
  • No breaking changes to public API
  • Improved code organization and readability
  • Reduced cognitive load for developers

Source

Extracted from:

Priority

High - File size significantly impacts maintainability and developer productivity. This refactoring will make future changes easier and reduce the risk of bugs in complex activation logic.

Estimated Effort

2-3 days (including testing and validation)

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 13, 2026, 5:22 AM UTC

Activity

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