Skip to content

[WIP] Refactor compiler_activation_jobs.go into focused modules#14420

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/refactor-compiler-activation-jobs-again
Closed

[WIP] Refactor compiler_activation_jobs.go into focused modules#14420
Copilot wants to merge 2 commits intomainfrom
copilot/refactor-compiler-activation-jobs-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Refactor compiler_activation_jobs.go by splitting into focused modules</issue_title>
<issue_description>## Description

The compiler_activation_jobs.go file is 821 lines, approaching the refactoring threshold. It contains large functions (some exceeding 200 lines) with multiple concerns mixed together. Splitting this file improves maintainability, navigation, and testability.

Current State

  • File Size: 821 lines (near 800-line refactor threshold)
  • Large Functions:
    • buildPreActivationJob(): 264 lines
    • buildActivationJob(): 242 lines
    • buildMainJob(): 215 lines
  • Issues: Multiple concerns per function, hard to navigate

Proposed Split

Split into 2-3 focused files:

Option 1: 2-File Split

  1. compiler_pre_activation_job.go (~350 lines)

    • buildPreActivationJob()
    • extractPreActivationCustomFields()
    • Membership check helpers
  2. compiler_activation_main_jobs.go (~470 lines)

    • buildActivationJob()
    • buildMainJob()
    • Reaction and lock helpers

Option 2: 3-File Split (More Granular)

  1. compiler_pre_activation_job.go (~280 lines)

    • Pre-activation logic only
  2. compiler_activation_job.go (~280 lines)

    • Activation job logic
  3. compiler_main_job.go (~260 lines)

    • Main job orchestration

Additional Refactoring (Optional)

Extract feature builders to reduce function complexity:

func (c *Compiler) buildReactionSteps(...) []string { ... }
func (c *Compiler) buildLockSteps(...) []string { ... }
func (c *Compiler) buildComputeTextSteps(...) []string { ... }

// Then compose in buildActivationJob:
steps = append(steps, c.buildReactionSteps(data)...)
steps = append(steps, c.buildLockSteps(data)...)

Files Affected

  • pkg/workflow/compiler_activation_jobs.go (split into 2-3 files)
  • pkg/workflow/compiler_activation_jobs_test.go (may need refactoring to match)

Success Criteria

  • Original file split into 2-3 focused files (~300-400 lines each)
  • All functions moved to appropriate files
  • Test file(s) updated to match new structure
  • All existing tests continue to pass
  • No functionality changes (pure refactoring)
  • Function complexity reduced (functions <150 lines preferred)

Priority

Medium - Improves maintainability, but not blocking current work

Estimated Effort

1 day (including test refactoring and validation)

Source

Extracted from:

Listed as "Short-term Improvement" (Medium Priority) in both compiler quality reports.

Notes

  • This is a larger refactoring task - consider breaking into smaller sub-tasks
  • Coordinate with ongoing compiler development to avoid merge conflicts
  • Ideal time: During quieter development periods

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 7, 2026, 9:07 PM UTC

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Created compiler_pre_activation_job.go (362 lines)
- Created compiler_activation_job.go (254 lines)
- Created compiler_main_job.go (232 lines)
- Split test file into 3 matching test files
- All tests passing, no functionality changes

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
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] Refactor compiler_activation_jobs.go by splitting into focused modules

2 participants