Skip to content

review: whole-repo simplify pass - #52

Merged
CMGS merged 1 commit into
mainfrom
review/simplify-round
Jul 26, 2026
Merged

review: whole-repo simplify pass#52
CMGS merged 1 commit into
mainfrom
review/simplify-round

Conversation

@CMGS

@CMGS CMGS commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Whole-repo /code + /simplify audit round. Behavior-preserving cleanups only:

  • Replace four hand-rolled ctx-cancelable sleep select blocks with commonk8s.SleepCtx (provider watcher backoff/restart, probe loop, SAC dial retry).
  • cmp.Or for empty-string fallbacks (NewLeaseParser, NewCocoonCLI); errors.AsType for error matching (Go 1.26).
  • Inline single-call-site forwarders: probes.applyResult, stats.readNodeUsage, stats.readProcessUsage.
  • probePort now reads the annotation under RLock instead of deep-copying the whole pod on every probe tick.
  • Move cocoon's private run-dir layout knowledge (COW overlay size, CH console socket path, cloudimg overlay probe) out of provider/cocoon into vm/rundir.go, restoring the vm/-owns-cocoon-internals boundary.
  • Make vm.normalizeSizeArg the single owner of quantity→CLI-arg conversion; the provider passes raw quantity strings for memory, same as storage.
  • Tests: wire Probes once in newTestProvider (−67 duplicated assembly lines); drop a dead channel in probes_test.
  • Reattach the isCocoonNotFound godoc that sat on startCmdPipe.

Gates: golangci-lint 0 issues (linux+darwin), asl clean (linux+darwin), go test -race ./... green. Net −87 lines.

…yout into vm/

- replace four hand-rolled ctx-cancelable sleeps with commonk8s.SleepCtx
- cmp.Or for empty-string fallbacks; errors.AsType for error matching
- inline single-call-site forwarders (probes.applyResult, stats read*Usage)
- probePort: narrow RLock read instead of a full pod DeepCopy per probe tick
- move cocoon run-dir layout knowledge (COW size, console socket, cloudimg
  probe) from provider/cocoon into vm/rundir.go
- single owner for quantity-to-CLI-arg conversion (vm.normalizeSizeArg)
- tests: wire Probes once in newTestProvider (-67 duplicated lines)
- reattach the isCocoonNotFound godoc that sat on startCmdPipe
@CMGS
CMGS merged commit 251e5a1 into main Jul 26, 2026
2 checks passed
@CMGS
CMGS deleted the review/simplify-round branch July 26, 2026 10:29
@CMGS CMGS mentioned this pull request Jul 26, 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.

1 participant