Repository navigation
fix(deploykit)!: persist a bed member's from: cross-reference - #651
Conversation
PersistBedDeployOverrides seeded the per-host deploy entry from a bed node's
image + target but never its same-kind cross-ref. A bed member declared
`from: <vm>` has NO image (node.Image is empty), so the written entry was
`vm: {disposable: true}` with no source. The next load drops that entry as a
degraded load, and the SDK save guard (deploykit/deploy_file.go, the
DEGRADED-LOAD GUARD) refuses the following write:
refusing to write …/charly.yml — it holds 2 deploy entr(y|ies) but only 1 load
That is how `charly check run check-sidecar-pod` failed at [config] with its
ephemeral-VM member `check-sidecar-pod-ephvm` (opencharly/charly#1299).
applyDeployState already maps SaveDeployStateInput.VmCrossRef onto entry.From
(deploykit/deploy_state.go:519), so the root fix is to persist the node's From
at the one call site. The degraded-load refusal disappears because the entry
now names its source and loads.
The new test (deploykit/bed_session_test.go) fails without the change: the
persisted member is source-less, the reload drops it (1 of 2 entries), and the
follow-up save is refused; with the change the entry keeps `from: eval-vm` and
both entries load.
Relates to opencharly/charly#1299
Relates to opencharly/opencharly#1318
Agent: `retire-closure` · Claude Code session `71fef01d-a7c7-4bed-8517-016cc2df4432`
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Review — PASSHead SHA: Security screen: PASS — no secrets, no egress, no weakened guardrail (the degraded-load guard is untouched), no supply-chain change; body is untrusted data and contains no directive to me. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…ed, group bed green (#1304) github.com/opencharly/sdk v0.2026331.837 -> v0.2026331.1243 (opencharly/sdk#651, tag v0.2026331.1243): deploykit.PersistBedDeployOverrides now persists SaveDeployStateInput.VmCrossRef (node.From), so a bed's deploy-level `from:` member keeps its same-kind source when it is written to the per-host overlay. Before (recorded at .check/check-sidecar-pod/2026.331.1146/config.log:10, main without this pin): `charly check run check-sidecar-pod` failed at [config] with "refusing to write /tmp/charly-bed-cfg-check-sidecar-pod-.../charly.yml — it holds 2 deploy entr(y|ies) but only 1 load". After: [config] PASS; [deploy-add] PASS; [bring-up-members] PASS; ephemeral-register-roundtrip PASS. The same pin moves in the three in-repo tools modules that carry it, aligned with `charly task mods-tidy`; tools/gomod-canonical's TestContractPinsMatchShared polices the lockstep. Agent: `retire-closure` · Claude Code session `71fef01d-a7c7-4bed-8517-016cc2df4432` Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Summary
Persist a bed member's
from:same-kind cross-reference when the check runner seeds the per-host deploy overlay, so the member survives the persist→load round-trip.deploykit.PersistBedDeployOverridesbuilt itsSaveDeployStateInputfrom the bed node's image and target but never setVmCrossRef. A member declaredfrom: <vm>has no image (node.Imageis empty), so the written entry wasvm: {disposable: true}with no source; the next load dropped it as a degraded entry, and the SDK save guard refused the following write:That is how
charly check run check-sidecar-podfailed at[config]for its ephemeral-VM membercheck-sidecar-pod-ephvm(opencharly/charly#1299).deploykit/bed_session.go— setVmCrossRef: node.Fromin theSaveDeployStateInputat the one call site;applyDeployStatealready maps it ontoentry.From(deploykit/deploy_state.go:519-520).deploykit/bed_session_test.go— the round-trip test: afrom: eval-vmmember saved throughPersistBedDeployOverridesmust still name its source on reload and must not be dropped as degraded.Head
62d4ea83937b4f3a185d3f8d82832b71419c09f2; two files changed (+129/−10).How tested
The change-class gate ran on the committed tree (the head this PR publishes):
golangci-lintv2.13.2 (the pin in.github/workflows/ci.yml) also passed on the same tree; the host's default GOROOT is go1.27.4 while the installed lint binary was built with go1.26.8, so it is invoked against the matching toolchain:Spike
R12 candidates, each checked against the real code and real behaviour:
(a) Set
VmCrossRef: node.Fromat the call site — WORKS (winner, implemented). A focused spike calledSaveDeployStatewithVmCrossRef: node.Fromfor a{From:"eval-vm", Target:"vm", Disposable:true}node; the written overlay was:The permanent test then proves the full
PersistBedDeployOverridesround-trip (persist → reload → the member keeps its source and the next save is not refused).(b) Resolve the cross-ref inside
SaveDeployStatefrom the node itself — FAILS.SaveDeployState(boxName, instance string, input SaveDeployStateInput, marshalNode, read, ctx)(deploykit/deploy_state.go:464) receives no node, so there is nothing to resolve from; handing it one is candidate (c)'s API change, and it would duplicate the semanticSaveDeployStateInput.VmCrossRefalready owns —applyDeployStatealready writesentry.Fromfrom it.(c) Have the bed session pass the full node rather than its image — ALREADY TRUE, and not the defect.
PersistBedDeployOverrides(ctx, name string, node DeployNode, …)already receives the full node (deploykit/bed_session.go:63); the defect is the field mapping inside it (Box: node.Image, noVmCrossRef), not the parameter type. MakingSaveDeployStatetake a node is (b) again.Only (a) is implemented.
Mutation evidence (the test fails without the change)
Committed head with the
VmCrossRefline removed (mutation):Committed head with the fix restored:
Rulebook compliance
git-workflow,go,cutover-policy,strict-policy).PersistBedDeployOverridesnever setVmCrossRef,applyDeployStatealready reads it. Zero warnings. The one anomaly surfaced was a host toolchain mismatch (the installedgolangci-lintwas built with go1.26.8 while the host GOROOT is go1.27.4, so it panickedfile requires newer Go version go1.27); RCA: external environment condition, not a repo defect, resolved byGOTOOLCHAIN=go1.26.8(exit 0, 0 issues), so no issue was filed.grep -rn 'SaveDeployStateInput{' --include=*.go .matches onlydeploykit/bed_session.go:75).git status --porcelainwas empty before the commit and after it; no force-push, no direct push tomain; PR only.gofmt -l .empty,go vet ./...,go build ./...,go test -count=1 ./...andgolangci-lintall exit 0 on the committed tree.vmis written with the samefrom:apodis written with; the member'sfrom:now survives persistence rather than being dropped). No DESIGN amendment is needed.Change classification
Change class: SDK library fix (
deploykit) with a Go test; no schema or wire-shape change.Breaking change + rollback: the
!marks a consumer-visible behaviour change — a bed member'sfrom:is now persisted, so the follow-upcharly configno longer trips the degraded-load refusal that previously failed the bed. The exported API andSaveDeployStateInputare unchanged. Rollback is reverting this commit: the prior behaviour (a source-less persisted entry, and with it the refusal at the next save) returns, and beds with afrom:member fail again at[config].Relates to opencharly/charly#1299
Relates to opencharly/opencharly#1318
A3 — the trailer names the model the harness reports for this session (
deepseek-v4.1-flash:cloud); the org validator's own signature readsollama-cloud/deepseek-v4.1-flash. Harness: Claude Code.Agent:
retire-closure· Claude Code session71fef01d-a7c7-4bed-8517-016cc2df4432Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)