Skip to content

feat(schema): mirror the two drifted VM state fields and gate the hand mirror - #378

Merged
github-actions[bot] merged 5 commits into
mainfrom
feat/hand-state-lockstep
Nov 18, 2026
Merged

github-actions[bot] merged 5 commits into
mainfrom
feat/hand-state-lockstep

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

spec/hand_state_types.go opens by stating its own contract: the three types in it cannot be
generated 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_resolved and snapshot, and schema/deploy.cue carried neither.

This change makes the mirror true and then makes it stay true.

  • The inline ephemeral?: { … } block becomes a named @go(-) def, and the two missing records
    join it as #VmKeyInjectionResolved and #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-gen emitted
    the three types and the build failed on VmKeyInjectionResolved redeclared. #VmDeployState's
    own @go(-) is a different sentence: its open ... tail additionally degrades gengotypes'
    output to map[string]any, so generating it would be lossy as well as duplicative.
  • #VmDeployState gains key_injection_resolved?: #VmKeyInjectionResolved and
    snapshot?: [...#VmSnapshotState], and points ephemeral? at the new def.
  • schema/hand_state_lockstep_test.go compares each def's field names against its Go struct's
    yaml 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 be
generated away — PortSpec has no CUE def by design (its own schema comment says so) and the
state 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:

$ go test ./schema/ -run TestVmDeployStateMirrorsItsCueDef
--- FAIL: TestVmDeployStateMirrorsItsCueDef (0.00s)
    hand_state_lockstep_test.go:100: spec.VmDeployState vs #VmDeployState is out of lockstep: declared in CUE only []; declared in Go only [key_injection_resolved snapshot]
    hand_state_lockstep_test.go:103: #EphemeralRuntime not found in deploy.cue
FAIL

GREEN, on the committed tree:

$ go test ./schema/ -run TestVmDeployStateMirrorsItsCueDef -v
=== RUN   TestVmDeployStateMirrorsItsCueDef
--- PASS: TestVmDeployStateMirrorsItsCueDef (0.00s)
ok  	github.com/opencharly/spec/schema	0.011s

The generator is this repo's contract proof, and the three new defs are @go(-), so the
generated Go must not move — the tree after two generator runs says it did not:

$ charly task cue-gen        # then a second run
  [pass] run — generate the Go params in-process + schemagen the vocab lists
  [pass] check — regen is reproducible — TestGenReproducible passes on the committed tree
$ git status --short
 M schema/deploy.cue
?? schema/hand_state_lockstep_test.go

spec/cue_types_gen.go is 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:

$ git -C spec grep -nE '^[[:space:]]*disposable:' origin/main -- '*.yml' '*.yaml'
grep_rc=1
$ go build ./...
build_rc=0
$ go test ./...
test_rc=0
$ gofmt -l .
gofmt: []
$ golangci-lint run ./...
lint_rc=0
0 issues.

Rulebook compliance

  • R0 — /charly-internals:go, /charly-internals:plugin and /charly-internals:git-workflow were loaded before the first git action, and this repo's AGENTS.md was read first (Part II feat(spec): CUE-source ResolvedBox/BuilderMap/AggregatedCandyCaps (#55 step3 unit 3a) #4).
  • R1 — the drift this change fixes was surfaced by a test rather than assumed, and it is fixed here; no new anomaly was left open, so nothing needed filing.
  • R2 — the inline ephemeral block and the three hand-mirrored records now have one home each in the schema, and the Go mirror is checked against them instead of being a second, unchecked statement of the same shapes.
  • R3 — no workaround: @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.
  • R4 — no documented command changes; the schema now validates the two fields the runtime has been writing all along.
  • R5 — the inline ephemeral block is replaced by a named def in the same change, and everything the block carried moves with it: every field, plus the block-level provenance comment and the deploy_address rationale 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.
  • R6 — git status --short was clean before the branch was cut; the work is on feat/hand-state-lockstep in a worktree, never the tracked checkout; no force-push, no bypass, no direct push to main.
  • R7 — the proof fails without the change and is pasted above in both directions: RED before the schema fix (two fields missing, one def absent), GREEN after, and the generator re-run twice on the committed tree to show the generated Go did not move.
  • R8 — no live service boundary is crossed: this is a contract module whose gate is code generation plus the Go suite, and no venue is contacted.
  • R9 — no binary is deployed from this repo and no runtime dependency is added; the generator ran through the umbrella's own built binary.
  • R10 — the class is contract/library, its gate is the module CI pasted above, and the anchored disposable: grep pasted above proves no bed venue exists in this tree, so no charly check run applies.

Change classification

No consumer breakage and nothing to roll back. #VmDeployState and 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)

…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)
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 05524644b13213ede8d1865f2c4c31138cd8384e (branch: feat/hand-state-lockstep)

