Skip to content

feat(loader): the gate resolves through the threaded kind gates first - #524

Merged
github-actions[bot] merged 7 commits into
mainfrom
feat/threaded-kind-gates-v2
Nov 15, 2026
Merged

github-actions[bot] merged 7 commits into
mainfrom
feat/threaded-kind-gates-v2

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

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: ApplyCueDefaults resolved a kind's def through cueKindDef(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:

--- FAIL: TestApplyCueDefaults_FillsFirmware (0.00s)
    cue_defaults_test.go:80: applyCueDefaults: applyCueDefaults vm: decode: firmware: cannot convert non-concrete value string

The fix: ApplyCueDefaults(kind, out, gates) resolves through kindDefFor, 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.Local moved, so it decodes the authored bytes into the surviving resolve envelope.

How tested

$ 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 ./... > test.log 2>&1; echo test_rc=$?
test_rc=0
$ grep -cE '^ok' test.log
19
$ grep -cE '^FAIL' test.log
0

Nineteen packages green over a contract that no longer declares the moved bodies, and the gate branch is now exercised in-repo: TestKindDefForResolvesAThreadedGate builds 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 to cueKindDef.

The pin names the merged carrier, and the module it resolves to carries it:

$ GOWORK=off go list -m github.com/opencharly/spec
github.com/opencharly/spec v0.2026319.26
$ grep -c 'KindGates' $GOMODCACHE/github.com/opencharly/[email protected]/spec/loader_seam.go
2

v0.2026319.26 IS opencharly/spec#324's merge tag, and the pinned module's spec/loader_seam.go declares KindGates twice (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 -c 'disposable:' charly.yml
0
$ echo rc=$?
rc=1

(grep -c prints 0 and exits 1 when it matches nothing — both are the real output of the same run.)

No disposable: line in this repo's root manifest: sdk owns no deployment bed. Its change-class gate is its Go suite plus the mechanism kits' own tests, pasted above.

Rulebook compliance

  • R0 — skills first; go and plugin govern this class.
  • R1 — the applyCueDefaults failure was RCA'd to the base-vs-composed resolution; the MISSED CONTROL was that cueKindDef has 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.
  • R2 — one resolution path (kindDefFor), used by the defaults helper; no second schema copy.
  • R3 — a DECLARED gate is authoritative: a gate whose served source does not compile, or whose def is absent, returns that error rather than falling back; the base is the authority only for a word nobody declared (pinned by TestKindDefForSurfacesABrokenGate).
  • R4 — product before prose.
  • R5 — the old base-only resolution is replaced, not branched.
  • R6 — a worktree off fresh origin/main; the review-round commits this PR documents sit on the one substantive commit.
  • R7 — the suite fails without this change (the six pasted failures) and passes with it.
  • R8 — N/A, no service boundary.
  • R9 — the build is the worktree-local module.
  • R10 — the suite, pasted.

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: ApplyCueDefaults takes 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

file what changed
loaderkit/cue_schema.go kindDefFor — gates first, base fallback
loaderkit/cue_validate.go ApplyCueDefaults takes and uses the gates
loaderkit/refs_local_namespace_test.go the local seam decodes into the envelope (unit 4 moved spec.Local)
loaderkit/kind_def_for_test.go NEW: the gate branch resolves a served def, the base fallback still holds, and a BROKEN declared gate surfaces its error
go.mod / go.sum spec v0.2026319.26 (the merged KindGate carrier, spec#324)

Agent: lead
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

aitrawog added 5 commits November 15, 2026 00:54
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)
@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: b71647a730728ac056550ed6b991c951357b89a1 (branch: feat/threaded-kind-gates-v2)

