Skip to content

refactor(cmd): split autoscale.go into concern files (#321) - #338

Merged
scttfrdmn merged 1 commit into
mainfrom
audit/phase3-split-autoscale
Jul 11, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
audit/phase3-split-autoscale

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Closes #321. Part of the audit tracker #328 (Phase 3). Pure internal reorganization — CLI command/flag tree byte-identical to main.

What changed

cmd/autoscale.go (1417 LOC) — the run* handlers and helpers move into concern files; the cobra Command definitions, the flag var block, and init() stay in autoscale.go (tightly coupled to registration).

File Concern
autoscale_launch.go runAutoscaleLaunch, buildQueueConfig, buildMetricPolicy
autoscale_status.go status / list / health + printGroupStatus
autoscale_policy.go set-policy / set-metric-policy + scaling/metric activity
autoscale_lifecycle.go update / pause / resume / terminate
autoscale_schedule.go add / remove / list schedule handlers
autoscale_helpers.go getAutoscaler, triggerLambda

Verification

  • 23 functions conserved (main had 23 → 23 across the files).
  • go build ./..., go vet ./cmd, gofmt -l clean; full go test ./cmd green (excl. pre-existing TestCatalogValid / feat(plugin): permissions declaration block (#388) #392).
  • Rebuilt bin/spawn, diffed the full recursive command+flag tree vs main → byte-identical.

Third and final split PR (after #336 client.go, #337 launch.go). CHANGELOG rebase expected when landing.

Pure same-package reorganization of cmd/autoscale.go (1417 LOC), no
behavior change. The run* handlers and helpers move to concern files;
the cobra Command definitions, flag var block, and init() stay in
autoscale.go (tight to registration).

- autoscale_launch.go    — runAutoscaleLaunch, buildQueueConfig, buildMetricPolicy
- autoscale_status.go    — status/list/health + printGroupStatus
- autoscale_policy.go    — set-policy/set-metric-policy + activity handlers
- autoscale_lifecycle.go — update/pause/resume/terminate
- autoscale_schedule.go  — add/remove/list schedule handlers
- autoscale_helpers.go   — getAutoscaler, triggerLambda

Verified: 23 funcs conserved; go build ./..., go vet, gofmt clean; full
cmd test suite green; command+flag tree byte-identical vs main.
Part of the 2026-07-11 audit (#328, Phase 3).
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 849 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/autoscale_status.go 0.00% 181 Missing ⚠️
cmd/autoscale_launch.go 0.00% 166 Missing ⚠️
cmd/autoscale_policy.go 0.00% 163 Missing ⚠️
cmd/autoscale_schedule.go 0.00% 160 Missing ⚠️
cmd/autoscale_lifecycle.go 0.00% 142 Missing ⚠️
cmd/autoscale_helpers.go 0.00% 37 Missing ⚠️

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit be8e73f into main Jul 11, 2026
6 of 7 checks passed
@scttfrdmn
scttfrdmn deleted the audit/phase3-split-autoscale branch July 11, 2026 20:32
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.

[audit] Refactor: split cmd/autoscale.go (1335 LOC, ~15 handlers)

1 participant