Skip to content

chore: ship-ready cleanup from final audit#58

Merged
CMGS merged 1 commit into
masterfrom
chore/ship-ready-cleanup
May 20, 2026
Merged

chore: ship-ready cleanup from final audit#58
CMGS merged 1 commit into
masterfrom
chore/ship-ready-cleanup

Conversation

@CMGS
Copy link
Copy Markdown
Contributor

@CMGS CMGS commented May 20, 2026

Summary

Final ship-readiness audit pass — small, safe fixes from the 3-agent review (SKILL / reuse / quality+efficiency).

  • images/cloudimg.New: add conf == nil guard. Every other backend ctor (oci/CH/FC/cni/bridge/localfile) has it; cloudimg was the lone outlier and would have panicked in NewConfig deref.
  • hypervisor.CloneStorageConfigs: skip nil entries per the memory rule "Never dereference pointers without nil check". Callers pass validated slices today, but the helper is general-purpose.
  • UpdateStates(VMStateRunning) rejected: the Running branch silently opens a fresh compute interval without emitting compute.start. Production code never calls it, but the case was a latent trap — any future caller would silently open an unaccounted interval. Now returns an error pointing callers to BatchMarkStarted.
  • socketProbeTimeout 2s → 500ms: AF_UNIX has no TIME_WAIT and ECONNREFUSED/ENOENT returns immediately; the only 2s wait happened for "socket file present but VMM frozen" — 500ms is plenty.
  • godoc fixes:
    • BatchMarkStarted referenced State==Running which drifted after switching to the hasOpenComputeInterval sentinel
    • LoadRecord documents the shallow value-copy (pointer/slice fields still alias the live record)

Two larger followups are coming as separate PRs:

Test plan

  • TestUpdateStatesEmitsOnlyOnRunningToStopped rewritten to use BatchMarkStarted for Running transitions
  • TestUpdateStatesRunningIsRejected — new test that the Running case now errors
  • TestDeleteAfterErrorEmitsOnlyStorageStop adjusted to BatchMarkStarted path
  • make fmt-check && make lint && go test -race ./... — 21 packages green, lint 0, fmt 0, AST layout audit 0

@CMGS CMGS force-pushed the chore/ship-ready-cleanup branch from 2afefa1 to 6c44470 Compare May 20, 2026 09:18
- images/cloudimg.New now guards conf == nil (consistent with every
  other backend ctor; would otherwise panic in NewConfig deref)
- CloneStorageConfigs skips nil StorageConfig entries per the memory
  rule "Never dereference pointers without nil check"
- UpdateStates(VMStateRunning) is now rejected with an error so future
  callers don't silently open an unaccounted compute interval. Use
  BatchMarkStarted to open a fresh interval. Tests adjusted.
- socketProbeTimeout 2s → 500ms; AF_UNIX local-only socket doesn't
  need a 2s budget and batch rm of unreachable VMs stalls less
- BatchMarkStarted godoc reflects hasOpenComputeInterval (the
  previous wording referenced State==Running which drifted after the
  sentinel switch)
- LoadRecord godoc documents the shallow value-copy (pointer/slice
  fields still alias the live record)
- Two pre-existing standalone public-after-private layout fixes:
  firecracker.DevPath moved before private decompress helpers;
  metadata.CreateFAT12 moved before the private builder type
@CMGS CMGS force-pushed the chore/ship-ready-cleanup branch from 6c44470 to 6b86637 Compare May 20, 2026 09:28
@CMGS CMGS merged commit 3fe0fd0 into master May 20, 2026
4 checks passed
@CMGS CMGS deleted the chore/ship-ready-cleanup branch May 20, 2026 09:34
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