Summary
| Severity |
Count |
| 🚨 BLOCKER |
13 |
| ⚠️ WARNING |
65+ |
| i️ INFO |
0 |
No import cycles detected. ✅
🚨 BLOCKER Violations
These violations indicate serious structural problems that require prompt attention.
Go files exceeding 1,000 lines
File: pkg/cli/audit_report_render.go — 1,139 lines
Issue: File significantly exceeds the 1,000-line blocker threshold. Contains a single renderConsole() function of 244 lines.
Why it matters: Large rendering files mix data formatting with presentation logic, making them hard to test and extend.
Suggested fix: Extract console rendering sections into focused helpers (e.g., audit_report_render_steps.go, audit_report_render_summary.go). The renderConsole() function should delegate to smaller helpers per section (steps, metrics, tool usage).
File: pkg/cli/logs_orchestrator.go — 1,075 lines
Issue: Contains two critically oversized functions: DownloadWorkflowLogs() at 562 lines and downloadRunArtifactsConcurrent() at 394 lines.
Why it matters: A 562-line function is unmaintainable — it combines HTTP coordination, filtering logic, output formatting, error handling, and file I/O in a single block. This is a god-function anti-pattern.
Suggested fix:
- Extract flag validation into
validateDownloadOptions().
- Extract run fetching/filtering into
fetchFilteredRuns().
- Extract post-download processing (parsing, report generation, metrics) into
processDownloadedRuns().
- Extract the concurrency logic in
downloadRunArtifactsConcurrent() into a dedicated runDownloadPool struct.
File: pkg/workflow/compiler_orchestrator_workflow.go — 1,073 lines
Issue: ParseWorkflowFile() is 176 lines; extractAdditionalConfigurations() is 140 lines; processAndMergeSteps() is 89 lines.
Why it matters: This is the central orchestration file for the compiler. Large orchestrators become coordination bottlenecks where every new feature adds to an already-heavy function.
Suggested fix: Extract extractAdditionalConfigurations() into compiler_config_extraction.go. Move imports handling into compiler_imports.go. Split ParseWorkflowFile() into parseMarkdown() → extractFrontmatter() → buildWorkflowData().
File: pkg/cli/gateway_logs.go — 1,066 lines
Issue: Contains parseRPCMessages() at 205 lines, extractMCPToolUsageData() at 188 lines, buildToolCallsFromRPCMessages() at 142 lines, and guardPolicyReasonFromCode() at 122 lines.
Why it matters: Log parsing and data extraction are separate concerns mixed into one file.
Suggested fix: Split into gateway_rpc_parser.go (RPC message parsing), gateway_mcp_usage.go (MCP tool usage extraction), and gateway_policy.go (policy reason mapping).
File: pkg/cli/logs_report.go — 1,065 lines
Issue: buildLogsData() is 200 lines; buildMCPToolUsageSummary() is 141 lines.
Why it matters: Report-building functions that touch many data types tend to grow unbounded over time. At 1,065 lines it's already crossed the blocker threshold.
Suggested fix: Extract MCP tool usage building into logs_mcp_usage.go, move episode/run aggregation into logs_run_aggregator.go.
File: pkg/workflow/compiler_safe_outputs_config.go — 1,035 lines
Issue: handlerConfigBuilder.Build() is a single method of 787 lines — the largest function in the entire Go codebase.
Why it matters: A 787-line method is effectively untestable and unreadable. It likely represents a large switch/if tree that has grown by accretion. Every new safe-output handler type extends an already-massive function.
Suggested fix: Decompose Build() by handler category. Create buildIssueHandlerConfig(), buildPRHandlerConfig(), buildDiscussionHandlerConfig(), etc. Each should be a focused method or standalone function. Consider a registry pattern where handlers self-register their config.
JS/CJS files exceeding 1,000 lines
File: actions/setup/js/log_parser_shared.cjs — 1,703 lines
Issue: Contains 7 functions all exceeding 80 lines: generatePlainTextSummary() (211), generateCopilotCliStyleSummary() (201), generateConversationMarkdown() (166), formatToolUse() (153), formatInitializationSummary() (149), formatSafeOutputsPreview() (109), parseLogEntries() (96).
Suggested fix: Split by output format — log_parser_markdown.cjs, log_parser_text.cjs, log_parser_conversation.cjs — keeping log_parser_shared.cjs for the core parseLogEntries() and shared type definitions.
File: actions/setup/js/create_pull_request.cjs — 1,678 lines
Issue: Contains generatePatchPreview() at an astonishing 1,473 lines — the largest single function in the entire codebase.
Why it matters: A 1,473-line function is effectively a program in itself. It cannot be unit tested meaningfully, cannot be reviewed safely, and is a regression magnet.
Suggested fix: This function likely handles multiple patch formats and rendering strategies. Extract: formatHunkHeader(), renderAddedLines(), renderDeletedLines(), formatPatchStats(), truncateLargePatch(). Each logical section should be its own function ≤ 80 lines. Consider splitting into create_pull_request_patch.cjs.
File: actions/setup/js/handle_agent_failure.cjs — 1,536 lines
Suggested fix: Identify the distinct failure-handling strategies (timeout, permission, network, tool-failure) and extract each into a dedicated handler module or named function. Create handle_agent_failure_strategies.cjs for the strategy implementations.
File: actions/setup/js/update_project.cjs — 1,451 lines
Suggested fix: Split into update_project_fields.cjs (field update logic), update_project_status.cjs (status transitions), and update_project_api.cjs (GitHub API calls).
File: actions/setup/js/safe_output_handler_manager.cjs — 1,266 lines
Suggested fix: Extract handler registration and lookup into safe_output_handler_registry.cjs, keeping lifecycle management in the main file. Similar split opportunity as the Go-side compiler_safe_outputs_config.go.
File: actions/setup/js/sanitize_content_core.cjs — 1,171 lines
Suggested fix: Group sanitization strategies by content type: sanitize_content_markdown.cjs, sanitize_content_code.cjs, sanitize_content_text.cjs.
File: actions/setup/js/runtime_import.cjs — 1,022 lines
Suggested fix: Split by runtime type (node, python, go, etc.) into individual runtime_import_node.cjs, runtime_import_python.cjs etc., with a thin dispatcher in runtime_import.cjs.
⚠️ WARNING Violations
These violations should be addressed soon to prevent further structural debt.
Top 10 Go WARNING files (500–1,000 lines):
| File |
Lines |
pkg/workflow/cache.go |
973 |
pkg/workflow/frontmatter_types.go |
957 |
pkg/workflow/compiler_yaml.go |
895 |
pkg/workflow/mcp_setup_generator.go |
893 |
pkg/cli/logs_download.go |
890 |
pkg/workflow/frontmatter_extraction_yaml.go |
868 |
pkg/workflow/compiler_yaml_main_job.go |
868 |
pkg/workflow/compiler_jobs.go |
836 |
pkg/cli/audit.go |
835 |
pkg/cli/pr_command.go |
829 |
65 Go source files are in the 500–1,000 line warning range.
Top JS WARNING files (500–1,000 lines):
| File |
Lines |
actions/setup/js/parse_copilot_log.cjs |
914 |
actions/setup/js/safe_outputs_handlers.cjs |
904 |
actions/setup/js/send_otlp_span.cjs |
850 |
actions/setup/js/mcp_server_core.cjs |
835 |
actions/setup/js/create_issue.cjs |
803 |
actions/setup/js/validate_secrets.cjs |
776 |
actions/setup/js/push_to_pull_request_branch.cjs |
788 |
Notable oversized functions in WARNING files:
logs_orchestrator.go::downloadRunArtifactsConcurrent() — 394 lines
audit_report_render.go::renderConsole() — 244 lines
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
💡 Add a .architecture.yml to the repository root to customize thresholds.
Action Checklist
🏛️ Architecture Guardian — automated scan for run 24349660827
🏛️ Architecture report by Architecture Guardian · ● 1.4M · ◷
Summary
a5e4ba1— Extract shared close-older marker search/filter logic into helpers module (Extract shared close-older marker search/filter logic into helpers module #26023)No import cycles detected. ✅
🚨 BLOCKER Violations
Go files exceeding 1,000 lines
File:
pkg/cli/audit_report_render.go— 1,139 linesIssue: File significantly exceeds the 1,000-line blocker threshold. Contains a single
renderConsole()function of 244 lines.Why it matters: Large rendering files mix data formatting with presentation logic, making them hard to test and extend.
Suggested fix: Extract console rendering sections into focused helpers (e.g.,
audit_report_render_steps.go,audit_report_render_summary.go). TherenderConsole()function should delegate to smaller helpers per section (steps, metrics, tool usage).File:
pkg/cli/logs_orchestrator.go— 1,075 linesIssue: Contains two critically oversized functions:
DownloadWorkflowLogs()at 562 lines anddownloadRunArtifactsConcurrent()at 394 lines.Why it matters: A 562-line function is unmaintainable — it combines HTTP coordination, filtering logic, output formatting, error handling, and file I/O in a single block. This is a god-function anti-pattern.
Suggested fix:
validateDownloadOptions().fetchFilteredRuns().processDownloadedRuns().downloadRunArtifactsConcurrent()into a dedicatedrunDownloadPoolstruct.File:
pkg/workflow/compiler_orchestrator_workflow.go— 1,073 linesIssue:
ParseWorkflowFile()is 176 lines;extractAdditionalConfigurations()is 140 lines;processAndMergeSteps()is 89 lines.Why it matters: This is the central orchestration file for the compiler. Large orchestrators become coordination bottlenecks where every new feature adds to an already-heavy function.
Suggested fix: Extract
extractAdditionalConfigurations()intocompiler_config_extraction.go. Move imports handling intocompiler_imports.go. SplitParseWorkflowFile()intoparseMarkdown()→extractFrontmatter()→buildWorkflowData().File:
pkg/cli/gateway_logs.go— 1,066 linesIssue: Contains
parseRPCMessages()at 205 lines,extractMCPToolUsageData()at 188 lines,buildToolCallsFromRPCMessages()at 142 lines, andguardPolicyReasonFromCode()at 122 lines.Why it matters: Log parsing and data extraction are separate concerns mixed into one file.
Suggested fix: Split into
gateway_rpc_parser.go(RPC message parsing),gateway_mcp_usage.go(MCP tool usage extraction), andgateway_policy.go(policy reason mapping).File:
pkg/cli/logs_report.go— 1,065 linesIssue:
buildLogsData()is 200 lines;buildMCPToolUsageSummary()is 141 lines.Why it matters: Report-building functions that touch many data types tend to grow unbounded over time. At 1,065 lines it's already crossed the blocker threshold.
Suggested fix: Extract MCP tool usage building into
logs_mcp_usage.go, move episode/run aggregation intologs_run_aggregator.go.File:
pkg/workflow/compiler_safe_outputs_config.go— 1,035 linesIssue:
handlerConfigBuilder.Build()is a single method of 787 lines — the largest function in the entire Go codebase.Why it matters: A 787-line method is effectively untestable and unreadable. It likely represents a large
switch/iftree that has grown by accretion. Every new safe-output handler type extends an already-massive function.Suggested fix: Decompose
Build()by handler category. CreatebuildIssueHandlerConfig(),buildPRHandlerConfig(),buildDiscussionHandlerConfig(), etc. Each should be a focused method or standalone function. Consider a registry pattern where handlers self-register their config.JS/CJS files exceeding 1,000 lines
File:
actions/setup/js/log_parser_shared.cjs— 1,703 linesIssue: Contains 7 functions all exceeding 80 lines:
generatePlainTextSummary()(211),generateCopilotCliStyleSummary()(201),generateConversationMarkdown()(166),formatToolUse()(153),formatInitializationSummary()(149),formatSafeOutputsPreview()(109),parseLogEntries()(96).Suggested fix: Split by output format —
log_parser_markdown.cjs,log_parser_text.cjs,log_parser_conversation.cjs— keepinglog_parser_shared.cjsfor the coreparseLogEntries()and shared type definitions.File:
actions/setup/js/create_pull_request.cjs— 1,678 linesIssue: Contains
generatePatchPreview()at an astonishing 1,473 lines — the largest single function in the entire codebase.Why it matters: A 1,473-line function is effectively a program in itself. It cannot be unit tested meaningfully, cannot be reviewed safely, and is a regression magnet.
Suggested fix: This function likely handles multiple patch formats and rendering strategies. Extract:
formatHunkHeader(),renderAddedLines(),renderDeletedLines(),formatPatchStats(),truncateLargePatch(). Each logical section should be its own function ≤ 80 lines. Consider splitting intocreate_pull_request_patch.cjs.File:
actions/setup/js/handle_agent_failure.cjs— 1,536 linesSuggested fix: Identify the distinct failure-handling strategies (timeout, permission, network, tool-failure) and extract each into a dedicated handler module or named function. Create
handle_agent_failure_strategies.cjsfor the strategy implementations.File:
actions/setup/js/update_project.cjs— 1,451 linesSuggested fix: Split into
update_project_fields.cjs(field update logic),update_project_status.cjs(status transitions), andupdate_project_api.cjs(GitHub API calls).File:
actions/setup/js/safe_output_handler_manager.cjs— 1,266 linesSuggested fix: Extract handler registration and lookup into
safe_output_handler_registry.cjs, keeping lifecycle management in the main file. Similar split opportunity as the Go-sidecompiler_safe_outputs_config.go.File:
actions/setup/js/sanitize_content_core.cjs— 1,171 linesSuggested fix: Group sanitization strategies by content type:
sanitize_content_markdown.cjs,sanitize_content_code.cjs,sanitize_content_text.cjs.File:
actions/setup/js/runtime_import.cjs— 1,022 linesSuggested fix: Split by runtime type (node, python, go, etc.) into individual
runtime_import_node.cjs,runtime_import_python.cjsetc., with a thin dispatcher inruntime_import.cjs.Top 10 Go WARNING files (500–1,000 lines):
pkg/workflow/cache.gopkg/workflow/frontmatter_types.gopkg/workflow/compiler_yaml.gopkg/workflow/mcp_setup_generator.gopkg/cli/logs_download.gopkg/workflow/frontmatter_extraction_yaml.gopkg/workflow/compiler_yaml_main_job.gopkg/workflow/compiler_jobs.gopkg/cli/audit.gopkg/cli/pr_command.go65 Go source files are in the 500–1,000 line warning range.
Top JS WARNING files (500–1,000 lines):
actions/setup/js/parse_copilot_log.cjsactions/setup/js/safe_outputs_handlers.cjsactions/setup/js/send_otlp_span.cjsactions/setup/js/mcp_server_core.cjsactions/setup/js/create_issue.cjsactions/setup/js/validate_secrets.cjsactions/setup/js/push_to_pull_request_branch.cjsNotable oversized functions in WARNING files:
logs_orchestrator.go::downloadRunArtifactsConcurrent()— 394 linesaudit_report_render.go::renderConsole()— 244 linesConfiguration
Thresholds (defaults — no
.architecture.ymlfound):Action Checklist
handlerConfigBuilder.Build()(787 lines) — decompose by handler categoryDownloadWorkflowLogs()(562 lines) — extract validation, fetching, processinggeneratePatchPreview()(1,473 lines in JS) — extract by patch-rendering concernlog_parser_shared.cjs(1,703 lines) by output formatpkg/cli/audit_report_render.go(1,139 lines) by rendering sectionpkg/cli/gateway_logs.go(1,066 lines) by parsing concern