Skip to content

review: post-batch cleanup round - #35

Merged
CMGS merged 2 commits into
masterfrom
review/post-batch-cleanup
Aug 30, 2026
Merged

review: post-batch cleanup round#35
CMGS merged 2 commits into
masterfrom
review/post-batch-cleanup

Conversation

@CMGS

@CMGS CMGS commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Repo-wide review round after merging #28-#34: style walkthrough, simplify lenses, comment-budget sweep, structural gate, prod-LOC audit, and hot-path check. The batch converged almost clean; this PR applies the three findings that survived adjudication.

  • drop the inline os.RemoveAll(dir) on the resizeSystemDisk error path in create() and clone() — the cleanupFailedVM defer registered above it already removes the dir (and reaps helpers)
  • fold the one-line teardownNet wrapper into teardownNetContext and keep the single ctx-taking teardownNet

Audit ledger

  • Comment budget: zero multi-line comments remain in production Go (scanned every non-test file); no change needed.
  • Structural gate (asl ./...): clean on linux and darwin before and after.
  • resetIncompleteVMDir's committed-record guard was flagged as redundant with scaffoldVM's check, but it sits directly on a destructive RemoveAll and carries a dedicated test — kept (no change needed).
  • connectFreeNBD's two cleanup blocks differ (one adds --disconnect); folding adds code — kept.
  • storageFromFlag/parseSize split is genuine reuse (data disks share parseSize) — kept.

Prod LOC

2803 lines of non-test Go (cmd/vm 1730, qemu 570, cmd/image 337, home 54, internal/procutil 25, version 21). The merged batch added a net +442 (largest: NBD lifecycle +165, transactional create +158), all earned by behavior; this PR returns 9.

Hot path

The batch adds work only to create/teardown paths (per-op flock + lock-dir ensure, create-time NBD lease and /proc scans, one pid verify at launch); nothing on the running-VM path, and this PR only removes work. Hardware re-timing of vm run is pending testbed availability (both hosts unreachable today) and will ride the next e2e round.

Validation

  • make lint — 0 issues on linux and darwin
  • asl ./... — clean on both GOOS
  • go test ./... — all packages ok
  • go vet — both GOOS

CMGS added 2 commits August 30, 2026 16:43
create/clone removed the VM dir inline on the resize error path while the
cleanupFailedVM defer already removes it; teardownNet was a one-line wrapper
around teardownNetContext with a single caller. Behavior unchanged.
Reject unsafe VM names, reconcile daemonized QEMU before offline and destructive operations, retain retryable state on network teardown failure, and serialize stopped-source clones. Align the documentation with the enforced behavior.
@CMGS
CMGS merged commit d6ab8ad into master Aug 30, 2026
3 checks passed
@CMGS
CMGS deleted the review/post-batch-cleanup branch August 30, 2026 09:37
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.

1 participant