Refactor: Split compiler_activation_jobs.go into focused modules (827→362+476 lines)#14431
Closed
Refactor: Split compiler_activation_jobs.go into focused modules (827→362+476 lines)#14431
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Split compiler_activation_jobs.go into two focused files
Refactor: Split compiler_activation_jobs.go into focused modules (827→362+476 lines)
Feb 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
compiler_activation_jobs.goexceeded the 600-line maintainability guideline at 827 lines with mixed concerns (pre-activation validation + activation/main job orchestration).Changes
Split into two focused files:
compiler_pre_activation_job.go(362 lines)buildPreActivationJob()- membership checks, stop-time validation, reaction setupextractPreActivationCustomFields()- custom job field extractionworkflow:compiler_pre_activation_jobcompiler_activation_main_jobs.go(476 lines)buildActivationJob()- timestamp checks, comments, issue lockingbuildMainJob()- agent job setup, permissions, safe-outputs configworkflow:compiler_activation_main_jobsTechnical Details
compiler_jobs.go,role_checks.go)compiler_activation_jobs_test.go, 464 lines) unchanged - all tests pass without modificationOriginal prompt
This section details on the original issue you should resolve
<issue_title>[Code Quality] Split compiler_activation_jobs.go into two focused files (821 lines → ~350 + ~470)</issue_title>
<issue_description>The
compiler_activation_jobs.gofile has grown to 821 lines, exceeding the maintainability guideline of 600 lines for a single file. This impacts code navigation, increases cognitive load, and makes the file harder to maintain as the codebase evolves.Problem
Current state:
compiler_activation_jobs.go: 821 lines (37% over guideline)buildActivationJob()at 242 linesWhy this matters:
Suggested Changes
Split into two focused files of ~350-470 lines each:
File 1:
compiler_pre_activation_job.go(~350 lines)Responsibility: Pre-activation checks before main workflow execution
Rationale: Pre-activation is a distinct phase focused on validation and permission checks.
File 2:
compiler_activation_main_jobs.go(~470 lines)Responsibility: Activation and main job orchestration
Rationale: Activation and main job building share common concerns (reactions, locks, outputs).
Files Affected
pkg/workflow/compiler_activation_jobs.go(821 lines → DELETE)pkg/workflow/compiler_pre_activation_job.go(~350 lines)pkg/workflow/compiler_activation_main_jobs.go(~470 lines)pkg/workflow/compiler_activation_jobs_test.go(may need split too)Implementation Approach
Phase 1: Prepare (30 min)
Phase 2: Split File (3-4 hours)
Create
compiler_pre_activation_job.gobuildPreActivationJob()and related helperslogger.New("workflow:compiler_pre_activation_job")Create
compiler_activation_main_jobs.gobuildActivationJob()andbuildMainJob()logger.New("workflow:compiler_activation_main_jobs")Delete
compiler_activation_jobs.goUpdate imports in dependent files:
compiler.gocompiler_jobs.goPhase 3: Verify (1 hour)
make fmt- ensure code formattedmake test-unit- verify all tests passmake lint- check for issuesmake agent-finish- complete validationPhase 4: Tests (optional split, 1-2 hours)
If
compiler_activation_jobs_test.gois also large (>500 lines), consider splitting:compiler_pre_activation_job_test.gocompiler_activation_main_jobs_test.goSuccess Criteria
make test-unit)make agent-finish)Priority
MEDIUM-HIGH - File is maintainable now but approaching hard limit. Better to refactor proactively.
Estimated Effort
1 day (6-8 hours including testing and validation)
Source
Extracted from Daily Compiler Code Quality Report - 2026-02-06 github/gh-aw#14159
The report identified this as a Medium Priority action with the note: "Consider splitting into 2 files of ~350 and ~470 lines when making significant changes."
References
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.