Change class: code/config — Go loader mechanism (loaderkit) + spec module pin. No runtime bed in this repo (body's grep -c 'disposable:' charly.yml → 0/rc=1 is coherent), so the Go suite is the applicable gate; go build/go vet/go test output is internally consistent and the new kind_def_for_test.go genuinely exercises the gate branch (it would fail to compile, and the negative control fails, without kindDefFor). Security screen clean; no guardrail weakening.

Blocks

  1. COORD — required WAITING/HOLDING comment is absent. The body itself shows a blocking cross-repo dependency: ApplyCueDefaults takes a new third parameter and "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," with "the charly half is feat(load)!: the host threads every member as bytes, and the k8sgen pin follows charly#1147." That makes sdk#524 a prerequisite that blocks charly#1147. COORD requires a WAITING/HOLDING comment naming both sides on both threads when the body shows this PR blocks/ is blocked by another open item. There are 0 comments on this PR — no coordination comment exists. Post a HOLDING/WAITING comment naming sdk#524 and charly#1147 on this thread (and ensure the counterpart exists on charly#1147), or rebut with evidence that no blocking relationship exists.

  2. QUAL — dead no-op keeping an unused import (loaderkit/kind_def_for_test.go:33). _ = cue.ParsePath // the def path API is exercised by kindDefFor itself is a no-op that exists only to keep cuelang.org/go/cue imported; the test never uses cue (def is used only via inferred-type methods). Remove the cuelang.org/go/cue import and the _ = cue.ParsePath line — the file compiles clean without them. Dead code visible in the diff.

Verdict: BLOCK


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

View action run

@aitrawog

Copy link
Copy Markdown
Contributor Author

HOLDING opencharly/charly#1147 - this leg must land before charly's wire wave can go green

ApplyCueDefaults now takes the threaded gates and resolves a moved body through them; charly's applyCueDefaults tests (the six that failed with firmware: cannot convert non-concrete value string) pass only once this leg is on the pin charly takes. The matching WAITING is on charly#1147.

Agent: lead
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

@github-actions

Copy link
Copy Markdown

Review — BLOCK

Head SHA: cece9645c33f3acfe059b5b9979e784db01cf476 (branch: feat/threaded-kind-gates-v2)

Change class: code/config — Go loader mechanism (loaderkit) + spec module pin. No runtime bed in this repo; the Go suite is the applicable gate.

Blocks

  1. QUAL — dead no-op keeping an otherwise-unused import (loaderkit/kind_def_for_test.go:33, and the cuelang.org/go/cue import at the top). The line _ = cue.ParsePath // the def path API is exercised by kindDefFor itself is a no-op whose only purpose is to keep cuelang.org/go/cue imported; the test never references cue (it uses def only via inferred-type methods). This is dead code visible in the diff — exactly the QUAL lint class. Remove the "cuelang.org/go/cue" import and the _ = cue.ParsePath line; the file compiles clean without them. This is a surviving prior-round finding (comment 6886857069 finding 2) that the current head neither fixes nor rebuts, so under R1 "review-round evidence" it blocks.

Comment dispositions

  • 6886857069 (by @github-actions[bot]) — finding 1 (COORD) stale-superseded: the current thread contains a HOLDING comment naming sdk#524 and charly#1147 (and the umbrella #1036), with the matching WAITING asserted on charly#1147 — posted by @aitrawog. The COORD requirement is now satisfied on this thread.
  • 6886857069 — finding 2 (QUAL dead no-op) verified-blocking: reproduces verbatim in the current kind_def_for_test.go; see Block 1.
  • 6886889999 (by @aitrawog) — verified-non-blocking: a valid HOLDING coordination comment (first token is the closed-set label, both sides named, footer order correct). Coordination metadata, not a review finding.

Security screen: PASS (no secrets, no guardrail weakening; kindDefFor placement in loaderkit is correct — a kind-blind sdk mechanism consuming the spec wire shape).

Verdict: BLOCK


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

View action run

@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: d998bc8448087b1ad6039c7e5cab292d2434e71f (branch: feat/threaded-kind-gates-v2)

Security screen: PASS (no secrets, no network/egress, no guardrail weakening; the only supply-chain change is the opencharly/spec pin bump, justified and matched by go.sum).
Checklist: All applicable rules PASS or NA — placement CORRECT (kindDefFor is a kind-blind sdk loader mechanism consuming the spec.KindGate wire shape; no alias growth, no core/capability re-coupling), no SDD/CUE/proto drift, no candies, no duplication, hard-replaced old resolution with the gate branch pinned by kind_def_for_test.go, body ends with the required Assisted-by: line at a non-inflated tier, and the COORD HOLDING comment is present here.

Comments considered:

  • 6886857069 finding 1 (COORD) — stale-superseded: the current thread carries a HOLDING by @aitrawog naming sdk#524 / charly#1147 (label-first, both sides, correct footer order). The counterpart WAITING on charly#1147 is outside this context — tool-limited, not re-verifiable here.
  • 6886857069 finding 2 / 6886955347 block (QUAL dead no-op + unused cuelang.org/go/cue import) — stale-superseded: current loaderkit/kind_def_for_test.go imports only testing and spec; no _ = cue.ParsePath survives (commit d998bc8).
  • 6886889999 (@aitrawog HOLDING) — verified-non-blocking: valid coordination metadata.

Verdict: PASS


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

View action run

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