Skip to content

Architecture Violations Detected — 2026-04-15 #26449

@github-actions

Description

@github-actions

Summary

Severity Count
🚨 BLOCKER 14
⚠️ WARNING 20+
i️ INFO 0

🚨 BLOCKER Violations

These violations indicate serious structural problems that require prompt attention.

1. maintenance_workflow.go — 1,347 lines (NEW in #26382)

File: pkg/workflow/maintenance_workflow.go
Commit: 31ef7c6 — feat: auto-generate side-repo maintenance workflow for SideRepoOps pattern
Issue: File introduced in this commit immediately exceeds the 1,000-line BLOCKER threshold at 1,347 lines.
Why it matters: A 1,347-line file covering multiple concerns (maintenance cron logic, SideRepoOps targets, YAML generation, CLI step generation) is hard to navigate, review, and test in isolation.
Suggested fix:

  • Extract generateSideRepoMaintenanceWorkflow and related types into pkg/workflow/side_repo_maintenance.go
  • Move cron-generation helpers (generateMaintenanceCron, generateSideRepoMaintenanceCron) to pkg/workflow/maintenance_cron.go
  • Keep GenerateMaintenanceWorkflow as the public orchestrator in a trimmed maintenance_workflow.go (<200 lines)

2. compiler_orchestrator_workflow.go — 1,125 lines

File: pkg/workflow/compiler_orchestrator_workflow.go
Commit: 31ef7c6
Issue: 1,125-line file combining workflow parsing, configuration extraction, and import merging.
Why it matters: Mixing parsing, extraction, and compilation concerns in one file makes it difficult to isolate changes and write focused tests.
Suggested fix:

  • Move ParseWorkflowFile and its 205-line body into pkg/workflow/workflow_parser.go
  • Extract extractAdditionalConfigurations and buildInitialWorkflowData into pkg/workflow/workflow_builder.go
  • The orchestrator file should contain only the top-level wiring (<200 lines)

3. logs_orchestrator.go — 1,077 lines

File: pkg/cli/logs_orchestrator.go
Commit: 31ef7c6
Issue: 1,077-line file with a single DownloadWorkflowLogs function spanning 563 lines (7x the 80-line threshold).
Why it matters: A 563-line function is effectively untestable as a unit and hides multiple logical phases (filtering, downloading, artifact handling, metrics).
Suggested fix:

  • Split DownloadWorkflowLogs into phase functions: filterWorkflowRuns, downloadAndStage, postProcessArtifacts
  • Extract downloadRunArtifactsConcurrent (395 lines) into pkg/cli/logs_download.go (a file that already exists for this purpose)
  • Target: no function in logs_orchestrator.go should exceed 100 lines

4–11. JavaScript/CJS files exceeding 1,000 lines

File Lines
actions/setup/js/log_parser_shared.cjs 1,703
actions/setup/js/create_pull_request.cjs 1,678
actions/setup/js/handle_agent_failure.cjs 1,572
actions/setup/js/update_project.cjs 1,451
actions/setup/js/safe_output_handler_manager.cjs 1,301
actions/setup/js/sanitize_content_core.cjs 1,171
actions/setup/js/runtime_import.cjs 1,022
actions/setup/js/safe_outputs_handlers.cjs 1,007

Why it matters: Large CJS files in actions/setup/js/ are hard to unit-test in isolation and tend to accumulate cross-cutting concerns.
Suggested fix (per file):

  • log_parser_shared.cjs: Split into log_parser_core.cjs (parsing primitives) + log_parser_formatters.cjs (output formatting)
  • create_pull_request.cjs: Extract PR diff logic into pr_diff_helpers.cjs; keep main flow <400 lines
  • handle_agent_failure.cjs: Separate failure classification (agent_failure_classifier.cjs) from notification logic
  • safe_output_handler_manager.cjs + safe_outputs_handlers.cjs: These two large files likely share logic; consolidate shared types into safe_output_types.cjs

⚠️ WARNING Violations — Function Size

Functions exceeding 80 lines (default threshold).

Function File Lines
GenerateMaintenanceWorkflow pkg/workflow/maintenance_workflow.go 639
DownloadWorkflowLogs pkg/cli/logs_orchestrator.go 563
downloadRunArtifactsConcurrent pkg/cli/logs_orchestrator.go 395
generateSideRepoMaintenanceWorkflow pkg/workflow/maintenance_workflow.go 325
ParseWorkflowFile pkg/workflow/compiler_orchestrator_workflow.go 205
extractAdditionalConfigurations pkg/workflow/compiler_orchestrator_workflow.go 140
buildInitialWorkflowData pkg/workflow/compiler_orchestrator_workflow.go 123

The top two (GenerateMaintenanceWorkflow at 639 lines and DownloadWorkflowLogs at 563 lines) are especially critical — they should be treated as BLOCKERs.

Suggested fix for GenerateMaintenanceWorkflow:
The function currently handles: detecting target repos, generating cron schedules, building YAML job trees, writing files — all in one body. Decompose into:

generateMaintenanceYAML(targets) → YAML string
writeMaintenanceFile(path, yaml) → error
orchestrateMaintenanceGeneration(data, opts) → error   ← new thin shell
```

**Suggested fix for `DownloadWorkflowLogs`**:
This function has a long parameter list (21 parameters!) and multiple phases. Consider introducing a `DownloadConfig` struct to group parameters, and break execution into:
```
resolveWorkflowRuns(cfg) → []WorkflowRun
downloadRuns(ctx, runs, cfg) → []DownloadResult
postProcessRuns(results, cfg) → error

⚠️ WARNING Violations — File Size (500–1000 lines)

79 Go files exceed the 500-line WARNING threshold. Highest-priority pre-existing cases:

File Lines
pkg/workflow/cache.go 973
pkg/parser/remote_fetch.go 928
pkg/workflow/compiler_yaml.go 911
pkg/workflow/mcp_setup_generator.go 897
cmd/gh-aw/main.go 895
pkg/cli/logs_download.go 891
pkg/cli/audit.go 873

Configuration

Thresholds used (defaults — no .architecture.yml found):

  • File size BLOCKER: 1,000 lines
  • File size WARNING: 500 lines
  • Function size: 80 lines
  • Max public exports: 10

💡 To customize thresholds, add a .architecture.yml file to the repository root.


Action Checklist

  • Refactor pkg/workflow/maintenance_workflow.go (1,347 lines, new in feat: auto-generate side-repo maintenance workflow for SideRepoOps pattern #26382) — highest priority
  • Split GenerateMaintenanceWorkflow (639 lines) into focused sub-functions
  • Split generateSideRepoMaintenanceWorkflow (325 lines) into focused sub-functions
  • Refactor pkg/workflow/compiler_orchestrator_workflow.go (1,125 lines)
  • Refactor pkg/cli/logs_orchestrator.go (1,077 lines) — introduce DownloadConfig struct
  • Address the 8 JavaScript files exceeding 1,000 lines
  • Close this issue once all BLOCKER violations are resolved

🏛️ Generated by Architecture Guardian — Run ID: 24461030372

🏛️ Architecture report by Architecture Guardian · ● 940.2K ·

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