Skip to content

fix(deploy,vm,bundle,substrate,status): bed-robustness batch — 6 VM/deploy/bed reliability fixes - #176

Merged
atrawog merged 6 commits into
mainfrom
feat/bed-robustness-batch
Jul 22, 2026
Merged

atrawog merged 6 commits into
mainfrom
feat/bed-robustness-batch

Conversation

@atrawog

@atrawog atrawog commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

The charly-core half of the bed-robustness thematic batch (the
operator-directed batch collecting accumulated non-blocking VM/deploy/bed-
reliability findings from recent wave landings — the Cutover Sizing Law: one
landing ceremony for the whole theme). Depends on opencharly/sdk#87
merging first
(pins its commit via the sdk gitlink — items 3 and 6 below
land there).

Six items, cross-checked against the program's own LOC ledger register (every
finding matches an already-logged entry):

  1. Ephemeral teardown timer never fired (candy/plugin-bundle/ephemeral.go)
    — registerTransientTimer never pinned --working-directory on the
    systemd-run --user transient unit, so the self-exec'd charly bundle del
    ran from the user systemd manager's default cwd (home), never finding
    charly.yml. ~21 recorded failures over weeks (wt-6a/6b/fsint/s3b).
  2. VM ssh-port dual-allocation race (candy/plugin-deploy-vm/lifecycle.go)
    — vmPrepareVenue used to pre-allocate its own throwaway port before
    auto-boot, racing vm create's own independent allocator for the SAME
    domain.
  3. Guest SSH hardening — sdk leg (sdk#87); no charly-core files touched.
  4. Discarded-decode-errors sweep across candy/plugin-deploy-vm,
    candy/plugin-vm, candy/plugin-deploy-pod — every silently-discarded
    json.Unmarshal error now handled (hard-fail at dispatch entry points /
    opts gating the R10 rebuild path; warn-and-continue where that matches the
    surrounding loop's existing convention). Two severity fixes:
    vmPluginOpError and the egress-validate reply decode used to treat a
    malformed reply as success.
  5. DeployStateHost out-of-process-read audit (the batch's most severe
    finding) — vmPrepareVenue's prior-state read called
    deploykit.LoadDeployConfigForRead directly; since this plugin runs
    out-of-process, deploykit.DeployStateHost (registered only by charly
    core's own init()) was never set in its process, so the read ALWAYS
    silently returned empty — forcing auto-boot (and a full disk-overlay wipe
    +recreate) on EVERY charly bundle add vm:<name>, even for an
    already-running VM. Fixed via the existing "config-resolve" HostBuild
    seam. Swept the same dormant class (compiled-in TODAY, but a per-BUILD
    placement fact, not an authoring guarantee) to candy/plugin-bundle
    (6 sites), candy/plugin-status, and candy/plugin-substrate (3 sites,
    including charly reap-orphans — which exists specifically to clean up
    orphaned EPHEMERAL deploys and would otherwise silently find nothing to
    reap, out-of-process, every time).
  6. Global ~/.local/share/charly/vm non-worktree-scoping footgun — sdk
    leg (vmshared.VmStateRoot(), sdk#87); this PR routes every charly-core
    call site (charly/vm_backend_lifecycle.go,
    charly/host_build_vm_build.go, candy/plugin-vm/vm.go + 2 more sites,
    candy/plugin-deploy-vm/lifecycle.go) through it instead of duplicating
    the literal path (R3).

Change class

charly-or-sdk Go (cross-repo: this is the CONSUMER leg — depends on
opencharly/sdk#87 merging first; the sdk gitlink here already points at
that PR's head commit faa32b1).

How R10-tested — exact gate, commands, and pasted output

  • The gate for this change class: cross-cutting VM/deploy/bed-lifecycle
    change → the full matching bed roster, run CONCURRENTLY (the high-load
    concurrency mandate for shared-state paths: the deploy ledger, VM
    lifecycle).
  • Eval beds run — EXACT beds + per-bed results (binary
    2026.203.0640/0644, all three launched concurrently as separate
    run_in_background processes against the SAME rebuilt binary on the
    merged tree):
charly check run check-substrate: [vm-build] PASS after 7.242s
charly check run check-substrate: [vm-create] PASS after 11.51s
charly check run check-substrate: [deploy-add] PASS after 41.679s
charly check run check-substrate: [deploy-check-substrate-member] PASS after 37.548s
charly check run check-substrate: [bring-up-members] PASS after 0s
charly check run check-substrate: [check-live] PASS after 32.236s
charly check run check-substrate: [check-live-check-substrate-member] PASS after 12.166s
charly check run check-substrate: [update] PASS after 1m57.04s
charly check run check-substrate: [cleanup] PASS after 10.914s
charly check run check-substrate: [cleanup-members] PASS after 0s
charly check run check-substrate: PASS (steps=10)
EXIT_CODE=0

charly check run check-charly-vm: [vm-build] PASS after 7.098s
charly check run check-charly-vm: [vm-create] PASS after 12.489s
charly check run check-charly-vm: [deploy-add] PASS after 2m45.838s
charly check run check-charly-vm: [bring-up-members] PASS after 0s
charly check run check-charly-vm: [check-live] PASS after 1m3.541s
charly check run check-charly-vm: [update] PASS after 3m42.957s
charly check run check-charly-vm: [cleanup] PASS after 11.655s
charly check run check-charly-vm: [cleanup-members] PASS after 0s
charly check run check-charly-vm: PASS (steps=8)
EXIT_CODE=0

charly check run check-sidecar-pod: [image-build] PASS after 2m34.686s
charly check run check-sidecar-pod: [check-image] PASS after 18.336s
charly check run check-sidecar-pod: [deploy-add] PASS after 1m18.245s
charly check run check-sidecar-pod: [config] PASS after 19.571s
charly check run check-sidecar-pod: [start] PASS after 26.78s
charly check run check-sidecar-pod: [deploy-check-sidecar-pod-ephvm] PASS after 1m37.438s
charly check run check-sidecar-pod: [bring-up-members] PASS after 0s
charly check run check-sidecar-pod: [check-live] PASS after 2m57.42s
charly check run check-sidecar-pod: [check-live-check-sidecar-pod-ephvm] PASS after 8.737s
charly check run check-sidecar-pod: [feature-run] PASS after 24.734s
charly check run check-sidecar-pod: [update] PASS after 2m17.827s
charly check run check-sidecar-pod: [redeploy-check-sidecar-pod-ephvm] PASS after 35.144s
charly check run check-sidecar-pod: [check-live-rebuild] PASS after 3m20.803s
charly check run check-sidecar-pod: [check-live-rebuild-check-sidecar-pod-ephvm] PASS after 8.098s
charly check run check-sidecar-pod: [feature-run-rebuild] PASS after 24.596s
charly check run check-sidecar-pod: [cleanup] PASS after 3.673s
charly check run check-sidecar-pod: [cleanup-members] PASS after 0s
charly check run check-sidecar-pod: PASS (steps=17)
EXIT_CODE=0

Item 1's direct proof (grepped from
.check/check-sidecar-pod/2026.203.0644/check-live.log):

PASS  check the NESTED ephemeral vm member ... registered its lifecycle
      through candy/plugin-bundle's OpEphemeralRegister ...
  [ephemeral-register-roundtrip]  exit=0
  • Fresh rebuild: task build:binary rebuilt cleanly from this exact
    merged tree (sdk pinned at faa32b1); charly version = 2026.203.0640
    (later 0644 for the sidecar re-run) matched across all bed runs;
    go.work.sum unchanged.
  • Did the CHANGED code path execute live? Yes for every item: item 1's
    ephemeral-register step fired for real (systemd timer + persisted state,
    verified); item 2's ssh-port resolution ran on every VM bed's deploy-add
    AND update; item 5's resolvePriorVmState seam call executed on every
    deploy-add/update across all three VM-touching beds (previously this
    path silently no-op'd — the beds now correctly reuse persisted state
    instead of wiping the disk overlay every time, which is WHY update's
    fresh-rebuild pass — a genuine destroy+recreate — still completes cleanly
    rather than racing a stale allocation).
  • Concurrency (shared-state changes only): YES — all 3 beds launched as
    separate run_in_background processes AT THE SAME TIME against the SAME
    binary/tree (the deploy ledger + VM lifecycle are exactly the shared-state
    paths this batch touches). No cross-bed interference observed; each bed's
    charly.yml overlay entries + libvirt domains are keyed by deploy name
    (P33 domain-identity scoping), so no collision.

Attribution tier

fully tested and validated

Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)

Harness rulebook compliance

  • R0 skills: /charly-internals:go, /charly-internals:strict-policy,
    /charly-internals:git-workflow, /charly-internals:cutover-policy,
    /charly-vm:vm, /charly-internals:vm-deploy-target,
    /charly-internals:vm-spec, /charly-check:check,
    /charly-internals:disposable, /charly-core:deploy — all loaded before
    any edit.
  • R1 RCA + zero warnings: (1) the pre-merge exploratory check-sidecar-pod
    run wedged 30m54s on deploy-check-sidecar-pod-ephvm — root-caused to the
    binary predating the sdk-side redundant-package fix (log inspection +
    cloud-init module-ordering analysis); the post-merge run above resolves it
    cleanly. (2) sdk/kit's TestStartProcessWaitMonitorNeverClosesConsumerPipes
    timed out at 600s under a real host-load spike (load avg 6.33→2.99 across
    retries, 21GB swap, 2 concurrent qemu VMs + another teammate's podman
    build) — re-ran isolated at lower load: PASS in 30ms; documented with
    before/after timing evidence, unrelated to this PR's files. Zero warnings
    in the final gate.
  • R2 no out-of-scope: every item the audit's own register named was
    fixed in this SAME cutover (the DeployStateHost sweep was extended from 1
    confirmed-active site to all 4 registered packages per operator ruling —
    "dormant today" is a placement fact, not grounds to defer).
  • R3 no duplication: the ~9 duplicated filepath.Join(home, ".local", "share", "charly", "vm") literals collapsed to ONE call through
    vmshared.VmStateRoot() (sdk leg); the DeployStateHost fix reuses the
    SAME "config-resolve"/"pod-config-load-bundle" seam pattern everywhere
    rather than inventing per-package variants.
  • R4 no workaround: no sleep/retry/magic-number introduced; the VM
    ssh-port fix removes a race via single-allocator ownership, not a delay.
  • R5 hard cutover + grep: no identifier removed/renamed — purely
    additive/corrective fixes; N/A for the stale-reference sweep.
  • R6 git safety: git status/git stash list checked clean before the
    origin/main merge; a WIP checkpoint was committed first (never merge
    over uncommitted work).
  • R7 runtime gate: full 3-bed concurrent roster (not just go test), see
    above.
  • R8 artifact invariants: N/A (no Containerfile/OCI-label surface
    touched by this batch).
  • R9 binary == source + deps: task build:binary rebuilt from this
    exact merged tree; charly version verified matching on every bed run; no
    new runtime OS dependency.
  • R10 disposable + coverage: all three beds are disposable: true;
    proven via FRESH charly update (destroy+recreate) passes in ALL THREE,
    zero warnings; the check coverage that would FAIL without these fixes is
    exactly ephemeral-register-roundtrip (item 1) and the absence of a
    disk-overlay-wipe-on-every-redeploy regression (item 5, implicitly proven
    by update's clean pass reusing persisted state).
  • RDD / ADE / SDD: RDD — every high-risk VM-lifecycle assumption (ssh-port
    resolution, prior-state read behavior, guest boot sequencing) proven live
    on disposable VM beds, not from a code/doc reading — see the exploratory
    pre-merge run's FAILURE + this PR's fresh combined-fix PASS as the
    before/after RDD proof pair. ADE: N/A. SDD: N/A (no .cue schema touched).
  • Hard cutover: ONE atomic commit, no Phase 2/TODO left; the DeployStateHost
    sweep is complete across every registered site, not partially deferred.
  • Kernel/plugin boundary law: N/A — every fix stays within its existing
    plugin candy or the pre-existing charly-core call sites those candies
    already used; no new kind-specific core branch.
  • Disposable-only autonomy: all destroy/rebuild actions targeted
    disposable: true beds only.
  • Clean architecture + Go gates: gofmt -l . empty, go vet ./... clean,
    go test ./... green across charly/ (169.5s) + every touched plugin
    module (plugin-deploy-vm, plugin-deploy-pod, plugin-vm,
    plugin-bundle, plugin-status, plugin-substrate).
  • CHANGELOG: CHANGELOG/2026.203.0710.md staged (placeholder CalVer; the
    pr-validator finalizes the merge-time version).

atrawog added 3 commits July 22, 2026 08:17
…eckpoint)

WIP checkpoint before merging origin/main (charly#175) — will be reshaped/
re-verified against the final composed tree before the R10 acceptance run.
…eploy/bed reliability fixes

Pins sdk feat/bed-robustness-batch (guest SSH hardening + VM state-dir
worktree scoping, sdk#87).

1. Ephemeral teardown timer never fired (no --working-directory on the
   systemd-run transient unit) — closes ~21 recorded failures over weeks.
2. VM ssh-port dual-allocation race — vmPrepareVenue no longer races vm
   create's own allocator on a fresh domain.
3. Guest SSH hardening (sdk leg) — mask ssh.socket + a self-testing
   PerSourcePenalties sshd drop-in, closing the RCA'd kex-reset wedge.
4. Discarded-decode-errors sweep across plugin-deploy-vm/plugin-vm/
   plugin-deploy-pod — malformed replies no longer silently read as success
   or zero-value.
5. DeployStateHost out-of-process-read audit (the batch's most severe
   finding) — vmPrepareVenue's prior-state read was ALWAYS silently empty
   out-of-process, forcing the per-domain disk overlay to be wiped and
   recreated on every ordinary redeploy of an already-running VM. Fixed via
   the existing config-resolve seam, and swept to every other registered
   dormant site (plugin-bundle, plugin-status, plugin-substrate).
6. Global ~/.local/share/charly/vm non-worktree-scoping footgun — a new
   CHARLY_VM_STATE_DIR override (sdk leg) closes the cross-worktree domain
   collision risk.

No public surface removed — internal-only fixes (unexported function
signatures gained a ctx param; no YAML field, CLI flag, or OCI label
changed) — so no breaking-change marker.

R10: check-substrate (10/10), check-charly-vm (8/8, incl. fresh-rebuild),
check-sidecar-pod (17/17, incl. fresh-rebuild + a second ephemeral-VM
redeploy cycle) all PASS on the frozen final tree, binary 2026.203.0640/0644.
ephemeral-register-roundtrip check (item 1's direct proof) exit=0.

Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
…ash (sdk#87)

sdk#87 merged as af9beb2 (v0.2026203.730) — the squash-merge commit,
distinct from the local feat/bed-robustness-batch branch tip (faa32b1,
which does not survive on sdk main after the branch delete). Repoints the
sdk gitlink + bumps charly/go.mod's require to the merge-time tag,
mirroring wave-6's own e2b9520 "repoint gitlink to the merged sdk#86
squash" pattern.

Verified: task build:binary rebuilds cleanly on this pointer.

Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
@atrawog

atrawog commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — CHANGES REQUESTED ❌

Change class: charly Go, runtime (cross-repo consumer leg — sdk gitlink repointed to the merged sdk#87 squash).

Head SHA validated: f555a7c0b0c6d1d117568b6c06c926be2f7b06e6

Gitlink repoint verification (independent)

  • git ls-tree HEAD sdk → af9beb2938897faa7803d2e36915ccb63386939a; git -C sdk merge-base --is-ancestor af9beb2... origin/main → YES, confirmed an ancestor of sdk's real main.
  • charly/go.mod require line → github.com/opencharly/sdk v0.2026203.730, matching the tag I pushed when merging sdk#87.
  • git -C sdk diff faa32b1...af9beb2... → only the CHANGELOG rename + H1 date rewrite (2026.203.0700.md→2026.203.0730.md, one line changed). Content-identical by construction, confirmed myself, not taken on the author's word. The delta re-gate (rebuild + go test, which the author ran per the f555a7c commit message) is therefore sufficient for the repoint itself — no bed re-run needed for that piece.
  • plugins gitlink: git diff origin/main HEAD -- plugins → empty. Confirmed untouched (the committed pointer in f555a7c is byte-identical to origin/main's), independent of a stray uncommitted local worktree drift I found and reset before testing.

Independent re-run of the full Go quality gates (this exact head, in the dedicated charly-wt-bedrobust worktree)

  • gofmt -l (charly/ + every touched candy): empty.
  • charly/ module: go build ./... / go vet ./... clean; go test ./... → all green (192.7s, matches the PR's claimed 169.5s order of magnitude).
  • Every touched candy module (plugin-bundle, plugin-status, plugin-substrate, plugin-vm via workspace mode; plugin-deploy-vm, plugin-deploy-pod via GOWORK=off standalone, since they are NOT in go.work — out-of-process plugins): go build/go vet/go test all green.
  • golangci-lint run ./... (v2.12.2, isolated GOLANGCI_LINT_CACHE): 0 issues on charly/ and every touched candy module.
  • CHANGELOG 2026.203.0710.md: filename + H1 format valid, no collision on main.
  • charly#118: file overlap check — zero shared files (kernel_manifest_floor_test.go + its own CHANGELOG only). verified-non-blocking.

Regression-test claims — spot-checked against the diff

  • Item 1 (TestRegisterTransientTimerArgs_PinsWorkingDirectory): asserts --working-directory=<wd> is present at the correct argv position; would fail against the pre-fix registerTransientTimer (which never built this flag at all). Sound.
  • Item 5 (TestResolvePriorVmState_ReadsNonEmptyOutOfProcess): uses a fake HostBuild-only executor; the pre-fix code called deploykit.LoadDeployConfigForRead directly and never touched the executor, so this test would return nil/fail against that shape. Sound, and I independently traced the DeployStateHost placement bug's mechanism (out-of-process plugin process never runs charly-core's init(), so the package var is never populated) — matches the RCA.
  • Items 2 & 4's malformed-JSON tests: straightforward, directly exercise the now-exported error paths. Sound.

Two blocking findings

1. R3 — loadBundleConfig() duplicated into a 3rd and 4th near-identical implementation instead of being unified (item 7 FAIL).

This PR adds the SAME "call the pod-config-load-bundle HostBuild seam, JSON-marshal the request, JSON-unmarshal the reply" logic as a brand-new, independent copy in both candy/plugin-status/nested_tree.go (loadBundleConfig(ex, ctx)) and candy/plugin-substrate/status_flat.go (loadBundleConfig(ctx)). I verified via git grep that this exact pattern already exists in candy/plugin-bundle/ephemeral.go (pre-existing) AND candy/plugin-pod/remove_orchestration.go (pre-existing, from an earlier wave's own independent discovery of this identical bug class — its comments literally describe the same DeployStateHost RCA). This PR is the 3rd and 4th copy of the identical pattern, landing in the SAME cutover — precisely R3's trigger ("the FIRST time the same pattern... would land in a second place, refactor to ONE shared abstraction... the fix MUST apply cleanly to ALL surfaces it covers"). The PR's own comments justify this as "a separate copy since plugin modules cannot cross-import each other" — but that reasoning is incorrect: plugin modules already import shared sdk kits freely (deploykit, kit, spec are imported by all four packages here), and an sdk kit is exactly the mechanism this project uses to share code across plugin module boundaries. The correct fix is a single sdk/deploykit (or equivalent kit) helper that all four call sites (plugin-pod, plugin-bundle, plugin-status, plugin-substrate) consume, eliminating the now-4-way duplication instead of growing it to 4.

2. Architecture gate — new sdk/vmshared kit import into charly/ core without the required justification (item 15 FAIL).

charly/vm_backend_lifecycle.go adds import "github.com/opencharly/sdk/vmshared" (confirmed new via the diff's + line) and its vmDir() now calls vmshared.VmStateRoot() directly. Per the standing IMPORT-PURITY rule, a NEW charly/ import of an sdk mechanism kit is a blocker unless it is "the residual-call-site import created when a mechanism's BODY moves OUT of core in the SAME PR (net core-LOC NEGATIVE)... inventoried until-K with a tracked exit." Neither condition is met: git diff --stat shows charly/vm_backend_lifecycle.go at net +6/-6 (zero net LOC change), not negative, and no equivalent logic left core in this PR (VmStateRoot's env-var-override behavior is new logic added to the sdk kit in sdk#87, not code relocated out of charly/core). No "until-K" inventory language appears in the code comment or the PR body — the PR body's own architecture-gate answer ("Kernel/plugin boundary law: N/A — ... no new kind-specific core branch") does not address this import at all, which is an incomplete/inaccurate answer to that section (not a valid N/A).

Mitigating context I verified but which does not resolve the finding: charly/vmshared_aliases.go is a large pre-existing alias file that already imports sdk/vmshared extensively elsewhere in the charly package (untouched by this PR — confirmed not in the diff). So vmshared is not a novel dependency for the charly module as a whole, and this specific call (vmshared.VmStateRoot(), a pure kind-agnostic path resolver — not a spec.<Kind> field-read, kind-word switch, or per-kind map) does not itself leak per-capability knowledge into core. However, the rule's stated exception is explicit and mechanical ("one without the same-PR body-move + inventory STAYS A BLOCKER") and does not carve out "the kit happens to already be used elsewhere in the package" as a free pass — and my mandate is to apply that rule without granting benefit of the doubt.

What's needed to clear both: (a) extract the loadBundleConfig-style seam call into ONE shared sdk-kit function (e.g., sdk/deploykit) and have all four plugin call sites (plugin-pod, plugin-bundle, plugin-status, plugin-substrate) consume it, deleting the now-redundant local copies; (b) either add an explicit "until-K" inventory note (naming the tracked K-wave that will retire charly/vmshared_aliases.go and this call site together) to vm_backend_lifecycle.go's vmDir() doc comment and the PR body's boundary-law answer, or drop this ONE file's piece of the item-6 R3 dedup (leave the literal duplicated in charly/vm_backend_lifecycle.go a little longer, tracked separately) if no such K-wave exists yet. Both are narrow, mechanical fixes; everything else in this PR — the six reliability fixes themselves, the R10 bed evidence, the Go quality gates, the gitlink repoint — is compliant and I will not need to re-review it.

Checklist

# Item Verdict
0 Security & anti-tampering PASS
1 Description completeness PASS (substantively complete; the boundary-law "N/A" inaccuracy is captured under item 15, not scored as an incomplete-template failure)
2 Change-class gate matches evidence PASS
3 Attribution tier vs proof PASS
4 R0 skills honored PASS, with a note: /charly-internals:plugin (the boundary-law owner) was not in the loaded list despite this PR touching the kernel/plugin boundary via new charly/*.go code — consulting it would likely have caught finding #2
5 R1 RCA + zero warnings PASS
6 R2 no pre-existing/out-of-scope split PASS for the PR's own six items; the two findings above are this review's own surfaced issues, to be fixed in this same cutover per R2
7 R3 no duplication FAIL — see finding 1
8 R4 no ad-hoc workaround PASS
9 R5 hard cutover + grep self-test PASS / N/A (no identifier removed)
10 R6/R8/R9 PASS/N/A
11 R10 disposable-only, fresh-rebuild, coverage PASS
12 RDD/ADE/SDD PASS
13 Concurrency mandate PASS — genuine 3-bed concurrent roster on shared-state (deploy ledger/VM lifecycle) paths
14 Hard cutover — one atomic set, no Phase 2 PASS (the f555a7c repoint commit is a legitimate producer-dependency follow-up, not scope creep)
15 ARCHITECTURE GATE — placement FAIL — see finding 2. placement: SHOULD-BE-tracked-inventory (vmshared.VmStateRoot() call in charly/vm_backend_lifecycle.go needs explicit until-K inventory or should not have been added this PR)
16 Disposable-only autonomy PASS
17 Clean architecture + Go gates PASS — independently re-run: gofmt/vet/build/test/golangci-lint all clean on charly/ + every touched candy module
18 CHANGELOG present PASS

Per-item trace (charly/*.go changes):

  • charly/go.mod: dependency version bump only (not a placement decision).
  • charly/host_build_vm_build.go: pre-existing core function (HostBuild "vm-build" seam handler, itself residual migration inventory per the boundary law's R-item classification, not newly placed by this PR); no new import in this file — it calls the already-modified same-package vmDir(). No alias, no Legacy smell.
  • charly/vm_backend_lifecycle.go: pre-existing vmDir() helper (inventory) modified to call a NEW sdk/vmshared import → blocker, see finding 2. No alias-form declaration (plain call, does not trip the ZERO-ALIASES hook), no Legacy smell.

Comments considered: none — the PR carries no comments as of this review.

Cross-PR interactions considered: sdk#87 — already merged by me; this PR correctly repoints to its squash SHA (verified). charly#118 — zero file overlap, verified-non-blocking. opencharly/plugins#101 — the docs-last companion for the sdk leg; correctly does not touch this repo, no interaction with this PR's own correctness.

Decision: FAIL. Two findings, both narrow and mechanical to fix (see "What's needed to clear both" above). Not merged.

Assisted-by: Claude Code (Anthropic Claude Sonnet 5; analysed on a live system)

…— R3 seam-read hoist + UNTIL-K annotation

pr-validator round-1 findings on charly#176, both fixed in this same
cutover:

1. R3 — the "pod-config-load-bundle" HostBuild seam read had
   accumulated 4 near-identical copies (candy/plugin-bundle/ephemeral.go,
   candy/plugin-pod/remove_orchestration.go's resolveSidecarNames,
   candy/plugin-status/nested_tree.go, candy/plugin-substrate/status_flat.go).
   Hoisted into ONE shared deploykit.LoadBundleConfigViaSeam (sdk#88,
   merged d7c04ed, tag v0.2026203.824) and repointed all four call
   sites onto it. Pure consolidation, byte-equivalent semantics; net
   -22 LOC across the four files.

2. Architecture gate — charly/vm_backend_lifecycle.go's new
   sdk/vmshared import lacked its required K-wave inventory
   justification. Added an explicit "MIGRATION INVENTORY (north-star
   §4.4): ... UNTIL-K4/K5" doc comment on vmDir(), naming
   charly/vmshared_aliases.go (documented K4/K5-dissolving inventory)
   as the shared exit this call site rides.

sdk gitlink repointed af9beb2 -> d7c04ed; charly/go.mod bumped to
v0.2026203.824. Delta re-gate only (no bed re-run): go build/vet/test
clean on charly/ (152s) + all 4 touched candy modules against the
real merged sdk commit; gofmt clean; the two standalone
plugin-deploy-vm/plugin-deploy-pod modules re-verified unaffected.
golangci-lint: 14 pre-existing issues, zero in code touched by this
cutover (verified against git diff d92e3e4..HEAD) -- flagged for the
next lint-category thematic batch, not fixed here.
@atrawog

atrawog commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Round-1 findings fixed, pushed as c8b9b9d:

1. R3 — hoisted the 4-way-duplicated pod-config-load-bundle seam read. New small sdk PR (sdk#88, merged d7c04ed, tag v0.2026203.824): deploykit.LoadBundleConfigViaSeam(ctx, ex, caller) is the ONE shared implementation, with its own 4-case unit test suite. All four charly-side call sites now delegate to it:

  • candy/plugin-bundle/ephemeral.go's loadBundleConfig()
  • candy/plugin-pod/remove_orchestration.go's resolveSidecarNames (the pre-existing twin I hadn't examined in round 1 — now fixed too)
  • candy/plugin-status/nested_tree.go's loadBundleConfig()
  • candy/plugin-substrate/status_flat.go's loadBundleConfig()

Removed the now-dead local seam-kind consts and unused imports at each site. Net -22 LOC across the four files (pure consolidation). Pure byte-equivalent semantics — same seam kind, same request/reply shape, same nil-on-empty contract, same error propagation; verified no test anywhere asserts on this path's error text.

2. Architecture gate — the new sdk/vmshared import in charly/vm_backend_lifecycle.go. Took option (a): kept the item-6 dedup (vmDir()'s body is untouched), added an explicit MIGRATION INVENTORY (north-star §4.4): ... UNTIL-K4/K5 doc comment naming charly/vmshared_aliases.go (documented K4/K5-dissolving inventory across this program's CHANGELOG, e.g. CHANGELOG/2026.197.2205.md) as the shared exit this call site rides — mirrors the charly/alias_collect.go/arbiter_bracket.go UNTIL-K convention.

Sequence + gitlink: sdk#88 merged first (squash d7c04ed, tag v0.2026203.824); gitlink repointed af9beb2 → d7c04ed (verified an ancestor of sdk origin/main); charly/go.mod bumped to match. d7c04ed's own diff against its squash-merge parent (isolating sdk#88's actual contribution from the unrelated concurrently-merged sdk#89 Unit-8 leg) touches exactly 3 files — confirmed via git diff 901bf2d..d7c04ed, not taken on faith.

Re-gate (delta, no bed re-run — both fixes are zero-behavior-change):

$ GOWORK=$(pwd)/go.work go build ./charly/... ./candy/plugin-bundle/... \
    ./candy/plugin-pod/... ./candy/plugin-status/... ./candy/plugin-substrate/...
(clean)
$ GOWORK=$(pwd)/go.work go vet    (same set)
(clean)
$ GOWORK=$(pwd)/go.work go test ./charly/...
ok  	github.com/opencharly/charly/charly	152.035s
$ GOWORK=$(pwd)/go.work go test ./candy/plugin-bundle/... ./candy/plugin-pod/... \
    ./candy/plugin-status/... ./candy/plugin-substrate/...
ok (all 4)
$ (cd candy/plugin-deploy-vm && GOWORK=off go build ./... && GOWORK=off go test ./...)
ok  	github.com/opencharly/charly/candy/plugin-deploy-vm

gofmt -l clean on all touched files. golangci-lint run across the 5 touched packages: 14 pre-existing issues, zero in code touched by this cutover (each flagged line individually checked against git diff d92e3e4..HEAD to confirm it lies outside every hunk this batch introduced) — noted as pre-existing lint debt for the next lint-category thematic batch, not fixed here.

CHANGELOG (CHANGELOG/2026.203.0710.md) updated in place with a "Round 2" section documenting both fixes + the re-gate evidence.

@atrawog

atrawog commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅ (round 2 review — supersedes round-1 verdict)

Head SHA validated: c8b9b9ddef175983e4ea3ec63e57a8f6219bd026

Gitlink / require re-verification

  • git ls-tree HEAD sdk → d7c04ed61907b6780d53e80bae069f20b0463aac; confirmed an ancestor of sdk origin/main myself (git merge-base --is-ancestor → YES).
  • charly/go.mod require → v0.2026203.824, matching the tag I pushed when merging sdk#88.
  • Independently ran git diff 901bf2d..d7c04ed in the sdk repo myself (isolating sdk#88's actual contribution from the concurrently-merged sdk#89 Unit-8 leg) — confirmed exactly 3 files (the new deploykit/load_bundle_config_seam.go + _test.go + its CHANGELOG), not taken on the PR description's word.
  • plugins gitlink: still untouched (git diff origin/main HEAD -- plugins empty, re-checked).

Finding 1 (R3 duplication) — resolved, independently verified

All four call sites now delegate to deploykit.LoadBundleConfigViaSeam:

  • candy/plugin-bundle/ephemeral.go's loadBundleConfig() — now a one-line delegate; its local podConfigLoadBundleSeamKind const deleted.
  • candy/plugin-pod/remove_orchestration.go's resolveSidecarNames — now delegates; its local podConfigLoadBundleKind const deleted.
  • candy/plugin-status/nested_tree.go's loadBundleConfig(ex, ctx) — thin wrapper delegating.
  • candy/plugin-substrate/status_flat.go's loadBundleConfig(ctx) — thin wrapper delegating (resolves its own executor via sdk.ExecutorForInvoke, since this VERB provider needs per-call executor resolution unlike the COMMAND-plugin package-var pattern the other three use — a sound, documented placement difference, not a duplication).

I independently re-ran the R3 grep myself (not trusting the author's "should now show the helper as the ONLY implementation" framing): git grep -n "pod-config-load-bundle" across the whole tree shows the two remaining bare consts are gone (both podConfigLoadBundleSeamKind/podConfigLoadBundleKind declarations deleted, confirmed absent), and every remaining hit is either a comment/doc reference or the shared deploykit.LoadBundleConfigViaSeam implementation itself. R5 grep self-test clean.

New, non-blocking finding surfaced during this re-check: a 5th live instance of the identical marshal→HostBuild(pod-config-load-bundle)→unmarshal sequence survives at candy/plugin-deploy-pod/config_setup_helpers.go:531 (updateAllDeployedQuadlets), untouched by either round of this PR. I judged this genuinely separable, not blocking: (a) it already routes through the seam correctly (never called the raw deploykit.LoadBundleConfig(), so it never had the DeployStateHost silent-no-op bug this batch's item 5 targets); (b) it's one of ~38 uses of plugin-deploy-pod's own single, consistently-used generic hostBuild(ctx, ex, kind, req, rep) seam-dispatch helper (config_setup.go:58) — not a bespoke copy-pasted reimplementation, so it's already reasonably DRY within its own package's established convention; (c) it predates the entire bed-robustness batch, untouched by either round. Its own correctness does not depend on this PR's fix (satisfies R2's separability test). Naming it here so it isn't dropped: route it to the next R3/lint-category thematic batch rather than treating it as resolved.

Finding 2 (architecture gate — new vmshared import) — resolved, independently verified

charly/vm_backend_lifecycle.go's vmDir() now carries an explicit MIGRATION INVENTORY (north-star §4.4): ... UNTIL-K4/K5 doc comment naming charly/vmshared_aliases.go as the shared exit this call site rides. I did not take the citation on faith: pulled CHANGELOG/2026.197.2205.md from main myself and confirmed it genuinely documents charly/vmshared_aliases.go as "K4/K5 inventory" verbatim (line 47: "the still-standing charly/vmshared_aliases.go, K4/K5 inventory, untouched here") — a real, pre-existing, independently-verifiable tracked K-wave, not invented for this PR. vmDir()'s function body is unchanged from round 1 (confirmed via diff — only the comment block is new). This satisfies the standing rule's "inventoried until-K with a tracked exit" requirement.

Byte-equivalence claim — independently verified, delta re-gate judged sufficient

I compared LoadBundleConfigViaSeam's seam kind, request/reply types, nil-on-empty contract, and decode target against what each of the four original call sites did (already verified in sdk#88's own review) — genuinely behavior-preserving. Both this round's changes (the R3 hoist and the architecture-gate comment annotation) are zero-observable-behavior-change by construction: the hoist is a byte-equivalent refactor with its own new unit-test coverage, and the annotation is a pure comment addition (vmDir()'s body is untouched from round 1). Per the R10 gate-by-change-class principle (a gate that cannot fail on a change proves nothing), I judge a disposable-bed re-run would exercise nothing new here — the delta re-gate (rebuild + go test on every touched module) is the correct, proportional gate. This is my own independent conclusion from inspecting the diffs, not a deference to the operator's ruling alone.

Independent gate re-run (this exact head, dedicated worktree)

  • gofmt -l (charly/ + all touched candy): empty.
  • charly/ module: build/vet clean; go test ./... → all green (150.4s).
  • All 5 in-workspace touched candy modules (plugin-bundle, plugin-pod, plugin-status, plugin-substrate, plugin-vm): build/vet/test all green.
  • Both out-of-process modules (plugin-deploy-vm, plugin-deploy-pod, GOWORK=off): build/vet/test all green.
  • golangci-lint run ./... (isolated cache) on all 7 touched packages: 0 issues in every one — I note this is a discrepancy from the PR body's own claim of "14 pre-existing issues, zero in this cutover's diff" (I found zero total, not just zero new). My own authoritative re-run is what governs this checklist item regardless of the discrepancy's source, and it clears the bar with room to spare — not a compliance concern, just flagged for transparency.
  • TestGenReproducible-equivalent (SDD): N/A here, already verified in sdk#88's own review (no new type in this repo's diff).

Checklist

All 19 items PASS. Items 7 (R3) and 15 (Architecture gate) — the two round-1 FAILs — now independently confirmed resolved as detailed above. placement: CORRECT (the vmshared import is now properly inventory-tracked; deploykit.LoadBundleConfigViaSeam lives in the correct sdk-kit layer per sdk#88's own review).

Comments considered: the author's round-2 fix-description comment — verified-non-blocking, every specific claim in it (sdk#88 merge SHA/tag, the 4-site repoint, the K-wave citation, the git diff 901bf2d..d7c04ed isolation, the delta-only re-gate) independently re-derived above, not taken on trust.

Cross-PR interactions considered: sdk#87/sdk#88 — both already merged by me, correctly referenced. charly#118 — still unrelated. charly#177 (Unit-8's own consumer leg, different chain) — no file overlap, verified-non-blocking. opencharly/plugins#101 — docs-last companion for the sdk leg, unaffected by this round, no interaction.

Decision: PASS. Proceeding to Phase 3: finalize merge-time CalVer, squash-merge, tag.

Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)

pr-validator merge-time version stamp for the bed-robustness batch
(guest SSH hardening, VM ssh-port race, DeployStateHost sweep,
discarded-decode-error sweep, VM state-dir worktree scoping, and the
round-2 R3 seam-read hoist + architecture-gate inventory annotation).

Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
@atrawog
atrawog merged commit 3f12890 into main Jul 22, 2026
@atrawog
atrawog deleted the feat/bed-robustness-batch branch July 22, 2026 08:45
atrawog added a commit that referenced this pull request Aug 15, 2026
Both were true-sounding facts about shared mutable state, asserted without the
identifiers that would have made them falsifiable.

1. "main is drift-red" — FALSE, and it was never true. main pins plugins at
   396e4bfe, and aa80ca9f (#174) is NOT an ancestor of it, so the gitlink
   predates #174: main's candy sources are pre-sweep AND its pinned plugins
   tree is pre-#174, two halves of one older state, which is what a clean drift
   check reports. The eight-artifact red only appears in a checkout with
   plugins/ ahead of the gitlink and candy sources not yet swept — an ordinary
   working tree, never a committed state of main.

   Recorded as a rule, because the mechanism generalises: `charly marketplace
   drift` and `charly docs drift` answer a question about the CHECKOUT they ran
   in — candy sources on disk versus the submodule tree on disk — not about any
   commit. A submodule checkout floats independently of its gitlink, so "the
   gate is red on main" means nothing until main's exact tree is reconstructed
   (superproject commit plus each submodule at its PINNED sha).

   The urgency framing this produced is removed from the entry and the PR body:
   the generated half was pending at the plugins tip, which is a queue, not a
   breakage.

2. "both gitlinks are their submodule's current tip" — half false, and already
   false when written. docs ee3d162e was the tip; plugins aa80ca9f was not —
   4458a400 (#176) had merged minutes earlier, and ab1f93d3 has landed since.
   The pin is a strict ancestor of the tip, so the FORWARD MOVE claim (the one
   that matters for correctness) stands unchanged; only the word "tip" was
   wrong. Restated as "descendant of what main carries", which does not decay.

Both corrections applied to the CHANGELOG and the PR body, and the whole entry
re-swept for sentences leaning on the removed premise rather than only the two
quoted in review. That re-sweep caught a third, smaller instance: this
correction's own cross-reference said "see below" for a section that sits above
it. Now cited by heading, per the same rule.

CHANGELOG-only; no code, config, gitlink or DOCS_REF change, so the bed run and
every gate figure in the entry stand unchanged.

Assisted-by: Claude Code Anthropic Claude Opus 5 (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
atrawog added a commit that referenced this pull request Aug 15, 2026
An earlier revision of this entry — written at my own request for a disclosure —
stated that landing the projections leaves main drift-red until this PR carries
their source. That is FALSE and it stated it about main, in an artifact of
record.

Verified mechanism: marketplace drift compares candy sources against the plugins
tree AT THE SUBMODULE CHECKOUT, and main pins plugins at 396e4bfe, which is not
a descendant of either #174 (aa80ca9f) or #176 (4458a40). Main's source and its
pinned tree are both pre-projection, so the gate is green on it, and landing a
projection does not move a superproject gitlink.

The true statement: the gap is PENDING AT THE PLUGINS TIP and materializes only
when a superproject leg bumps the gitlink past those commits — the leg that
advances the pointer owns carrying the matching source. The red state is
reproducible only in a working tree whose plugins/ is fetched past the gitlink,
which is not main.

Both traps are kept because both are correct and independently useful: a drift
result is a fact about a CHECKOUT (measuring main means reconstructing main's
tree with submodules at their gitlink, not their own origin/main), and the
'clean (N artifacts)' line prints only on the clean path so its absence is not
evidence.

Assisted-by: Claude Code Anthropic Claude Opus 5 (documentation reviewed)
Claude-Session: https://claude.ai/code/session_01Rt9KMZF6v3x1iL24M74dN2
atrawog added a commit that referenced this pull request Aug 15, 2026
…uilt (#278)

`charly check box <box>` could run against an image that was not the one you had just
built, report every step green, and give no sign. A gate that certifies the wrong
artifact is the highest-severity defect this system has, because a false pass is
indistinguishable from a real one.

Two independent causes compounded, both traced against the real image store. The render
labelled an imported box's image with the namespace-qualified Generator key while tagging
the ref with the leaf name, so a fresh build was invisible to a resolve of its own image
name. And the election's primary key is the content-derived version label, so an image
built from a differently-versioned source tree outranked a newer build regardless of when
either was produced.

The three build-scope verdict verbs — `charly check box`, `charly box feature run` and
`charly box labels` — now resolve through the guarded `kit.ResolveBuiltImageRef`, which
refuses a short name whose election is not the newest local build and names both refs plus
the pinned re-invocation. Build recency keys on the image's CREATION TIME, the only key
total over the tags charly mints (`--tag` REPLACES the CalVer tag, so every bed build reads
as no CalVer at all). All three verbs print their `Image:` provenance FIRST on every path,
including the no-plan path that previously bailed before printing one; for `box labels` it
goes to stderr so `--format`'s single raw stdout value stays byte-unchanged.

`candy/plugin-clean`'s retention sort shared the same blind spot and is folded in rather
than named separately, because it is the one surface here that DESTROYS an artifact instead
of mis-answering: a group of bed-tagged images had no usable ordering key, so `keep_images:
N` kept an arbitrary N and could delete the newest build.

This commit carries FOUR cutovers' candy sources, and the union was forced rather than
chosen. The docs mirror had been regenerated at a projection no reachable superproject state
reproduced, so the first leg through the gate had to carry all of them: the build-scope
verdict resolver, the git-workflow landing-mechanics leg (#176), the merge-tree guard (#177,
source `c144ad11`), and the R4a task-target sweep (#285). Named so a squash does not bury
other authors' provenance.

Advancing the `sdk` gitlink forces a spec-floor sweep across 90 `candy/*/go.mod` files:
under MVS every module depending on `sdk` and requiring `spec` directly must match, and
`go.work` masks the defect in-tree while these plugins ship out-of-workspace. The standing
gate this adds is a `GOWORK=off` per-module build; it reports 91 modules with one failure,
`candy/plugin-dsh`, which fails identically on `main` for an unrelated `go`-directive cause
and joins a named module-hygiene batch with a measured scope.

Gates, re-derived independently at merge: `check-agent-pod` run 2026.227.1451 (13 steps,
365s) against a byte-identical final resolver; `check-docs` run 2026.227.1835 (13 steps,
492s) on the final tree at zero warnings, with the build log showing it cloned the
`DOCS_REF` commit it then asserts. `marketplace drift` clean at 400 artifacts and
`task docs:drift` a no-op over 6 repo roots and 891 pages — the first of those
perturbation-tested to confirm it can actually fail.

Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)
github-actions Bot pushed a commit that referenced this pull request Aug 28, 2026
…systemd (#419)

B1's last item, and the half that had to wait for sdk#176.

systemd's candy_file: listed only *.service, and its assembly_template hardcoded
that same extension TWICE:

    cp /systemd/*.service /usr/lib/systemd/user/ && \
    for svc in /systemd/*.service; do systemctl --global enable ...; done

The pair agreed only because both were frozen. A candy could not ship a .socket,
.target or .slice at all - and widening either side alone would have been worse
than leaving it: widening candy_file: would stage units the copy never installs,
widening the copy would install units nothing collected.

Both move together now. candy_file: claims .service/.socket/.target/.timer/.path/
.slice, and the assembly copies EVERY staged unit, then enables only the types
systemd can enable.

.slice is claimed but deliberately NOT enabled: a slice is a resource container
referenced by other units' Slice=, and `systemctl enable` on one is an error, not
a no-op. That distinction is asserted, not just commented.

The enable loop carries an existence guard because an unmatched glob stays literal
in sh - without it, a candy shipping only services would fail the build on
`systemctl enable '/systemd/*.socket'`.

This is inert without sdk#176, which made candy_file: honoured at all (the scan is
init-agnostic, so the patterns are globbed at the point of use). The sdk pin moves
to v0.2026240.1542, which also carries #177's fix for the depends_candy
false positive that #176 introduced.

TestEmbeddedVocab_SystemdClaimsEveryUnitTypeItInstalls guards the pair that has to
stay consistent - what candy_file: claims versus what the assembly copies and
enables - so neither side can drift again. Verified to fail on the pre-change
vocabulary rather than assumed.

Assisted-by: Claude Code Anthropic Opus 5 (analysed on a live system)

Claude-Session: https://claude.ai/code/session_01Gf42A3bau77JigFYLALrnq

Co-authored-by: atrawog <[email protected]>
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