Skip to content

Architecture Violations Detected — 2026-04-10 #25659

@github-actions

Description

@github-actions

Summary

Severity Count
🚨 BLOCKER 13
⚠️ WARNING 86
i️ INFO

🚨 BLOCKER Violations

These violations indicate serious structural problems that require prompt attention.

Go files exceeding 1,000 lines

File: pkg/cli/gateway_logs.go1,332 lines
Commit: c144ee3 — test: add regression coverage for .github/agents/
Issue: File is 33% above the 1000-line blocker threshold, and contains 6 functions over 80 lines (parseRPCMessages 205 lines, extractMCPToolUsageData 188 lines, renderGatewayMetricsTable 166 lines, buildToolCallsFromRPCMessages 142 lines, processGatewayLogEntry 130 lines, guardPolicyReasonFromCode 122 lines).
Why it matters: Gateway log parsing and metrics rendering are distinct concerns crammed into one file, making it hard to review, test, and evolve independently.
Suggested fix: Split into three files:

  • pkg/cli/gateway_logs_parser.go — RPC message parsing (parseRPCMessages, processGatewayLogEntry, buildToolCallsFromRPCMessages)
  • pkg/cli/gateway_logs_renderer.go — table/metrics rendering (renderGatewayMetricsTable, guardPolicyReasonFromCode, displayAggregatedGatewayMetrics)
  • pkg/cli/gateway_logs_extractor.go — high-level extraction (extractMCPToolUsageData, buildGuardPolicySummary)

File: pkg/workflow/compiler_safe_outputs_config.go1,035 lines
Commit: c144ee3
Issue: The Build() method on handlerConfigBuilder spans 787 lines (lines 140–926) — a single function nearly as large as the entire blocker threshold. This is a critical structural problem.
Why it matters: A 787-line function is impossible to review meaningfully, contains many implicit code paths, and makes testing individual cases extremely difficult.
Suggested fix: Decompose Build() into domain-specific builder helpers:

  • buildCoreConfig() — base handler settings
  • buildAuthConfig() — authentication-related fields
  • buildOutputConfig() — output handler configuration
  • buildEngineConfig() — engine-specific config sections
    Each should be ≤80 lines and testable in isolation.

File: pkg/cli/audit_report_render.go1,139 lines
Commit: c144ee3
Issue: Render functions for many different report domains are co-located in one file.
Why it matters: Each render domain (policy, performance, tokens, tools) changes for different reasons, creating merge conflicts.
Suggested fix: Extract into pkg/cli/audit_render_policy.go, pkg/cli/audit_render_performance.go, pkg/cli/audit_render_tokens.go, following the pattern used by audit_diff_render.go.


File: pkg/cli/logs_orchestrator.go1,074 lines
File: pkg/cli/logs_report.go1,065 lines
File: pkg/workflow/compiler_orchestrator_workflow.go1,062 lines

These three files are marginally over the blocker threshold. The orchestrator files in pkg/cli/ share a domain and could be reduced by extracting their pipeline helper functions (processOnSectionAndFilters 81 lines, processAndMergeSteps 89 lines) into a compiler_orchestrator_helpers.go file.


JavaScript/CJS files exceeding 1,000 lines

File Lines Key Large Functions
actions/setup/js/log_parser_shared.cjs 1,703 generatePlainTextSummary (211), generateCopilotCliStyleSummary (201), generateConversationMarkdown (166), formatToolUse (153)
actions/setup/js/create_pull_request.cjs 1,666 main function and helpers
actions/setup/js/handle_agent_failure.cjs 1,494 Context builders
actions/setup/js/update_project.cjs 1,451 Project update flows
actions/setup/js/safe_output_handler_manager.cjs 1,258 Handler management
actions/setup/js/sanitize_content_core.cjs 1,171 Sanitization pipelines
actions/setup/js/runtime_import.cjs 1,019 Runtime import logic

Suggested fixes:

  • log_parser_shared.cjs: Split into log_parser_markdown.cjs (markdown generation), log_parser_text.cjs (plain text summary), log_parser_tool_formatting.cjs (tool call formatting). The generatePlainTextSummary and generateCopilotCliStyleSummary functions alone total 412 lines.
  • create_pull_request.cjs: Extract fallback/error handling into create_pull_request_fallback.cjs and label/limit enforcement into create_pull_request_limits.cjs.
  • handle_agent_failure.cjs: Extract context builder functions into agent_failure_context_builders.cjs.

⚠️ WARNING Violations

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

Go files (500–1000 lines) — 71 files total

Top offenders:

File Lines
pkg/workflow/cache.go 973
pkg/workflow/frontmatter_types.go 957
pkg/parser/remote_fetch.go 928
pkg/cli/logs_download.go 890
pkg/workflow/compiler_yaml.go 886
cmd/gh-aw/main.go 885
pkg/workflow/frontmatter_extraction_yaml.go 868
pkg/workflow/compiler_yaml_main_job.go 867
pkg/workflow/mcp_setup_generator.go 856
pkg/workflow/compiler_jobs.go 836
pkg/cli/audit.go 834
pkg/workflow/domains.go 820
pkg/parser/schema_suggestions.go 814

Notable: cmd/gh-aw/main.go at 885 lines is a concern — CLI entry points should be thin; command registration logic should be delegated to subpackages.

JavaScript/CJS files (500–1000 lines) — 15 files

File Lines
actions/setup/js/parse_copilot_log.cjs 914
actions/setup/js/safe_outputs_handlers.cjs 904
actions/setup/js/mcp_server_core.cjs 835
actions/setup/js/create_issue.cjs 803
actions/setup/js/send_otlp_span.cjs 794
actions/setup/js/validate_secrets.cjs 776
actions/setup/js/add_comment.cjs 702
actions/setup/js/assign_agent_helpers.cjs 641

Configuration

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

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

Action Checklist

  • Decompose Build() in pkg/workflow/compiler_safe_outputs_config.go (787-line function)
  • Split pkg/cli/gateway_logs.go into parser/renderer/extractor
  • Split pkg/cli/audit_report_render.go by render domain
  • Address actions/setup/js/log_parser_shared.cjs (1,703 lines, 4 functions >80 lines)
  • Split actions/setup/js/create_pull_request.cjs (1,666 lines)
  • Review 71 Go WARNING files approaching the blocker threshold
  • Add .architecture.yml to customize thresholds if defaults are too strict
  • Close this issue once all BLOCKER violations are resolved

🏛️ To configure thresholds, add a .architecture.yml file to the repository root.

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

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