Repository navigation
feat(loader): the gate resolves through the threaded kind gates first - #524
Conversation
ApplyCueDefaults now takes the gates map and resolves a kind def through kindDefFor: the SERVED source a plugin declared, compiled here, then the base module only when a word is absent. That is what lets a loader-side helper unify an authored body that moved into a plugin - the defect the vm body move exposed (applyCueDefaults vm: firmware non-concrete). The local test seam follows unit 4: spec.Local moved, so it decodes into the envelope. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
spec v0.2026319.26 carries KindGate + Threaded.KindGates (spec#324), so this leg builds and tests standalone (19 packages green). Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
…lback still works Round 2: no sdk test supplied a non-empty gates map, so kindDefFor degenerated to cueKindDef and the suite would pass identically without the change. This test builds a gate from a served source, asserts the def resolves, and asserts the BASE lookup FAILS for that word - so the branch is exercised and the fallback is pinned. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Round 3 found the real defect: kindDefFor fell back to the base when a declared gate failed to compile or its def was missing, so a broken declaration surfaced as "no CUE schema registered" for a body that HAS one. It now returns the compile/lookup error, the base is the authority ONLY for a word nobody declared, and a test pins both halves. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: code/config — Go loader mechanism ( Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
HOLDING opencharly/charly#1147 - this leg must land before charly's wire wave can go green
Agent: lead |
Review — BLOCKHead SHA: Change class: code/config — Go loader mechanism ( Blocks
Comment dispositions
Security screen: PASS (no secrets, no guardrail weakening; Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS (no secrets, no network/egress, no guardrail weakening; the only supply-chain change is the Comments considered:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
Successor to #523 (auto-closed at the verdict threshold with this code; the last block found a real defect — a declared gate falling back silently — which this head fixes and pins with a test).
The SDK half of the RCA's step 3 (
PROGRAM/schema-ownership-rca-rdd.md§3 I3/I4), and the fix for the defect a live test found in charly.The defect:
ApplyCueDefaultsresolved a kind's def throughcueKindDef(kind)— the BASE schema's table. After the vm body moved into plugin-substrate, that table returns the envelope (#ResolvedVm, correct for the loader) while the defaults helper needs the authored#Vm. Six tests failed:The fix:
ApplyCueDefaults(kind, out, gates)resolves throughkindDefFor, which consults the THREADED gates first — the SERVED CUE source a plugin declared, compiled here, in this process — and falls back to the base module only for a word nobody declared. That is what lets a loader-side helper unify an authored body that moved into a plugin, without a registry query and without a second private copy of the schema.The local test seam follows unit 4:
spec.Localmoved, so it decodes the authored bytes into the surviving resolve envelope.How tested
Nineteen packages green over a contract that no longer declares the moved bodies, and the gate branch is now exercised in-repo:
TestKindDefForResolvesAThreadedGatebuilds a gate from a served source, asserts the def resolves through it, and asserts the BASE lookup FAILS for that same word — which is what proves the branch runs rather than degenerating tocueKindDef.The pin names the merged carrier, and the module it resolves to carries it:
v0.2026319.26ISopencharly/spec#324's merge tag, and the pinned module'sspec/loader_seam.godeclaresKindGatestwice (the field and the type's mention) — so every pasted run above is the PINNED state, not a local workspace.R10 honesty, premise pasted
(
grep -cprints0and exits 1 when it matches nothing — both are the real output of the same run.)No
disposable:line in this repo's root manifest:sdkowns no deployment bed. Its change-class gate is its Go suite plus the mechanism kits' own tests, pasted above.Rulebook compliance
applyCueDefaultsfailure was RCA'd to the base-vs-composed resolution; the MISSED CONTROL was thatcueKindDefhas no notion of a plugin-declared def, so every helper built on it assumes the base owns every body. This leg removes that assumption; the contract half (fix(loaderkit)!: scope candy-version arbitration + notice PER BOX, INFO not WARNING (#735) #324) carries the data.kindDefFor), used by the defaults helper; no second schema copy.Change classification
Kind: a loader mechanism resolves a kind's authored def through the threaded gates (the served source) before falling back to the base schema.
Breaking change + rollback:
ApplyCueDefaultstakes a third parameter — its two callers (plugin-loader,plugin-vm) pass their threaded gates in the wave that follows this leg, and both are repointed there rather than here to keep each PR one coherent change. Rolling back restores the base-only resolution, which fails on any moved body.Filed issues
None — this closes the SDK half of the defect; the charly half is opencharly/charly#1147.
Files changed
loaderkit/cue_schema.gokindDefFor— gates first, base fallbackloaderkit/cue_validate.goApplyCueDefaultstakes and uses the gatesloaderkit/refs_local_namespace_test.gospec.Local)loaderkit/kind_def_for_test.gogo.mod/go.sumspec v0.2026319.26(the mergedKindGatecarrier, spec#324)Agent: lead
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)