Skip to content

gate-infrastructure hardening: vm-destroy false-success (#69), makepkg sibling-branch fetch (#72), unstamped-binary bed-runner guard (#74) - #109

Merged
atrawog merged 3 commits into
mainfrom
feat/gate-infra-hardening
Jul 14, 2026
Merged

atrawog merged 3 commits into
mainfrom
feat/gate-infra-hardening

Conversation

@atrawog

@atrawog atrawog commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

gate-infrastructure hardening — charly vm destroy false-success (#69), makepkg sibling-branch fetch (#72), unstamped-binary bed-runner guard (#74)

Three independently-non-blocking bed/gate reliability fixes, landed as ONE cutover (one superproject leg — the RCA relocated #72's fix off pkg/arch, so there is NO pkg/arch PR).

#69 — charly vm destroy backend-mismatch false-success + bundle del domain-teardown owner

charly vm destroy <name> could print Destroyed VM charly-<name> and exit 0 while the libvirt domain kept running; a manual bundle add/bundle del of a vm: deploy leaked the running domain.

RCA: VmDestroyCmd.Run trusted a single RESOLVED backend. A deploy-name positional resolves no kind:vm entity backend: pin → fell back to the global vm.backend setting (qemu on this host) → took the qemu no-op arm (RemoveAll a non-existent state dir, errcheck-swallowed) while the real LIBVIRT domain kept running. Separately, a vm: deploy's bundle del had NO domain-teardown arm for the non-ephemeral case.

Fix: destroyVmDomain() probes libvirt authoritatively (backend-agnostic), tears the domain down from whichever backend actually holds it, and VERIFIES it is gone; Run() hard-errors "no such VM" on not-found (no unconditional print). vmPostTeardown fires vm destroy <entity> --domain <domain> --keep-deploy — the bundle-del domain-teardown owner, mirroring vmRebuild's proven vmCli destroy. + regression unit tests.

#72 — makepkg update-phase fetch: disable git's default on-demand submodule recursion

The eval-VM update phase's opencharly-git makepkg working copy fetched ALL branches of the (worktree-shared) local superproject and, by git's DEFAULT fetch.recurseSubmodules=on-demand, on-demand-recursed into the sdk submodule for a sibling branch whose gitlink bumped sdk to a locally-committed-but-UNPUSHED SHA → fatal: remote error: upload-pack: not our ref … → update phase exit 1. A concurrency landmine for every parallel-worktree wave.

Fix (SUPERPROJECT build vocabulary — NOT pkg/arch; the RCA relocated it): the arch localpkg local_pkg.build_template's makepkg -sf now sets GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=fetch.recurseSubmodules GIT_CONFIG_VALUE_0=false. SAFE — the PKGBUILD prepare() wires sdk from a SEPARATE git+file:// source, so superproject-fetch recursion is never needed. Applied to BOTH //go:embed copies of the vocab (charly/charly.yml + candy/plugin-vm/build_defaults.yml, R3). Proven by an isolated git spike (default fetch reproduces not our ref; fetch.recurseSubmodules=false → clean).

deb/rpm — why unaffected (documented per R3, not blanket-patched): the deb (dpkg-buildpackage) and rpm (rpmbuild) localpkg build_templates use NO makepkg and NO git+file:// clone — they build charly + welded plugins DIRECTLY from the superproject working tree ($SUPER/charly, $SUPER/candy/* via go build), then podman run a plain cp -aT /src + dpkg-buildpackage/rpmbuild. No git fetch, no submodule recursion → the mechanism cannot fail there. A fix on a surface that can't fail would be untestable noise.

#74 — bed-runner precondition: refuse an unstamped ("unknown") binary

A plain go build -o bin/charly ./charly produces CharlyVersion()=="unknown"; the bed runner then failed minutes later inside a plan step (or passed vacuously) — the defect recurred twice.

Fix: CheckBinaryStamped(ctx.Command()) (the version-identity analog of the freshness guard, at the same startup site) refuses charly check run on an unstamped binary, pointing at task build:binary; scoped to run via commandPathKey (Kong renders the check family's passthrough as check <args>) + os.Args; bypassable via CHARLY_SKIP_FRESHNESS_CHECK. charly version also exits non-zero on "unknown". + 3 unit tests. Live-proven: unstamped check run refuses (rc=1); check box/live unaffected; stamped runs; version rc=1/0; bypass works.

Found + registered while landing

R10 evidence

Change class & landing

Code (charly Go + candy build-vocab). One superproject leg — zero submodule pointer bumps, no producer legs (the RCA relocated #72 off pkg/arch). R0–R10 satisfied: RDD (isolated #72 spike + disposable beds), R1 (each anomaly RCA'd — the qemu/errcheck backend fallback, the libvirt-daemon temp-HOME test-isolation incident I caused+fixed, the check <args> ctx.Command() miss), R3 (both build-vocab copies; no <name>-host/-pod siblings), R5 (no removed identifiers; grep clean), R10 (fresh-rebuild live proofs pasted above, zero warnings). CHANGELOG placeholder 2026.195.0620.md (validator finalizes the merge-time CalVer).

Assisted-by: Claude (fully tested and validated)

atrawog added 2 commits July 14, 2026 09:00
…n-teardown owner (#69)

`charly vm destroy` printed "Destroyed VM" rc=0 while the libvirt domain kept
running, and a manual bundle add/del of a vm: deploy leaked the domain.

RCA: Run() trusted a single RESOLVED backend; a deploy-name positional resolves
no kind:vm entity `backend:` pin so it fell back to the global vm.backend setting
(qemu here) and took the qemu no-op arm (RemoveAll a non-existent state dir,
errcheck-swallowed) while the real LIBVIRT domain kept running. Separately, a vm:
deploy's bundle del had NO domain-teardown arm for the non-ephemeral case.

Fix:
- candy/plugin-vm/vm.go: destroyVmDomain() probes libvirt authoritatively (the
  domain-state op spawns the session daemon), tears the domain down from whichever
  backend actually holds it, and VERIFIES it is gone; Run() hard-errors "no such
  VM" on not-found (no unconditional success print).
- candy/plugin-deploy-vm/lifecycle.go: vmPostTeardown fires `vm destroy <entity>
  --domain <domain> --keep-deploy` (best-effort) — the bundle-del domain-teardown
  owner, mirroring vmRebuild's proven vmCli-destroy.
- candy/plugin-vm/vm_destroy_test.go: TestDestroyVmDomain_NotFound/_QemuStateDir.

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01GZAcd3eoszb4PN5w5SELag
…nary bed-runner guard (#74)

#72 — the eval-VM update phase's opencharly-git makepkg working copy fetched ALL
branches of the (worktree-shared, all-branches) local superproject and, by git's
DEFAULT fetch.recurseSubmodules=on-demand, on-demand-recursed into the sdk submodule
for a sibling branch whose gitlink bumped sdk to an UNPUSHED SHA -> "not our ref" ->
update phase exit 1. Fix (superproject build vocabulary, NOT pkg/arch - the RCA
relocated it): the arch localpkg build_template's `makepkg -sf` now sets
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=fetch.recurseSubmodules GIT_CONFIG_VALUE_0=false,
disabling the recursion (sdk is wired by PKGBUILD prepare() from a separate source, so
superproject-fetch recursion is never needed). Applied to both //go:embed copies
(charly/charly.yml + candy/plugin-vm/build_defaults.yml, R3). deb/rpm use no makepkg
git+file:// clone (they go build from the working tree) -> arch-specific, documented.
RCA proven by an isolated git spike; end-to-end by the check-local-vm bed's update
phase (PASS steps=7, update phase ok:true) under the live sibling-gitlink state.

#74 — a plain `go build -o bin/charly` produces CharlyVersion()=="unknown", and the bed
runner then fails minutes later inside a plan step (or passes vacuously); the defect
recurred twice. CheckBinaryStamped (main_freshness.go, called at the freshness-guard
startup site) refuses `charly check run` on an unstamped binary, pointing at
`task build:binary`; scoped to `run` via commandPathKey (ctx.Command() is "check <args>")
+ os.Args; bypassable via CHARLY_SKIP_FRESHNESS_CHECK. `charly version` also exits
non-zero on "unknown". Tests: TestShouldRefuseUnstamped/TestCheckSubcommandIsRun/
TestVersionCmd_UnstampedReturnsError; live-proven end to end.

Found + registered: #76 (word-keyed shared plugin cache races across worktrees).

Assisted-by: Claude (fully tested and validated)
Claude-Session: https://claude.ai/code/session_01GZAcd3eoszb4PN5w5SELag
@atrawog

atrawog commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

pr-validator — APPROVED ✅

Change class: code/config — charly Go + candy build-vocab (gate-infrastructure thematic batch: #69 + #72 + #74)

Independent re-validation (trusting no author claim): full diff + every changed file read in context; static gates re-run myself; R10 beds corroborated read-only from disk.

Checklist (all PASS):

Decision: All three fixes are correct and independently proven. commandPathKey confirmed to collapse check <args>→check (the #74 guard genuinely fires); the charly version non-zero-on-unknown change carries no regression (both $(charly version) consumers run the ldflags-stamped binary; status_probes.go uses || true). Approving and merging.

Non-blocking follow-up (validator finding, NOT a blocker): stopVM (candy/plugin-vm/vm.go:337-385) shares #69's latent backend-mismatch false-success class — a manual vm stop <deploy-name> that resolves no backend pin can print Stopped VM while a libvirt domain keeps running (line 382 prints unconditionally). It is separable (the automated deploy/bundle path passes the correct entity; #69's R10 proves its claim without it) and belongs in the next vm-lifecycle-correctness thematic batch (mirroring this PR's own #69→#76 routing). startVM is not affected. Registered for the orchestrator; does not gate this PR.

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

/#72/#74)

Evaluator-generated CalVer stamp for the gate-infrastructure batch cutover
(vm-destroy false-success #69, makepkg sibling-branch fetch #72, unstamped-binary
bed-runner guard #74). Renames the placeholder CHANGELOG to CHANGELOG/2026.195.0802.md and
stamps its H1 to match; folded into the squash-merge.

Assisted-by: Claude (fully tested and validated)
@atrawog
atrawog merged commit 9e476e2 into main Jul 14, 2026
@atrawog
atrawog deleted the feat/gate-infra-hardening branch July 14, 2026 08:04
atrawog added a commit that referenced this pull request Sep 7, 2026
…sdk ledger-lock decoupling + build/substrate advance (Cutover C task 1, charly half, follow-up)

Completes the seven-contract re-pin the group-removal conversion commit
(dbf8e2a) started, to the settled CC-1 wave ledger:

- spec v0.2026249.2215 -> v0.2026250.158: the refs WarmUp prefetch-warm
  fix (spec #109) — a persisted latest_tags entry is now PREFETCH-warm,
  killing the on-demand LatestTag strict re-probe O(n) network storm and
  the deterministic "fetching git metadata for 194 repo(s)" hang.
- sdk v0.2026249.2239 -> v0.2026250.154: carries BOTH the contract floor
  (sdk #226) AND the fleet-del self-deadlock fix (sdk #227:
  kit.AcquireLedgerLock moved off charly.yml.lock onto the dedicated
  <config>.ledger.lock). Folded from sibling commit 3867f71e
  (feat/fleet-del-deadlock-pin-bump) — its bump is absorbed here rather
  than cherry-picked to avoid a broken intermediate sdk pin (the
  conversion commit's tree carried v0.2026250.17 uncommitted).
- plugin-build v0.2026243.1627 -> v0.2026249.2311 and plugin-substrate
  v0.2026241.1038 -> v0.2026249.2326 (the substrate imageless
  agent_provisioned fold fix a857bd5 consumes).
- plugin-check 2119 / plugin-preempt 2116 / plugin-fleet 2126 /
  plugin-migrate 2144 were already advanced by dbf8e2a — unchanged.
- plugin-deploy-vm (v0.2026249.2224) / plugin-deploy-pod
  (v0.2026249.2212) are @github refs resolved at runtime to their
  latest tags — no go.mod require exists by design (externalized
  deploy substrates, provider_deploy.go).

Verified: go build ./... and go vet ./... exit 0; go test -count=1
./... fails ONLY the two distro-gated tests (TestCueKinds_Corpus and
TestMaterializeSeam_RealFixtureDeterministic — both read the
pre-conversion ../box/{arch,fedora,cachyos} submodule trees, the
pending distro conversion wave's dependency, independent of this
go.mod/go.sum-only diff); task build:binary exit 0, bin/charly
version 2026.250.0054. The own-tree bed R10s + box validate are
blocked at project resolve by the same pre-conversion distro import
pins (arch v2026.241.1429 first) — they run when the distro
conversion PRs land and the import pins bump (coordinated separately).

Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)
github-actions Bot pushed a commit that referenced this pull request Sep 7, 2026
…ags + box pointers + spec 200 / sdk 417 re-pins (#552)

* feat(schema)!: remove the group kind from charly — unroll migration, provider drop, seven-contract re-pin (Cutover C task 1, charly half)

* feat(schema)!: remove the group kind from charly — unroll migration, provider drop, seven-contract re-pin (Cutover C task 1, charly half)

* fix(substrate): fold the imageless agent_provisioned pod as a DEPLOY — the shape classifier missed the Fleet gate exemption

RCA (2026-09-07 runtime envelope drop): the canonical imageless agent_provisioned pod (agent_provisioned: true + iterate:, no image:/from:, no resource-member sibling) VANISHED from the resolved-project envelope Deploy map — every build:project consumer saw no-entity. Root cause: foldSubstrateKind classified deploy vs template via pl.IsDeployShape(pn) (from:/image: bodies only) || ResourceChildren — the agent_provisioned spelling the Fleet gate (spec.ValidateDeploymentTree → ValidateDeployRequiresBox) exempts from the box requirement matched NEITHER arm, so the node folded as a standalone TEMPLATE (acc.PluginKinds[pod]) and never entered acc.Fleet. The plugin-build #9 in-repo tests missed it because every test doc carries a watcher: sibling feeding the ResourceChildren arm. Fix: extend the foldSubstrateKind predicate with agentProvisionedBody(rawBody) so the classifier stays in lockstep with the gate exemption. TDD: substrate_imageless_deploy_test.go reproduces the drop pre-fix (acc.Fleet empty, node in the template map) and locks the discriminator (plain imageless pod stays a template; watcher-sibling shape unaffected).

* chore(deps): the 10/11-contract re-pin — spec WarmUp prefetch-warm + sdk ledger-lock decoupling + build/substrate advance (Cutover C task 1, charly half, follow-up)

Completes the seven-contract re-pin the group-removal conversion commit
(dbf8e2a) started, to the settled CC-1 wave ledger:

- spec v0.2026249.2215 -> v0.2026250.158: the refs WarmUp prefetch-warm
  fix (spec #109) — a persisted latest_tags entry is now PREFETCH-warm,
  killing the on-demand LatestTag strict re-probe O(n) network storm and
  the deterministic "fetching git metadata for 194 repo(s)" hang.
- sdk v0.2026249.2239 -> v0.2026250.154: carries BOTH the contract floor
  (sdk #226) AND the fleet-del self-deadlock fix (sdk #227:
  kit.AcquireLedgerLock moved off charly.yml.lock onto the dedicated
  <config>.ledger.lock). Folded from sibling commit 3867f71e
  (feat/fleet-del-deadlock-pin-bump) — its bump is absorbed here rather
  than cherry-picked to avoid a broken intermediate sdk pin (the
  conversion commit's tree carried v0.2026250.17 uncommitted).
- plugin-build v0.2026243.1627 -> v0.2026249.2311 and plugin-substrate
  v0.2026241.1038 -> v0.2026249.2326 (the substrate imageless
  agent_provisioned fold fix a857bd5 consumes).
- plugin-check 2119 / plugin-preempt 2116 / plugin-fleet 2126 /
  plugin-migrate 2144 were already advanced by dbf8e2a — unchanged.
- plugin-deploy-vm (v0.2026249.2224) / plugin-deploy-pod
  (v0.2026249.2212) are @github refs resolved at runtime to their
  latest tags — no go.mod require exists by design (externalized
  deploy substrates, provider_deploy.go).

Verified: go build ./... and go vet ./... exit 0; go test -count=1
./... fails ONLY the two distro-gated tests (TestCueKinds_Corpus and
TestMaterializeSeam_RealFixtureDeterministic — both read the
pre-conversion ../box/{arch,fedora,cachyos} submodule trees, the
pending distro conversion wave's dependency, independent of this
go.mod/go.sum-only diff); task build:binary exit 0, bin/charly
version 2026.250.0054. The own-tree bed R10s + box validate are
blocked at project resolve by the same pre-conversion distro import
pins (arch v2026.241.1429 first) — they run when the distro
conversion PRs land and the import pins bump (coordinated separately).

Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)

* feat(cutover-c): land the distro conversion wave — the 4 converted distro import tags + box pointers + spec v0.2026250.200 + sdk v0.2026250.417 + the structkind plugin re-pin

* chore: re-trigger the pr-validator — body re-classification (A1/A3/R2/R10 findings addressed; named batch #553)

---------

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