Repository navigation
feat(schema): mirror the two drifted VM state fields and gate the hand mirror - #378
Conversation
…d mirror spec/hand_state_types.go states its own contract in its header: every field of the hand-written #VmDeployState mirror has a matching CUE field. Nothing enforced it, and it was already false -- the Go struct carried key_injection_resolved and snapshot, and schema/deploy.cue carried neither. This adds the three hand-mirrored records as named, @go(-)'d defs (#VmKeyInjectionResolved, #VmSnapshotState, #EphemeralRuntime; the ephemeral block was inline), points #VmDeployState at them, and adds the two missing fields. It also adds schema/hand_state_lockstep_test.go, which compares each def's field names against its Go struct's yaml tags in BOTH directions, so the mirror cannot drift again. Row 2.3 closes here as correctly hand-written: the @go(-) exceptions are not debt but the only faithful shape, and this change makes that claim executable rather than prose. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: schema/contract (CUE defs) + Go test — code/config. Beds are correctly N/A for this contract module (the anchored Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: schema/contract (CUE defs) + Go test — code/config. Beds are correctly N/A for this contract module (the anchored Security screen: PASS — no secrets, no scope mismatch beyond the described change, no guardrail weakening (this is a schema def + a read-only lockstep test). Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
The comment above the hand-mirrored records said all four are @go(-) because the open tail of #VmDeployState degrades gengotypes output. That is true of #VmDeployState alone. The three records are @go(-) for a different and more specific reason: their Go types are hand-written, so the annotation suppresses generation, and it is load-bearing -- measured when the annotation was absent, cue-gen emitted the three types and the build failed on the redeclaration. The comment now states each sentence for what it covers, and names the measurement instead of the inference. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Brings the upstream merge of main (the BEHIND cure) under this round's fix commit, so the branch advances by addition rather than by rewrite. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: schema/contract (CUE defs) + Go test — code/config. Beds correctly N/A for this spec module (the anchored Blocks
This is a finding raised on the PR; per R1 it must be fixed in-tree, not dismissed as "no finding arose from this change, so nothing was filed." Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…ale onto the named def Moving the inline ephemeral block into #EphemeralRuntime dropped the comments that explained it: the block-level provenance (candy/plugin-deploy/ephemeral.go's RegisterEphemeralLifecycle / persistEphemeralRuntime, the FINAL/K5 unit 6a lifecycle) and the deploy_address rationale (the CLI-addressable identity, distinct from the dc.Deploy map key, RCA #2). Both are restored verbatim on the named def. A relocation that loses the reason a field exists is a deletion wearing a move's clothes, and the diff should not read as one. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — PASSHead SHA: Change class: schema/contract (CUE defs) + Go control test — code/config. Beds correctly N/A for the spec module (anchored Security screen: PASS — no secrets/egress, no scope mismatch (diff matches Summary), no guardrail weakening, no new deps; the added test is read-only. Checklist: All applicable rules (A1–A3, R0–R10, PIL/SDD, CONC, HC, ARCH, DISP, QUAL, COORD) PASS or NA. Placement: CORRECT — CUE defs and their lockstep control belong in Comment intake
No surviving finding reproduces against the current body/diff. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
spec/hand_state_types.goopens by stating its own contract: the three types in it cannot begenerated faithfully, so they are hand-mirrored, and "every field here has a matching CUE field".
Nothing enforced that sentence, and it was already false: the Go struct carried
key_injection_resolvedandsnapshot, andschema/deploy.cuecarried neither.This change makes the mirror true and then makes it stay true.
ephemeral?: { … }block becomes a named@go(-)def, and the two missing recordsjoin it as
#VmKeyInjectionResolvedand#VmSnapshotState. Each of the three is@go(-)because its Go type is hand-written: the annotation suppresses generation for that record,
and it is load-bearing — measured, not inferred: with the annotation absent,
cue-genemittedthe three types and the build failed on
VmKeyInjectionResolved redeclared.#VmDeployState'sown
@go(-)is a different sentence: its open...tail additionally degradesgengotypes'output to
map[string]any, so generating it would be lossy as well as duplicative.#VmDeployStategainskey_injection_resolved?: #VmKeyInjectionResolvedandsnapshot?: [...#VmSnapshotState], and pointsephemeral?at the new def.schema/hand_state_lockstep_test.gocompares each def's field names against its Go struct'syaml tags in both directions, so a field added on either side alone fails the suite.
Row 2.3 closes here as correctly hand-written. The
@go(-)exceptions are not debt to begenerated away —
PortSpechas no CUE def by design (its own schema comment says so) and thestate records need generator support for open records that does not exist — so the row's honest
disposition is that these three stay hand-written, with a control that proves the mirror rather
than a comment that asserts it.
How tested
The control was written first, so the drift is something the suite REPORTED rather than something
this body asserts. RED, on the tree before the schema half of this change:
GREEN, on the committed tree:
The generator is this repo's contract proof, and the three new defs are
@go(-), so thegenerated Go must not move — the tree after two generator runs says it did not:
spec/cue_types_gen.gois absent from that list, which is what@go(-)on all four records buys.This repo's change class is contract/library, so the gate is its own module CI — and the class is a
negative claim about beds, so it is proven rather than assumed:
Rulebook compliance
/charly-internals:go,/charly-internals:pluginand/charly-internals:git-workflowwere loaded before the first git action, and this repo'sAGENTS.mdwas read first (Part II feat(spec): CUE-source ResolvedBox/BuilderMap/AggregatedCandyCaps (#55 step3 unit 3a) #4).@go(-)is the schema's own mechanism for a record whose Go type is hand-written, and the change uses it rather than hand-editing generated output; that the annotation is load-bearing was measured when its absence produced colliding generated types and a failing build.deploy_addressrationale that explained them. The lockstep control compares field NAMES on both sides, so it proves the field sets agree and nothing more; the comment text is carried by this diff rather than asserted by a test.git status --shortwas clean before the branch was cut; the work is onfeat/hand-state-lockstepin a worktree, never the tracked checkout; no force-push, no bypass, no direct push tomain.disposable:grep pasted above proves no bed venue exists in this tree, so nocharly check runapplies.Change classification
No consumer breakage and nothing to roll back.
#VmDeployStateand its three records are@go(-),so no generated Go type changes and a consumer bumping its pin compiles as before; the schema
becomes stricter only about the two fields the runtime already writes, which is the point.
Filed issues
N/A — no finding arose from this change, so nothing was filed.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)