Change class: schema/contract (CUE defs) + Go test — code/config. Beds are correctly N/A for this contract module (the anchored disposable: grep rc=1 proves no bed venues); the go test gate is the right one. The RED/GREEN evidence is internally consistent — the reported hand_state_lockstep_test.go:100 / :103 lines match the committed test's call sites under t.Helper() — so the pasted proof itself is not in question.

Blocks

  1. R1 / A1 — the @go(-) rationale is false for the three new sub-records. The comment above #VmKeyInjectionResolved in schema/deploy.cue (and the body's Summary and R3: "the generator cannot express these shapes … the open ... tail degrades gengotypes' output to map[string]any") is accurate only for #VmDeployState. #VmKeyInjectionResolved, #VmSnapshotState, and #EphemeralRuntime are closed records that cue exp gengotypes can express; the real reason they are @go(-) is to avoid emitting Go types that would collide with the hand-mirrored structs in hand_state_types.go, not because of the parent's open tail. Correct the CUE comment and the body's R3 to state the actual driver, or paste cue exp gengotypes output showing these closed defs genuinely degrade.

  2. R5 / QUAL — the relocation dropped the deploy_address rationale. Moving the inline ephemeral block into #EphemeralRuntime (schema/deploy.cue) silently deleted its comment: "deploy_address is the CLI-addressable deploy identity … DISTINCT from the dc.Deploy map key … RCA feat(spec)!: host the loader-RESULT type family (#55 Phase B, cutover 1) #2, FINAL/K5 unit 6a." The field's semantics are unchanged, so the comment still applies; dropping it loses the RCA traceability and the very distinction that previously caused confusion. Carry the comment over with the field in the same commit (R5 sweep / QUAL documentation).

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: a8dd0ab7a30cb0ac97a2d60fd1c63e0612f71c6d (branch: feat/hand-state-lockstep)

Change class: schema/contract (CUE defs) + Go test — code/config. Beds are correctly N/A for this contract module (the anchored disposable: grep rc=1 proves no bed venues); the module go test/generator gate is the right one. The RED/GREEN evidence is internally consistent with the committed test's call sites, so the pasted proof itself is not in question.

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

  1. R1 / A1 — the @go(-) rationale is false for the three new sub-records. schema/deploy.cue (comment above #VmKeyInjectionResolved) and the body Summary/R3 state all four records are @go(-) "because the open ... tail of #VmDeployState degrades gengotypes' output to map[string]any". That is true only of #VmDeployState. #VmKeyInjectionResolved, #VmSnapshotState, and #EphemeralRuntime are closed records that cue exp gengotypes can express; they are @go(-)'d to avoid emitting generated Go types that would duplicate the hand-mirrored structs in spec/hand_state_types.go, not because of the parent's open tail. Correct the CUE comment and the body's R3 to state the actual driver, or paste cue exp gengotypes output showing these closed defs genuinely degrade.

  2. R5 / QUAL / A1 — the relocation dropped the deploy_address rationale. Moving the inline ephemeral block into #EphemeralRuntime silently deleted the field comment: "deploy_address is the CLI-addressable deploy identity … DISTINCT from the dc.Deploy map key … RCA feat(spec)!: host the loader-RESULT type family (#55 Phase B, cutover 1) #2, FINAL/K5 unit 6a." The field's semantics are unchanged, so the comment still applies; carry it over with the field in the same commit. The body's R5 ("nothing is deleted except the inline ephemeral block") also fails to account for this deletion.

Comment intake

  • Comment 6980503190 (bot BLOCK, head 05524644b132): both findings verified-blocking against the CURRENT diff — the merge of main (a8dd0ab7a30c) did not change the two defects, so neither is stale/superseded.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

aitrawog added 2 commits November 18, 2026 16:30
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)
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 8e653e8ebc5a7f178d3a8e28b4c9b5c393d30f1e (branch: feat/hand-state-lockstep)

