Skip to content

fix(spec): LibvirtGraphicsListeners UnmarshalJSON tri-shape - #3

Merged
atrawog merged 2 commits into
mainfrom
feat/listen-json-shorthand
Jul 8, 2026
Merged

atrawog merged 2 commits into
mainfrom
feat/listen-json-shorthand

Conversation

@atrawog

@atrawog atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Cutover L de-typed the vm substrate body to opaque JSON decoded into spec.Vm, but spec.LibvirtGraphicsListeners had only UnmarshalYAML + a charly-side YAML expander — no UnmarshalJSON. The documented listen: 127.0.0.1 scalar shorthand (and object/list forms) therefore failed on the JSON path with "cannot unmarshal string into …" — the check-cross-vm-http web-vm bed failure (identical on main, pre-existing). Added UnmarshalJSON + inferListenTypes accepting all three shapes; the YAML path decodes the same three via cue.Value.Decode running this method (the Matcher/PortScope self-decoding strategy), so one decoder now serves both paths (R3) — the redundant expandLibvirtListenersNode is removed in the consuming superproject cutover.

Change class + gate

sdk contract. go build ./... && go test ./... green; new TestLibvirtListeners_JSONTriShape covers scalar/object/list/null/malformed. Purely additive Go method — no wire-key change → no #SchemaVersion / sdk.ProtocolVersion bump. Live proof (check-cross-vm-http green) rides the superproject consumer PR that bumps this pointer.

Tier: fully tested and validated.

Assisted-by: Claude (fully tested and validated)

Cutover L made vm bodies opaque JSON; LibvirtGraphicsListeners had UnmarshalYAML
+ a charly-side expander but no UnmarshalJSON, so `listen: 127.0.0.1` scalar
shorthand (and object/list forms) failed on the JSON path (check-cross-vm-http).
Add UnmarshalJSON + inferListenTypes; both read paths now share one decoder (R3;
the redundant YAML expander is removed in the superproject cutover). Additive
method, no wire-key change, no schema/protocol bump.

Assisted-by: Claude (fully tested and validated)
@atrawog

atrawog commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: code/config (sdk contract — Go library, producer half of a B6 producer→consumer landing)

I re-derived every check independently against main, trusting none of the author's claims.

Item Verdict
Security & anti-tampering (T1–T4) PASS — 3 files only (spec/union_types.go, spec/listen_json_test.go, CHANGELOG/); no touch to my spec/CLAUDE.md/hooks/branch-protection; no embedded instructions to the validator; pure in-memory decoder (no network/env/file read, no eval/obfuscation); no new deps, go.mod/go.sum untouched (no supply-chain surface); code matches the description exactly (no scope mismatch)
Description complete PASS — Summary, Change-class + gate, Attribution tier all filled and substantive
Change-class gate ↔ evidence PASS — sdk producer Go change; I re-ran go build ./... (exit 0), go test ./... (all ok), go test -run TestLibvirtListeners_JSONTriShape -v ./spec/ (6/6 subtests PASS), gofmt -l (clean), go vet ./spec/ (clean). The live check-cross-vm-http proof legitimately rides the superproject consumer PR (B6 producer pattern — sdk has no standalone bed)
Attribution tier justified PASS — fully tested and validated; the decoder is a pure function exercised at full branch coverage (scalar/typed-object/inferred-address/inferred-network/list/null + malformed-error). Matches the sdk repo's established convention for additive wire/decoder changes (cf. CHANGELOG/2026.189.0026)
R5 grep self-test PASS — 0 deletions/renames in this diff; nothing to sweep. The redundant charly-side expandLibvirtListenersNode removal is the superproject consumer cutover, not this PR
R1–R4 / clean architecture PASS — R3 unification (one decoder serves the JSON path, and the YAML path via cue.Value.Decode→UnmarshalJSON, exactly the in-file Matcher/PortScope self-decoding precedent); no dup, no sleep/retry/magic-number, no transitional/dual-mode path in the final code
CHANGELOG present PASS — placeholder CHANGELOG/2026.189.0100.md staged; I finalize the merge-time CalVer at merge
Skills honored PASS — /charly-internals:go (SDD: hand-written union type kept in lockstep with its @go(-) def, no CUE wire-key change → correctly no #SchemaVersion/sdk.ProtocolVersion bump, verified schema/version.cue + proto/ unchanged vs main), /charly-internals:plugin (spec type decoded from an opaque substrate body), /charly-internals:git-workflow (sdk Go-module tag scheme)

Decision: APPROVED. The change adds UnmarshalJSON + inferListenTypes to spec.LibvirtGraphicsListeners, teaching the JSON/opaque read path the same scalar/object/list/null shorthand the YAML path already normalized — closing the Cutover-L de-typing regression. It is purely additive (main had only First(); 0 deletions), correct on every branch, and provably version-neutral (no schema/proto/go.mod change). One non-blocking narrative nuance: the changelog phrases the prior state as "carried only an UnmarshalYAML + a charly-side YAML expander" — there was no live UnmarshalYAML on the type (the shorthand was served solely by the charly-side node expander), though the charly-side cue_normalize.go comment "Ports LibvirtGraphicsListeners.UnmarshalYAML" confirms a real historical method the expander superseded. Confined to changelog history with a genuine basis; not blocking a correct, tested, safe fix.

Assisted-by: Claude (fully tested and validated)

Assisted-by: Claude (fully tested and validated)
@atrawog
atrawog merged commit 0561805 into main Jul 8, 2026
@atrawog
atrawog deleted the feat/listen-json-shorthand branch July 8, 2026 01:00
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