Skip to content

fix(loaderkit): the substrate-branch member scan excludes the declared #Deploy fields — the deploy-declared-fields channel (sdk #221 class) - #225

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/substrate-declared-fields
Sep 6, 2026

Conversation

@atrawog

@atrawog atrawog commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the sdk #221 parse regression for DEPLOY-SUBSTRATE bodies: the substrate-branch member scan misclassified declared #Deploy field bodies as in-substrate members.

The #222/#223 guards fixed the STRUCTURAL arm, but the SUBSTRATE arm (t.DeploySubstrates) still scanned disc values by VALUE SHAPE (discEntityPairs/isEntityValue): a declared #Deploy field whose value mapping carries a kind-word key classified as an IN-SUBSTRATE MEMBER. The proven repro (the canonical charly-cli ADE iterate-entity bed, charly/charly.yml:2032 pattern): a pod primary body with iterate: {sandbox: check-agent-pod, agent: [check-agent-live-claude], plateau_iteration: 1, prompt: ..., note: false, env: {}} — agent is a kind word, so iterate: classified as a member named "iterate", parseNode("iterate") took agent as ITS disc, and the scalar sandbox: hard-failed "node sandbox: expected a mapping value, got yaml kind 8". (Renaming the key to agentsX got past the raw parse, then CUE said "field not allowed" — isolating the parse class.) Blast radius: the canonical iterate-entity bed + 3 more iterate{agent:} beds + every AI-benchmark bed in the distro conversions.

Same mechanism as #223, extended to deploy substrates — membership semantics live in the PARENT kind's declared schema; for substrates that is #Deploy's OWN CUE schema:

