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 · ◷
Description
pkg/workflow/workflow_builder.goconverts step data from[]*WorkflowStepto[]anyand back multiple times (seecopilotSetupSteps,otherImportedSteps,mainSteps,allSteps,importedPreStepsdeclared asvar ... []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
[]*WorkflowStepthroughout the build pipeline.[]anyat the final YAML-marshal boundary (or implementMarshalYAMLonWorkflowStep/a wrapper slice type so no manual conversion is needed at all).mainStepsVal.([]any).Files Affected
pkg/workflow/workflow_builder.go(lines ~272, ~748-847)Success Criteria
[]anyconversions for step slices before the final marshal stepSource
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