Skip to content

Review round: VNC password quoting, gc predicate cut, stdlib uuid, deps, docs - #52

Merged
CMGS merged 10 commits into
masterfrom
review/round-2026-09-24
Sep 24, 2026
Merged

CMGS merged 10 commits into
masterfrom
review/round-2026-09-24

Conversation

@CMGS

@CMGS CMGS commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Whole-repo review round: dependency bump, one bug fix, comment and modern-Go review, two cuts, and docs that the code contradicted.

Commits

  • build: cocoon 22b7392 → 1951f35 (master: #262 TAP redirect verify, #261 image/doctor), flock v0.13.1, projecteru2/core v0.1.5, oras-go v2.6.2.
    • With #262, recoverNet's Verify also requires the TAP's ingress redirect filter. A TAP left without its filter by an interrupted add used to pass Verify, so QEMU launched onto a dead data path. Now vm start rebuilds it in one pass (CNI DEL+ADD with the recorded MAC; the qdisc and filter steps tolerate existing state).
    • A normally stopped VM keeps its filter, so it is not rebuilt.
    • Launch-path cost: one netlink filter listing per owned CNI NIC.
    • core, flock and oras change no call site here (no Sentry DSN; oras fetches a KB-sized manifest).
  • fix: reject a double quote in the VNC password.
    • QEMU's HMP parses an argument that starts with " as a quoted string (monitor/hmp.c get_str; set_password takes password:s). So --vnc-password '"abcdef"' passed validation and was stored as abcdef: silently the wrong password.
    • The new test row fails on master and passes here.
  • review: log the missed power-down at warn, as cocoon's stop escalation does.
    • Comment tightening: the nonexistent export op; the three gc godocs cut to one fact each; three dead //nolint:gosec (G204/G304 are excluded in .golangci.yml) and five dead test //nolint:errcheck; restated DataDisks and VNC proxy comments.
  • review: stdlib uuid.NewV4() for the SMBIOS UUID (Go 1.27) replaces the hand-rolled v4. The partition-wait predicate is folded.
  • cut:
    • gc's vmInUse predicate never matched:
      • cocoon's cni and bridge collectors only ask about IDs that Resolve left after dropping every recorded VMID.
      • sweep holds the gc lock exclusively plus every VM lock, so no record appears between ReadDB and Collect.
      • The bridge collector passes an 8-char prefix, and a 26-char VMID never equals it.
    • provisionNet's empty-Add guard never fired: both backends return one config per spec on success, and AddRange(0, 1) is one spec.
  • docs:
  • scripts/qmp-input.py (three commits): cmd now fails on a QMP error reply or a closed monitor instead of returning it unchecked, so an OCR step no longer clicks on a stale /tmp/_ocr.ppm from a failed screendump; the dead ocrdclick op goes (its callers left in 5ef9948); the usage text lists the ten live ops, the agree_button docstring is one line, % formatting becomes f-strings. Verified against a fake QMP server: click/dclick/key/chord/type/screendump exit 0; an error reply or EOF exits 1 (the old script exited 0 silently). Not run: ocrclick/ocrtext/agreebtn need tesseract + PIL.

Numbers

  • Production Go +27/−74 (net −47); tests +6/−5; go.mod/go.sum/docs/scripts +104/−102 (qmp-input.py +21/−37).
  • Go comment lines: +4/−5. The four are in-place rewrites; lines carrying a comment drop by 11.

Evidence (final HEAD)

golangci-lint v2.13.2 GOOS=linux   0 issues.
golangci-lint v2.13.2 GOOS=darwin  0 issues.
make fmt-check rc=0; golangci-lint fmt --diff rc=0
asl ./... linux/darwin: no findings (incl. -forwarder)
go vet linux/darwin: ok
go test -race -count=1 ./... (darwin): no FAIL lines, rc=0
go test -race -count=1 ./... (golang:1.27 linux/arm64 container):
ok  github.com/cocoonstack/cocoon-macos/cmd        1.031s
ok  github.com/cocoonstack/cocoon-macos/cmd/image  1.027s
ok  github.com/cocoonstack/cocoon-macos/cmd/vm     6.574s
ok  github.com/cocoonstack/cocoon-macos/home       1.017s
ok  github.com/cocoonstack/cocoon-macos/qemu       1.165s

The branch also builds, vets and passes the darwin race tests against the cocoon round branch through a scratch-only replace.

After cocoon #264

  • build: cocoon is pinned to the #264 squash commit dcec1fa (v0.6.9-0.20260924025202-dcec1fa3f056), and both command groups take cliutil.GroupCommand, which #264 made the one owner of the group contract (NoArgs + help). On the built binary: vm and image print help with rc 0; vm bogus and image bogus fail with unknown command "bogus" for "cocoon-macos vm" / "... image", rc 1.
  • Gates re-run on the final head: lint 0 issues on linux and darwin, fmt-check and golangci-lint fmt --diff rc 0, asl clean on both, build+vet both, race tests on darwin and in the linux container all ok.

Not in this PR

  • vk-cocoon's COCOON_MACOS_VNC_PASSWORD check accepts whitespace and double quotes that this repo rejects, so a bad value fails every macOS launch loudly instead of at vk-cocoon startup. That is a vk-cocoon change; its validator is being aligned in the vk-cocoon round.

CMGS added 10 commits September 24, 2026 00:50
…github.com/gofrs/flock v0.13.0→v0.13.1, github.com/projecteru2/core v0.1.3→v0.1.5, oras.land/oras-go/v2 v2.6.1→v2.6.2
HMP parses an argument that starts with a double quote as a quoted string, so a password like "abcdef" was stored as abcdef.
Drop dead gosec/errcheck nolint directives, restated DataDisks and VNC proxy comments, and the nonexistent export op; cut the gc godocs to one fact each; the guest ignoring the power-down is a degraded stop, so it logs at warn like cocoon's stop escalation.
vmInUse never matched: the collectors only ask about IDs Resolve left after dropping every recorded VMID, sweep holds the gc lock and every VM lock so no record appears before Collect, and the bridge collector passes an 8-char prefix.
provisionNet's empty-result guard never fired: both Add backends return one config per spec on success and AddRange(0, 1) is one spec.
…rk rebuild, and the e2e script

cli.md named overlay.qcow2 and a copied OpenCore; the VM dir holds disk.qcow2 and an OpenCore overlay. networking.md gains the #51 rebuild of lost owned networking. The e2e.sh header names the script it is.
cmd dropped error replies and EOF, so a failed screendump left OCR reading the previous /tmp/_ocr.ppm and a rejected key or click still exited 0.
Its only callers, the picker double-clicks in build-qemu-macos.sh, went away in 5ef9948; nothing in the workspace calls it.
…mmand groups

cocoon #264 made GroupCommand the one owner of the group contract (NoArgs + help); the two groups here now use it. Checked on the built binary: vm and image print help with rc 0, vm bogus and image bogus fail with unknown command.
@CMGS
CMGS marked this pull request as ready for review September 24, 2026 02:55
@CMGS
CMGS merged commit 5efe99a into master Sep 24, 2026
3 checks passed
@CMGS
CMGS deleted the review/round-2026-09-24 branch September 24, 2026 02:58
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