Repository navigation
Description
Spawn CLI/code audit — 2026-07-11 (findings tracker)
Full report: docs/spawn-audit-2026-07-11.md. Assessment-only, adversarially verified (62/62 findings survived verification; severities/scope adjusted where the first pass was wrong). All child issues carry the audit:2026-07 label.
The spawn CLI surface is fundamentally healthy — core lifecycle verbs, the --json→-o/--output gate, and the --yes-on-destructive convention are consistent and test-enforced. Findings cluster into: CLI ergonomics drift, ~1000 lines of internal dead code, and a few oversized/coupled internals.
Phase 0 — do now (safety + isolated cleanup, non-user-facing) ✅ APPROVED
- [audit] SAFETY: destructive-verb --yes gate misses hyphenated compound verbs (workspace-remove, remove-schedule do irreversible deletes with no confirmation) #285 SAFETY: --yes gate misses hyphenated compound verbs (workspace-remove / remove-schedule)
- [audit] Dead code: delete pkg/streaming (entirely unused, ~71 funcs across tcp/transport/zmq) #286 Dead: pkg/streaming (~71 funcs)
- [audit] Dead code: delete pkg/instance/patterns.go (unreferenced anywhere) #287 Dead: pkg/instance/patterns.go
- [audit] Dead code: delete pkg/audit/context.go (7 unused helpers) + its orphaned tests #288 Dead: pkg/audit/context.go
- [audit] Dead code: delete unused DNS encoding inverse helpers (DecodeAccountID/GetAccountSubdomain/ParseDNSName + pkg-level GetFQDN) #289 Dead: DNS encoding inverse helpers
- [audit] Dead code: delete unused alt-constructors/methods in pkg/scheduler + pkg/alerts #290 Dead: scheduler/alerts alt-constructors
- [audit] Dead code: delete pkg/queue DependenciesMet/GetReadyJobs (topo-sort path is the live one) #291 Dead: queue DependenciesMet/GetReadyJobs
- [audit] Dead code: delete cmd one-off helpers waitForDCV / getTagValue / formatTTLDuration #292 Dead: cmd one-off helpers (waitForDCV/getTagValue/formatTTLDuration)
- [audit] Dup: formatDuration and formatDurationForTTL are byte-identical — collapse to one #294 Dup: formatDuration == formatDurationForTTL
- [audit] Dup: truncate == truncateValue (byte-identical) — keep one #295 Dup: truncate == truncateValue
- [audit] Dup: ~20 identical tabwriter.NewWriter(...,2,' ',0) init sites — add a shared newTableWriter() helper #296 Dup: tabwriter init helper (optional)
- [audit] Dup: per-region EC2 client boilerplate repeated ~43+ times in pkg/aws — add c.regionalEC2(region) #297 Dup: per-region EC2 client boilerplate
- [audit] Bug+Dup: config.ParseDuration silently drops
d(day) support —ttl: 2dparses to 0; delegate to the complete parser #298 Bug+Dup: config.ParseDuration dropsd(ttl: 2d→0) — own PR
#293 (pkg/sms) is explicitly NOT in Phase 0 — it's a live cross-repo public API; coordinated removal only.
Phase 1 — additive / backward-compatible (one MINOR)
- [audit] Add
spawn autoscale list(todaystatus [group]overloads both list and detail) #299 addautoscale list - [audit] Standardize --regions to StringSlice everywhere (raw comma-split in 5 commands; one misses TrimSpace) #300
--regionsStringSlice everywhere - [audit] Bug:
spawn validate -o jsonerrors (unknown shorthand); validate/snapshot reinvent the root output flag #301 fixspawn validate -o json - [audit] Dup: 18 inline sts.NewFromConfig+GetCallerIdentity sites bypass the existing GetAccountID helper #302 STS/GetAccountID dedup (internal)
- [audit] Dup: SSH option block copy-pasted across 4 spored-exec sites — extract buildSporedSSHArgs/runSpored #303 SSH-invocation dedup (internal)
Phase 2 — user-facing renames (needs convention decision; ship with aliases + CHANGELOG, single MINOR)
- [audit] Verb consistency: standardize single-resource detail verb (info/describe/show fragmentation) #304 detail-verb standardization (info/describe/show)
- [audit] Grouping:
notify workspace-*flat-hyphenated verbs should be aworkspacesubgroup #305notify workspace-*→ subgroup - [audit] Grouping:
autoscale *-scheduleflat-hyphenated verbs should be anautoscale schedulesubgroup #306autoscale *-schedule→ subgroup - [audit] Grouping: autoscale set-policy/set-metric-policy + scaling-activity/metric-activity flat pairs #307 autoscale policy/activity flat pairs
- [audit] Grouping:
costgroup has a single childbreakdown— consider flattening #308 flattencost breakdown(low) - [audit] Flags: local --output/-o in queue/slurm/pipeline shadow the root format flag with a different meaning #309 local
--output/-oshadows root format flag - [audit] Flags: autoscale launch uses --tags (StringToString) vs --tag (StringArray) everywhere else #310 autoscale
--tagsvs--tag - [audit] Flags: launch uses --subnet vs --subnet-id on autoscale/burst/image import #311
--subnetvs--subnet-id - [audit] Flags: security-group flag has 3 names + 3 types; launch only accepts a single SG #312 security-group flag names/types (+ launch single-SG limitation)
- [audit] Flags: launch uses --key-pair vs --key-name on autoscale/burst #313
--key-pairvs--key-name - [audit] Flags: async flag is --detach (launch/sweep) vs --detached (pipeline launch); pipeline flag is also a no-op #314
--detachvs--detached(pipeline flag is a no-op) - [audit] Flags: execute-vs-dry-run is --force (cleanup) vs --confirm (workspace-destroy) vs --dry-run (capacity-block) #315
--force/--confirm/--dry-runexecute-vs-dry-run - [audit] Flags: --hibernate-on-idle boolean vs --on-complete enum — consider --on-idle enum #316
--hibernate-on-idlebool vs--on-idleenum (low) - [audit] Flags: --wait is bool (launch/ami/pipeline) vs int-minutes (image import) #317
--waitbool vs int-minutes (low; reasonable to defer)
Phase 3 — structural refactors (largest blast radius; after Phase 2 grouping decisions)
- [audit] Refactor: split cmd/launch.go (4324 LOC god-file) along its 5 concerns #318 split cmd/launch.go (4324 LOC)
- [audit] Refactor: launchWithProgress is a 749-line function (longest in the repo) — extract per-step helpers #319 launchWithProgress 749-line fn
- [audit] Refactor: extract runLaunchBatch for launchAllAtOnce + launchJobArray (also closes #220-class cleanup divergence) #320 extract runLaunchBatch (closes spawn#210 partial regression on v0.62.0: capacity-failed polls still orphan FSx on launcher.Provision (likely 1 per AZ attempt) — 3 live orphans preserved as evidence #220-class cleanup divergence)
- [audit] Refactor: split cmd/autoscale.go (1335 LOC, ~15 handlers) #321 split cmd/autoscale.go
- [audit] Refactor: pkg/aws/client.go (2379 LOC / 60 funcs) is a grab-bag — move domains to sibling files #322 split pkg/aws/client.go
- [audit] Refactor: SetupSporedIAMRole — extract inline trust-policy const; consolidate with iam.go #323 SetupSporedIAMRole trust-policy const (low)
- [audit] Refactor: buildTags is a 218-line straight-line function — group by concern (low) #324 buildTags grouping (low)
- [audit] Structural (design): pkg/aws is a god package — split opportunistically along domain files #325 pkg/aws god-package split (needs design)
- [audit] Structural (design): cmd/ talks to DynamoDB directly (27 sites, ~5 files) — extract a store/repository layer #326 cmd/→DynamoDB store layer (needs design)
- [audit] Guardrail: add a test forbidding NEW direct aws-sdk service imports in cmd/ (allowlist) #327 cmd/ aws-sdk-import guardrail test (gated on [audit] Structural (design): cmd/ talks to DynamoDB directly (27 sites, ~5 files) — extract a store/repository layer #326)
Doc-only (no bump; fold into whatever release notes) — no separate issues filed
- image/ami Short-string overlap — clarify help text (ami = capture from running; image = build from ISO). CHANGELOG
Documentation. - delete vs remove vs destroy — document the convention (remove = detach-from-parent, delete/destroy = teardown standalone). No churn to existing commands.
Investigated & ruled out (verified NOT actionable) — no issues filed
- launcher.Provision / validateEphemeralFSx / createAndAttachEphemeralFSx — flagged dead by
deadcode, but it's the exported headless launch entrypoint (spawn#210 partial regression on v0.62.0: capacity-failed polls still orphan FSx on launcher.Provision (likely 1 per AZ attempt) — 3 live orphans preserved as evidence #220 hotpath / Lambda no-SSH), reached by build-taggedtest/e2e/tier2_launcher_test.go. KEEP. - pkg/testutil (~55 funcs) + test/e2e/helpers.go — test infrastructure, invisible to
deadcode. KEEP. dup-list-then-filter-by-name— refuted: the loops do NOT duplicate resolveInstance's i-prefix/case-insensitive/running-over-stopped logic.--jsongate — verified still holds (all 9 flags MarkDeprecated; TestFlagConventions passes). Used as the model to extend for--output/--tag.- lifecycle verbs (start/stop/hibernate/terminate + cancel) — verified a clean, consistent split. No change.
resumetwo senses — disambiguated by noun context; top-levelresumealready correctly deprecated towardsweep resume. Doc-only.- provider vs pkg/aws dual EC2-access layers — confirmed a defensible split; document the boundary rather than merge.
SemVer if all Group A+B shipped together: single MINOR (pre-1.0 breaking → MINOR; everything ships as deprecated aliases, nothing hard-removed).
Activity
feat(cli): phase-1 consistency — autoscale list, --regions slice, -o …
feat(cli): align flag names across commands with deprecated aliases (#…
feat(cli): group notify workspace-* into a `notify workspace` subgroup (
feat(cli): group notify workspace-* into a `notify workspace` subgroup (
feat(cli): group autoscale *-schedule into an `autoscale schedule` su…
feat(cli): group autoscale *-schedule into an `autoscale schedule` su…
refactor(aws): split client.go into domain files (#322 #323 #324) (#336)
refactor(cmd): split launch.go into concern files (#318)
refactor(cmd): split launch.go into concern files (#318) (#337)
refactor(cmd): split autoscale.go into concern files (#321) (#338)
refactor(cmd): extract runLaunchBatch to dedup parallel-launch (#320) (…
refactor(cmd): extract step helpers from launchWithProgress (#319) (#340
chore(release): v0.71.0
chore(release): v0.72.0
scttfrdmn commentedon Jul 15, 2026
Audit fully closed — all 43 findings resolved.
Final wave (this session) cleared the last 12 open items:
Already-complete (verified against current main, closed with evidence):
Wave 1 — internal refactors (v0.76.0):
regionalEC2/regionalConfighelpers replace ~40 per-region client sites; retired the always-nil-errorgetRegionalConfig(refactor(aws): collapse per-region client boilerplate into helpers (#297) #359).GetCallerIdentitysites routed throughGetAccountID/GetCallerIdentityInfo(+ IMDS fallback); tightened the [audit] Guardrail: add a test forbidding NEW direct aws-sdk service imports in cmd/ (allowlist) #327 import allowlist (refactor(cmd): route STS caller-identity through pkg/aws helpers (#302) #360).sporedSSHOptions()for the 4 spored-exec SSH sites (refactor(cmd): share spored-SSH options via helper (#303) #358).Wave 2 — user-facing CLI consistency, all with deprecated aliases (v0.76.0, PR #361):
fsx show/schedule show; [audit] Grouping: autoscale set-policy/set-metric-policy + scaling-activity/metric-activity flat pairs #307autoscale set-scaling-policy; [audit] Grouping:costgroup has a single childbreakdown— consider flattening #308cost <id>; [audit] Flags: --hibernate-on-idle boolean vs --on-complete enum — consider --on-idle enum #316launch --on-idleenum; [audit] Flags: --wait is bool (launch/ami/pipeline) vs int-minutes (image import) #317image import --waitbool +--wait-timeout; [audit] Flags: execute-vs-dry-run is --force (cleanup) vs --confirm (workspace-destroy) vs --dry-run (capacity-block) #315cleanup/notify workspace destroyexecute-by-default +--dry-run,upgrade-spored --allow-downgrade.TestSupersededFlagsAreDeprecated+ updatedisDestructive/TestWaitFlagParsing.Wave 3 — cross-repo (#293): removed dead
pkg/smsfrom spawn (#363); rest-api now owns its local pending-reply types (#410).Shipped in spawn v0.76.0. Phases 0–3 complete.