Skip to content

feat(loaderkit)!: read the pod floor from the contract's kept envelope, not the moved #Pod - #504

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/delete-podspec-alias
Nov 13, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/delete-podspec-alias

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

Leg 3 of unit 3's chain (TODO.md 2.1, tracker opencharly/spec#304, row 3 — the pod kind). The contract module deleted #Pod / #PodValue in opencharly/spec#307 (squash 8cceca6924290854600a29cb74b7daf83d7bec01, merge-time tag v0.2026317.703), and this module names them in TWO places — one dead alias, one load-bearing table:

site what it was change
vmshared/spec_aliases.go PodSpec = spec.PodSpec — an unused zero-churn alias (the only PodSpec occurrence in this module IS that definition) deleted with the type it named
loaderkit/cue_schema.go cueKindDefs["pod"] = "#Pod" — the table the embedded contract schema is indexed by, and the source of the declared-fields CONTRACT FLOOR retargeted at #ResolvedPod, the def the contract keeps

Head of this PR:

$ git rev-parse HEAD
4a8084d0f9e00964ae540ddd5d12794af7cd6265

Why the table entry is a RETARGET, not a deletion

It is not cosmetic. sharedCueSchema() fail-fasts on any entry whose def is absent, so with the contract's deletion linked, the loader does not warn — it panics at init:

panic: loaderkit: CUE kind "pod": definition #Pod not found: field not found: #Pod
  github.com/opencharly/sdk/loaderkit.init.func3(.../sdk/loaderkit/cue_schema.go:85)
  ... loaderkit.ValidateNodeDocCUE → plugin-loader.ValidateNodeDocCUE → ParseDocStream

and the same table feeds loaderkit/declared_fields_floor.go — the process-lifecycle-independent field-name set the parse consults when the served-schema channel is empty. That file's header records the live repro it exists to prevent (distro-arch check-agent-live's pod body, an iterate: key carrying an agent: kind-word key, failing charly deploy add with expected a mapping value — sdk#221/#223/#225), and TestContractDeclaredFields_Floor pins pod as a NON-empty floor. Dropping the entry re-arms exactly that bug, and this repo's own gate forbids it — the plant below turns that test red.

So the entry names #ResolvedPod: the resolve-to-envelope form the contract keeps for the kind (and the reason the contract keeps #PodSidecar), whose field set is the authored body's plus the resolved-only raw. Two consequences are deliberate and written beside the table instead of being discovered later:

  • the floor for pod gains raw — a field no correct document authors, and one the pod VALUE gate still rejects as field not allowed, so the extra name cannot admit a document;
  • env_default's type differs between the authored #StrVal and the envelope's string, which would matter only to a CONCRETE unify — ValidateEntityClosedCUE("pod", …) / ApplyCueDefaults("pod") — and no caller in the tree passes "pod" to either:
$ grep -rn 'ValidateEntityClosedCUE("pod"\|ValidateEntityCUE("pod"\|ApplyCueDefaults("pod"' --include='*.go' .
./loaderkit/cue_schema.go:70:// to a CONCRETE unify, i.e. `ValidateEntityClosedCUE("pod", …)` / `ApplyCueDefaults("pod")`,

One hit, and it is the comment in this diff that NAMES the two functions — there is no call site: the only "pod" argument any of them receives anywhere in the tree is that sentence.

Files (exactly the diff)

$ git diff --stat origin/main...HEAD
 go.mod                                  |  2 +-
 go.sum                                  |  4 ++--
 loaderkit/cue_schema.go                 | 15 ++++++++++++++-
 loaderkit/declared_fields_floor.go      |  9 +++++++--
 loaderkit/declared_fields_floor_test.go | 12 ++++++++++++
 vmshared/spec_aliases.go                |  1 -
 6 files changed, 36 insertions(+), 7 deletions(-)
