Skip to content

Architecture Violations Detected — 2026-04-21 #27595

@github-actions

Description

@github-actions

Summary

  • Analysis Period: Last 24 hours
  • Commit Analyzed: 61253db[dead-code] chore: remove dead functions — 4 functions removed (#27567)
  • Files Analyzed: ~750 Go + ~80 CJS source files
  • Total Violations: 22
  • Date: 2026-04-21
Severity Count
🚨 BLOCKER 0
⚠️ WARNING 19
i️ INFO 3

⚠️ WARNING Violations

These violations should be addressed soon to prevent further structural debt.

File Size Warnings (> 1000 lines)

Go Files:

File Lines
pkg/workflow/domains.go 1,015
pkg/workflow/cache.go 1,002

CJS Files:

File Lines
actions/setup/js/create_pull_request.cjs 1,765
actions/setup/js/log_parser_shared.cjs 1,703
actions/setup/js/handle_agent_failure.cjs 1,590
actions/setup/js/update_project.cjs 1,451
actions/setup/js/safe_output_handler_manager.cjs 1,322
actions/setup/js/sanitize_content_core.cjs 1,224
actions/setup/js/runtime_import.cjs 1,022
actions/setup/js/safe_outputs_handlers.cjs 1,009

Suggested fixes:

  • create_pull_request.cjs (1,765 lines): Extract PR branch management, conflict resolution, and review/assignee logic into separate files (create_pull_request_branch.cjs, create_pull_request_review.cjs).
  • log_parser_shared.cjs (1,703 lines): The generatePatchPreview function (~1,650 lines) dominates the file. Split patch rendering logic into log_parser_patch.cjs and conversation/summary rendering into log_parser_format.cjs.
  • handle_agent_failure.cjs (1,590 lines): Extract failure context builders (buildCodePushFailureContext, buildEngineFailureContext) into handle_agent_failure_context.cjs.
  • safe_output_handler_manager.cjs (1,322 lines): Move buildEngineFailureContext (~850 lines) to a dedicated engine_failure_context.cjs.
  • pkg/workflow/domains.go (1,015 lines): Group domain lists by category (runtime domains, GitHub domains, tool-specific domains) into separate files domains_runtimes.go, domains_tools.go.
  • pkg/workflow/cache.go (1,002 lines): The file mixes cache-memory config parsing and step generation. Extract step generation into cache_steps.go.

Function Size Warnings (> 200 lines)

Go Functions:

Function File Est. Lines
generateMCPSetup pkg/workflow/mcp_setup_generator.go ~849
generateMainJobSteps pkg/workflow/compiler_yaml_main_job.go ~619
validateEngine cmd/gh-aw/main.go ~413
init cmd/gh-aw/main.go ~405
AuditWorkflowRun pkg/cli/audit.go ~356
buildCustomJobs pkg/workflow/compiler_jobs.go ~344
generatePrompt pkg/workflow/compiler_yaml.go ~236

CJS Functions:

Function File Est. Lines
generatePatchPreview log_parser_shared.cjs ~1,650
buildEngineFailureContext safe_output_handler_manager.cjs ~851
getContentToCheck safe_output_handler_manager.cjs ~504
getActionFailureIssueExpiresHours handle_agent_failure.cjs ~272
generatePlainTextSummary log_parser_shared.cjs ~211
generateCopilotCliStyleSummary log_parser_shared.cjs ~201

Suggested fixes:

  • generateMCPSetup (~849 lines) in mcp_setup_generator.go: This function handles multiple engine-specific MCP configurations. Extract engine-specific sections into dedicated helpers: generateCopilotMCPSetup(), generateClaudeMCPSetup(), etc. Each engine's setup should be an independently testable function.

  • generateMainJobSteps (~619 lines) in compiler_yaml_main_job.go: This function chains many step-generation calls. Split into phase-based helpers: generateSetupPhaseSteps(), generateAgentPhaseSteps(), generateCleanupPhaseSteps().

  • validateEngine (~413 lines) in cmd/gh-aw/main.go: This function contains engine-specific validation for every supported engine. Move to pkg/workflow/engine_validator.go and split per engine: validateCopilotEngine(), validateClaudeEngine(), etc.

  • init (~405 lines) in cmd/gh-aw/main.go: The init() function is registering all CLI commands and flags. Move command registration logic to pkg/cli/root.go and call a RegisterCommands() function from init().

  • AuditWorkflowRun (~356 lines) in pkg/cli/audit.go: This orchestrates download, parsing, and rendering. Extract downloadAuditArtifacts(), parseAuditResults(), and renderAuditResults() as separate functions.

  • generatePatchPreview (~1,650 lines) in log_parser_shared.cjs: This is by far the largest function in the JS codebase. It likely contains long switch/if chains for handling different diff types. Decompose into renderAddedLines(), renderRemovedLines(), renderContextLines(), renderHunkHeader(), and a PatchRenderer class.


i️ INFO Violations

Informational findings. Consider addressing in future refactoring.

  • pkg/constants/constants.go: 40 exported identifiers — This file is a "constants dump". Consider grouping constants into domain-specific files: constants_engines.go, constants_versions.go, constants_features.go.
  • pkg/workflow/domains.go: 24 exported identifiers — Already flagged for file size. Splitting will naturally reduce the export count per file.
  • pkg/workflow/compiler_types.go: 20 exported identifiers — The types file contains a large number of exported types. Consider splitting by concern: compiler_types_engine.go, compiler_types_job.go.

Configuration

Thresholds from .architecture.yml:

  • File size BLOCKER: 2,000 lines
  • File size WARNING: 1,000 lines
  • Function size WARNING: 200 lines
  • Max public exports INFO: 10

Action Checklist

  • Address generatePatchPreview in log_parser_shared.cjs (~1,650 lines) — highest priority function violation
  • Split log_parser_shared.cjs (1,703 lines) into rendering sub-modules
  • Refactor generateMCPSetup in mcp_setup_generator.go (~849 lines)
  • Decompose generateMainJobSteps in compiler_yaml_main_job.go (~619 lines)
  • Split create_pull_request.cjs (1,765 lines)
  • Move large init() / validateEngine() logic from cmd/gh-aw/main.go
  • Split pkg/constants/constants.go (40 exports) into domain-specific files
  • Address remaining WARNING violations in upcoming PRs
  • Close this issue once all violations are resolved

🏛️ Thresholds configured via .architecture.yml in the repository root.

🏛️ Architecture report by Architecture Guardian · ● 1.6M ·

Metadata

Metadata

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