Skip to content

[Code Quality] Split oversized CompileWorkflowData/generateAndValidateYAML in compiler.go and add %w error wrapping #49094

Closed as not planned

Description

@github-actions

Description

pkg/workflow/compiler.go (584 lines) has two functions that exceed the ~50-line guidance and zero %w-wrapped errors across 7 return err sites, per the Daily Compiler Quality Check discussion #49027:

  • CompileWorkflowData — 172 lines
  • generateAndValidateYAML — 123 lines

Both carry good godoc but mix multiple concerns (parse, validate, generate, write) in a single function body, and none of the 7 return err statements in the file wrap errors with %w, losing call-site context for debugging compile failures.

Suggested Changes

  • Split CompileWorkflowData into focused steps (e.g. parse -> validate -> generate -> write), each as a small named helper with its own error handling.
  • Split generateAndValidateYAML similarly by concern (generate vs. validate).
  • Wrap the 7 bare return err statements in compiler.go with fmt.Errorf("...: %w", err) including relevant context (workflow name/path/stage).

Files Affected

  • pkg/workflow/compiler.go (CompileWorkflowData, generateAndValidateYAML)

Success Criteria

  • No function in compiler.go exceeds ~50-60 lines
  • All return err sites in the file use %w wrapping with meaningful context
  • Existing compiler tests continue to pass; add/adjust unit tests for newly extracted helpers if needed

Source

Extracted from Daily Compiler Quality Check discussion #49027 (2026-07-30 run).

Priority

Medium - readability/maintainability improvement, not blocking.

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 47.6 AIC · ⌖ 4.6 AIC · ⊞ 10.2K · ◷

  • expires on Jul 30, 2026, 11:40 PM UTC-08:00

Activity

  1. github-actions commented on Jul 31, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-07-31T07:40:50.940Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions