Repository navigation
fix(plugin): unify with the def as receiver so a served def's contract refs resolve - #1124
Conversation
…t refs resolve `validateKindValueCUE` gated an authored kind value with `entity.Unify(def)` — authored document first. `cue.Value.Unify` resolves every reference it meets through the RECEIVER's runtime, and the two sides carry different ones: `def` comes from the composed unit, whose runtime carries the plugin unit's import graph, while `entity` is built from the authored JSON by the project loader, which has no import clause anywhere in it. So the moment unit 0 (#1122) moved the LOOKUP to the composed value and the first served def cited a contract definition (`schema.#LLMSpec`, as plugin-pipeline's `#PipelineValue` does), the gate resolved that reference through the entity's import-less runtime and failed. Same two values, one process, only the receiver differs: entity.Unify(def) = args.prs: cannot find package "github.com/opencharly/spec/schema" def.Unify(entity) = <nil> The flip is one line. The witness that was missing is a test that judges a body against a def DECLARED BY A SERVED UNIT whose body carries a contract reference: `TestKindValueGate_ValidatesAServedDefCarryingAContractReference`, red on assertions without the flip. The diagnostic change is kept, not stripped: a rejection now re-roots its path at the def (`local: connect: field not allowed` becomes `local: #LocalValue.connect: field not allowed`), which tells the reader WHICH def rejected the body. Zero accept/reject verdicts moved across the 2,004-body corpus (base arm vs this tree: 1984 OK / 20 FAIL on both sides, verdict-only diff empty); all 20 FAIL diagnostics re-root, and every one was already a FAIL. The corpus diff, the plant, the CI gates and the R10 bed summary (`check-loader-flat-import-local`, PASS, 884s, 0 errors / 0 warnings / 0 skipped) are in the pull request body. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Security screen: PASS (no scope mismatch, no secrets, no weakened guardrail — the flip is verdict-preserving per the 2,004-body corpus; no supply-chain/self-mod change). Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…pus one
Round-1 review finding (real, and fixed here in the same commit that added the comment). The doc
comment above TestKindValueGate_ValidatesAServedDefCarryingAContractReference quoted
args.prs: cannot find package "github.com/opencharly/spec/schema"
which is the diagnostic the ORIGINAL umbrella-corpus pipeline body produced — the defect's own
symptom. This fixture is `#ServedrefValue` with `label`/`llm`, so the un-flipped gate fails at
servedref: llm: cannot find package "github.com/opencharly/spec/schema"
The claim travelled from the defect diagnosis into a comment sitting next to a different fixture
and was never re-read against the output that fixture actually prints — even though that output is
pasted in the PR's own red fence. A comment that names a diagnostic the adjacent test cannot
produce is a false claim in the tree, so it is swept here rather than softened.
Missed control: the comment and the PR's §2 red fence were written from different sources and were
not cross-read; the fix is to quote the fixture, and the claim-keyed sweep for the stale string is
now empty.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
|
R1 — the round-1 finding is real, and this is its RCA plus the fix. Agent: dsh-kindvalue-order (DeepSeek Harness, ollama-cloud/deepseek-v4.1-flash) The finding, accepted in full. The doc comment above Mechanism. The claim was carried from the defect's diagnosis — where Missed control. The comment and the body's red fence were written from two different sources (diagnosis vs. this fixture's executed output) and were never cross-read, even though both sit in the same change and the correct line was already pasted two sections above. My own pre-push self-audit checked the code claims against measurement but not the new prose against the fixture it describes. Root fix (in the tree, not in this thread), and the sweep. $ grep -n "Red without the order flip" -A 2 charly/kind_value_composed_test.go
143:// Red without the order flip, with THIS fixture's own diagnostic (pasted red in the PR):
144:// `servedref: llm: cannot find package "github.com/opencharly/spec/schema"` — the node's
145:// discriminator, the field that forced the reference, and the module it could not resolve.
$ grep -rn "args\.prs" charly/ | wc -l
0Committed as The round-1 delta moves nothing, re-measured on the new head. Plant re-run: red on assertions, restored byte-identical ( The PR body has been re-written for the new head (head, tree, corpus, gates, R9 and the bed summary all re-derived on it) and is published before this push. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated) |
Review — PASSHead SHA: Security screen: PASS — no scope mismatch, no secrets, no weakened guardrail; the receiver flip is verdict-preserving per the 2,004-body corpus, no new deps, no self-mod of the validator/rulebook. Comments considered:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary
validateKindValueCUEgated every host-value kind withmerged := entity.Unify(def)— the authored document as the receiver.cue.Value.Unifyresolves every reference it meets through the receiver's runtime, and the two sides carry different runtimes:defcomes from the composed unit (pluginSchemas.unified), whose runtime carries the plugin unit's import graph, whileentityis built from the authored JSON by the project loader, which has no import clause anywhere in it. So the moment unit 0 (charly#1122) moved the lookup to the composed value and the first corpus field forced a contract reference through the gate, aschema.#…cited by a served def was resolved through the entity's import-less runtime and failed.Same def value, same authored entity, one process, only the receiver differs:
That failure IS the pair: the committed test asserts
entity.Unify(def)fails by import resolution and then that the production gate accepts the same body — so the red line above is the first assertion holding on the un-flipped gate.validateAuthoredPluginInput(plugin_loader.go) has always doned.Unify(in)— schema as receiver — which is why#PipelineAgentInput.llm: schema.#LLMSpechas worked sinceplugin-pipeline#60. The kind-value gate never needed it before only because every def it resolved came from the base (one package, no import clause).charly#1122moved the lookup and left the order.The change, one line:
Two commits, one cutover: the flip with its witness, and the round-1 comment correction (§9).
What it unblocks. This is the prerequisite the next unit lands on:
plugin-pipelinemoving#Pipeline/#PipelineValueinto its own CUE module (unit 1, leg 2, ofspec#304), where the body carriessteps[].plan[].llm: schema.#LLMSpec. Measured over the same tree and the same 2,004 gated bodies, with the plugin unit registered and this order left alone, twoeval-omarchybodies that are OK today becomeFAIL … cannot find package; the corpus arms below are that measurement in its general form, and they move zero verdicts with the flip.Files
charly/provider_kind_invoke.gomerged := entity.Unify(def)→merged := def.Unify(entity), with the receiver's-runtime mechanism documented in placecharly/kind_value_composed_test.goTestKindValueGate_ValidatesAServedDefCarryingAContractReference+ itsservedRefUnit/servedRefNodefixture: a served def whose body citesschema.#LLMSpecHow tested
1. The test that must exist — and why unit 0's tests could not catch this
Unit 0's fixture registered a served unit serving
#GateprobeValue, but that def cited no contract reference, so nothing it judged exercised the def's import graph. The new fixture is the shape a moved kind body actually takes: the unit importsgithub.com/opencharly/spec/schemaand its body def citesschema.#LLMSpecthrough it, exactly asplugin-pipeline's#PipelineValuedoes forsteps[].plan.registerPluginUnitSchema),validateKindValueCUE) — ACCEPT, including the field that forces the contract reference,2. The plant — red on ASSERTIONS, restored byte-identical
Reverting the one line on the committed tree, with the test in place:
An assertion failure (not a build error), naming the import resolution that is the defect, on the exact tree that is pushed.
3. Zero verdicts moved — the 2,004-body real corpus
charly/kind_value_corpus_sweep_test.gojudges every authored entity body of every gated kind through the production gate, with aCHARLY_KIND_VALUE_GATE=basearm that reproduces the pre-change lookup exactly (base schema alone, authored entity as receiver). Both arms were run on this tree, over the pinned umbrella corpus:The verdicts are unchanged; only the diagnostic text moves. Stripping each line's diagnostic and comparing the
path|kind|name|verdictalone:0 accept/reject verdicts moved across all 2,004 bodies. And in the full lists:
40 changed lines = 20 removed + 20 added, every one of them a line that was already
FAIL; not oneOKline is touched. The 20 FAILs are the same 20 that failed before this change (design/negative/*fixtures, the retired-pipeline migration testdata,plugin-migratetestdata) — files authored to fail.The full diff, pasted:
4. The diagnostic change — declared, not stripped
A rejection now re-roots its path at the def that rejected it. That is more informative: a reader learns which def refused the body — which is exactly the information a moved kind needs, because the base's
#LocalValueand a plugin's#LocalValueno longer look alike. Kept deliberately.entity.Unify(def))def.Unify(entity))local: {connect: …}local: connect: field not allowedlocal: #LocalValue.connect: field not allowedpod: {description: …}pod: description: field not allowedpod: #PodValue.description: field not allowedvm: {firmware: …}vm: firmware: … field not allowedvm: #VmValue.firmware: … field not allowedpipeline: {concurrency: …}pipeline: concurrency: field not allowedpipeline: #PipelineValue.concurrency: field not allowed0 accept/reject verdicts moved across all 2,004 bodies (§3); the 20 re-rooted lines are all rejections that were already rejections.
5. Gates run — what CI runs, on the final tree
Live load through the changed gate, the same way unit 0 proved it:
The multi-module tree is what CI sees:
charly/(the binary) plus fivetools/*modules, each tested and linted separately withGOWORK=off.6. R9 — the binary under test IS this source
go version -mcannot prove a charly binary's commit (-buildvcs=falseby design), so the honest chain is the CalVer stamp against the source that produces it, plus the bed's owndriver_version:charly version==scripts/calver.sh==2026.316.1635, and CalVer is derived only from HEAD's UTC timestamp (scripts/calver.sh), so the stamp identifies the source and not the build clock. No new runtime OS dependency, sopackaging:is untouched.7. R10 — the bed
Change class:
charlyGo code on the loader/kind-gate path. The A2 matrix routes a cross-cutting loader change to the beds that exercise the loader, and its namedcheck-podis no longer defined in this repo's tree — it moved toplugin-pod, tracked ascharly#1123(which records that the map names beds that resolve to nothing):The bed this class has been proven with — and the one unit 0 used, recorded in
spec#304with its reason — ischeck-loader-flat-import-local.Read from the file the run wrote (
.check/check-loader-flat-import-local/2026.316.1640/summary.yml), not from the console:driver_version: 2026.316.1635is the R9 build named in §6, so the bed exercised this source.skipped_checks: 0matters: a bed whose step table reports SKIPs has not proven what it claims. Thecheck-livestep's log (.check/check-loader-flat-import-local/2026.316.1640/check-live.log) is where the loader path under change ran live —deploy-addandcheck-liveboth load this repo's real project throughvalidateKindValueCUEbefore the fixture assertion runs, so the changed gate is on the executed path, not merely adjacent to it.8. Provenance — the exact tree the numbers above describe
Head:
1945d616b3dd1a5ca60708ee2499c387e2da7a86The pushed head is the commit the evidence was produced on: the tree hash
a7fcdedaee62201a23ea1cfd6be3e279e6520b48is the tree the plant, the corpus arms, the CI gates and the bed all ran against, on a rebuilt driver stamped2026.316.1635from this head (scripts/calver.sh).go version -mwould report(devel)for this binary (-buildvcs=falseby design), which is why the CalVer chain in §6 plus the bed's owndriver_versionis the provenance, notgo version -m.Evidence fence:
9. Review round 1 — the finding, the fix, the RCA
The fresh validator BLOCKed on one real defect in prose this PR added, and it was correct: the doc comment above the new test quoted
which is the diagnostic the umbrella corpus's pipeline body produced — not what THIS fixture produces.
#ServedrefValuehaslabel/llm, so the un-flipped gate fails atservedref: llm: cannot find package …, which is exactly what the §2 red fence (and the fence in §Summary) has always shown. The comment named a diagnostic its own adjacent test cannot print: a false claim in the tree, fixed rather than softened, in a new commit.RCA (missed control). The comment and the PR's red fence were written from different sources — the comment from the defect's diagnosis (where the corpus body's
args.prs: …is the correct symptom), the fence from this fixture's actual run — and nothing cross-read the two. The control that would have caught it is the one I applied as the fix: quote the fixture from its own executed output, then sweep the stale string claim-keyed rather than trusting the prose. The root fix landed in the tree (the comment), not in the review thread.The round-1 delta moves nothing, re-measured on this head: the plant re-run (§2: red on assertions, restored byte-identical), both corpus arms (§3: byte-identical verdict lists to the pre-round hashes,
117afcac…/c99e948b…), the full suite (§5:288.894s/130.719s), lint/gofmt/vet (§5:0 issues, 0 files,rc=0), and a fresh R10 bed on the new tree (§7:2026.316.1640, PASS, 882 s, driver2026.316.1635).Rulebook compliance
R0 (skills first). Loaded through the dispatcher before the first edit or git/
ghaction:plugin(the plugin-host contract this gate lives in),go(charly source/build),check(the R10 bed, its change-class matrix and the bed authoring rules),git-workflow(before any branch/commit/PR), and — for the lint work —go-quality(withstrict-policyfor the R1 dispositions). BothAGENTS.mdfiles (umbrella andcharly/) were read first. Every row the dispatcher selects for core-Go + plugin-host work was loaded.R1 (RCA every anomaly, then fix it or file it). Three anomalies, each RCA'd before remediation, each with its missed control named:
cue.Value.Unifyresolving through the receiver's runtime; the missed control is that unit 0's fixture served a def with no contract reference, so no test ever exercised a served def's import graph; the blast radius is every served def citingschema.#…; the root fix is the receiver flip plus the witness test that fails without it.gateProbeNodefixture, which hardcodesDisc: "gateprobe"— so for a node whose discriminator had no gated def the gate returnedniland both assertions would have "passed". RCA: the fixture carried a discriminator I did not control. Missed control: a fixture that makes a negative case look green. Fixed withservedRefNode(the unit's own discriminator) before the flip, which is why the red run in §2 exists at all. This is the "a test that cannot fail is invalid" class (R7).golangci-lintwas not onPATH(it lives in~/go/binon this host) — an invocation error, not a code finding; fixed by using it explicitly, after which the configured run reports0 issues.No warnings in any gate. Nothing to file.
R2 (no duplication). One gate, one unification site, one resolver: the fix changes the existing expression rather than adding a second gate path, and the new test reuses the existing
gateProbeProvider/PluginSchemafixture types instead of a parallel harness.R3 (no workarounds). The fix is the mechanism, not a suppression: no retry, no sleep, no "skip when the def carries an import", no special case for
schema.references. A fallback that hid the next served-def failure would have been the workaround, and this is its opposite.R4 (product before prose). No documented command changed and nothing was routed around in prose; the mechanism is documented where the code is, and both the corpus and the live
box validateprove the product.R5 (no legacy; claim-keyed sweep). No identifier was deleted or renamed, so there is no removed-name sweep. The claim that changed is the gate's unification order, and it is swept — the production site is the only one, and every other occurrence is deliberately the OLD order kept as a witness:
provider_kind_invoke.go:557is the one production site.kind_value_composed_test.go:169/172are the test's pinned assertion that the OLD order fails (its whole point);kind_value_corpus_sweep_test.go:89is the sweep'sbasearm, whose header already documents it as the pre-change oracle. No stale claim survives.R6 (preserve work, git safety). The worktree was created off fresh
origin/main(c3f47694) on its own branch, and the tree is clean on the committed head; nothing but the two files of this diff is in the commit, no other session's file was touched (a pre-existing/tmp/pr-body.mdfrom another session was left alone and this body was written to its own path), and there was no force-push, no direct push tomainand no hook bypass:One branch off
origin/main, clean tree, two commits of one cutover (the fix, then the round-1 correction) — visible in §8 (above) as well.R7 (prove behavior, not compilation). The coverage fails without the change, and it fails as an assertion that names the real diagnostic (§2, restored byte-identically under
sha256sum -c). The changed path executed live over 2,004 real authored entity bodies with the output retained (§3) and over this repo's real project load (§5box validate). No emitted-artifact boundary is involved.R8 (live or skip, never fake). N/A by kind: this diff crosses no external service boundary (no credential, no provider, no network). The CUE module graph the fix needs is the embedded
specoverlay — real in every arm above, not mocked.R9 (binary equals source).
charly version==scripts/calver.sh==2026.316.1635on the committed tree, and the bed'ssummary.ymlrecords that samedriver_version(§7). No new runtime OS dependency;packaging:untouched.R10 (fresh disposable proof).
check-loader-flat-import-localon the committed tree, driven by the worktree-local CalVer build, pasted from.check/<bed>/<calver>/summary.ymlin §7:ok: true,status: PASS,skipped_checks: 0,diagnostics.errors: 0,warnings: 0. The bed isdisposable: trueand runs the full deploy → check-live →charly updatefresh rebuild → re-check → teardown cycle.Change classification
charlycore Go — one production line in the kind-value gate (loader / prescan-dispatch), plus its witness test. No CUE schema, no wire type, no generated artifact, no pin, no gitlink, nodesign/*.tsv, noTODO.md, no skill prose.!and no authored surface changes — nothing a consumer configures or calls changes, and that is measured rather than asserted: 0 accept/reject verdicts moved over 2,004 real bodies (§3) and the live project load is unchanged (§5). The one observable difference is diagnostic wording: a rejection's path is now rooted at the def (#LocalValue.connectinstead ofconnect), so a consumer matching on the old error string would see a different string. Rollback is a revert of this one commit — it carries no pins, schema or wire contract, so there is nothing to migrate; reverting restores the import-resolution failure for any served def citingschema.#….Filed issues
charly#1123— pre-existing and already tracked, not filed here: the A2 change-class row (andcharly.yml's bed-to-verb coverage map) namescheck-pod, which is no longer defined in this repo's tree; it moved toplugin-pod. Recorded because it is the reason this PR names a substitute bed instead of the matrix's named one. Its fix does not change this PR's verdict.spec#304— the chain tracker this unit belongs to (unit 0 =charly#1122; unit 1 leg 2 lands on top of this merge). Not filed here either; it is where the landingSTATUSgoes.No new issue was filed: every finding this PR produced was blocking and was fixed in it.
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)