Skip to content

Refactor AWF helper monolith into focused modules with preserved command/env APIs - #50297

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/file-diet-refactor-awf-helpers
Closed

Refactor AWF helper monolith into focused modules with preserved command/env APIs#50297
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/file-diet-refactor-awf-helpers

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

pkg/workflow/awf_helpers.go had become the largest non-test source file, with command assembly and feature/env/image/ARC-DinD helpers co-located. This change decomposes that surface into focused files while keeping behavior and exported interfaces stable.

  • Module split by responsibility

    • awf_command.go: BuildAWFCommand, BuildAWFArgs, GetAWFCommandPrefix, WrapCommandInShell
    • awf_arcdind.go: ARC/DinD topology detection and chroot/workflow-call network patch helpers
    • awf_feature_support.go: AWF version-gated capability checks (awfSupports*, awfVersionAtLeast)
    • awf_env.go: environment assembly/injection helpers (ComputeAWFExcludeEnvVarNames, token/max-credit env wiring)
    • awf_image.go: image tag+digest resolution and model JSON path export script helpers
  • Public API and behavior preserved

    • Kept exported entrypoints unchanged:
      • BuildAWFCommand
      • BuildAWFArgs
      • GetAWFCommandPrefix
      • WrapCommandInShell
      • ComputeAWFExcludeEnvVarNames
    • No interface or call-site contract changes; refactor is structural and boundary-oriented.
  • Test boundary alignment

    • Existing AWF helper coverage remains intact while logic is reorganized around clearer module boundaries (command assembly vs feature gates vs ARC/DinD vs env vs image).
// command assembly API remains stable after split
cmd, err := BuildAWFCommand(cfg, wfData, fwConfig)
if err != nil {
    return err
}
args := BuildAWFArgs(cfg, wfData, fwConfig)
_ = append([]string{cmd}, args...)

Copilot AI linked an issue Aug 4, 2026 that may be closed by this pull request
8 tasks
Copilot AI changed the title [WIP] Refactor pkg/workflow/awf_helpers.go into smaller files Refactor AWF helper monolith into focused modules with preserved command/env APIs Aug 4, 2026
Copilot AI requested a review from pelikhan August 4, 2026 15:35
@pelikhan pelikhan closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[file-diet] File Diet: Refactor pkg/workflow/awf_helpers.go (1148 lines)

2 participants