Skip to content

Architecture Violations Detected β€” 2026-04-17Β #26878

@github-actions

Description

@github-actions

Summary

  • Analysis Period: Last 24 hours
  • Files Analyzed: 1,002 (Go + CJS/JS files from commit 722cdd1)
  • Total Violations: 17
  • Date: 2026-04-17
Severity Count
🚨 BLOCKER 0
⚠️ WARNING 16
i️ INFO 1

⚠️ WARNING Violations

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


File Too Large β€” pkg/workflow/compiler_activation_job.go

File: pkg/workflow/compiler_activation_job.go | Lines: 1,084
Commit: 722cdd1 β€” [aw-compat] Downgrade strict missing-permission failures for default GitHub toolsets to warnings (#26816)
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: The file already follows a functional decomposition pattern (many small helper functions). The main opportunity is to extract buildActivationJob (see Function violation below) into a dedicated orchestration file, e.g. compiler_activation_job_builder.go. Secondary helpers such as addActivationInteractionPermissions*, shouldInclude*, and activationEventSet could move to a compiler_activation_job_helpers.go file, keeping each under 400 lines.


Function Too Large β€” buildActivationJob in pkg/workflow/compiler_activation_job.go

File: pkg/workflow/compiler_activation_job.go | Function: buildActivationJob | Lines: 624
Commit: 722cdd1 β€” [aw-compat] Downgrade strict missing-permission failures for default GitHub toolsets to warnings
Issue: buildActivationJob is 624 lines β€” more than 3Γ— the 200-line threshold. This makes it very hard to read, test, or modify safely.
Suggested fix: Decompose into smaller, focused builder functions:

  1. buildActivationJobTriggerSteps() β€” gathers the trigger/on-section steps
  2. buildActivationJobPermissionSteps() β€” handles permissions setup
  3. buildActivationJobPromptStep() β€” delegates to generatePromptInActivationJob
  4. buildActivationJobOutputSteps() β€” handles output/sanitization steps

Each sub-function should be independently testable and under 100 lines.


File Too Large β€” pkg/workflow/cache.go

File: pkg/workflow/cache.go | Lines: 1,007
Commit: 722cdd1 β€” [aw-compat] Downgrade strict missing-permission failures for default GitHub toolsets to warnings
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Identify the distinct concerns inside this file β€” caching strategy, data structures, and eviction logic are typically separable. Extract into cache_types.go (data models), cache_store.go (read/write operations), and keep cache.go as the top-level orchestration layer.


File Too Large β€” actions/setup/js/log_parser_shared.cjs

File: actions/setup/js/log_parser_shared.cjs | Lines: 1,703
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: The file mixes log-parsing entry points with multiple formatting concerns. Split into:

  • log_parser_conversation.cjs β€” generateConversationMarkdown, generateInformationSection
  • log_parser_formatters.cjs β€” formatToolUse, formatInitializationSummary, formatMcpParameters, formatResultPreview
  • log_parser_summary.cjs β€” generatePlainTextSummary, generateCopilotCliStyleSummary
  • Keep log_parser_shared.cjs as a thin re-export barrel

Function Too Large β€” generatePlainTextSummary in log_parser_shared.cjs

File: actions/setup/js/log_parser_shared.cjs | Function: generatePlainTextSummary | Lines: ~211
Issue: Function exceeds the 200-line threshold.
Suggested fix: Extract sections (header, body, tool-use summary, footer) into smaller helpers and delegate from generatePlainTextSummary.


Function Too Large β€” generateCopilotCliStyleSummary in log_parser_shared.cjs

File: actions/setup/js/log_parser_shared.cjs | Function: generateCopilotCliStyleSummary | Lines: ~201
Issue: Function exceeds the 200-line threshold.
Suggested fix: Same strategy as generatePlainTextSummary β€” extract per-section helpers.


File Too Large β€” actions/setup/js/create_pull_request.cjs

File: actions/setup/js/create_pull_request.cjs | Lines: 1,678
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Split into create_pull_request_client.cjs (API client setup, label/assignee helpers) and create_pull_request_patch.cjs (patch enforcement and preview logic). The main orchestration function should stay in create_pull_request.cjs but be refactored (see Function violation below).


Function Too Large β€” main in create_pull_request.cjs

File: actions/setup/js/create_pull_request.cjs | Function: main | Lines: ~1,442
Issue: main is ~1,442 lines β€” the largest single function violation. It combines client initialization, fallback issue creation, PR diff generation, patch application, label management, and error handling.
Suggested fix: Decompose into a pipeline of clearly named async functions:

  1. initializeClients(config) β€” sets up GitHub clients
  2. preparePullRequestContent(config, clients) β€” builds title/body/labels
  3. applyPatchAndPush(config, clients, content) β€” handles patch enforcement and git push
  4. finalizePullRequest(config, clients, pr) β€” labels, reviews, assignments

Each phase should be independently testable. The main function should orchestrate them with error handling only.


File Too Large β€” actions/setup/js/handle_agent_failure.cjs

File: actions/setup/js/handle_agent_failure.cjs | Lines: 1,590
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Extract context-building functions (all the build*Context helpers) into a dedicated handle_agent_failure_context.cjs file. The main function (see Function violation below) should live in the current file as a thin orchestrator.


Function Too Large β€” main in handle_agent_failure.cjs

File: actions/setup/js/handle_agent_failure.cjs | Function: main | Lines: ~616
Issue: main is ~616 lines.
Suggested fix: Extract distinct phases β€” issue parent creation (ensureParentIssue), context assembly (calling build*Context functions), and issue/comment posting β€” into separate async functions called from main.


File Too Large β€” actions/setup/js/update_project.cjs

File: actions/setup/js/update_project.cjs | Lines: 1,451
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Separate project field update logic from project item query and mutation logic. Consider update_project_fields.cjs for field-specific logic and update_project_queries.cjs for GraphQL query/mutation definitions.


File Too Large β€” actions/setup/js/safe_output_handler_manager.cjs

File: actions/setup/js/safe_output_handler_manager.cjs | Lines: 1,301
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Extract individual handler registrations into per-handler files or a safe_output_handlers/ subdirectory, keeping safe_output_handler_manager.cjs as a registration and dispatch layer only.


File Too Large β€” actions/setup/js/sanitize_content_core.cjs

File: actions/setup/js/sanitize_content_core.cjs | Lines: 1,224
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Separate sanitization rules (regex patterns, replacement logic) from orchestration code. Consider sanitize_content_rules.cjs for the rule definitions and sanitize_content_pipeline.cjs for the processing pipeline.


File Too Large β€” actions/setup/js/runtime_import.cjs

File: actions/setup/js/runtime_import.cjs | Lines: 1,022
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Group runtime-specific import handling into separate modules (e.g., runtime_import_node.cjs, runtime_import_python.cjs) and keep runtime_import.cjs as a dispatcher.


File Too Large β€” actions/setup/js/safe_outputs_handlers.cjs

File: actions/setup/js/safe_outputs_handlers.cjs | Lines: 1,007
Commit: 722cdd1
Issue: File exceeds the 1,000-line warning threshold.
Suggested fix: Similar to safe_output_handler_manager.cjs β€” split handlers by domain (issue handlers, PR handlers, discussion handlers) into focused files.


i️ INFO Violations

Informational findings. Consider addressing in future refactoring.

  • pkg/workflow/cache.go: 2 exported identifiers β€” export count is within limits; noted for context only given the file size.

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

  • Decompose buildActivationJob in pkg/workflow/compiler_activation_job.go (624 lines β†’ target ≀ 100 lines per function)
  • Split pkg/workflow/compiler_activation_job.go (1,084 lines) into focused sub-files
  • Split pkg/workflow/cache.go (1,007 lines) into cache_types.go + cache_store.go
  • Refactor main in create_pull_request.cjs (~1,442 lines) into a pipeline of async functions
  • Split actions/setup/js/log_parser_shared.cjs (1,703 lines) into per-concern modules
  • Refactor main in handle_agent_failure.cjs (~616 lines)
  • Address remaining CJS file-size warnings (update_project.cjs, safe_output_handler_manager.cjs, sanitize_content_core.cjs, runtime_import.cjs, safe_outputs_handlers.cjs)
  • Close this issue once all violations are resolved

πŸ›οΈ Thresholds are configured in .architecture.yml at the repository root.

πŸ›οΈ Architecture report by Architecture Guardian Β· ● 1.5M Β· β—·

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