Repository navigation
refactor(cmd): extract step helpers from launchWithProgress (#319) - #340
Merged
Merged
Conversation
The 743-line single-instance orchestrator now delegates its cleanly- bounded early setup phases to named helpers, dropping to ~625 lines and reading as a step sequence. No behavior change. - ensureAMIAndPreflight — AMI detect + OS resolve + instance-type guards (Windows lifecycle/burstable, nested-virt, MPI/EFA/hibernation preflight) - ensureIAMProfile — user-specified or default spored IAM profile - ensureSecurityGroup — MPI / Windows managed SG (else no-op) Left inline by design: the FSx-provisioning block (its pendingFSx* locals thread into the post-launch create step) and the launch/wait/DNS tail (interwoven with the launch result). The count>1 job-array early-return stays in the parent, not buried in a helper. Verified: go build ./..., go vet ./cmd, gofmt clean; full cmd test suite green; job-array early-return confirmed still in launchWithProgress; command+flag tree byte-identical vs main. Part of the 2026-07-11 audit (#328, Phase 3).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #319. Part of the audit tracker #328 (Phase 3). No behavior change — command/flag tree byte-identical to
main.What changed
launchWithProgress(the single-instance launch orchestrator) was 743 lines. Extracted its cleanly-bounded early setup phases into named helpers so the function reads as a step sequence and drops to ~625 lines:ensureAMIAndPreflight— AMI detect (Step 1) + OS resolve (1b) + instance-type guards (Windows lifecycle/burstable, nested-virt, MPI/EFA/hibernation preflight)ensureIAMProfile— user-specified or default spored IAM instance profile (Step 3)ensureSecurityGroup— MPI / Windows managed security group, else no-op (Step 4)Each helper takes
(ctx, awsClient, config, prog[, auditLog]), mutatesconfig, and returnserror— a mechanical lift of contiguous blocks.Left inline (deliberately — the plan called this out)
pendingFSxConfig/pendingFSx*locals thread through to the post-launch create step (6.5), so extracting would require a struct return and add risk for little readability gain.resultvalue.count > 1job-array early-return stays in the parent (verified:launchWithProgressstill contains thecount > 1 → launchJobArray/launchJobArrayCohortdispatch), not buried in a helper.Verification
go build ./...,go vet ./cmd,gofmt -lclean.go test ./cmdgreen (excl. pre-existingTestCatalogValid/ feat(plugin): permissions declaration block (#388) #392).bin/spawn, command+flag tree byte-identical vsmain.This is the highest-risk Phase 3 item (large, branchy, no direct unit test — needs AWS), so I kept extractions minimal and mechanical; anything that resisted a clean lift was left inline per the plan. Final Phase 3 PR (after #336/#337/#338 splits + #339 dedup).