File Change
go.mod require github.com/opencharly/spec → v0.2026317.703 (the merged leg-2 tag)
go.sum that pin's hash
loaderkit/cue_schema.go the pod entry names #ResolvedPod; the reasoning and both bounded consequences are the comment under the table
loaderkit/declared_fields_floor.go the derivation note no longer claims all five substrate bodies validate against a `#Pod
loaderkit/declared_fields_floor_test.go pins the move: cueKindDefs["pod"] == "#ResolvedPod" and the floor still covers the AUTHORED body's own field names (box, sidecar, env_default, secret)
vmshared/spec_aliases.go the unused PodSpec alias

How tested

This repo's gate (sdk/AGENTS.md: gofmt, go vet, go test, golangci-lint, and the cross-compile matrix), on the committed tree with the spec require at the merged leg-2 tag:

$ test -z "$(gofmt -l .)"; echo "gofmt rc=$?"
gofmt rc=0
$ GOWORK=off go build ./...; echo "build rc=$?"
build rc=0
$ GOWORK=off go vet ./...; echo "vet rc=$?"
vet rc=0
$ GOWORK=off go test -count=1 ./... 2>&1 | grep -c '^ok'
19
$ GOWORK=off go test -count=1 ./... 2>&1 | grep -c '^FAIL' || true
0
$ for a in amd64 arm64 arm 386; do GOOS=linux GOARCH=$a CGO_ENABLED=0 go build ./... && echo "build $a ok"; done
build amd64 ok
build arm64 ok
build arm ok
build 386 ok
$ GOTOOLCHAIN=go1.26.8 golangci-lint run ./...
0 issues.

The consumer matrix — the modules that read this surface, built against THIS tree

go mod edit -replace github.com/opencharly/sdk=<this tree> in each consumer (its own spec then follows this module's require through MVS), then its own go build ./...:

== plugin-box: build ok
== plugin-fleet: build ok
== plugin-build: build ok
== plugin-deploy-vm: build ok
== plugin-loader: build ok
== plugin-check: BUILD FAIL
# github.com/opencharly/plugin-check/candy/plugin-check
./checkproject.go:291:16: undefined: spec.Pod

Six of the twenty-six modules that import sdk/loaderkit or sdk/vmshared are built here; the one failure is the next leg of this chain and nothing else — plugin-check's own var pod spec.Pod, retargeted in its own PR. The five that pass include the ones whose parse path actually consumes the floor this diff touches.

The plant — red on ASSERTIONS, restored byte-identical

Plant: drop pod from cueKindDefs (the option that would silently re-arm the unsafe value-shape scan) — the floor gate must go red on its own assertion, not on a build error:

$ python3 - <<'EOF'    # remove the "pod": "#ResolvedPod" entry
$ GOWORK=off go test -count=1 -run 'TestContractDeclaredFields_Floor' -v ./loaderkit/
=== RUN   TestContractDeclaredFields_Floor
    declared_fields_floor_test.go:207: contract floor for substrate "pod" is empty — the contract derivation is dead
--- FAIL: TestContractDeclaredFields_Floor (0.06s)
FAIL

Restored, verified byte-identical against the committed files, and the restored tree IS the committed tree:

$ git checkout -- loaderkit/cue_schema.go
$ for f in loaderkit/cue_schema.go loaderkit/declared_fields_floor.go loaderkit/declared_fields_floor_test.go vmshared/spec_aliases.go; do
    a=$(sha256sum "$f" | cut -d' ' -f1); b=$(git show HEAD:"$f" | sha256sum | cut -d' ' -f1);
    [ "$a" = "$b" ] && echo "$f OK" || echo "$f DIFF"; done
loaderkit/cue_schema.go OK
loaderkit/declared_fields_floor.go OK
loaderkit/declared_fields_floor_test.go OK
vmshared/spec_aliases.go OK
$ GOWORK=off go test -count=1 -run 'TestContractDeclaredFields_Floor' ./loaderkit/
ok  	github.com/opencharly/sdk/loaderkit	0.079s
$ git status --short
(no output — the restored tree is the committed tree)

R10 — the assembled bed

No disposable target of this repo's own exists: sdk/AGENTS.md names the Go gates plus the org-wide validator, and a mechanism library ships no deploy. The change is bedded where it is CONSUMED — the charly leg of this same chain runs the assembled check-pod bed with all four pins (and the spec leg's own run already drove that bed with this tree linked in). Scope limit, stated rather than implied: this repo cannot bed itself; its proof is the gates, the consumer matrix, and the assembled bed on the consumer's tree.

Rulebook compliance

  • R0 — skills first. /charly-internals:plugin, /charly-internals:go and /charly-internals:git-workflow were loaded before the first code change; this repo's AGENTS.md and the umbrella rulebook were read first.
  • R1 — RCA every anomaly, fix or file. The anomaly is the same one the spec leg records: the tracker's row 3 said "no charly+sdk consumer", and this module has two — because neither writes spec.Pod; one names spec.PodSpec through the alias, the other names the DEF as a table key, and the second one FAILS AT INIT rather than at compile time. RCA and fix are both in this diff and in the tracker's STATUS comment. The one separable finding of the chain (plugin-substrate's own test that still marshals spec.Pod) is filed as opencharly/plugin-substrate#33.
  • R2 — no duplication. The pod body's field names are not copied into this module: the floor derives them from the contract's own def, exactly as before the move.
  • R3 — no workarounds. No compatibility alias is kept, no def is stubbed, and no code special-cases pod — one map entry changes, and the fallback for words the contract does not declare is untouched.
  • R4 — product before prose. Both comments that named #Pod as a live contract def are corrected in the same change.
  • R5 — delete legacy completely. grep -rn 'PodSpec' --include='*.go' . returns nothing after this diff; the only #Pod mentions left are prose recording the move:
$ grep -rn 'PodSpec' --include='*.go' .; echo "rc=$?"
rc=1
$ grep -rn '#Pod\b' --include='*.go' .
./loaderkit/cue_schema.go:62:// `pod` names #ResolvedPod, NOT the authored #Pod: spec#304 unit 3 moved the authored body
./loaderkit/cue_schema.go:64:// longer declares #Pod. What the contract still declares for the kind — and what this table
./loaderkit/declared_fields_floor_test.go:226:		t.Fatalf("cueKindDefs[pod] = %q, want the contract's kept envelope #ResolvedPod — the authored #Pod moved out of this module", def)

All three hits are PROSE that records the move — two bullets of the new comment beside the table, and the failure message of the assertion that pins it. No definition, no reference, no name of a symbol this module must still resolve.

  • R6 — preserve user work and Git safety. git status read before staging; branch feat/delete-podspec-alias off fresh origin/main; no force-push, no unrelated file staged. No pin, gitlink, design/*.tsv or TODO.md is touched.
  • R7 — prove behavior, not compilation. The floor gate is red on its assertion under the plant and green without it; the consumer matrix builds the modules that read this surface; the init panic above is the behaviour the retarget prevents.
  • R8 — live or skip, never fake. Nothing in this change crosses a live service.
  • R9 — binary equals source. No binary ships from here; the consuming leg's bed records the driver it built.
  • R10 — fresh disposable proof. See "R10 — the assembled bed", including the stated scope limit.

Change classification

Breaking change + rollback: require github.com/opencharly/spec advances to the tag where spec.Pod/spec.PodSpec no longer exist, so this module's exported vmshared.PodSpec disappears. Nothing in the tree used it (the grep above), and every consumer that imports sdk/loaderkit/sdk/vmshared builds against this tree except plugin-check, which is the next leg and retargets its own spec.Pod decode. Rollback is a revert of this commit: the previous spec require resolves again and the alias returns with it; the loaderkit retarget is harmless against the old contract too (it names a def that exists in both), so a partial revert cannot strand the chain.

Filed issues

None new from this leg. The chain's one separable finding — plugin-substrate's load_pod_substrate_test.go:275 still marshalling spec.Pod — is filed as opencharly/plugin-substrate#33 from the spec leg.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

…e, not the moved #Pod

opencharly/spec#304 unit 3, leg 3. The contract module deleted `#Pod` and
`#PodValue` (opencharly/spec#307, tag v0.2026317.703), and this module named them
in two places.

`vmshared/spec_aliases.go`: `PodSpec = spec.PodSpec` was an UNUSED zero-churn
alias (the only `PodSpec` occurrence in this module is its own definition), so it
goes with the type it named.

`loaderkit/cue_schema.go`: `cueKindDefs["pod"] = "#Pod"` indexes the EMBEDDED
contract schema, and `sharedCueSchema()` fail-fasts on an absent def, so with the
moved def the parse panicked at init — `loaderkit: CUE kind "pod": definition
#Pod not found`. The entry now names `#ResolvedPod`, the resolve-to-envelope form
the contract KEEPS: the same def the contract keeps `#PodSidecar` for.

Dropping the entry instead is the silent option, and it is the one this repo's
own gate forbids. That table is the source of the declared-fields CONTRACT FLOOR
(loaderkit/declared_fields_floor.go), whose header records the live repro it
exists to prevent — distro-arch check-agent-live's pod body, an `iterate:` key
carrying an `agent:` kind-word key, failing `charly deploy add` with `expected a
mapping value` (sdk#221/#223/#225) — and TestContractDeclaredFields_Floor pins
`pod` as a non-empty floor. A nil floor would re-arm exactly that bug.

Two consequences are deliberate, bounded, and written beside the table rather
than discovered later: the floor for `pod` gains the resolved-only `raw` (which
the pod value gate still rejects as `field not allowed`, so the extra name cannot
admit a document), and `env_default`'s type differs between the authored
`#StrVal` and the envelope's `string` — which would matter only to a CONCRETE
unify (`ValidateEntityClosedCUE("pod", ...)` / `ApplyCueDefaults("pod")`), and no
caller in the tree passes "pod" to either.

`require github.com/opencharly/spec` advances to v0.2026317.703.

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 4a8084d0f9e00964ae540ddd5d12794af7cd6265 (branch: feat/delete-podspec-alias)

Security screen: PASS
Checklist: All applicable rules PASS or NA.

Non-blocking note: the plugin-check consumer build failure pasted in the body is the next tracked leg of chain opencharly/spec#304 (separate repo, cannot be fixed here; disclosed transparently with root cause and resolution path), and the one genuinely separable finding is filed as opencharly/plugin-substrate#33. R10's no-disposable-target scope limit is stated explicitly rather than implied, which is correct for a mechanism library that ships no deploy; the changed pod floor path is executed and pinned by TestContractDeclaredFields_Floor (red under the plant, green restored byte-identical).

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 13, 2026 07:12
@github-actions
github-actions Bot merged commit 8dfd54f into main Nov 13, 2026
8 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 13, 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