Skip to content

refactor(charly): vmshared→spec envelope-route repoint — all 23 passthrough symbols (task #16) - #128

Merged
atrawog merged 10 commits into
mainfrom
feat/52b-vmshared-spec-repoint
Jul 16, 2026
Merged

atrawog merged 10 commits into
mainfrom
feat/52b-vmshared-spec-repoint

Conversation

@atrawog

@atrawog atrawog commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The vmshared→spec envelope-route repoint (task #16, folded into the #52 alias-inventory theme). COMPLETE: all 23 spec-passthrough symbols repointed. These are E-envelope types the kernel is supposed to reference directly (per the boundary law) — the defect was the route (vmshared, a forbidden mechanism kit), not the reference; sdk/spec is core's explicitly-allowed import.

6 commits, one symbol group at a time, each proactively collision-checked before the mechanical rewrite:

  1. 13 small/self-contained types (39 files): LibvirtDomain, LibvirtGraphicsListeners, MCPServerYAML, PackageItem, PortScope, PreemptibleConfig, TunnelYAML, ShellConfig(→spec.Shell), EnvDependency, ServiceEntry, InstallContext, BuildStageContext, CandyPluginDecl(→spec.Plugin).
  2. 6 more (43 files): DistroDef(→spec.ResolvedDistro), VmDeployState, Matcher, MatcherList, PortSpec, CandyYAML.
  3. BoxConfig (27 files) — known collision: two methods literally named BoxConfig on UnifiedFile/Config, handled by hand.
  4. Step (31 files) — clean, no collisions found.
  5. BundleNode (86 files, the largest single-symbol batch) — clean, no collisions found.
  6. Op (68 files, 136 candidate consumers measured) — the hardest: Op is a struct FIELD NAME shared by five unrelated structs (Operation.Op, OpStep.Op, Step.Op, Matcher.Op, ExternalPluginStep.Op), each using Op: as a composite-literal key that must never be qualified. Generalized the rewrite tool's exclusion rule to catch any field-key position regardless of owning struct. One further edge case — a struct field DECLARATION (Op string, no colon in Go's declaration syntax) — evaded even that rule; go build caught the single instance immediately, fixed by hand.

Remaining in vmshared_aliases.go (correctly out of scope): 6 genuine vmshared mechanism functions with no spec equivalent (InstallSignalHandler, ParseLibvirtURI, PollRemote, RegisterShutdownHook, SweepStaleTemps, pollUntil), plus the deploykit-defined E-envelope symbols (InstallPlan/DeployExecutor/etc.) tracked separately as task #13 (an SDK package-boundary move, sequenced after this).

Bug classes found and fixed across the whole series (every one caught by go build/go vet before shipping):

  1. A method sharing a name with the repointed type (a selector-expression call, not a type reference).
  2. A struct field (embedded or plain) literally named after the old bare type — composite-literal keys for such fields must stay unqualified even though the field's type changed.
  3. A local identifier named spec (the established *VmSpec shorthand throughout VM code) shadowing the package import.
  4. Go's ...Type variadic ellipsis false-matching the "preceded by dot" selector-exclusion rule.
  5. A composite-literal field key shared across unrelated structs (the Op: case, the most pervasive).
  6. A struct field DECLARATION (no colon in Go's field syntax) — the one case the field-key rule can't catch.

Merge round: main (post-#127, 7be18e7/v2026.197.1051) merged in

Brought the branch up to date with main's just-landed PR #127 (alias dissolution, teardown
robustness, the VM disk-build engine's move into candy/plugin-vm, the loader-residue fold).
27 conflicted files, resolved by three patterns:

One post-merge build failure, found and fixed (R1): host_build_vm_build.go:142: undefined: VmDeployState. This file arrived via main's P8b-rest expansion (38→235 lines) and was never in
the 27-file conflict list (git auto-merged it cleanly, since my repoint never touched it before),
so it was never individually checked against the repoint. VmDeployState IS one of the 23
repointed symbols (sub-batch 2) — fixed the one call site to *spec.VmDeployState.

Audit method: the lighter form (per revised guidance — gofmt -r is NOT a reliable AST-safety

oracle for composite-literal keys/locals, so it cannot serve as an independent verification tool)

Chose the lighter audit (proactive scan + go build/vet/test across the whole merged tree, not a
full per-hunk gofmt-r-delta classification) because the residual risk category — a bare reference
to one of the 23 old alias names surviving somewhere the 27-conflict list didn't cover — is a
guaranteed hard compile error, never a silent pass: package main no longer declares any of
the 23 old bare names at all after the repoint, so a missed site cannot both go unqualified and
still compile. go build/go vet/go test, run clean across charly AND every touched plugin
module (plugin-vm, plugin-box, plugin-build, plugin-loader, plugin-tunnel), is a
complete proof for that risk class — and is exactly what caught the one real bug above.
Supplemented with a proactive grep across every touched non-test file for the ONE class a
compiler can't catch (a rewrite landing inside a string literal instead of code): found only
legitimate prose/real-code matches (error-message text referencing real spec. package symbols,
one pre-existing local variable named spec), no corruption.

Test plan

  • Every one of the 6 original commits passed the full gate individually: go build/go vet/
    go test ./... (~90-120s), gofmt -l . + golangci-lint fmt --diff clean, golangci-lint run ./... 0 issues, an R5 grep self-test, task build:binary + charly box validate exit 0.

  • Merge-round final gate (this round, on the fully merged tree): go build/go vet/
    go test ./... green on charly (100s) and all 5 touched plugin modules; golangci-lint run ./... 0 issues; gofmt -l . + golangci-lint fmt --diff — found and fixed import-ordering
    drift (spec before vmshared alphabetically) in 8 files from an earlier batch conflict
    resolution via gofmt -w . (pure formatting), re-verified green after; task build:binary
    clean (charly version = 2026.197.1120); charly box validate exit 0, zero warnings;
    git submodule update --init --recursive — all 8 submodule gitlinks resolved forward, git submodule status clean.

  • Confirmation bed (one bed, per team-lead's ruling that this type-route-only,
    zero-behavior-change repoint doesn't need a full bed roster — main's HEAD already passed 7
    beds at the refactor(core)!: wave-1 core hygiene — alias dissolution (#52) + teardown robustness (#55) + loader-residue fold (#46) + gitlink bumps + P8b Tier-1 (VM disk-build → plugin-vm) #127 landing): charly check run check-sidecar-pod:

    charly check run check-sidecar-pod: PASS (steps=12)
    

    (started 13:32:13, finished 13:38:50 — ~6m37s; a real podman build + pod deploy + 12-step
    check-plan cycle, exit code 0)

https://claude.ai/code/session_01R8UGGr3ui1959oTb5JuSif

atrawog added 6 commits July 16, 2026 08:28
…directly (#52b)

vmshared_aliases.go's Op/BundleNode/Step/... (and this batch's 13 symbols:
LibvirtDomain, LibvirtGraphicsListeners, MCPServerYAML, PackageItem,
PortScope, PreemptibleConfig, TunnelYAML, ShellConfig, EnvDependency,
ServiceEntry, InstallContext, BuildStageContext, CandyPluginDecl) are pure
`= spec.X` passthroughs -- legitimate E-envelope types the kernel is
supposed to reference, routed through the forbidden vmshared mechanism-kit
hop instead of sdk/spec directly. Repointed every consumer (production +
test) to reference spec.X directly and deleted the now-unused bindings.
First of several sub-batches decomposing the full 23-symbol/278-file
vmshared repoint (task #16); the remaining 10 envelope passthroughs and 6
genuine vmshared mechanism functions (no spec equivalent) are out of scope
for this cutover.

Assisted-by: Claude (analysed on a live system)
…pec (#52b-2)

DistroDef (-> spec.ResolvedDistro), VmDeployState, Matcher, MatcherList,
PortSpec, CandyYAML repointed directly to spec.X across every consumer;
vmshared_aliases.go bindings deleted. Found and fixed three new mechanical-
rewrite bug classes beyond the first sub-batch's method-call collision:
(1) a struct field literally named after the old bare type (embedded or
not) whose composite-literal key must stay unqualified even though the
field's type is now spec.X; (2) a local "spec" parameter/variable (the
established VmSpec shorthand throughout vm_bootstrap.go/vm_build.go/
vm_bootc_install.go/vm_cloud_image.go) shadowing the spec package import
once a second parameter needed spec.X in the same function -- fixed by
renaming the local identifier to vmSpec in each of the 8 affected
functions; (3) Go's variadic "...Type" ellipsis false-matching the
rewriter's preceding-dot selector exclusion, silently skipping a real
bare-type reference -- fixed the one instance and hardened the tool.
go build/go vet both caught every instance; none shipped uncaught.

Assisted-by: Claude (analysed on a live system)
BoxConfig repointed directly to spec.BoxConfig across 27 files; the
vmshared_aliases.go binding deleted. Handled the known method-name
collision by hand: uf_box_generic.go declares two accessor methods
literally named BoxConfig (on UnifiedFile and Config) -- the method
NAMES stay unqualified (Go requires it) while their return types become
spec.BoxConfig. A filter bug of my own (comparing git-grep's "./file.go"
output against a bare "file.go" exclusion tuple) let the batch script
briefly re-corrupt the already-hand-fixed file plus vmshared_aliases.go's
own declaration line; go build caught both instances immediately
("expected '(', found '.'"), reverted before commit.

Assisted-by: Claude (analysed on a live system)
Step repointed directly to spec.Step across 31 files; the
vmshared_aliases.go binding deleted. 21 of 23 spec-passthrough symbols
done. Proactive collision check (method/field/embedded/local-var/
ellipsis) found none for this symbol -- go build and go vet both passed
clean on the first attempt, unlike the previous three sub-batches.

Assisted-by: Claude (analysed on a live system)
BundleNode repointed directly to spec.BundleNode across 86 files (the
largest sub-batch to date, 99 candidate consumer files measured); the
vmshared_aliases.go binding deleted. 22 of 23 spec-passthrough symbols
done. Proactive collision check found none for this symbol -- go build
and go vet both passed clean on the first attempt, the second sub-batch
in a row with zero fix-up round.

Assisted-by: Claude (analysed on a live system)
…#52b-6)

Op repointed directly to spec.Op across 68 files (136 candidate consumer
files measured, the largest fan-out); the vmshared_aliases.go binding
deleted. 23 of 23 spec-passthrough symbols done -- task #16 complete.

Op is a struct field name shared by five unrelated structs (Operation.Op,
OpStep.Op, Step.Op, Matcher.Op, ExternalPluginStep.Op), each using "Op:"
as a composite-literal field key that must never be qualified -- hardened
the rewrite tool with a general field-key exclusion (any occurrence
followed by ':' inside a composite literal, regardless of which struct
owns the field). A struct field DECLARATION (`Op string`, no colon in Go's
declaration syntax) evaded that rule; go build caught the one instance
(provider.go's Operation.Op) immediately, fixed by hand.

Assisted-by: Claude (analysed on a live system)
@atrawog atrawog changed the title refactor(charly): repoint 13 vmshared spec-passthrough types to spec directly (#52b) refactor(charly): vmshared→spec envelope-route repoint — all 23 passthrough symbols (task #16) Jul 16, 2026
atrawog added 4 commits July 16, 2026 13:20
Brings the branch up to date with main post-#127 (7be18e7, v2026.197.1051),
resolving 27 conflicts across the alias files, VM engine relocations (P8b-rest:
charly/vm_bootc_install.go + vm_bootstrap.go + vm_build.go + vm_cloud_image.go
moved to candy/plugin-vm), bundle_members.go's teardown error-joining refactor
(#55), and 20 test files needing both the vmshared-repoint's spec.X qualification
and main's independent changes combined. vmshared_aliases.go resolved via the
intersection of both branches' independent alias-dissolution deletions (mine:
the 23 spec-passthrough repoint symbols; main's, from my own merged PR #127: the
DEAD+TESTONLY slice).

Assisted-by: Claude (analysed on a live system)
go build caught one bare-reference fallout from the main merge:
host_build_vm_build.go (arrived via main's P8b-rest expansion, never in the
27-file conflict list since the repoint never touched it before) referenced
VmDeployState bare -- one of the 23 repointed symbols whose vmshared_aliases.go
binding is now gone. Qualified to *spec.VmDeployState.

gofmt -w also fixed import-ordering drift (spec before vmshared alphabetically)
in 8 test files from an earlier batch-script conflict resolution -- pure
formatting, re-verified go build/vet/golangci-lint clean after.

Adds the CHANGELOG entry for the merge round (conflict-resolution patterns,
the one bug found+fixed, and the audit method used).

Assisted-by: Claude (analysed on a live system)
…ator findings

Renames the final-round CHANGELOG entry to the merge-time CalVer and appends
the fresh pr-validator's independent findings: the delta re-gate onto
post-#131 main, the adversarial spot-check of the BoxConfig/Op/BundleNode
collision-handling, the R5 sweep, the investigation resolving why ~28
additional vmshared spec-passthrough-shaped symbols correctly stay out of
this cutover's scope (their consumers sit in the not-yet-started K4
migration wave), the cross-PR sweep, and the no-`!`-marker justification.

Assisted-by: Claude (analysed on a live system)
@atrawog

atrawog commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: charly Go code (mechanical type-repoint sweep, zero behavior change claimed).

Checklist

# Item Verdict
0 Security & anti-tampering (T1-T4) PASS
1 Description completeness PASS — per-commit map matches the go-quality skill's own convention
2 Change-class gate vs evidence PASS
3 Attribution tier vs proof PASS — analysed on a live system, not inflated
4 R0 skills honored PASS — including the NEW "Mechanical type-repoint sweeps" collision catalog (fetched fresh from plugins origin/main, since the local checkout was stale)
5 R1 RCA on every failure PASS — the post-merge VmDeployState build failure was correctly root-caused and fixed
6 R2 no pre-existing/out-of-scope split PASS — see the completeness investigation below
7 R3 no duplication PASS — this PR IS a de-duplication
8 R4 no ad-hoc workaround PASS
9 R5 hard cutover + grep self-test PASS — independently re-verified, zero live stragglers
10 R6/R8/R9 artifact + binary integrity PASS
11 R10 disposable-only, fresh-rebuild, coverage PASS — confirmation bed cross-checked on disk
12 RDD/ADE/SDD N/A — no schema/CUE change
13 Concurrency mandate + anti-cheat N/A
14 Hard cutover — one atomic phase PASS
15 ARCHITECTURE GATE PASS — placement: CORRECT
16 Disposable-only autonomy PASS
17 Clean architecture + go gates PASS — independently re-run clean
18 CHANGELOG present PASS — finalized at 2026.197.1309

Architecture gate

Every one of the 23 repointed symbols IS an E-envelope type the boundary law says core should reference via sdk/spec directly — the defect was the ROUTE (vmshared, a forbidden mechanism-kit hop), never the reference. No new alias file, no new kit import — the opposite: a 23-symbol alias-surface SHRINK. The 6 retained vmshared function aliases (InstallSignalHandler, ParseLibvirtURI, PollRemote, RegisterShutdownHook, SweepStaleTemps, pollUntil) are genuine mechanism functions with no spec equivalent — correctly kept.

placement: CORRECT

Deep investigation (validator-initiated, resolved as NOT a defect)

Cross-referencing sdk/vmshared/spec_aliases.go (vmshared's own internal = spec.X alias surface) against the 33 type aliases remaining in charly/vmshared_aliases.go after this PR found ~28 names that ALSO appear as spec-passthroughs there (e.g. DeployShellOverlay, K8sDeployConfig, ServiceOverrides, CandyArtifact, InstallOptsConfig) — at first glance a possible under-scoping of this PR's "COMPLETE: all 23" claim. Traced their charly-side consumers (deploy.go, k8s_deploy_from_box.go, k8s_config.go, service_render.go, layer_artifacts.go, layers.go, bundle_add_cmd.go) and confirmed every one sits squarely inside the NOT-YET-STARTED K4 migration wave (deploy + config resolution, ~13k LOC per CLAUDE.md's own K-wave table) — these symbols' call sites are slated to move OUT of core entirely in K4, at which point their aliases dissolve naturally, exactly the deferral rule the original #52 PR already established for its own 179-symbol residue bucket. Confirmed: not a gap in task #16's own, already-authorized scope (23 named symbols) — the PR's completeness claim is accurate relative to its own scope.

Adversarial spot-checks (the 3 hardest documented collisions)

  • BoxConfig (method-name collision): func (uf *UnifiedFile) BoxConfig(...) kept its bare method name; only the return type became spec.BoxConfig. Correct.
  • Op (the Op: field-key collision across 5 unrelated structs + the field-declaration edge case): grepped every Op: composite-literal occurrence in non-test charly/*.go — all stayed bare, zero mis-qualifications.
  • BundleNode (largest single-symbol batch, 86 files): spot-checked node_bundle.go — every local var / map value / function signature correctly qualified to spec.BundleNode, import added.

Merge-round (delta re-gate, done twice)

The branch was BEHIND post-#127 main when validation started — the author's own final-round commit already absorbed that (27 conflicts, one real bug caught+fixed: VmDeployState). The validator's own gh pr update-branch then brought it onto post-#131 main (binary-policy) — clean auto-merge, zero conflict markers, exactly ONE overlapping file (charly/unified.go, disjoint lines). Re-ran the full gate (go vet/test/golangci-lint/gofmt/build/validate) on the resulting tree — all independently clean.

Cross-PR sweep (comment-intake)

Zero comments/reviews on #128 itself. #118 holds by design (merges last). #130/#112 (Codex-assisted) are scope-excluded per the standing operator directive; #130's own coordination thread (already posted by a teammate) covers its overlap with #131, unrelated to this repoint.

Marker decision: no !

This cutover deletes 23 package main-internal type ALIASES — never an externally-importable Go surface (package main has none) — and touches zero CLI verb, YAML schema field, or OCI label. Unlike #127 (which relocated build-engine BEHAVIOR across a plugin/process boundary), this repoint is provably zero-behavior-change internal wiring; no public/user-facing surface is removed.

Decision

APPROVED. Every rule independently re-verified — including resolving a genuine-looking completeness question in the author's favor only after tracing real consumer files to a named, already-tracked K-wave, and adversarially re-checking the three hardest documented collision cases myself. Proceeding to squash-merge (no ! marker) and tag.

Assisted-by: Claude (analysed on a live system)

@atrawog
atrawog merged commit 41571e7 into main Jul 16, 2026
@atrawog
atrawog deleted the feat/52b-vmshared-spec-repoint branch July 16, 2026 13:15
atrawog added a commit that referenced this pull request Aug 4, 2026
opencharly/marketplace#128 landed as 1f85098, tagged v2026.216.1427, carrying the
skill-side half of this cutover: three surfaces described `--repo` resolution as
it was before it worked.

This bump is what makes this PR's R5 sweep TRUE OF WHAT IT SHIPS. Review caught
that the sweep was clean only in the working tree, because the `plugins`
submodule was checked out at #128's then-unmerged branch head — while the gitlink
this PR actually shipped (53d21497), and plugins origin/main, both still carried
the falsified row. Merging then would have recorded a lying doc on charly@main.
The ordering this PR already demonstrated one commit earlier for `spec` (bump
only AFTER the producer merged) is now applied to `plugins` as well.

The same review found the pasted sweep command missing its `-E`, so as
transcribed it returned zero hits and "proved" clean trivially. The body now
carries the executed alternation with `-E`; the two surviving hits are both
sanctioned — plugins' own CHANGELOG (R5 history) and the generated docs
projection that regenerates via `task docs:sync`.

No re-gate owed: `plugins` is not in go.work (it holds skills and agent
definitions, no compiled Go), and the binary is BYTE-IDENTICAL across this bump,
so the final-tree gate at run-calver 2026.216.1347 still governs.

Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)
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