Skip to content

[Code Quality] Fix []any round-trip for steps in workflow_builder.go to stay typed as []*WorkflowStep #51030

Description

@github-actions

Description

pkg/workflow/workflow_builder.go converts step data from []*WorkflowStep to []any and back multiple times (see copilotSetupSteps, otherImportedSteps, mainSteps, allSteps, importedPreSteps declared as var ... []any, with comments like "Convert back to []any for YAML marshaling" around lines 748-847). This round-trip loses type safety in the middle of the pipeline and requires repeated type assertions (steps, ok := mainStepsVal.([]any)).

Suggested Changes

  • Keep step collections typed as []*WorkflowStep throughout the build pipeline.
  • Only convert to []any at the final YAML-marshal boundary (or implement MarshalYAML on WorkflowStep/a wrapper slice type so no manual conversion is needed at all).
  • Remove now-unnecessary type assertions like mainStepsVal.([]any).

Files Affected

  • pkg/workflow/workflow_builder.go (lines ~272, ~748-847)

Success Criteria

  • No intermediate []any conversions for step slices before the final marshal step
  • Existing workflow build/marshal tests pass unchanged
  • Type assertions on step slices reduced/eliminated

Source

Extracted from Typist - Go Type Consistency Analysis #50840

Priority

Medium - part of a higher-risk structural cleanup but this slice is isolated to step marshaling

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

  • expires on Aug 7, 2026, 11:12 PM UTC-08:00

Activity

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