Skip to content

[Code Quality] Refactor compiler_activation_jobs.go - Split 855-line file into focused modules #12709

@github-actions

Description

@github-actions

Description

The compiler_activation_jobs.go file has grown to 855 lines, exceeding the 800-line guideline and creating cognitive load for developers. The Daily Compiler Code Quality Report identified this as a high-priority refactoring opportunity.

Current State

  • File: pkg/workflow/compiler_activation_jobs.go
  • Size: 855 lines
  • Quality Score: 79/100 (Good, but could be Excellent with refactoring)
  • Test Coverage: ✅ 54% (464-line test file)

Suggested Changes

Split the file into three focused modules:

  1. compiler_activation_pre.go (~300 lines)

    • Pre-activation job building logic
    • Permission check steps
    • Stop time check steps
    • Skip condition steps
  2. compiler_activation_main.go (~350 lines)

    • Main activation job logic
    • Core activation workflows
    • Output configuration
  3. compiler_activation_helpers.go (~200 lines)

    • Shared helper functions
    • containsRole() and similar utilities
    • Common pattern extraction

Files Affected

  • pkg/workflow/compiler_activation_jobs.go (split into 3 files)
  • pkg/workflow/compiler_activation_jobs_test.go (update imports, potentially split)

Success Criteria

  • File split maintains all existing functionality
  • All tests pass without modification
  • Each new file is under 400 lines
  • Clear separation of concerns between files
  • No duplication of code across new files
  • Quality score improves from 79/100 to 85+/100

Benefits

  • Improved maintainability: Easier to understand and modify focused files
  • Reduced cognitive load: Developers can work in smaller, clearer modules
  • Better organization: Clear separation between pre-activation, activation, and helpers
  • Easier testing: Smaller modules are easier to test in isolation

Source

Extracted from Daily Compiler Code Quality Report discussion #12674

Priority

High - Improves code organization and maintainability for one of the largest compiler files

Estimated Effort

3-4 hours of refactoring + testing

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 13, 2026, 9:14 AM UTC

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