Also bumps the spec pin to v0.2026249.2215 (the channel's contract change).

How tested

THE repro fixture, TestParse_SubstrateDeclaredIterateStaysData: pod primary + iterate:{agent:[...]} + scalar sandbox — parses as DATA (the full iterate body travels intact in the pod's body, agent list included), the pod still parses, and the deploy-level sibling member (watcher:) still classifies. Plus:

  • TestParse_SubstrateDeclaredKindWordKeyStaysData — the channel's direct proof: a declared field NAMED like a kind word (agent: carrying a pod: entity) stays data.
  • TestParse_SubstrateNonDeclaredKeysStillMembers — a kind-word key that is NOT declared, and a plain value-shape member (sidecar:), still classify as in-substrate members in authored order.
  • TestParse_SubstrateNoDeclaredSchemaFallback — the documented fallback: no channel entry → the plain value-shape scan unchanged.

ALL prior surfaces stay green — the authored-depth tests (TestParseFold_PreservesAuthoredDepth, recursive), TestParse_MemberCarrierKeysStrippedFromBody, TestMemberDisc_Unity, the 8a external-structural case (TestParse_ExternalStructuralChildUnderExternalStructuralParent), TestParse_StructuralDeclaredFieldStaysData, TestNoDualMapConstruction — full corpus:

$ go build ./... && go vet ./... && go test ./... -count=1
ok  	github.com/opencharly/sdk	0.096s
ok  	github.com/opencharly/sdk/agentkit	0.380s
ok  	github.com/opencharly/sdk/buildkit	0.008s
ok  	github.com/opencharly/sdk/candywalk	0.003s
ok  	github.com/opencharly/sdk/deploykit	2.930s
ok  	github.com/opencharly/sdk/enginekit	0.005s
ok  	github.com/opencharly/sdk/kit	1.993s
ok  	github.com/opencharly/sdk/loaderkit	0.041s
ok  	github.com/opencharly/sdk/packagekit	0.015s
ok  	github.com/opencharly/sdk/vmshared	0.115s

(zero FAIL, -count=1, on the committed tree)

Rulebook compliance

Change classification

  • Change class: Go parse-correctness fix + regression tests + contract pin bump — no CUE schema change, no migration.
  • Verification gate: full module gate (build/vet/test -count=1) on the committed tree — pasted above.
  • Attribution tier: fully tested and validated — the changed parse path executes live in the new fixtures (including THE repro) on the committed tree.

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

…d #Deploy fields — the deploy-declared-fields channel (sdk #221 class)

The #222/#223 parent-disc + key-rule guards fixed the STRUCTURAL arm, but the
SUBSTRATE arm (t.DeploySubstrates) still scanned disc values by VALUE SHAPE
(discEntityPairs/isEntityValue): a declared #Deploy field whose value mapping
carries a kind-word key classified as an IN-SUBSTRATE MEMBER. The proven
repro (the canonical charly-cli ADE iterate-entity bed): a pod primary body
with iterate: {sandbox: check-agent-pod, agent: [check-agent-live-claude],
plateau_iteration: 1, ...} — `agent` is a kind word, so `iterate:` classified
as a member named "iterate", parseNode("iterate") took `agent` as ITS disc,
and the scalar `sandbox:` hard-failed "expected a mapping value, got yaml
kind 8". Renaming the key to agentsX got past the raw parse (then CUE:
field not allowed) — isolating the parse class.

Same mechanism as #223, extended to deploy substrates: membership semantics
live in the PARENT kind's declared schema — for substrates that is #Deploy's
OWN CUE schema. The new spec.Threaded.DeployDeclaredFields channel
(opencharly/spec#107, v0.2026249.2215 — the #104 StructuralDeclaredFields
twin) is consulted by the substrate branch: a pair whose KEY is a declared
#Deploy field is DATA — its value is never looked inside; every other
entity-keyed value-shape member (web:/chrome:/sidecar:) stays a member. A
substrate word with NO declared schema threaded keeps the plain value-shape
scan (the documented no-declared-schema fallback). Zero hardcoded lists.

Also pins spec v0.2026249.2215 (the channel's contract change).

Gate: go build/vet/test ./... -count=1 green on the committed tree; the
repro fixture + the full corpus (authored-depth, 8a external-structural,
TestParse_StructuralDeclaredFieldStaysData, TestNoDualMapConstruction) green.
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: c9d78a582012 (branch: fix/loaderkit-substrate-declared-fields)

Security screen: PASS — no scope mismatch (all 4 changed files accounted for in the body), no secrets/exfiltration, no weakened guardrails, spec pin bump is a same-module version bump (v0.2026249.2106→v0.2026249.2215) consistent with the channel contract change.

Checklist: All applicable rules PASS or NA.

  • Change class: Go parse-correctness fix + regression tests + spec pin bump. Gate = full module gate (build/vet/test -count=1), pasted and internally consistent (all packages ok, loaderkit 0.041s); the changed substrate-branch path executes live in the new fixtures.
  • A1/A3: Body complete, ends with the exact *Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)* footer; tier justified — the new deployDeclared path runs in the repro fixture on the committed tree.
  • R1: Real RCA (substrate arm's value-shape scan lacked field awareness; same missing-channel class fix(loaderkit): structural bodies scan in-body members by the KEY rule, minus the declared input-schema fields #223 fixed for structural kinds); no flake/transient framing.
  • R2: The host-side channel feed is a named cross-repo consumer change following the fix(loaderkit): structural bodies scan in-body members by the KEY rule, minus the declared input-schema fields #223/feat(spec,proto,deploykit,buildkit)!: wave-3 sdk leg — K4 candy/box selection wire + build:ensure wire contract #104 contract-first precedent — not a vague deferral; the sdk change is self-contained (mechanism + tests + fallback).
  • R3/R4: Reuses the existing scan minus the declared set; zero hardcoded lists; nil-map fallback preserves the old scan.
  • R10/coverage: 4 new tests prove the new behavior — the repro test would fail without the fix (old code classifies iterate: as a member and hard-fails on scalar sandbox:); fallback, collision, and non-declared-keys cases all pinned.
  • B16 placement: CORRECT — the DeployDeclaredFields channel is a kind-blind sdk mechanism (wire shape), not capability in core; no alias files, no new kit imports, no *Legacy* identifiers.
  • B18: gofmt-clean, no dead code/unused params/shadowing visible in the diff.
  • B13/B17: N/A — no candy/CUE/generated-file change; no destroy/rebuild evidence required.

Verdict: PASS


ollama/deepseek-v4-flash — pi-review-action.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 6, 2026 22:39
@github-actions
github-actions Bot merged commit 145ea18 into main Sep 6, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 6, 2026
github-actions Bot pushed a commit that referenced this pull request Sep 7, 2026
… the parse seam — the executor-boundary declared-fields completion (#226)

The declared-fields maps (Threaded.StructuralDeclaredFields / DeployDeclaredFields) are
host-registry state populated lazily by charly loaderThreaded() from pluginSchemas.inputDefs
(the builtin schema gate runs mid-load; an external served schema registers only at connect).
A parse consuming a Threaded BEFORE that gate — the executor loader legs
(loaderkit.LoadUnifiedViaExecutor, shared by plugin-fleet fleet add, plugin-build
build:project, the deploy-target surfaces) and the plugin-side Threaded consumers — receives
EMPTY maps and the documented no-declared-schema fallback re-arms the unsafe value-shape
scan: a converted tree's declared #Deploy fields re-scan as in-substrate members (the live
repro: distro-arch check-agent-live pod body, charly fleet add failing with
'node "sandbox": expected a mapping value, got yaml kind 8' — the #223/#225 regression
re-armed at the executor seam).

The declared-fields data is CONTRACT data (what each kind schema declares), not registry
state: ONE parse lookup (threadedDeclaredFields) now serves both the substrate and the
structural branches of parseNode — the threaded (served-schema) entry when present
(authoritative; byte-identical host-side behavior), else the contract-declared field set
derived from the embedded spec/schema this package already compiles (sharedCueSchema +
cueKindDefs — the SAME single source cue:gen derives from); a contract-unknown
(external plugin) word floors to nil — the documented fallback, unchanged.

Two prior tests fabricated an in-body member keyed 'sidecar:' (a vm-contract-DECLARED
field), pinning the pre-floor empty-Threaded divergence; their member key is renamed to a
non-declared name with every authored-depth assertion preserved.
@aitrawog
aitrawog deleted the feat/substrate-declared-fields branch September 25, 2026 19:08
github-actions Bot pushed a commit that referenced this pull request Oct 14, 2026
…ts no longer exist for (#378)

`opencharly/spec#225` removed eight silently-inert `#Kubernetes` cluster-template fields and the
six wire types that typed them. This file re-exported all six as pass-through aliases, so the next
`go get github.com/opencharly/spec@<post-#225 tag>` in this repo could not compile. Witnessed here,
not argued — the pin bumped with the aliases still present:

    $ go build ./...
    vmshared/spec_aliases.go:56:36: undefined: spec.KubernetesGatewayAPI
    vmshared/spec_aliases.go:57:36: undefined: spec.KubernetesHostname
    vmshared/spec_aliases.go:60:36: undefined: spec.KubernetesObservability
    vmshared/spec_aliases.go:64:36: undefined: spec.KubernetesResources
    vmshared/spec_aliases.go:65:36: undefined: spec.KubernetesResourceValues
    vmshared/spec_aliases.go:66:36: undefined: spec.KubernetesSecretsBackend

The deletion has to ride the pin bump in ONE commit, which is why it is here rather than in a PR of
its own: against the old pin the aliases have live referents, against the new one they have none,
and there is no revision in between that is both consistent and compiling.

Nothing referenced them: a recursive grep over the module for all six names now returns **zero**
matches, and before the deletion every one of the org's 19 references was a definition site (the
six lines here plus the thirteen in the older pinned `spec/spec/cue_types_gen.go`). With this
merged, `opencharly/plugin-kube` — which pins `spec v0.2026287.716` today for exactly this reason —
and `opencharly/charly` can both advance.

Pins: `spec` v0.2026287.638 → **v0.2026287.727** (a merged, tagged ref — Policy B).

Closes #377
Agent: dsh-k8s-ext
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

Co-authored-by: Andreas Trawoeger <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Nov 13, 2026
…e, not the moved #Pod (#504)

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)
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