Change class: schema/contract (CUE defs) + Go test — code/config. Beds correctly N/A for this spec module (the anchored disposable: grep rc=1), so the module go test/generator gate is the right one. The RED/GREEN evidence is internally consistent with the committed test's call sites.

Blocks

  1. R5 / A1 — the relocation silently dropped the deploy_address field rationale, and the body's R5 misstates the deletion set. In schema/deploy.cue the removed inline ephemeral block carried a five-line comment on deploy_address ("deploy_address is the CLI-addressable deploy identity (the dotted tree path for a nested deploy — charly deploy del <deploy_address>), DISTINCT from the dc.Deploy map key this entry is stored under … RCA feat(spec)!: host the loader-RESULT type family (#55 Phase B, cutover 1) #2, FINAL/K5 unit 6a."). The new #EphemeralRuntime def carries the field with no comment, so that traceability is lost. The block-level ephemeral provenance comment (persistence source ephemeral.go's RegisterEphemeralLifecycle / persistEphemeralRuntime, "cross-substrate ephemeral-instance lifecycle", "FINAL/K5 unit 6a") is likewise not carried over. The body's R5 states "nothing is deleted except the inline ephemeral block, which is replaced by a named def" — contradicted by the diff, which also deletes these comments. Carry the deploy_address comment (and the ephemeral provenance) onto the named def in the same commit, and correct R5's accounting. Note: the lockstep test only compares field names, so it does not "fail if the block and the def disagree" on semantics — R5's stated evidence overclaims what the control proves.

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

  • Comment 6980503190 (bot BLOCK, head 05524644b132) — Finding 1 (@go(-) rationale false for the three sub-records): stale-superseded — commit 6c025f182fdd (after this comment) rewrote the CUE comment and the body's Summary/R3 to correctly state that the three records are @go(-)'d because their Go types are hand-written (generation suppresses the redeclaration), distinct from #VmDeployState's open-tail/map[string]any reason. Finding 2 (deploy_address comment dropped): verified-blocking against the current diff — still open.
  • Comment 6982621560 (bot BLOCK, head a8dd0ab7a30c) — Finding 1: stale-superseded (resolved by 6c025f182fdd, which post-dates this comment). Finding 2: verified-blocking — unchanged, still open.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

…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)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 43c59a5b20b2adb7a9c43f46de5376f7df15bb7f (branch: feat/hand-state-lockstep)

Change class: schema/contract (CUE defs) + Go control test — code/config. Beds correctly N/A for the spec module (anchored disposable: grep rc=1 proves no bed venue); the module go build/go test/gofmt/golangci-lint + cue-gen reproducibility gate is the right one.

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 spec/schema; nothing leaked into core/sdk/candy. The @go(-) defs are the schema's own suppression mechanism (not a workaround), and the diff is internally consistent: the pasted RED output's hand_state_lockstep_test.go:100 (out-of-lockstep t.Errorf) and :103 (#EphemeralRuntime not found t.Fatalf, which aborts before the last two asserts) match the committed test's call sites under t.Helper() exactly.

Comment intake

  • Comment 6980503190 — Finding 1 (@go(-) rationale false for the three sub-records): stale-superseded by 6c025f18; the current CUE header comment and body R3 correctly state the driver is "Go type hand-written → annotation suppresses generation (redeclaration)" and reserve the open-tail/map[string]any reason for #VmDeployState alone. Finding 2 (deploy_address rationale dropped): stale-superseded by 43c59a5b; the comment is now carried verbatim into #EphemeralRuntime (deploy_address?: string, schema/deploy.cue).
  • Comment 6982621560 — Finding 1: stale-superseded (same as above). Finding 2: stale-superseded (43c59a5b carried the comment).
  • Comment 6983204117 — Finding (dropped deploy_address + block-level provenance; R5 misstated the deletion set; lockstep test only compares names): stale-superseded — current diff carries both the deploy_address rationale and the block-level provenance onto #EphemeralRuntime, and body R5 now states exactly that ("every field, plus the block-level provenance comment and the deploy_address rationale … 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").

No surviving finding reproduces against the current body/diff.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 18, 2026 15:38
@github-actions
github-actions Bot merged commit 0177053 into main Nov 18, 2026
4 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 18, 2026
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