Skip to content

[lint-monster] Lint Remediation: Workflow Compilation (Group 3/3) #32705

@github-actions

Description

@github-actions

Summary

Refactor workflow compilation engine in pkg/workflow/ to eliminate ~600 lint findings related to excessive function line length (>60 lines) and parameter counts (>8). This is the largest subsystem with the most complex compilation logic.

Affected Packages

  • pkg/workflow/ - ~100+ functions with excessive line length (63-486 lines), concentrated in compiler and engine modules

Critical Long Functions (Priority Order - Largest First)

  1. pkg/workflow/compiler_pre_activation_job.go:20 - buildPreActivationJob is 486 lines
  2. pkg/workflow/compiler_main_job.go:26 - buildMainJob is 333 lines
  3. pkg/workflow/claude_tools.go:168 - computeAllowedClaudeToolsString is 360 lines
  4. pkg/workflow/copilot_engine_execution.go:41 - GetExecutionSteps is 470 lines
  5. pkg/workflow/compiler_orchestrator_engine.go:35 - setupEngineAndImports is 391 lines
  6. pkg/workflow/compiler_orchestrator_tools.go:50 - processToolsAndMarkdown is 322 lines
  7. pkg/workflow/compiler_orchestrator_workflow.go:15 - ParseWorkflowFile is 295 lines
  8. pkg/workflow/codex_engine.go:146 - GetExecutionSteps is 286 lines
  9. pkg/workflow/compiler_validators.go:86 - validateToolConfiguration is 328 lines
  10. pkg/workflow/claude_engine.go:119 - GetExecutionSteps is 372 lines

And 90+ additional functions ranging 62-100+ lines across compilation modules.

Functions with Parameter Overload

  • pkg/workflow/compiler_activation_job.go:79 - addActivationInteractionPermissions (10 params)
  • pkg/workflow/compiler_activation_job.go:112 - addActivationInteractionPermissionsMap (10 params)
  • pkg/workflow/compiler_activation_job.go:203 - addBroadActivationInteractionPermissions (9 params)
  • pkg/workflow/compiler_safe_outputs_job.go:382 - buildSafeOutputsJobFromParts (9 params)
  • pkg/workflow/maintenance_workflow.go:120 - GenerateMaintenanceWorkflow (9 params)
  • pkg/workflow/maintenance_workflow_yaml.go:16 - buildMaintenanceWorkflowYAML (12 params)
  • pkg/workflow/mcp_rendering.go:94 - renderStandardJSONMCPConfig (9 params)
  • pkg/workflow/mcp_setup_generator.go:585 - writeMCPGatewayExports (12 params)
  • And 14+ more in workflow module

Remediation Strategy

Phase 1: Engine Implementations (Highest Impact)

  • Refactor GetExecutionSteps functions (Claude, Copilot, Codex engines):
    1. Extract step-generation logic into separate builder functions
    2. Create helper functions for each step type (setup, runtime, agent, collection, etc.)
    3. Reduce main function to orchestration/flow control
    4. Ensure each helper <60 lines
    5. Test with various engine configurations
  • Focus on claude_engine.go and copilot_engine_execution.go first

Phase 2: Compiler Main Functions (Build Pipeline)

  • Refactor buildMainJob, buildPreActivationJob:
    1. Extract job-section generation into separate functions
    2. Create builders for: steps, permissions, outputs, conditions
    3. Maintain main function as high-level orchestrator
    4. Test workflow compilation end-to-end
  • Refactor orchestrator functions (ParseWorkflowFile, setupEngineAndImports):
    1. Break into phase-specific functions (parse, setup, process, validate)
    2. Extract validation logic
    3. Ensure error handling preserved

Phase 3: Utility Functions & Parameter Cleanup

  • Apply options struct pattern to functions with >8 parameters:
    1. Create XOptions structs for parameter groups
    2. Update function signatures and callsites
    3. Test parameter passing
  • Break remaining >60 line functions using helper extraction
  • Focus on compiler modules: activation, safe_outputs, jobs

Validation

  • Run make golint-custom and confirm zero errors in pkg/workflow/
  • Run workflow tests: go test -v ./pkg/workflow/...
  • Test workflow compilation: ./gh-aw compile <sample-workflows>
  • Test multiple engines: copilot, claude, codex
  • Run make agent-report-progress (build + fmt + lint + test-unit) before commit

Important Notes

  • Workflow compilation is critical path; changes require thorough testing
  • Engine implementations must preserve behavior across all configurations
  • Maintain existing error messages and validation order
  • Extract helpers should have single responsibility (build section, generate step, validate config, etc.)
  • Use descriptive names for extracted functions (e.g., buildAgentRunSteps, generateSetupSteps)
  • Test with different workflow complexity levels (simple, with MCP, with safe-outputs, etc.)

Success Criteria

✅ All lint findings in pkg/workflow/ resolved
✅ All workflow tests pass
✅ Workflow compilation produces correct YAML
✅ All engine implementations work correctly
✅ No regressions in workflow behavior

Generated by 🧌 LintMonster · ● 573.9K ·

  • expires on May 23, 2026, 9:19 PM UTC

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions