Skip to content

feat(plugin): compose each served unit's schema, then unify it onto the base - #1115

Merged
github-actions[bot] merged 4 commits into
mainfrom
feat/plugin-schema-per-unit-compose
Nov 9, 2026
Merged

github-actions[bot] merged 4 commits into
mainfrom
feat/plugin-schema-per-unit-compose

Conversation

@aitrawog

@aitrawog aitrawog commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

opencharly/sdk#490's second ordered root: the host's plugin schema gate no longer joins unit
sources into one compilation unit.

compileBasePlusServed compiled strings.Join(everyLoadedUnit, "\n") onto charly's base, and
registerPluginUnitSchema first compiled each unit's text standalone with no CUE module in
scope. Both shapes are text, and text cannot carry the import this cutover exists for. Measured
on the pre-change tree, with a plugin schema that imports github.com/opencharly/spec/schema:

ONE unit, old text compile            -> package "github.com/opencharly/spec/schema" imported but not defined in  (and 1 more errors)
TWO units joined, old text compile    -> expected label or ':', found 'STRING' "github.com/opencharly/spec/schema"

The second is a failure #490 names as independent of the first: N units joined into one file
put N import clauses in one compilation unit, which is not CUE at all.

Now each unit is COMPOSED as its own CUE module instance and the values are unified onto the
base — the unit boundary lands exactly where CUE's own package boundary is: one package per
plugin. The composer is spec/schemacompose, the ONE composer in the contract module: this host
may import github.com/opencharly/spec and may NOT import github.com/opencharly/sdk (this
repo's import-purity gate, "the sdk mechanism kits and the sdk root plugin-authoring package are
for PLUGINS to import, never the host"), while the serve side may import both — so the shared
home is the only place the two halves can judge the same schema with the same code.

The running value is grown one unify per registration, not rebuilt from the base. That is a
measured requirement, not a refinement: rebuilding made plugin loading quadratic, and
charly/charly's TestMain — which registers the 63 builtin plugin schemas — went from 1.4 s to
26.4 s
, which then pushed TestConnectPluginReady_HonorsACallerCancellation past its 10 s bound,
because the fixture's child process could not finish its own TestMain and answer the handshake.
With one unify per registration TestMain is 1.1 s and that test passes at 1.45 s.

The declarations the gate reads per source are unchanged: topLevelDefNames now reads the
composed unit's value, which carries the same top-level definitions, and the charly#770
collision identity index is untouched.

The composer's deep arms live where the composer lives: opencharly/spec#297 tagged
v0.2026313.453, which this change pins.

Files

File Change
charly/plugin_loader.go per-unit compose then unify; the running value grown one unify per registration; the doc comments follow the contract
charly/plugin_schema_import_test.go the host's own acceptance: an importing unit is gated and its imported def enforced; two importing units coexist; the host's composed unit equals the serve side's
charly/plugin_schema_collision_test.go the precondition test states the per-unit compose, and the base-def twin test reads the base directly
charly/provider_checkenv_schema_gate_test.go the schema-set save/restore renames the field it clears
charly/registry_testsupport_test.go same, for the shared save/restore helper
charly/go.mod github.com/opencharly/spec → v0.2026313.453
charly/go.sum that version's hashes

The six lockstep tools/ modules

The go job's TestContractPinsMatchShared requires every lockstep tools/* module to carry the shared pins.
Bumping spec in charly's own go.mod without them fails that test — caught by CI, not by a local go test ./...,
which never leaves the charly/ module. Fixed with the repo's own charly task mods-tidy, which changed exactly
these six files (spec pin v0.2026313.48 across the lockstep set):

file change
tools/generate-packages/go.mod shared spec pin
tools/generate-packages/go.sum its checksums
tools/golden-cloudinit/go.mod shared spec pin
tools/golden-cloudinit/go.sum its checksums
tools/golden-compile/go.mod shared spec pin
tools/golden-compile/go.sum its checksums

How tested

Code gate, on the committed tree d481eb65609feb27bce4694a7fe95fc5211e937d:

$ go build ./...        rc=0
$ go vet ./...          rc=0
$ go test ./...         rc=0   (ok on github.com/opencharly/charly/charly and .../internal/pluginsgen)
$ golangci-lint run ./...   0 issues   (v2.13.2, the CI pin, under the go.mod toolchain)

The suite includes TestMain, which loads all 63 builtin plugin schemas through the changed
gate — so the whole shipped corpus composes and unifies under the new shape.

The host's own arms:

--- PASS: TestPluginUnitSchemaImportsSpecDefinition
    violating spec.#TunnelConfig -> plugin verb:importunittunnel: plugin_input fails
        #ImportUnitTunnelInput: #ImportUnitTunnelInput.provider: conflicting values 5 and string
        (mismatched types int and string)
--- PASS: TestTwoImportingUnitsComposePerUnit
--- PASS: TestHostAndServeComposeTheSameUnit

R7 — the arms fail without the change. With origin/main's plugin_loader.go restored, the
same source produced the two errors quoted in the Summary (imported but not defined for one
unit; expected label or ':', found 'STRING' for two joined). That measurement is the reason the
joined path cannot simply be given a module.

R9 — the binary is the source. ./scripts/bootstrap-charly.sh built this worktree's
bin/charly (charly version = 2026.313.0209), and the changed path ran live:

$ ./bin/charly box validate
charly box validate: OK — checked 604 candies, 122 boxes, 49 deploys, 7 distros, 7 builders; 0 warnings, 0 errors

R10 — the disposable bed. ./bin/charly check run check-pod-overlay on this tree (a
disposable: true pod bed that builds an overlay image, deploys it, runs its checks, does a
genuine charly update rebuild and re-checks). The first attempt failed on an upstream curl: (22) The requested URL returned error: 504 fetching a release tarball inside the image build — an external condition, RCA'd and evidenced before retrying. The retry's summary:

$ ./bin/charly check run check-pod-overlay
[image-build] PASS after 3m40.43s
[check-image] PASS after 1m8.382s      (steps=..., 3 runtime-context checks correctly not run in box mode)
[deploy-add]  PASS after 6m6.913s
[config]      PASS after 2m41.998s
[start]       PASS after 1m53.294s
[wait-ready]  PASS
[bring-up-members] PASS
[check-live]  PASS after 2m50.266s
[feature-run] PASS after 1m58.984s
[update]      PASS after 12m39.599s     <-- the genuine fresh rebuild
[rebuild-ready] PASS
[check-live-rebuild]   PASS after 2m49.848s
[feature-run-rebuild]  PASS after 1m57.522s
[cleanup] PASS after 40.127s ; [cleanup-members] PASS
charly check run check-pod-overlay: PASS (steps=16, skipped_checks=3)

summary.yml records the same run against the worktree binary:
driver: .../dsh-490/charly/bin/charly, driver_version: 2026.313.0209, every step ok: true.


## Rulebook compliance

- **R0** — the dispatched skills (`go`, `plugin`, `git-workflow`, `strict-policy`) were loaded
  before the first edit, and this repo's `AGENTS.md` first of all.
- **R1** — every gate green on the committed tree. Two anomalies were RCA'd before remediation:
  the upstream 504 in the bed's image build (external, evidenced, then retried once), and the
  quadratic load regression described in the Summary (fixed in this change, with the before/
  after measurement pasted).
- **R2** — ONE implementation of the compose: `spec/schemacompose`, called by both the serve side
  and this gate. Nothing is duplicated in this tree.
- **R3** — no sleep, retry loop, magic value or fallback in the change: a unit that does not
  compose is a hard error naming the plugin; an unservable dependency is a hard error naming the
  module.
- **R4** — N/A — no documented command changes; `charly box validate` and the check beds behave as
  documented, and the live run above is the proof.
- **R5** — the retired shapes are gone: `strings.Join` over unit sources and the per-unit
  `CompileString` are both deleted, and `grep -rn 'served schema does not compile STANDALONE' charly`
  returns nothing (the message it named is retired with it).
- **R6** — git safety: a session worktree branched off `origin/main`, `git status` clean before
  each action, one commit for the change, no force-push, no rebase, no self-merge.
- **R7** — the arms fail without the change and pass with it (pasted above), and the live binary
  exercises the changed path on the whole shipped plugin corpus.
- **R8** — N/A — no live external service is crossed by this change; the module registry in the
  composer is in-process and offline.
- **R9** — the worktree-local CalVer-stamped binary, built by `scripts/bootstrap-charly.sh` from
  this tree, is what ran; no installed binary was used.
- **R10** — the `disposable: true` pod bed above, on the committed tree, including its own fresh
  `charly update` rebuild and check-live pass. No VM bed was run: this host's libvirt is not
  available (`virtqemud` socket absent, `libvirtd` disabled), and a bed that cannot start is
  reported, not silently replaced.

## Change classification

Core plugin-loading behaviour, no user-facing surface change.

- **What changes for a consumer:** nothing to do. Every plugin that served a schema before still
  serves it — proved by the live run over the whole builtin corpus — and a plugin may now import
  the spec schema (opencharly/sdk#491/#492 carry the serve side).
- **What is NOT done here:** a consumer that adds `cue.mod/module.cue` + an import still cannot
  have its Go params generated, because #490's ordered root 3 (the param generator keeps a module)
  is untouched, as the issue scopes. The census rows of opencharly/opencharly#945 stay.
- **Reversing it:** the commit is one file plus tests; moving `require github.com/opencharly/spec`
  back to `v0.2026313.48` and restoring `plugin_loader.go` returns the previous behaviour.

## Filed issues

None.

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



…he base

opencharly/sdk#490's second ordered root. The host's plugin schema gate joined every
loaded unit's served text into ONE compilation unit and compiled it onto the base. That
shape cannot carry an import: a plugin that imports github.com/opencharly/spec/schema gets
its import clause copied into a file that already has one, and CUE refuses before
resolution is even attempted ("expected label or ':', found 'STRING'"). It made the
one-unit case refuse the import outright too, because the text compile had no module in
scope.

Each unit is now COMPOSED as its own CUE module instance (spec/schemacompose — the ONE
composer, in the contract module, because this host may import spec and may not import the
sdk, while the serve side may import both) and unified onto the running value. The unit
boundary lands where CUE's own package boundary is: one package per plugin.

The running value is grown one unify per registration instead of being rebuilt from the
base per registration. That is not cosmetic: rebuilding made loading quadratic, and it was
MEASURED here — charly/charly's TestMain, which registers the 63 builtin plugin schemas,
went from 1.4 s to 26.4 s, which in turn pushed a cancellation test past its 10 s bound
(TestConnectPluginReady_HonorsACallerCancellation: the fixture's child process could not
finish its own TestMain and answer the handshake). With one unify per registration TestMain
is 1.1 s and that test passes at 1.45 s.

The declarations the gate reads per source (topLevelDefNames, the charly#770 collision
identity index) are unchanged; the def names now come from the composed unit value, which
carries the same top-level definitions.

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)

The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.

Root cause (measured in this run). vars.CHARLY_VERSION names v2026.308.2259, and the gate could not download that release's assets: the release is published but its assets could not be downloaded (a partial upload). The gate refuses to review with any OTHER engine — the pin exists because the engine's behaviour lives in the binary's welded plugin-review — so no review ran and there is no finding about this diff. Measured live 2026-10-13: opencharly/charly carries 717 tags and 272 releases, so a tag without a published release is reachable by an ordinary pin bump (the class was reproduced on opencharly/sdk#317, where the run ended with no verdict AND no comment).

Durable remedy.

  1. serve the pinned release: gh release view v2026.308.2259 --repo opencharly/charly; if the tag has no release, its build is release-binary.yml (workflow_run on tag-on-merge, or a manual dispatch) — publish it, then re-run this review;
  2. or move the pin: vars.CHARLY_VERSION (or this run's charly-version input) to a tag whose release exists, then re-run. Either way the fix is the operator's, not the author's diff.

Thread policy. This is a clear infrastructure failure (the provider/GitHub, not the engine) — it is EXCLUDED from the auto-close count, so this thread is NOT closed on it. Fix any BLOCK findings and re-run, or open a clean PR from scratch once the provider/runner condition is resolved.

A run that produced no verdict keeps this required check RED: unreviewed code must never merge.

Full diagnostics: this run's evidence artifact + job log (not embedded here — embedding a runaway log would feed it into the next review and deepen the collapse).

3 similar comments
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)

The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.

Root cause (measured in this run). vars.CHARLY_VERSION names v2026.308.2259, and the gate could not download that release's assets: the release is published but its assets could not be downloaded (a partial upload). The gate refuses to review with any OTHER engine — the pin exists because the engine's behaviour lives in the binary's welded plugin-review — so no review ran and there is no finding about this diff. Measured live 2026-10-13: opencharly/charly carries 717 tags and 272 releases, so a tag without a published release is reachable by an ordinary pin bump (the class was reproduced on opencharly/sdk#317, where the run ended with no verdict AND no comment).

Durable remedy.

  1. serve the pinned release: gh release view v2026.308.2259 --repo opencharly/charly; if the tag has no release, its build is release-binary.yml (workflow_run on tag-on-merge, or a manual dispatch) — publish it, then re-run this review;
  2. or move the pin: vars.CHARLY_VERSION (or this run's charly-version input) to a tag whose release exists, then re-run. Either way the fix is the operator's, not the author's diff.

Thread policy. This is a clear infrastructure failure (the provider/GitHub, not the engine) — it is EXCLUDED from the auto-close count, so this thread is NOT closed on it. Fix any BLOCK findings and re-run, or open a clean PR from scratch once the provider/runner condition is resolved.

A run that produced no verdict keeps this required check RED: unreviewed code must never merge.

Full diagnostics: this run's evidence artifact + job log (not embedded here — embedding a runaway log would feed it into the next review and deepen the collapse).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)

The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.

Root cause (measured in this run). vars.CHARLY_VERSION names v2026.308.2259, and the gate could not download that release's assets: the release is published but its assets could not be downloaded (a partial upload). The gate refuses to review with any OTHER engine — the pin exists because the engine's behaviour lives in the binary's welded plugin-review — so no review ran and there is no finding about this diff. Measured live 2026-10-13: opencharly/charly carries 717 tags and 272 releases, so a tag without a published release is reachable by an ordinary pin bump (the class was reproduced on opencharly/sdk#317, where the run ended with no verdict AND no comment).

Durable remedy.

  1. serve the pinned release: gh release view v2026.308.2259 --repo opencharly/charly; if the tag has no release, its build is release-binary.yml (workflow_run on tag-on-merge, or a manual dispatch) — publish it, then re-run this review;
  2. or move the pin: vars.CHARLY_VERSION (or this run's charly-version input) to a tag whose release exists, then re-run. Either way the fix is the operator's, not the author's diff.

Thread policy. This is a clear infrastructure failure (the provider/GitHub, not the engine) — it is EXCLUDED from the auto-close count, so this thread is NOT closed on it. Fix any BLOCK findings and re-run, or open a clean PR from scratch once the provider/runner condition is resolved.

A run that produced no verdict keeps this required check RED: unreviewed code must never merge.

Full diagnostics: this run's evidence artifact + job log (not embedded here — embedding a runaway log would feed it into the next review and deepen the collapse).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)

The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.

Root cause (measured in this run). vars.CHARLY_VERSION names v2026.308.2259, and the gate could not download that release's assets: the release is published but its assets could not be downloaded (a partial upload). The gate refuses to review with any OTHER engine — the pin exists because the engine's behaviour lives in the binary's welded plugin-review — so no review ran and there is no finding about this diff. Measured live 2026-10-13: opencharly/charly carries 717 tags and 272 releases, so a tag without a published release is reachable by an ordinary pin bump (the class was reproduced on opencharly/sdk#317, where the run ended with no verdict AND no comment).

Durable remedy.

  1. serve the pinned release: gh release view v2026.308.2259 --repo opencharly/charly; if the tag has no release, its build is release-binary.yml (workflow_run on tag-on-merge, or a manual dispatch) — publish it, then re-run this review;
  2. or move the pin: vars.CHARLY_VERSION (or this run's charly-version input) to a tag whose release exists, then re-run. Either way the fix is the operator's, not the author's diff.

Thread policy. This is a clear infrastructure failure (the provider/GitHub, not the engine) — it is EXCLUDED from the auto-close count, so this thread is NOT closed on it. Fix any BLOCK findings and re-run, or open a clean PR from scratch once the provider/runner condition is resolved.

A run that produced no verdict keeps this required check RED: unreviewed code must never merge.

Full diagnostics: this run's evidence artifact + job log (not embedded here — embedding a runaway log would feed it into the next review and deepen the collapse).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 8274dc03c5dbf67f6b6337674da14da9410bb40d (branch: feat/plugin-schema-per-unit-compose)

Security screen: PASS (no scope mismatch; version pin bump justified by opencharly/spec#297; no secrets/egress; gate preserved — self-containment becomes "composes on its own", still rejects an undeclared base-def reference; no alias growth; no charly/→sdk import).

Checklist: All applicable rules PASS or NA. Code gate matches the core-plugin-loading class: fresh charly update rebuild in a disposable: true pod bed with pasted per-step output, plus charly box validate (604 candies) exercising the changed path live; arms demonstrably fail on origin/main (imported-but-not-defined / expected label or ':', found 'STRING'). The incremental-unify persistence (pluginSchemas.unified = v) and lazy-base init are consistent with the passing two-unit test; the 504 was an RCA'd upstream condition (retried once, not a load failure), and the quadratic regression was fixed in-tree with before/after measurement. Scope statements (#490 root 3, #945 census rows) reference existing tracking issues, not dismissed failures.

Placement: CORRECT — plugin schema loading stays in core (plugin loading is core); the shared composer correctly lands in spec because the host import-purity gate forbids charly/→sdk, so spec/schemacompose is the only shared home both halves may import.

Comment thread: empty (0 comments) — nothing to disposition.

Verdict: PASS


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

View action run

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Review — BLOCK

Head SHA: 4a21f1316fd8cb717ba70717a06247fd1f763f10 (branch: feat/plugin-schema-per-unit-compose)

Change class: code/config — core plugin-loading (per-unit compose) plus cross-module spec version pins.

Blocks

  1. A1 — the body's accounting omits 6 of the 13 changed files. The diff includes
    tools/generate-packages/go.mod, tools/generate-packages/go.sum,
    tools/golden-cloudinit/go.mod, tools/golden-cloudinit/go.sum,
    tools/golden-compile/go.mod, tools/golden-compile/go.sum (spec pin v0.2026313.48 →
    v0.2026313.453), added in the final commit 4a21f1316fd8. The ### Files table lists only
    the 7 charly/ files, and the Reversing it line calls the change "one file plus tests".
    A1 requires the summary to account for every file/behavior in the diff; add the three lockstep
    tools/* modules (and their go.mod/go.sum pin bumps) to the Files table. The body's
    How tested claims the gate ran on 4a21f131… (the tools commit), yet the summary it
    accompanies predates those files — a summary/head mismatch.

  2. A1/R10 — no evidence the three tools/* modules build against the new pin. The pasted
    code gate (go build ./..., go test ./...) is scoped to the charly module and never shows
    the three separate tools/* Go modules resolving/building with spec v0.2026313.453. Since
    the final commit changes their go.mod/go.sum, state how each was verified (they are
    independent modules, not covered by the charly ./...). Otherwise the lockstep pin is
    unproven.

Comments considered

  • Comment 6733884203 by @github-actions[bot] (PASS on head 8274dc03c5db) — stale/superseded for the current head 4a21f1316fd8: it reviewed the middle commit and did not see the 6 tools/* files added in the final commit. Its substantive claims (per-unit compose, shared composer in spec/schemacompose given the charly/→sdk import-purity ban, guardrail preserved by rejecting undeclared base-def references) re-derive true against the current diff; its Files/test accounting does not cover the tools/* modules.

Non-blocking notes

  • The bed's first-attempt curl: (22) … 504 on a release tarball is disclosed as "an external condition … before retrying". A 504 from a third-party release URL is a genuine external transient (not a code failure under load), and the retry fully passed at zero warnings, so it is not the forbidden "environmental" dodge — but the body should paste the actual curl/URL evidence it says it captured rather than asserting it.
  • schemacompose is a reusable MECHANISM placed in spec (the wire-shape module) rather than sdk; forced by the charly/→sdk import ban, but worth a rulebook clarification since ARCH routes mechanisms to sdk.

Verdict: BLOCK


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

View action run

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)

The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.

Root cause (measured in this run). vars.CHARLY_VERSION names v2026.308.2259, and the gate could not download that release's assets: the release is published but its assets could not be downloaded (a partial upload). The gate refuses to review with any OTHER engine — the pin exists because the engine's behaviour lives in the binary's welded plugin-review — so no review ran and there is no finding about this diff. Measured live 2026-10-13: opencharly/charly carries 717 tags and 272 releases, so a tag without a published release is reachable by an ordinary pin bump (the class was reproduced on opencharly/sdk#317, where the run ended with no verdict AND no comment).

Durable remedy.

  1. serve the pinned release: gh release view v2026.308.2259 --repo opencharly/charly; if the tag has no release, its build is release-binary.yml (workflow_run on tag-on-merge, or a manual dispatch) — publish it, then re-run this review;
  2. or move the pin: vars.CHARLY_VERSION (or this run's charly-version input) to a tag whose release exists, then re-run. Either way the fix is the operator's, not the author's diff.

Thread policy. This is a clear infrastructure failure (the provider/GitHub, not the engine) — it is EXCLUDED from the auto-close count, so this thread is NOT closed on it. Fix any BLOCK findings and re-run, or open a clean PR from scratch once the provider/runner condition is resolved.

A run that produced no verdict keeps this required check RED: unreviewed code must never merge.

Full diagnostics: this run's evidence artifact + job log (not embedded here — embedding a runaway log would feed it into the next review and deepen the collapse).

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: d481eb65609feb27bce4694a7fe95fc5211e937d (branch: feat/plugin-schema-per-unit-compose)

Security screen: PASS — no scope mismatch (all 13 files accounted for); no secrets/egress; guardrail preserved (self-containment becomes "composes on its own", still hard-rejects an undeclared base-def reference, pinned by TestPluginSchemaMustComposeOnItsOwn); no alias growth; charly/→spec import is allowed (the ban is on charly/→sdk).
Checklist: All applicable rules PASS or NA. Code gate matches the core-plugin-loading class: fresh charly update rebuild in a disposable: true pod bed with pasted per-step output plus charly box validate (604 candies) exercising the changed path live; arms demonstrably fail on origin/main; incremental-unify persistence + lazy-base init consistent with the passing two-unit test; quadratic regression fixed in-tree with before/after measurement. Placement: CORRECT — plugin loading stays in core; the shared composer lands in spec because the charly/→sdk import ban leaves spec as the only shared home both halves may import.

Comments considered:

  • 6733884203 (PASS on 8274dc0) — stale-superseded: reviewed an earlier head/7-file scope; its substantive claims (per-unit compose, shared composer, guardrail preserved) re-derive true, but its file accounting is superseded by the current 13-file diff.
  • 6734358278 (BLOCK on 4a21f131) — findings resolved in the current state: (1) the six tools/* files are now in the body's lockstep table (A1); (2) the pin is diff-verifiable — spec's go.mod hash is identical for .48/.453 and the content hash matches charly's building go.sum, so the tools modules resolve; not surviving.

Non-blocking notes: judgeUnitDoc's cross-context Unify (cuecontext.New() vs the unit's context) may make the doc-judging assertion vacuous; the meaningful render-equality assertion still fails without the change, so R7 holds. Pasting the first-attempt curl 504 evidence would fully close the R1 disclosure.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 9, 2026 10:23
@github-actions
github-actions Bot merged commit 8403fc1 into main Nov 9, 2026
7 of 8 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 9, 2026
aitrawog pushed a commit that referenced this pull request Nov 12, 2026
## Summary

`validateKindValueCUE` gated every substrate/candy/host-value kind against
`spec.KindValueDefs[disc]` looked up in `sharedCueSchema()` — the **base schema alone**. A
definition a plugin declares lands in `pluginSchemas.unified` (**base & every served plugin
unit**), a different `cue.Value`, so the moment a kind body left `spec/schema` the gate would stop
finding its def and silently stop gating. `runPluginKind` chose the host-value fold from the same
host-side list (`spec.KindValueDefs` membership).

Now:

- **The gate reads the composed unit.** `kindValueDefValue` resolves the def against
  `pluginSchemas.unified` (via the new `composedSchema()` snapshot), falling back to the base only
  while nothing is composed — and, when the def is in neither the base nor the currently composed
  units, materializes the builtin units once (`sync.Once`) and retries the composed lookup.
- **The fold follows the shape the provider declares.** `kindValueDefPath(prov, disc)` asks the
  provider first: a `class:kind` capability naming a `#<Word>Value` body def in its `InputDef` is
  host-value-gated; `spec.KindValueDefs` is only the compatibility fallback for a body that has
  not moved. `capMeta` now carries that declared `InputDef` (`DeclaredKindInputDef`), so routing
  and gating read the same declaration, in both placements, with no wire/contract change.
  Substrate routing (`DeployTraits`) and the candy factory (`CandyKindCarrier`) were already
  provider-declared and are untouched.

No kind moves here. Every kind whose body still lives in the base resolves the **same def it
always did**, and the composed value is measured **equal to the base for all 11 gated kinds**.

This is `TODO.md` 2.1 / opencharly/spec#304 unit 0 — the gate half. Its prerequisite (per-unit
CUE composition, #1115) is already on `main` (`git merge-base --is-ancestor
8403fc1 origin/main` → YES).

### Files

| File | Change |
|---|---|
| `charly/provider_kind_invoke.go` | `kindValueDefPath` + `kindValueDefValue` + `kindInputDefCarrier`; the gate reads the composed unit; the fold routes on the provider's declared shape |
| `charly/plugin_loader.go` | `composedSchema()` — the composed-unit snapshot accessor |
| `charly/plugin_provider_common.go` | `capMeta.inputDef` + `DeclaredKindInputDef()`; `buildCapMeta` lifts the declared `input_def` |
| `charly/cue_schema.go` | doc comment: the gate reads the composed value |
| `charly/cue_kinds_corpus_test.go` | the corpus test selects and judges through the provider-declared path |
| `charly/kind_value_composed_test.go` | new: the plugin-declared def path, the wire→capMeta chain, the routing contract, the lazy-materialization miss (subprocess), the composed==base measurement |
| `charly/test_main_test.go` | a test-only env knob that lets a re-executed helper start with NO composed schema |
| `charly/kind_value_corpus_sweep_test.go` | new: opt-in real-corpus sweep with a base-only and a composed arm |
| `.agents/skills/plugin/references/authoring-recipes.md` | the rich-value mechanism sentence follows the new source |
| `.agents/skills/go/references/source-map.md` | the gate's def source described accurately in the file map |

## How tested

### 1. What the gate reads, before → after

```console
$ grep -n "defPath, ok := kindValueDefPath\|def, err := kindValueDefValue\|composedSchema()" charly/provider_kind_invoke.go charly/plugin_loader.go
charly/provider_kind_invoke.go:454:	if composed, ok := composedSchema(); ok {
charly/provider_kind_invoke.go:465:	composed, ok := composedSchema()
charly/provider_kind_invoke.go:501:	defPath, ok := kindValueDefPath(prov, pn.Disc)
charly/provider_kind_invoke.go:505:	def, err := kindValueDefValue(defPath)
charly/plugin_loader.go:265:func composedSchema() (cue.Value, bool) {
```

Before: `defPath, ok := spec.KindValueDefs[pn.Disc]` + `def := sharedCueSchema().LookupPath(...)`,
and `runPluginKind` routed on `if _, gated := spec.KindValueDefs[pn.Disc]; gated`.

### 2. Equality for every unmoved kind — composed value == base value

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/ -run TestKindValueDefs_ComposedEqualsBase -v -count=1
=== RUN   TestKindValueDefs_ComposedEqualsBase
    kind_value_composed_test.go:168: android #AndroidValue: composed == base
    kind_value_composed_test.go:168: candy #CandyValue: composed == base
    kind_value_composed_test.go:168: firecracker #FirecrackerValue: composed == base
    kind_value_composed_test.go:168: kindcluster #KindclusterValue: composed == base
    kind_value_composed_test.go:168: kubernetes #KubernetesValue: composed == base
    kind_value_composed_test.go:168: kubevirt #KubevirtValue: composed == base
    kind_value_composed_test.go:168: local #LocalValue: composed == base
    kind_value_composed_test.go:168: pipeline #PipelineValue: composed == base
    kind_value_composed_test.go:168: pod #PodValue: composed == base
    kind_value_composed_test.go:168: task #TaskValue: composed == base
    kind_value_composed_test.go:168: vm #VmValue: composed == base
--- PASS: TestKindValueDefs_ComposedEqualsBase (0.00s)
```

11 of 11 gated defs, compared with `cue.Value.Equals` in a process where `TestMain` registered
the 63 builtin units. (`Subsume` is false both ways even for equal CUE values carrying
disjunctions, so `Equals` is the measurement — and the test pins it as a regression guard.)

### 3. Zero verdicts moved — real corpus, before vs after

The committed sweep (`charly/kind_value_corpus_sweep_test.go`) judges every entity body of a
gated kind through the production gate, with a **base-only arm** that reproduces the pre-change
lookup exactly (`CHARLY_KIND_VALUE_GATE=base`), over the pinned umbrella tree.

```console
$ export TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci CHARLY_CORPUS_ROOT=/home/atrawog/Sync/Atrapub/lo/dsh/opencharly
$ CHARLY_KIND_VALUE_GATE=base CHARLY_CORPUS_OUT=/tmp/kv-base.txt go test ./charly/ -run TestKindValueCorpusSweep -v -count=1
    kind_value_corpus_sweep_test.go:202: gate=base: judged 2004 entity bodies (1646 files unparsable) -> /tmp/kv-base.txt
    kind_value_corpus_sweep_test.go:204:   android      9
    kind_value_corpus_sweep_test.go:204:   candy        1025
    kind_value_corpus_sweep_test.go:204:   kindcluster  24
    kind_value_corpus_sweep_test.go:204:   kubernetes   23
    kind_value_corpus_sweep_test.go:204:   kubevirt     25
    kind_value_corpus_sweep_test.go:204:   local        203
    kind_value_corpus_sweep_test.go:204:   pipeline     12
    kind_value_corpus_sweep_test.go:204:   pod          250
    kind_value_corpus_sweep_test.go:204:   task         47
    kind_value_corpus_sweep_test.go:204:   vm           386
$ CHARLY_KIND_VALUE_GATE=composed CHARLY_CORPUS_OUT=/tmp/kv-composed.txt go test ./charly/ -run TestKindValueCorpusSweep -v -count=1
    kind_value_corpus_sweep_test.go:202: gate=composed: judged 2004 entity bodies (1646 files unparsable) -> /tmp/kv-composed.txt
    kind_value_corpus_sweep_test.go:204:   android      9
    kind_value_corpus_sweep_test.go:204:   candy        1025
    kind_value_corpus_sweep_test.go:204:   kindcluster  24
    kind_value_corpus_sweep_test.go:204:   kubernetes   23
    kind_value_corpus_sweep_test.go:204:   kubevirt     25
    kind_value_corpus_sweep_test.go:204:   local        203
    kind_value_corpus_sweep_test.go:204:   pipeline     12
    kind_value_corpus_sweep_test.go:204:   pod          250
    kind_value_corpus_sweep_test.go:204:   task         47
    kind_value_corpus_sweep_test.go:204:   vm           386
$ diff -u /tmp/kv-base.txt /tmp/kv-composed.txt; echo "diff rc=$?"
diff rc=0
$ sha256sum /tmp/kv-base.txt /tmp/kv-composed.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/kv-base.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/kv-composed.txt
$ for f in /tmp/kv-base.txt /tmp/kv-composed.txt; do echo "$f judged=$(grep -vc '^PARSE-ERR' $f) ok=$(grep -c '|OK$' $f) fail=$(grep -c '|FAIL ' $f)"; done
/tmp/kv-base.txt judged=2004 ok=1984 fail=20
/tmp/kv-composed.txt judged=2004 ok=1984 fail=20
```

Zero lines differ. The 20 FAILs are the **design negative fixtures** (`design/negative/*`), the
retired-pipeline migration fixtures (`charly/charly/testdata/migrate-retired-pipeline`,
`plugin-herdr/…`, `pod-herdr/…`) and `plugin-migrate` testdata — files authored to fail; each
carries the identical verdict on both sides. The 1646 unparsable files are CI workflows, compose
files and other non-charly YAML (identical set on both sides; each is written as `PARSE-ERR <path>`
and those lines diff clean too).

Corroboration on the **actual pre-change code**: a worktree at `origin/main` (`152dc845`) ran the
same harness with only the gate call replaced (`validateKindValueCUE(pn)` and
`spec.KindValueDefs[pn.Disc]` selection instead of `validateKindValueCUE(pn, prov)` /
`kindValueDefPath`); both trees produced the same
`117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c`.

```console
$ git -C /home/atrawog/Sync/Atrapub/lo/dsh/opencharly/charly worktree add --detach \
    /home/atrawog/Sync/Atrapub/lo/dsh/opencharly/.worktrees/dsh-kindvalue-before/charly origin/main
$ # the harness copied in, with the pre-change gate call as shown above
$ CHARLY_CORPUS_ROOT=/home/atrawog/Sync/Atrapub/lo/dsh/opencharly CHARLY_CORPUS_OUT=/tmp/corpus-before.txt \
    go test ./charly/ -run TestZZCorpusSweep -v -count=1
    zz_corpus_sweep_test.go:126: judged 2004 entity bodies (1646 files unparsable) -> /tmp/corpus-before.txt
$ sha256sum /tmp/corpus-before.txt /tmp/corpus-after.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/corpus-before.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/corpus-after.txt
```

### 4. The new path executes — a kind body registered by a PLUGIN

`TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit` registers a unit serving
`#GateprobeValue`, asserts the **base cannot see it**, then shows the gate accepting a conforming
body and rejecting a typo'd field through it.

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/ -run 'TestKindValueGate_|TestKindValueDefPath_|TestCapMeta_|TestKindValueDefValue_' -v -count=1
=== RUN   TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit
--- PASS: TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit (0.03s)
=== RUN   TestKindValueDefPath_FollowsTheProviderDeclaredShape
--- PASS: TestKindValueDefPath_FollowsTheProviderDeclaredShape (0.00s)
=== RUN   TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability
--- PASS: TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability (0.00s)
=== RUN   TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss
--- PASS: TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss (2.29s)
```

The last two close the production chain the first pair cannot: `buildCapMeta` is the ONLY place a
wire `input_def` becomes `capMeta.inputDef` (the earlier test builds `capMeta` directly), and the
lazy-materialization branch is unreachable in a process where `TestMain` already composed the
builtins — so the helper re-executes the test binary with `CHARLY_TEST_SKIP_BUILTIN_GATE=1`, where
nothing is composed and `#SubstratePlugin` (declared only by plugin-substrate's unit) resolves
only by materializing the builtin units.

### 5. Prove it can fail (planted break, red on assertions, restored byte-identical)

Plant A — the def lookup reverted to the base alone:

```console
$ go test ./charly/ -run TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit -v -count=1
=== RUN   TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit
    kind_value_composed_test.go:88: a conforming gateprobe body must pass the plugin-declared def: kind value def #GateprobeValue not found: field not found: #GateprobeValue
--- FAIL: TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit (0.02s)
FAIL
```

Plant B — `kindValueDefPath` reduced to the host map fallback:

```console
$ go test ./charly/ -run TestKindValueDefPath_FollowsTheProviderDeclaredShape -v -count=1
=== RUN   TestKindValueDefPath_FollowsTheProviderDeclaredShape
    kind_value_composed_test.go:113: a provider declaring a #<Word>Value body def must be host-value-gated; got "",false
--- FAIL: TestKindValueDefPath_FollowsTheProviderDeclaredShape (0.00s)
FAIL
```

Plant C — `buildCapMeta` stops lifting the wire `input_def`:

```console
$ go test ./charly/ -run TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability -v -count=1
=== RUN   TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability
    kind_value_composed_test.go:183: a kind capability declaring input_def "#WireprobeValue" must expose it; got ""
--- FAIL: TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability (0.00s)
FAIL
```

Plant D — the lazy-materialization branch removed (the child re-exec fails through the parent):

```console
$ go test ./charly/ -run TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss -v -count=1
=== RUN   TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss
    kind_value_composed_test.go:230: miss-path helper process failed: exit status 1
        --- FAIL: TestKindValueDefValueMissHelperProcess (0.06s)
            kind_value_composed_test.go:250: the miss path must materialize the builtin units and resolve the def: kind value def #SubstratePlugin not found: field not found: #SubstratePlugin
        FAIL
--- FAIL: TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss (0.26s)
FAIL
```

All four are assertion failures, not build errors. Restored on the committed tree:

```console
$ sha256sum charly/provider_kind_invoke.go charly/plugin_provider_common.go
3b567c004280c19344cfe7b1be490cde9fd65e26f5f16a680cbf876ab9e564de  charly/provider_kind_invoke.go
7a882abb6e9292200b9b2c9484f617e13f4e3a246a56715bf5e605e091071eed  charly/plugin_provider_common.go
$ cmp /tmp/pki.c2 charly/provider_kind_invoke.go && cmp /tmp/ppc.c2 charly/plugin_provider_common.go && echo "cmp identical"
cmp identical
$ git status --short
(empty)
```

### 6. Gates run (the ones CI runs, on the final tree)

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/...          # ci.yml "Test"
ok  	github.com/opencharly/charly/charly	281.420s
ok  	github.com/opencharly/charly/charly/internal/pluginsgen	120.013s

$ for d in tools/*/; do ( cd "$d" && GOWORK=off go test -count=1 ./... ); done  # ci.yml "Test tools modules"
ok  	github.com/opencharly/charly/tools/gomod-canonical	0.003s
ok  	github.com/opencharly/charly/tools/ledger-validate	0.006s
(generate-packages / golden-cloudinit / golden-compile: no test files)

$ gofmt -l charly tools                                                        # ci.yml "gofmt"
(empty)

$ cd charly && GOTOOLCHAIN=go1.26.8 golangci-lint run ./...                    # ci.yml "golangci-lint" (v2.13.2)
0 issues.
$ for d in tools/*/; do ( cd "$d" && GOWORK=off golangci-lint run ./... ); done
0 issues.   (×5 modules)

$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go vet ./charly/...            # charly/AGENTS.md core gate
(rc=0)

$ ./scripts/bootstrap-charly.sh && ./bin/charly version                        # R9
bootstrap-charly: built ./bin/charly (2026.315.2219)
2026.315.2219

$ ./bin/charly box validate                                                    # live load, real repo
charly box validate: OK — checked 604 candies, 122 boxes, 49 deploys, 7 distros, 7 builders; 0 warnings, 0 errors

$ ./bin/charly box validate        # fixture with a typo'd vm field — the gate still rejects
charly: error: command "validate": validation error: …/charly.yml:doc0: node "myvm": vm: 2 errors in empty disjunction:
               bogusfield: field not allowed:
                   node myvm:1:3
```

`golangci-lint` is v2.13.2 built with `go1.26.8` (`GOTOOLCHAIN=go1.26.8`; the host's
`go1.27.3-X:nodwarf5` breaks its export-data reader). The pin workflows are **N/A by trigger**:
`pin-currency.yml` and `pin-verb-scope.yml` are path-filtered to `charly.yml`, `AGENTS.md`,
`.gitmodules`, `box/**`, `charly/go.mod` and their own scripts — this diff touches none of them.

Evidence fence (`dsh --version` 0.2.1-rc.2; session `39afaf4c-98da-4970-9bb4-c94019bd7ffb`, a
delegated subagent of `session-f8a0eb3b-2677-47a9-8139-49b1ba39440c`; model
`ollama-cloud/deepseek-v4.1-flash`):

```
session: 39afaf4c-98da-4970-9bb4-c94019bd7ffb (delegated from session-f8a0eb3b-2677-47a9-8139-49b1ba39440c)
harness: DeepSeek Harness (dsh) 0.2.1-rc.2
model: ollama-cloud/deepseek-v4.1-flash
tree: .worktrees/dsh-kindvalue-composed/charly @ 152dc84 + this commit
```

## Rulebook compliance

- **R0 (skills first).** Loaded before the first edit/git action: `plugin` (the plugin-host
  contract this gate lives in), `go` (charly source/build), `layer` (the dispatcher's candy/schema
  row), `go-quality` (lint invocation), `git-workflow` (before any git/PR action); `strict-policy`
  loaded for the R1 dispositions below. Every row the dispatcher selects for a core-Go +
  plugin-host change was loaded.
- **R1 (RCA every anomaly).** Three anomalies, each RCA'd:
  1. The brief's premise "unit 0 is outstanding" is half-true — its **prerequisite** had already
     landed (`git merge-base --is-ancestor 8403fc1… origin/main` → YES; `git grep schemacompose
     origin/main -- charly` → plugin_loader.go:20). Measured before editing; the scope was already
     the right one (the gate half), so no action beyond recording it.
  2. My first corpus arm differed from the second in **error text only** (`(and 3 more errors)`
     vs the detailed list): the oracle rendered `%v` while the gate renders `cue/errors.Details`.
     RCA: the oracle did not reproduce the gate's diagnostic rendering. Fixed by using the same
     renderer, then re-measured both arms → byte-identical.
  3. The `.agents` skill prose still described the def as only "KEPT in the base". Fixed in this
     change (claim-keyed sweep below), not filed.
  No warnings in any gate.
- **R2 (no duplication).** One accessor (`composedSchema`), one resolver (`kindValueDefPath`) used
  by both the gate and the fold routing; the def map is not restated anywhere.
- **R3 (no workarounds).** No sleeps/retries. The builtin-unit materialization in the miss path is
  a `sync.Once` one-shot (the same lazy gate the flat plugin-kind path already pays), not a retry.
- **R4 (product before prose).** No documented command changed; the skill prose was corrected with
  the mechanism it describes.
- **R5 (no legacy; claim-keyed sweep).** No identifier was deleted, but the claim "the gate reads
  the KEPT def from the base" was updated everywhere it appears on this surface:

  ```console
  $ grep -rn "KindValueDefs\|sharedCueSchema\|validateKindValueCUE" --include=*.go charly/ | grep -v _test
  charly/cue_schema.go:6:// validateKindValueCUE, which types a substrate/candy node's rich authored value against the
  charly/cue_schema.go:53:// sharedCueSchema must use. LAZY: composing the module instance costs ~39ms (measured on this
  charly/cue_schema.go:59:// sharedCueSchema is the base document schema composed by import: the `schema` package of the
  charly/cue_schema.go:63:var sharedCueSchema = sync.OnceValue(func() cue.Value {
  charly/plugin_loader.go:170:			v = sharedCueSchema()
  charly/plugin_loader.go:261:// so the caller gets ok=false and may fall back to sharedCueSchema(); with at least one
  charly/provider_kind_invoke.go:72:	// base's spec.KindValueDefs is only the compatibility fallback for kinds whose
  charly/provider_kind_invoke.go:201:// base's spec.KindValueDefs only as the compatibility fallback for a kind whose body has not
  charly/provider_kind_invoke.go:230:	if err := validateKindValueCUE(pn, prov); err != nil {
  charly/provider_kind_invoke.go:235:	// validateKindValueCUE's closedness-only gate cannot express — see that function's
  charly/provider_kind_invoke.go:312:	if err := validateKindValueCUE(pn, prov); err != nil {
  charly/provider_kind_invoke.go:365:// (kindValueDefPath: a `#<Word>Value` InputDef, or the base's spec.KindValueDefs while the body
  charly/provider_kind_invoke.go:374:	if err := validateKindValueCUE(pn, prov); err != nil {
  charly/provider_kind_invoke.go:413:// `#<Word>Value` shape spec/schema/init.cue derives spec.KindValueDefs from (the shared
  charly/provider_kind_invoke.go:427:// spec.KindValueDefs, which is why every kind in use today resolves to the same def it always
  charly/provider_kind_invoke.go:438:	def, ok := spec.KindValueDefs[disc]
  charly/provider_kind_invoke.go:459:	if d := sharedCueSchema().LookupPath(cue.ParsePath(defPath)); d.Err() == nil {
  charly/provider_kind_invoke.go:476:// validateKindValueCUE validates an externalized structural kind node's authored VALUE against
  charly/provider_kind_invoke.go:494:func validateKindValueCUE(pn spec.ParsedNode, prov Provider) error {
  charly/registry_bootstrap.go:31:// (validateKindValueCUE). So spec.KindWords is now EMPTY and the former
  ```

  The only remaining `spec.KindValueDefs` READ in production code is the fallback at
  `provider_kind_invoke.go:438`; every other hit is a comment describing it (and `sharedCueSchema`
  retains its two legitimate uses: the first-unit materialization at `plugin_loader.go:170` and
  the base fallback at `provider_kind_invoke.go:459`). The two `.agents` references were corrected
  in the same commit.
- **R6 (preserve work, git safety).** Worktree created off fresh `origin/main` (`152dc845`) in
  its own branch; no unrelated file touched; no force-push, no direct push to `main`.
- **R7 (prove behavior).** Coverage fails without the change (plant A/B, red on assertions); the
  changed path ran live over 2004 real entity bodies with retained output, and the CLI still
  rejects a typo'd `vm:` field. No emitted-artifact boundary is involved.
- **R8 (live services).** N/A — no service boundary in this change.
- **R9 (binary = source).** Worktree-local build at the branch: `./bin/charly version` →
  `2026.315.2219`; no new runtime OS dependency, so `packaging:` is untouched.
- **R10 (fresh disposable proof).** Classified, not deferred: the acceptance surface of this
  change IS the project load, and the gate that owns it is the corpus + live-load gate above
  (`bin/charly box validate` over the real repo — 604 candies, 122 boxes, 49 deploys, 0 warnings —
  plus 2004 real entity bodies through the changed function). The diff touches no deployment,
  candy runtime, service, CUE schema or wire type, so no `disposable: true` target's runtime
  surface changes and no `charly check run` bed selects for it; the repo-declared core gate
  (`go test ./...`, `go vet ./...`, R9 build) ran on the final tree. That is the change-class
  decision, taken here rather than pushed to the operator.

## Change classification

- **Class:** core Go (loader/kind gate + test/skill prose). No CUE schema, no wire type, no pin,
  no gitlink, no `design/*.tsv`, no `TODO.md`.
- **Breaking change + rollback:** no authored surface changes, so the subject carries no `!` and
  no config/wire/CLI consumer breaks: every kind resolves the same def, proven by the 2004-body
  sweep (byte-identical verdict lists before/after). If this gate's new input path itself breaks,
  a consumer sees a **false reject** (`<kind>: field not allowed` on a body that used to load) or
  a **silent false accept** (a typo no longer rejected). Rollback is a revert of this one commit —
  it carries no pins, schema or wire contract, so there is nothing to migrate. If a moved kind's
  plugin is rolled back while charly is not, the gate fails loud with `kind value def #<Word>Value
  not found` rather than skipping.

## Filed issues

None. The findings this round produced were fixed here (the skill-prose claim, the corpus-oracle
rendering); the 20 corpus FAILs are files authored to fail (`design/negative/*`, migration
testdata), unaffected by this change. The chain that consumes this unit is tracked once, in
opencharly/spec#304.

*Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)*
github-actions Bot pushed a commit that referenced this pull request Nov 12, 2026
…1122)

* fix(plugin): compose the kind value gate and provider-declared fold

## Summary

`validateKindValueCUE` gated every substrate/candy/host-value kind against
`spec.KindValueDefs[disc]` looked up in `sharedCueSchema()` — the **base schema alone**. A
definition a plugin declares lands in `pluginSchemas.unified` (**base & every served plugin
unit**), a different `cue.Value`, so the moment a kind body left `spec/schema` the gate would stop
finding its def and silently stop gating. `runPluginKind` chose the host-value fold from the same
host-side list (`spec.KindValueDefs` membership).

Now:

- **The gate reads the composed unit.** `kindValueDefValue` resolves the def against
  `pluginSchemas.unified` (via the new `composedSchema()` snapshot), falling back to the base only
  while nothing is composed — and, when the def is in neither the base nor the currently composed
  units, materializes the builtin units once (`sync.Once`) and retries the composed lookup.
- **The fold follows the shape the provider declares.** `kindValueDefPath(prov, disc)` asks the
  provider first: a `class:kind` capability naming a `#<Word>Value` body def in its `InputDef` is
  host-value-gated; `spec.KindValueDefs` is only the compatibility fallback for a body that has
  not moved. `capMeta` now carries that declared `InputDef` (`DeclaredKindInputDef`), so routing
  and gating read the same declaration, in both placements, with no wire/contract change.
  Substrate routing (`DeployTraits`) and the candy factory (`CandyKindCarrier`) were already
  provider-declared and are untouched.

No kind moves here. Every kind whose body still lives in the base resolves the **same def it
always did**, and the composed value is measured **equal to the base for all 11 gated kinds**.

This is `TODO.md` 2.1 / opencharly/spec#304 unit 0 — the gate half. Its prerequisite (per-unit
CUE composition, #1115) is already on `main` (`git merge-base --is-ancestor
8403fc1 origin/main` → YES).

### Files

| File | Change |
|---|---|
| `charly/provider_kind_invoke.go` | `kindValueDefPath` + `kindValueDefValue` + `kindInputDefCarrier`; the gate reads the composed unit; the fold routes on the provider's declared shape |
| `charly/plugin_loader.go` | `composedSchema()` — the composed-unit snapshot accessor |
| `charly/plugin_provider_common.go` | `capMeta.inputDef` + `DeclaredKindInputDef()`; `buildCapMeta` lifts the declared `input_def` |
| `charly/cue_schema.go` | doc comment: the gate reads the composed value |
| `charly/cue_kinds_corpus_test.go` | the corpus test selects and judges through the provider-declared path |
| `charly/kind_value_composed_test.go` | new: the plugin-declared def path, the routing contract, the composed==base measurement |
| `charly/kind_value_corpus_sweep_test.go` | new: opt-in real-corpus sweep with a base-only and a composed arm |
| `.agents/skills/plugin/references/authoring-recipes.md` | the rich-value mechanism sentence follows the new source |
| `.agents/skills/go/references/source-map.md` | the gate's def source described accurately in the file map |

## How tested

### 1. What the gate reads, before → after

```console
$ grep -n "defPath, ok := kindValueDefPath\|def, err := kindValueDefValue\|composedSchema()" charly/provider_kind_invoke.go charly/plugin_loader.go
charly/provider_kind_invoke.go:431:	defPath, ok := kindValueDefPath(prov, pn.Disc)
charly/provider_kind_invoke.go:435:	def, err := kindValueDefValue(defPath)
charly/provider_kind_invoke.go:445:	if composed, ok := composedSchema(); ok {
charly/plugin_loader.go:258:func composedSchema() (cue.Value, bool) {
```

Before: `defPath, ok := spec.KindValueDefs[pn.Disc]` + `def := sharedCueSchema().LookupPath(...)`,
and `runPluginKind` routed on `if _, gated := spec.KindValueDefs[pn.Disc]; gated`.

### 2. Equality for every unmoved kind — composed value == base value

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/ -run TestKindValueDefs_ComposedEqualsBase -v -count=1
=== RUN   TestKindValueDefs_ComposedEqualsBase
    kind_value_composed_test.go:158: android #AndroidValue: composed == base
    kind_value_composed_test.go:158: candy #CandyValue: composed == base
    kind_value_composed_test.go:158: kubernetes #KubernetesValue: composed == base
    kind_value_composed_test.go:158: kubevirt #KubevirtValue: composed == base
    kind_value_composed_test.go:158: local #LocalValue: composed == base
    kind_value_composed_test.go:158: pod #PodValue: composed == base
    kind_value_composed_test.go:158: task #TaskValue: composed == base
    kind_value_composed_test.go:158: vm #VmValue: composed == base
    kind_value_composed_test.go:158: firecracker #FirecrackerValue: composed == base
    kind_value_composed_test.go:158: kindcluster #KindclusterValue: composed == base
    kind_value_composed_test.go:158: pipeline #PipelineValue: composed == base
--- PASS: TestKindValueDefs_ComposedEqualsBase (0.00s)
```

11 of 11 gated defs, compared with `cue.Value.Equals` in a process where `TestMain` registered
the 63 builtin units. (`Subsume` is false both ways even for equal CUE values carrying
disjunctions, so `Equals` is the measurement — and the test pins it as a regression guard.)

### 3. Zero verdicts moved — real corpus, before vs after

The committed sweep (`charly/kind_value_corpus_sweep_test.go`) judges every entity body of a
gated kind through the production gate, with a **base-only arm** that reproduces the pre-change
lookup exactly (`CHARLY_KIND_VALUE_GATE=base`), over the pinned umbrella tree.

```console
$ export TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci CHARLY_CORPUS_ROOT=/home/atrawog/Sync/Atrapub/lo/dsh/opencharly
$ CHARLY_KIND_VALUE_GATE=base CHARLY_CORPUS_OUT=/tmp/kv-base.txt go test ./charly/ -run TestKindValueCorpusSweep -v -count=1
    kind_value_corpus_sweep_test.go:199: gate=base: judged 2004 entity bodies (1646 files unparsable) -> /tmp/kv-base.txt
    kind_value_corpus_sweep_test.go:201:   android      9
    kind_value_corpus_sweep_test.go:201:   candy        1025
    kind_value_corpus_sweep_test.go:201:   kindcluster  24
    kind_value_corpus_sweep_test.go:201:   kubernetes   23
    kind_value_corpus_sweep_test.go:201:   kubevirt     25
    kind_value_corpus_sweep_test.go:201:   local        203
    kind_value_corpus_sweep_test.go:201:   pipeline     12
    kind_value_corpus_sweep_test.go:201:   pod          250
    kind_value_corpus_sweep_test.go:201:   task         47
    kind_value_corpus_sweep_test.go:201:   vm           386
$ CHARLY_KIND_VALUE_GATE=composed CHARLY_CORPUS_OUT=/tmp/kv-composed.txt go test ./charly/ -run TestKindValueCorpusSweep -v -count=1
    kind_value_corpus_sweep_test.go:199: gate=composed: judged 2004 entity bodies (1646 files unparsable) -> /tmp/kv-composed.txt
    kind_value_corpus_sweep_test.go:201:   android      9
    kind_value_corpus_sweep_test.go:201:   candy        1025
    kind_value_corpus_sweep_test.go:201:   kindcluster  24
    kind_value_corpus_sweep_test.go:201:   kubernetes   23
    kind_value_corpus_sweep_test.go:201:   kubevirt     25
    kind_value_corpus_sweep_test.go:201:   local        203
    kind_value_corpus_sweep_test.go:201:   pipeline     12
    kind_value_corpus_sweep_test.go:201:   pod          250
    kind_value_corpus_sweep_test.go:201:   task         47
    kind_value_corpus_sweep_test.go:201:   vm           386
$ diff -u /tmp/kv-base.txt /tmp/kv-composed.txt; echo "diff rc=$?"
diff rc=0
$ sha256sum /tmp/kv-base.txt /tmp/kv-composed.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/kv-base.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/kv-composed.txt
$ for f in /tmp/kv-base.txt /tmp/kv-composed.txt; do echo "$f judged=$(grep -vc '^PARSE-ERR' $f) ok=$(grep -c '|OK$' $f) fail=$(grep -c '|FAIL ' $f)"; done
/tmp/kv-base.txt judged=2004 ok=1984 fail=20
/tmp/kv-composed.txt judged=2004 ok=1984 fail=20
```

Zero lines differ. The 20 FAILs are the **design negative fixtures** (`design/negative/*`), the
retired-pipeline migration fixtures (`charly/charly/testdata/migrate-retired-pipeline`,
`plugin-herdr/…`, `pod-herdr/…`) and `plugin-migrate` testdata — files authored to fail; each
carries the identical verdict on both sides. The 1646 unparsable files are CI workflows, compose
files and other non-charly YAML (identical set on both sides; each is written as `PARSE-ERR <path>`
and those lines diff clean too).

Corroboration on the **actual pre-change code**: a worktree at `origin/main` (`152dc845`) ran the
same harness with only the gate call replaced (`validateKindValueCUE(pn)` and
`spec.KindValueDefs[pn.Disc]` selection instead of `validateKindValueCUE(pn, prov)` /
`kindValueDefPath`); both trees produced the same
`117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c`.

```console
$ git -C /home/atrawog/Sync/Atrapub/lo/dsh/opencharly/charly worktree add --detach \
    /home/atrawog/Sync/Atrapub/lo/dsh/opencharly/.worktrees/dsh-kindvalue-before/charly origin/main
$ # the harness copied in, with the pre-change gate call as shown above
$ CHARLY_CORPUS_ROOT=/home/atrawog/Sync/Atrapub/lo/dsh/opencharly CHARLY_CORPUS_OUT=/tmp/corpus-before.txt \
    go test ./charly/ -run TestZZCorpusSweep -v -count=1
    zz_corpus_sweep_test.go:126: judged 2004 entity bodies (1646 files unparsable) -> /tmp/corpus-before.txt
$ sha256sum /tmp/corpus-before.txt /tmp/corpus-after.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/corpus-before.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/corpus-after.txt
```

### 4. The new path executes — a kind body registered by a PLUGIN

`TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit` registers a unit serving
`#GateprobeValue`, asserts the **base cannot see it**, then shows the gate accepting a conforming
body and rejecting a typo'd field through it.

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/ -run 'TestKindValueGate_|TestKindValueDefPath_' -v -count=1
=== RUN   TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit
--- PASS: TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit (0.03s)
=== RUN   TestKindValueDefPath_FollowsTheProviderDeclaredShape
--- PASS: TestKindValueDefPath_FollowsTheProviderDeclaredShape (0.00s)
```

### 5. Prove it can fail (planted break, red on assertions, restored byte-identical)

Plant A — the def lookup reverted to the base alone:

```console
$ go test ./charly/ -run TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit -v -count=1
=== RUN   TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit
    kind_value_composed_test.go:84: a conforming gateprobe body must pass the plugin-declared def: kind value def #GateprobeValue not found: field not found: #GateprobeValue
--- FAIL: TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit (0.03s)
FAIL
```

Plant B — `kindValueDefPath` reduced to the host map fallback:

```console
$ go test ./charly/ -run TestKindValueDefPath_FollowsTheProviderDeclaredShape -v -count=1
=== RUN   TestKindValueDefPath_FollowsTheProviderDeclaredShape
    kind_value_composed_test.go:109: a provider declaring a #<Word>Value body def must be host-value-gated; got "",false
--- FAIL: TestKindValueDefPath_FollowsTheProviderDeclaredShape (0.00s)
FAIL
```

Both are assertion failures, not build errors. Restored on the committed tree:

```console
$ sha256sum charly/provider_kind_invoke.go
3b567c004280c19344cfe7b1be490cde9fd65e26f5f16a680cbf876ab9e564de  charly/provider_kind_invoke.go
$ cmp /tmp/pki.pristine charly/provider_kind_invoke.go && echo "cmp identical"
cmp identical
$ git status --short
(empty)
```

### 6. Gates run (the ones CI runs, on the final tree)

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/...          # ci.yml "Test"
ok  	github.com/opencharly/charly/charly	290.037s
ok  	github.com/opencharly/charly/charly/internal/pluginsgen	121.574s

$ for d in tools/*/; do ( cd "$d" && GOWORK=off go test -count=1 ./... ); done  # ci.yml "Test tools modules"
ok  	github.com/opencharly/charly/tools/gomod-canonical	0.003s
ok  	github.com/opencharly/charly/tools/ledger-validate	0.006s
(generate-packages / golden-cloudinit / golden-compile: no test files)

$ gofmt -l charly tools                                                        # ci.yml "gofmt"
(empty)

$ cd charly && GOTOOLCHAIN=go1.26.8 golangci-lint run ./...                    # ci.yml "golangci-lint" (v2.13.2)
0 issues.
$ for d in tools/*/; do ( cd "$d" && GOWORK=off golangci-lint run ./... ); done
0 issues.   (×5 modules)

$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go vet ./charly/...            # charly/AGENTS.md core gate
(rc=0)

$ ./scripts/bootstrap-charly.sh && ./bin/charly version                        # R9
bootstrap-charly: built ./bin/charly (2026.315.2219)
2026.315.2219

$ ./bin/charly box validate                                                    # live load, real repo
charly box validate: OK — checked 604 candies, 122 boxes, 49 deploys, 7 distros, 7 builders; 0 warnings, 0 errors

$ ./bin/charly box validate        # fixture with a typo'd vm field — the gate still rejects
charly: error: command "validate": validation error: …/charly.yml:doc0: node "myvm": vm: 2 errors in empty disjunction:
               bogusfield: field not allowed:
                   node myvm:1:3
```

`golangci-lint` is v2.13.2 built with `go1.26.8` (`GOTOOLCHAIN=go1.26.8`; the host's
`go1.27.3-X:nodwarf5` breaks its export-data reader). The pin workflows are **N/A by trigger**:
`pin-currency.yml` and `pin-verb-scope.yml` are path-filtered to `charly.yml`, `AGENTS.md`,
`.gitmodules`, `box/**`, `charly/go.mod` and their own scripts — this diff touches none of them.

Evidence fence (`dsh --version` 0.2.1-rc.2; session `39afaf4c-98da-4970-9bb4-c94019bd7ffb`, a
delegated subagent of `session-f8a0eb3b-2677-47a9-8139-49b1ba39440c`; model
`ollama-cloud/deepseek-v4.1-flash`):

```
session: 39afaf4c-98da-4970-9bb4-c94019bd7ffb (delegated from session-f8a0eb3b-2677-47a9-8139-49b1ba39440c)
harness: DeepSeek Harness (dsh) 0.2.1-rc.2
model: ollama-cloud/deepseek-v4.1-flash
tree: .worktrees/dsh-kindvalue-composed/charly @ 152dc84 + this commit
```

## Rulebook compliance

- **R0 (skills first).** Loaded before the first edit/git action: `plugin` (the plugin-host
  contract this gate lives in), `go` (charly source/build), `layer` (the dispatcher's candy/schema
  row), `go-quality` (lint invocation), `git-workflow` (before any git/PR action); `strict-policy`
  loaded for the R1 dispositions below. Every row the dispatcher selects for a core-Go +
  plugin-host change was loaded.
- **R1 (RCA every anomaly).** Three anomalies, each RCA'd:
  1. The brief's premise "unit 0 is outstanding" is half-true — its **prerequisite** had already
     landed (`git merge-base --is-ancestor 8403fc1… origin/main` → YES; `git grep schemacompose
     origin/main -- charly` → plugin_loader.go:20). Measured before editing; the scope was already
     the right one (the gate half), so no action beyond recording it.
  2. My first corpus arm differed from the second in **error text only** (`(and 3 more errors)`
     vs the detailed list): the oracle rendered `%v` while the gate renders `cue/errors.Details`.
     RCA: the oracle did not reproduce the gate's diagnostic rendering. Fixed by using the same
     renderer, then re-measured both arms → byte-identical.
  3. The `.agents` skill prose still described the def as only "KEPT in the base". Fixed in this
     change (claim-keyed sweep below), not filed.
  No warnings in any gate.
- **R2 (no duplication).** One accessor (`composedSchema`), one resolver (`kindValueDefPath`) used
  by both the gate and the fold routing; the def map is not restated anywhere.
- **R3 (no workarounds).** No sleeps/retries. The builtin-unit materialization in the miss path is
  a `sync.Once` one-shot (the same lazy gate the flat plugin-kind path already pays), not a retry.
- **R4 (product before prose).** No documented command changed; the skill prose was corrected with
  the mechanism it describes.
- **R5 (no legacy; claim-keyed sweep).** No identifier was deleted, but the claim "the gate reads
  the KEPT def from the base" was updated everywhere it appears on this surface:

  ```console
  $ grep -rn "KindValueDefs\|sharedCueSchema\|validateKindValueCUE" --include=*.go charly/ | grep -v _test
  charly/provider_kind_invoke.go:71:  … base's spec.KindValueDefs is only the compatibility fallback …
  charly/provider_kind_invoke.go:200: … base's spec.KindValueDefs only as the compatibility fallback …
  charly/provider_kind_invoke.go:364: … kindValueDefPath … the base's spec.KindValueDefs while the body still lives there …
  charly/provider_kind_invoke.go:412: … the `#<Word>Value` shape spec/schema/init.cue derives spec.KindValueDefs from …
  charly/provider_kind_invoke.go:426: … falls back to the base's spec.KindValueDefs …
  charly/provider_kind_invoke.go:437: def, ok := spec.KindValueDefs[disc]
  charly/plugin_loader.go:258: func composedSchema() (cue.Value, bool) {
  charly/cue_schema.go:6: … read from the COMPOSED base & units value …
  ```

  The only remaining `spec.KindValueDefs` reads are the documented fallback and the test
  selection. The two `.agents` references were corrected in the same commit.
- **R6 (preserve work, git safety).** Worktree created off fresh `origin/main` (`152dc845`) in
  its own branch; no unrelated file touched; no force-push, no direct push to `main`.
- **R7 (prove behavior).** Coverage fails without the change (plant A/B, red on assertions); the
  changed path ran live over 2004 real entity bodies with retained output, and the CLI still
  rejects a typo'd `vm:` field. No emitted-artifact boundary is involved.
- **R8 (live services).** N/A — no service boundary in this change.
- **R9 (binary = source).** Worktree-local build at the branch: `./bin/charly version` →
  `2026.315.2219`; no new runtime OS dependency, so `packaging:` is untouched.
- **R10 (fresh disposable proof).** **Not run.** This change touches the in-process loader, not a
  deploy/runtime surface; the campaign brief's proof standard for unit 0 is the corpus + unit +
  CI gate above, and the repo-declared core gate (`go test`, `go vet`, R9 build) passed on the
  final tree. If a `charly check run` bed is required for landability, that needs an operator
  call — stated here rather than implied.

## Change classification

- **Class:** core Go (loader/kind gate + test/skill prose). No CUE schema, no wire type, no pin,
  no gitlink, no `design/*.tsv`, no `TODO.md`.
- **Breaking change + rollback:** no authored surface changes, so the subject carries no `!` and
  no config/wire/CLI consumer breaks: every kind resolves the same def, proven by the 2004-body
  sweep (byte-identical verdict lists before/after). If this gate's new input path itself breaks,
  a consumer sees a **false reject** (`<kind>: field not allowed` on a body that used to load) or
  a **silent false accept** (a typo no longer rejected). Rollback is a revert of this one commit —
  it carries no pins, schema or wire contract, so there is nothing to migrate. If a moved kind's
  plugin is rolled back while charly is not, the gate fails loud with `kind value def #<Word>Value
  not found` rather than skipping.

## Filed issues

None. The findings this round produced were fixed here (the skill-prose claim, the corpus-oracle
rendering); the 20 corpus FAILs are files authored to fail (`design/negative/*`, migration
testdata), unaffected by this change. The chain that consumes this unit is tracked once, in
opencharly/spec#304.

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

* fix(plugin): compose the kind value gate and provider-declared fold

## Summary

`validateKindValueCUE` gated every substrate/candy/host-value kind against
`spec.KindValueDefs[disc]` looked up in `sharedCueSchema()` — the **base schema alone**. A
definition a plugin declares lands in `pluginSchemas.unified` (**base & every served plugin
unit**), a different `cue.Value`, so the moment a kind body left `spec/schema` the gate would stop
finding its def and silently stop gating. `runPluginKind` chose the host-value fold from the same
host-side list (`spec.KindValueDefs` membership).

Now:

- **The gate reads the composed unit.** `kindValueDefValue` resolves the def against
  `pluginSchemas.unified` (via the new `composedSchema()` snapshot), falling back to the base only
  while nothing is composed — and, when the def is in neither the base nor the currently composed
  units, materializes the builtin units once (`sync.Once`) and retries the composed lookup.
- **The fold follows the shape the provider declares.** `kindValueDefPath(prov, disc)` asks the
  provider first: a `class:kind` capability naming a `#<Word>Value` body def in its `InputDef` is
  host-value-gated; `spec.KindValueDefs` is only the compatibility fallback for a body that has
  not moved. `capMeta` now carries that declared `InputDef` (`DeclaredKindInputDef`), so routing
  and gating read the same declaration, in both placements, with no wire/contract change.
  Substrate routing (`DeployTraits`) and the candy factory (`CandyKindCarrier`) were already
  provider-declared and are untouched.

No kind moves here. Every kind whose body still lives in the base resolves the **same def it
always did**, and the composed value is measured **equal to the base for all 11 gated kinds**.

This is `TODO.md` 2.1 / opencharly/spec#304 unit 0 — the gate half. Its prerequisite (per-unit
CUE composition, #1115) is already on `main` (`git merge-base --is-ancestor
8403fc1 origin/main` → YES).

### Files

| File | Change |
|---|---|
| `charly/provider_kind_invoke.go` | `kindValueDefPath` + `kindValueDefValue` + `kindInputDefCarrier`; the gate reads the composed unit; the fold routes on the provider's declared shape |
| `charly/plugin_loader.go` | `composedSchema()` — the composed-unit snapshot accessor |
| `charly/plugin_provider_common.go` | `capMeta.inputDef` + `DeclaredKindInputDef()`; `buildCapMeta` lifts the declared `input_def` |
| `charly/cue_schema.go` | doc comment: the gate reads the composed value |
| `charly/cue_kinds_corpus_test.go` | the corpus test selects and judges through the provider-declared path |
| `charly/kind_value_composed_test.go` | new: the plugin-declared def path, the wire→capMeta chain, the routing contract, the lazy-materialization miss (subprocess), the composed==base measurement |
| `charly/test_main_test.go` | a test-only env knob that lets a re-executed helper start with NO composed schema |
| `charly/kind_value_corpus_sweep_test.go` | new: opt-in real-corpus sweep with a base-only and a composed arm |
| `.agents/skills/plugin/references/authoring-recipes.md` | the rich-value mechanism sentence follows the new source |
| `.agents/skills/go/references/source-map.md` | the gate's def source described accurately in the file map |

## How tested

### 1. What the gate reads, before → after

```console
$ grep -n "defPath, ok := kindValueDefPath\|def, err := kindValueDefValue\|composedSchema()" charly/provider_kind_invoke.go charly/plugin_loader.go
charly/provider_kind_invoke.go:454:	if composed, ok := composedSchema(); ok {
charly/provider_kind_invoke.go:465:	composed, ok := composedSchema()
charly/provider_kind_invoke.go:501:	defPath, ok := kindValueDefPath(prov, pn.Disc)
charly/provider_kind_invoke.go:505:	def, err := kindValueDefValue(defPath)
charly/plugin_loader.go:265:func composedSchema() (cue.Value, bool) {
```

Before: `defPath, ok := spec.KindValueDefs[pn.Disc]` + `def := sharedCueSchema().LookupPath(...)`,
and `runPluginKind` routed on `if _, gated := spec.KindValueDefs[pn.Disc]; gated`.

### 2. Equality for every unmoved kind — composed value == base value

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/ -run TestKindValueDefs_ComposedEqualsBase -v -count=1
=== RUN   TestKindValueDefs_ComposedEqualsBase
    kind_value_composed_test.go:168: android #AndroidValue: composed == base
    kind_value_composed_test.go:168: candy #CandyValue: composed == base
    kind_value_composed_test.go:168: firecracker #FirecrackerValue: composed == base
    kind_value_composed_test.go:168: kindcluster #KindclusterValue: composed == base
    kind_value_composed_test.go:168: kubernetes #KubernetesValue: composed == base
    kind_value_composed_test.go:168: kubevirt #KubevirtValue: composed == base
    kind_value_composed_test.go:168: local #LocalValue: composed == base
    kind_value_composed_test.go:168: pipeline #PipelineValue: composed == base
    kind_value_composed_test.go:168: pod #PodValue: composed == base
    kind_value_composed_test.go:168: task #TaskValue: composed == base
    kind_value_composed_test.go:168: vm #VmValue: composed == base
--- PASS: TestKindValueDefs_ComposedEqualsBase (0.00s)
```

11 of 11 gated defs, compared with `cue.Value.Equals` in a process where `TestMain` registered
the 63 builtin units. (`Subsume` is false both ways even for equal CUE values carrying
disjunctions, so `Equals` is the measurement — and the test pins it as a regression guard.)

### 3. Zero verdicts moved — real corpus, before vs after

The committed sweep (`charly/kind_value_corpus_sweep_test.go`) judges every entity body of a
gated kind through the production gate, with a **base-only arm** that reproduces the pre-change
lookup exactly (`CHARLY_KIND_VALUE_GATE=base`), over the pinned umbrella tree.

```console
$ export TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci CHARLY_CORPUS_ROOT=/home/atrawog/Sync/Atrapub/lo/dsh/opencharly
$ CHARLY_KIND_VALUE_GATE=base CHARLY_CORPUS_OUT=/tmp/kv-base.txt go test ./charly/ -run TestKindValueCorpusSweep -v -count=1
    kind_value_corpus_sweep_test.go:202: gate=base: judged 2004 entity bodies (1646 files unparsable) -> /tmp/kv-base.txt
    kind_value_corpus_sweep_test.go:204:   android      9
    kind_value_corpus_sweep_test.go:204:   candy        1025
    kind_value_corpus_sweep_test.go:204:   kindcluster  24
    kind_value_corpus_sweep_test.go:204:   kubernetes   23
    kind_value_corpus_sweep_test.go:204:   kubevirt     25
    kind_value_corpus_sweep_test.go:204:   local        203
    kind_value_corpus_sweep_test.go:204:   pipeline     12
    kind_value_corpus_sweep_test.go:204:   pod          250
    kind_value_corpus_sweep_test.go:204:   task         47
    kind_value_corpus_sweep_test.go:204:   vm           386
$ CHARLY_KIND_VALUE_GATE=composed CHARLY_CORPUS_OUT=/tmp/kv-composed.txt go test ./charly/ -run TestKindValueCorpusSweep -v -count=1
    kind_value_corpus_sweep_test.go:202: gate=composed: judged 2004 entity bodies (1646 files unparsable) -> /tmp/kv-composed.txt
    kind_value_corpus_sweep_test.go:204:   android      9
    kind_value_corpus_sweep_test.go:204:   candy        1025
    kind_value_corpus_sweep_test.go:204:   kindcluster  24
    kind_value_corpus_sweep_test.go:204:   kubernetes   23
    kind_value_corpus_sweep_test.go:204:   kubevirt     25
    kind_value_corpus_sweep_test.go:204:   local        203
    kind_value_corpus_sweep_test.go:204:   pipeline     12
    kind_value_corpus_sweep_test.go:204:   pod          250
    kind_value_corpus_sweep_test.go:204:   task         47
    kind_value_corpus_sweep_test.go:204:   vm           386
$ diff -u /tmp/kv-base.txt /tmp/kv-composed.txt; echo "diff rc=$?"
diff rc=0
$ sha256sum /tmp/kv-base.txt /tmp/kv-composed.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/kv-base.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/kv-composed.txt
$ for f in /tmp/kv-base.txt /tmp/kv-composed.txt; do echo "$f judged=$(grep -vc '^PARSE-ERR' $f) ok=$(grep -c '|OK$' $f) fail=$(grep -c '|FAIL ' $f)"; done
/tmp/kv-base.txt judged=2004 ok=1984 fail=20
/tmp/kv-composed.txt judged=2004 ok=1984 fail=20
```

Zero lines differ. The 20 FAILs are the **design negative fixtures** (`design/negative/*`), the
retired-pipeline migration fixtures (`charly/charly/testdata/migrate-retired-pipeline`,
`plugin-herdr/…`, `pod-herdr/…`) and `plugin-migrate` testdata — files authored to fail; each
carries the identical verdict on both sides. The 1646 unparsable files are CI workflows, compose
files and other non-charly YAML (identical set on both sides; each is written as `PARSE-ERR <path>`
and those lines diff clean too).

Corroboration on the **actual pre-change code**: a worktree at `origin/main` (`152dc845`) ran the
same harness with only the gate call replaced (`validateKindValueCUE(pn)` and
`spec.KindValueDefs[pn.Disc]` selection instead of `validateKindValueCUE(pn, prov)` /
`kindValueDefPath`); both trees produced the same
`117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c`.

```console
$ git -C /home/atrawog/Sync/Atrapub/lo/dsh/opencharly/charly worktree add --detach \
    /home/atrawog/Sync/Atrapub/lo/dsh/opencharly/.worktrees/dsh-kindvalue-before/charly origin/main
$ # the harness copied in, with the pre-change gate call as shown above
$ CHARLY_CORPUS_ROOT=/home/atrawog/Sync/Atrapub/lo/dsh/opencharly CHARLY_CORPUS_OUT=/tmp/corpus-before.txt \
    go test ./charly/ -run TestZZCorpusSweep -v -count=1
    zz_corpus_sweep_test.go:126: judged 2004 entity bodies (1646 files unparsable) -> /tmp/corpus-before.txt
$ sha256sum /tmp/corpus-before.txt /tmp/corpus-after.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/corpus-before.txt
117afcac27674e333147f86ea91b97c4209ebda545960b2d236ec01baa52029c  /tmp/corpus-after.txt
```

### 4. The new path executes — a kind body registered by a PLUGIN

`TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit` registers a unit serving
`#GateprobeValue`, asserts the **base cannot see it**, then shows the gate accepting a conforming
body and rejecting a typo'd field through it.

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/ -run 'TestKindValueGate_|TestKindValueDefPath_|TestCapMeta_|TestKindValueDefValue_' -v -count=1
=== RUN   TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit
--- PASS: TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit (0.03s)
=== RUN   TestKindValueDefPath_FollowsTheProviderDeclaredShape
--- PASS: TestKindValueDefPath_FollowsTheProviderDeclaredShape (0.00s)
=== RUN   TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability
--- PASS: TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability (0.00s)
=== RUN   TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss
--- PASS: TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss (2.29s)
```

The last two close the production chain the first pair cannot: `buildCapMeta` is the ONLY place a
wire `input_def` becomes `capMeta.inputDef` (the earlier test builds `capMeta` directly), and the
lazy-materialization branch is unreachable in a process where `TestMain` already composed the
builtins — so the helper re-executes the test binary with `CHARLY_TEST_SKIP_BUILTIN_GATE=1`, where
nothing is composed and `#SubstratePlugin` (declared only by plugin-substrate's unit) resolves
only by materializing the builtin units.

### 5. Prove it can fail (planted break, red on assertions, restored byte-identical)

Plant A — the def lookup reverted to the base alone:

```console
$ go test ./charly/ -run TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit -v -count=1
=== RUN   TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit
    kind_value_composed_test.go:88: a conforming gateprobe body must pass the plugin-declared def: kind value def #GateprobeValue not found: field not found: #GateprobeValue
--- FAIL: TestKindValueGate_ReadsAPluginDeclaredDefFromTheComposedUnit (0.02s)
FAIL
```

Plant B — `kindValueDefPath` reduced to the host map fallback:

```console
$ go test ./charly/ -run TestKindValueDefPath_FollowsTheProviderDeclaredShape -v -count=1
=== RUN   TestKindValueDefPath_FollowsTheProviderDeclaredShape
    kind_value_composed_test.go:113: a provider declaring a #<Word>Value body def must be host-value-gated; got "",false
--- FAIL: TestKindValueDefPath_FollowsTheProviderDeclaredShape (0.00s)
FAIL
```

Plant C — `buildCapMeta` stops lifting the wire `input_def`:

```console
$ go test ./charly/ -run TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability -v -count=1
=== RUN   TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability
    kind_value_composed_test.go:183: a kind capability declaring input_def "#WireprobeValue" must expose it; got ""
--- FAIL: TestCapMeta_DeclaredKindInputDefLiftedFromTheWireCapability (0.00s)
FAIL
```

Plant D — the lazy-materialization branch removed (the child re-exec fails through the parent):

```console
$ go test ./charly/ -run TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss -v -count=1
=== RUN   TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss
    kind_value_composed_test.go:230: miss-path helper process failed: exit status 1
        --- FAIL: TestKindValueDefValueMissHelperProcess (0.06s)
            kind_value_composed_test.go:250: the miss path must materialize the builtin units and resolve the def: kind value def #SubstratePlugin not found: field not found: #SubstratePlugin
        FAIL
--- FAIL: TestKindValueDefValue_MaterializesBuiltinUnitsOnMiss (0.26s)
FAIL
```

All four are assertion failures, not build errors. Restored on the committed tree:

```console
$ sha256sum charly/provider_kind_invoke.go charly/plugin_provider_common.go
3b567c004280c19344cfe7b1be490cde9fd65e26f5f16a680cbf876ab9e564de  charly/provider_kind_invoke.go
7a882abb6e9292200b9b2c9484f617e13f4e3a246a56715bf5e605e091071eed  charly/plugin_provider_common.go
$ cmp /tmp/pki.c2 charly/provider_kind_invoke.go && cmp /tmp/ppc.c2 charly/plugin_provider_common.go && echo "cmp identical"
cmp identical
$ git status --short
(empty)
```

### 6. Gates run (the ones CI runs, on the final tree)

```console
$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go test ./charly/...          # ci.yml "Test"
ok  	github.com/opencharly/charly/charly	281.420s
ok  	github.com/opencharly/charly/charly/internal/pluginsgen	120.013s

$ for d in tools/*/; do ( cd "$d" && GOWORK=off go test -count=1 ./... ); done  # ci.yml "Test tools modules"
ok  	github.com/opencharly/charly/tools/gomod-canonical	0.003s
ok  	github.com/opencharly/charly/tools/ledger-validate	0.006s
(generate-packages / golden-cloudinit / golden-compile: no test files)

$ gofmt -l charly tools                                                        # ci.yml "gofmt"
(empty)

$ cd charly && GOTOOLCHAIN=go1.26.8 golangci-lint run ./...                    # ci.yml "golangci-lint" (v2.13.2)
0 issues.
$ for d in tools/*/; do ( cd "$d" && GOWORK=off golangci-lint run ./... ); done
0 issues.   (×5 modules)

$ TMPDIR=/tmp/charly-ci GOTMPDIR=/tmp/charly-ci go vet ./charly/...            # charly/AGENTS.md core gate
(rc=0)

$ ./scripts/bootstrap-charly.sh && ./bin/charly version                        # R9
bootstrap-charly: built ./bin/charly (2026.315.2219)
2026.315.2219

$ ./bin/charly box validate                                                    # live load, real repo
charly box validate: OK — checked 604 candies, 122 boxes, 49 deploys, 7 distros, 7 builders; 0 warnings, 0 errors

$ ./bin/charly box validate        # fixture with a typo'd vm field — the gate still rejects
charly: error: command "validate": validation error: …/charly.yml:doc0: node "myvm": vm: 2 errors in empty disjunction:
               bogusfield: field not allowed:
                   node myvm:1:3
```

`golangci-lint` is v2.13.2 built with `go1.26.8` (`GOTOOLCHAIN=go1.26.8`; the host's
`go1.27.3-X:nodwarf5` breaks its export-data reader). The pin workflows are **N/A by trigger**:
`pin-currency.yml` and `pin-verb-scope.yml` are path-filtered to `charly.yml`, `AGENTS.md`,
`.gitmodules`, `box/**`, `charly/go.mod` and their own scripts — this diff touches none of them.

Evidence fence (`dsh --version` 0.2.1-rc.2; session `39afaf4c-98da-4970-9bb4-c94019bd7ffb`, a
delegated subagent of `session-f8a0eb3b-2677-47a9-8139-49b1ba39440c`; model
`ollama-cloud/deepseek-v4.1-flash`):

```
session: 39afaf4c-98da-4970-9bb4-c94019bd7ffb (delegated from session-f8a0eb3b-2677-47a9-8139-49b1ba39440c)
harness: DeepSeek Harness (dsh) 0.2.1-rc.2
model: ollama-cloud/deepseek-v4.1-flash
tree: .worktrees/dsh-kindvalue-composed/charly @ 152dc84 + this commit
```

## Rulebook compliance

- **R0 (skills first).** Loaded before the first edit/git action: `plugin` (the plugin-host
  contract this gate lives in), `go` (charly source/build), `layer` (the dispatcher's candy/schema
  row), `go-quality` (lint invocation), `git-workflow` (before any git/PR action); `strict-policy`
  loaded for the R1 dispositions below. Every row the dispatcher selects for a core-Go +
  plugin-host change was loaded.
- **R1 (RCA every anomaly).** Three anomalies, each RCA'd:
  1. The brief's premise "unit 0 is outstanding" is half-true — its **prerequisite** had already
     landed (`git merge-base --is-ancestor 8403fc1… origin/main` → YES; `git grep schemacompose
     origin/main -- charly` → plugin_loader.go:20). Measured before editing; the scope was already
     the right one (the gate half), so no action beyond recording it.
  2. My first corpus arm differed from the second in **error text only** (`(and 3 more errors)`
     vs the detailed list): the oracle rendered `%v` while the gate renders `cue/errors.Details`.
     RCA: the oracle did not reproduce the gate's diagnostic rendering. Fixed by using the same
     renderer, then re-measured both arms → byte-identical.
  3. The `.agents` skill prose still described the def as only "KEPT in the base". Fixed in this
     change (claim-keyed sweep below), not filed.
  No warnings in any gate.
- **R2 (no duplication).** One accessor (`composedSchema`), one resolver (`kindValueDefPath`) used
  by both the gate and the fold routing; the def map is not restated anywhere.
- **R3 (no workarounds).** No sleeps/retries. The builtin-unit materialization in the miss path is
  a `sync.Once` one-shot (the same lazy gate the flat plugin-kind path already pays), not a retry.
- **R4 (product before prose).** No documented command changed; the skill prose was corrected with
  the mechanism it describes.
- **R5 (no legacy; claim-keyed sweep).** No identifier was deleted, but the claim "the gate reads
  the KEPT def from the base" was updated everywhere it appears on this surface:

  ```console
  $ grep -rn "KindValueDefs\|sharedCueSchema\|validateKindValueCUE" --include=*.go charly/ | grep -v _test
  charly/cue_schema.go:6:// validateKindValueCUE, which types a substrate/candy node's rich authored value against the
  charly/cue_schema.go:53:// sharedCueSchema must use. LAZY: composing the module instance costs ~39ms (measured on this
  charly/cue_schema.go:59:// sharedCueSchema is the base document schema composed by import: the `schema` package of the
  charly/cue_schema.go:63:var sharedCueSchema = sync.OnceValue(func() cue.Value {
  charly/plugin_loader.go:170:			v = sharedCueSchema()
  charly/plugin_loader.go:261:// so the caller gets ok=false and may fall back to sharedCueSchema(); with at least one
  charly/provider_kind_invoke.go:72:	// base's spec.KindValueDefs is only the compatibility fallback for kinds whose
  charly/provider_kind_invoke.go:201:// base's spec.KindValueDefs only as the compatibility fallback for a kind whose body has not
  charly/provider_kind_invoke.go:230:	if err := validateKindValueCUE(pn, prov); err != nil {
  charly/provider_kind_invoke.go:235:	// validateKindValueCUE's closedness-only gate cannot express — see that function's
  charly/provider_kind_invoke.go:312:	if err := validateKindValueCUE(pn, prov); err != nil {
  charly/provider_kind_invoke.go:365:// (kindValueDefPath: a `#<Word>Value` InputDef, or the base's spec.KindValueDefs while the body
  charly/provider_kind_invoke.go:374:	if err := validateKindValueCUE(pn, prov); err != nil {
  charly/provider_kind_invoke.go:413:// `#<Word>Value` shape spec/schema/init.cue derives spec.KindValueDefs from (the shared
  charly/provider_kind_invoke.go:427:// spec.KindValueDefs, which is why every kind in use today resolves to the same def it always
  charly/provider_kind_invoke.go:438:	def, ok := spec.KindValueDefs[disc]
  charly/provider_kind_invoke.go:459:	if d := sharedCueSchema().LookupPath(cue.ParsePath(defPath)); d.Err() == nil {
  charly/provider_kind_invoke.go:476:// validateKindValueCUE validates an externalized structural kind node's authored VALUE against
  charly/provider_kind_invoke.go:494:func validateKindValueCUE(pn spec.ParsedNode, prov Provider) error {
  charly/registry_bootstrap.go:31:// (validateKindValueCUE). So spec.KindWords is now EMPTY and the former
  ```

  The only remaining `spec.KindValueDefs` READ in production code is the fallback at
  `provider_kind_invoke.go:438`; every other hit is a comment describing it (and `sharedCueSchema`
  retains its two legitimate uses: the first-unit materialization at `plugin_loader.go:170` and
  the base fallback at `provider_kind_invoke.go:459`). The two `.agents` references were corrected
  in the same commit.
- **R6 (preserve work, git safety).** Worktree created off fresh `origin/main` (`152dc845`) in
  its own branch; no unrelated file touched; no force-push, no direct push to `main`.
- **R7 (prove behavior).** Coverage fails without the change (plant A/B, red on assertions); the
  changed path ran live over 2004 real entity bodies with retained output, and the CLI still
  rejects a typo'd `vm:` field. No emitted-artifact boundary is involved.
- **R8 (live services).** N/A — no service boundary in this change.
- **R9 (binary = source).** Worktree-local build at the branch: `./bin/charly version` →
  `2026.315.2219`; no new runtime OS dependency, so `packaging:` is untouched.
- **R10 (fresh disposable proof).** Classified, not deferred: the acceptance surface of this
  change IS the project load, and the gate that owns it is the corpus + live-load gate above
  (`bin/charly box validate` over the real repo — 604 candies, 122 boxes, 49 deploys, 0 warnings —
  plus 2004 real entity bodies through the changed function). The diff touches no deployment,
  candy runtime, service, CUE schema or wire type, so no `disposable: true` target's runtime
  surface changes and no `charly check run` bed selects for it; the repo-declared core gate
  (`go test ./...`, `go vet ./...`, R9 build) ran on the final tree. That is the change-class
  decision, taken here rather than pushed to the operator.

## Change classification

- **Class:** core Go (loader/kind gate + test/skill prose). No CUE schema, no wire type, no pin,
  no gitlink, no `design/*.tsv`, no `TODO.md`.
- **Breaking change + rollback:** no authored surface changes, so the subject carries no `!` and
  no config/wire/CLI consumer breaks: every kind resolves the same def, proven by the 2004-body
  sweep (byte-identical verdict lists before/after). If this gate's new input path itself breaks,
  a consumer sees a **false reject** (`<kind>: field not allowed` on a body that used to load) or
  a **silent false accept** (a typo no longer rejected). Rollback is a revert of this one commit —
  it carries no pins, schema or wire contract, so there is nothing to migrate. If a moved kind's
  plugin is rolled back while charly is not, the gate fails loud with `kind value def #<Word>Value
  not found` rather than skipping.

## Filed issues

None. The findings this round produced were fixed here (the skill-prose claim, the corpus-oracle
rendering); the 20 corpus FAILs are files authored to fail (`design/negative/*`, migration
testdata), unaffected by this change. The chain that consumes this unit is tracked once, in
opencharly/spec#304.

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

---------

Co-authored-by: aitrawog <[email protected]>
github-actions Bot pushed a commit to opencharly/.github that referenced this pull request Nov 13, 2026
… the release (#287)

* fix(gate): the engine pin measures the asset and names the class, not the release

The validator's `Ensure charly` step decides whether the pinned release's assets can
be obtained before a review is attempted, and when it cannot, it hands a class to the
gate. It fetched with `curl -fsSL` — discarding the status and the body — and then
reported, for EVERY failure, "the release is published but its assets could not be
downloaded (a partial upload)". That sentence is false for the failure that actually
happens, and it names a remedy that is already true.

MEASURED, 2026-11-09 (#285):
  .../v2026.308.2259/charly-linux-amd64    -> 200, 37097634 B
  .../v2026.313.0209/charly-linux-amd64    -> 504, 92 B   (GitHub's gateway page)
  .../v2026.313.0209/charly-candy-charly.yml -> 200, 23561 B   (same release)
  .../v2026.308.2259/charly-candy-charly.yml -> 504, 92 B     (same release)
Both releases report every asset `state: uploaded` at its full size over the release
API, so no API-only check can see the condition; the same bytes answer 200 over the
API asset route while the download path 504s. The failing hop is GitHub's
release-download path, it is INTERMITTENT and per-OBJECT, and a pin move moves the
failure instead of removing it.

So each asset is now fetched WITHOUT `-f` and the BYTES are judged: HTTP status, size
and the first four magic bytes (ELF for the binary, gzip for the plugin bundle). A 200
carrying a gateway page is not an engine. The release's own state is measured
separately over the API, and the gate reports one of three classes, each with its own
remedy:
  endpoint-failed  the download path failed   -> RE-RUN; never move the pin
  absent           the release does not serve it -> re-upload or move the pin
  no-tag/absent/draft release                  -> serve the release or move the pin
The comment's `class:` line now carries the failing asset's URL and HTTP status.

No review criterion, model setting, timeout or auto-close threshold is changed: the
class stays INFRA and is still excluded from AI_REVIEW_AUTO_CLOSE_AFTER, and the gate
still fails closed (the required check stays RED; unreviewed code never merges).

Coverage: `scripts/engine-pin-asset_test.sh` extracts the shipped steps and runs THEM
against a stubbed `curl` (six discriminations, including a 200 that is not the asset),
asserts the posted comment body, and turns itself RED under three negative controls.
`scripts/proof-engine-pin.sh` replaces the retired `proof-unresolvable-pin.sh` and runs
the same shipped text live, for the measurement. The gate's own `pin_class` output and
its "(a partial upload)" sentence are retired, with the claim sweep pasted in the PR.

Refs: #285, opencharly/charly#723, opencharly/charly#1115

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

* fix(ci): the proof harness resolves its example tags at run time, never as literals

The harness defaulted to two literal tags. That is the same rot-prone shape this change
is about, and the org's own retired-name sweep is what caught it: the sweep for the tag
the brief named found it in `scripts/proof-engine-pin.sh`.

The default pair is now derived at run time — the tag the org pin names today, and the
release before it — and the file names no tag at all. Passing two tags still overrides
both, which is how the harness was exercised.

Round-1 evidence: `git grep 'v2026.308.2259'` over the tree now returns rc=1 with 0
files, while the same predicate matches a tag the tree does carry (calibrated, not silent).

NOT PUSHED YET: the open verdict asks for a T4 maintainer sign-off, and this commit rides
with it so the final head carries both.

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

* fix(ci): the harness reaches its output block, and the body counts four classes
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