Skip to content

fix(loaderkit): the declared-fields channels floor to the CONTRACT at the parse seam — the executor-boundary declared-fields completion - #226

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

Conversation

@atrawog

@atrawog atrawog commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

The declared-fields channels (spec.Threaded.StructuralDeclaredFields from spec #104, spec.Threaded.DeployDeclaredFields from spec #107) are HOST-process registry state: charly's loaderThreaded() snapshots each recognized word's declared input-schema body field names from pluginSchemas.inputDefs, whose population is lazy (the builtin schema gate runs inside loadProjectPlugins, mid-load; an external plugin's served schema registers only at its connect). A parse that consumes a Threaded BEFORE that gate — the executor loader legs (loaderkit.LoadUnifiedViaExecutor's "loader-walk"/"loader-threaded" host legs, shared by plugin-fleet fleet add, plugin-build build:project, and the deploy-target surfaces), the plugin-side Threaded consumers (plugin-box validate, plugin-build resolve), or any process whose load interleaves differently — receives EMPTY declared-fields maps, and the documented no-declared-schema fallback re-arms the unsafe value-shape scan: a converted tree's declared #Deploy fields re-scan as in-substrate members.

Live repro (RCA'd and reproduced on the settled pin set, charly 2026.249.2351): charly fleet add check-agent-pod in distro-arch fails deterministically with:

charly: error: command "fleet": /…/distro-arch/charly.yml:doc0: node "sandbox": expected a mapping value, got yaml kind 8

— the exact regression sdk #223/#225 fixed for the populated host-side parse, re-armed at the executor seam. The walk leg runs host-side, but its Threaded is assembled from the LIVE registry at parse time, so the channel's completeness depends on process-lifecycle timing — violating the design ruling: the declared-fields maps are CONTRACT DATA (what each kind schema declares), not host-registry state.

THE FIX — the declared-fields CONTRACT FLOOR (mechanism (c), proven by RCA): loaderkit already compiles the embedded spec/schema contract lazily (cue_schema.go's sharedCueSchema + the cueKindDefs table). The parse's declared-fields lookup (ONE helper, threadedDeclaredFields, serving both the substrate branch and the structural branch of parseNode) now consults: the threaded (served-schema) entry when present — authoritative, presence wins, byte-identical host-side behavior — else the CONTRACT-declared field set derived from the embedded spec/schema (the SAME single source cue:gen and charly's base-schema splice derive from — R3); a word the contract does not declare (an external plugin kind) floors to nil — the documented no-declared-schema fallback, unchanged. Result: a parse of a converted tree behaves IDENTICALLY at every placement and every registry-timing state — host-side or plugin-side, gate-run or pre-gate — because the tier-1 declared fields never depend on process lifecycle.

Two prior tests (TestParseFold_PreservesAuthoredDepth, TestParse_MemberCarrierKeysStrippedFromBody) fabricated an in-body member keyed sidecar: — a field the vm contract DECLARES — pinning the pre-floor empty-Threaded divergence. Their in-body member key is renamed to a non-declared name (inbed); every assertion (authored-depth positions, body retention, emitter stripping, nested recursion) is preserved, with the naming rule documented in the test comments.

How tested

TDD (red → green), all -count=1:

  1. RED (the fix reverted): the new executor-seam test reproduces the live error verbatim:

    go test ./loaderkit/ -run 'TestLoadUnifiedViaExecutorSeam_DeclaredFieldsFloor|TestParse_DeclaredFieldsContractFloor_Substrate' -count=1
    declared_fields_executor_test.go:77: LoadUnified (degraded executor Threaded): …/charly.yml:doc0: node "sandbox": expected a mapping value, got yaml kind 8

  2. GREEN (the fix applied):

    go build ./... → clean
    go vet ./... → clean
    go test ./... -count=1 → EXIT:0, 10 packages ok, 0 FAIL

  3. Prior pinned tests stay green (-count=1): TestParseFold_PreservesAuthoredDepth, TestNoDualMapConstruction, TestDeployNodeHasNoDualMaps, TestParse_StructuralDeclaredFieldStaysData, TestParse_SubstrateDeclaredIterateStaysData, the parse-guard suite (8a class), TestParseDoc_*.

  4. LIVE end-to-end proof: a throwaway charly binary built against this sdk checkout (go.mod replace, /tmp clone — charly unmodified) turns the deterministic distro-arch repro from

    charly: error: command "fleet": /…/distro-arch/charly.yml:doc0: node "sandbox": expected a mapping value, got yaml kind 8

    into a full clean load that proceeds past the parse to actual deployment ("Overlay image ready … To start the container, run: charly start check-agent-pod").

Rulebook compliance

Change classification

  • Change class: sdk/loaderkit parse-mechanism fix (the declared-fields channel completion over the executor boundary) + test updates (two fabricated member keys renamed to non-declared names, assertions preserved).
  • Verification gate: go build/vet/test -count=1 GREEN on the final tree (full module, 10 packages) + the live repro flip (fail → clean deploy-path) through a throwaway charly binary.
  • Attribution tier: fully tested and validated — the changed parse path executed live (the distro-arch fleet add repro) with retained output, and the full gate passed.

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

… the parse seam — the executor-boundary declared-fields completion

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

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

Two prior tests fabricated an in-body member keyed 'sidecar:' (a vm-contract-DECLARED
field), pinning the pre-floor empty-Threaded divergence; their member key is renamed to a
non-declared name with every authored-depth assertion preserved.
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: c50a2b2b01c2 (branch: feat/declared-fields-contract-floor)

Security screen: PASS — no scope mismatch (summary accounts for all 5 files), no secrets/network/new deps, no guardrail weakening, no embedded directives.

Checklist: All applicable rules PASS or NA.

  • Change class: sdk/loaderkit parse-mechanism fix + test updates. Code change → fresh-rebuild gate satisfied (go build/vet/test -count=1 GREEN, red→green TDD, live cross-repo repro flip through a throwaway charly binary).
  • A1/A2/A3: Body supplies Summary, How-tested (named gate, fresh rebuild, changed path executed live, pasted red-test output + live error/success), rulebook compliance, and the exact *Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)* footer. Tier justified — the changed parse path executed live.
  • R1/R2/R3/R4/R5: RCA end-to-end (no flake framing); no parked follow-up; ONE lookup helper (threadedDeclaredFields) serving both parse branches, floor derived from the single embedded contract (no drift surface); no sleeps/workarounds; no dead identifiers left.
  • R10/B17: Full module suite + named tests + live disposable /tmp-clone repro; internally consistent with the diff.
  • Architecture gate: placement CORRECT — the floor is a kind-blind loader mechanism in the loader kit (sdk), not capability code in core; no alias growth, no new core→sdk-kit import.
  • SDD/ADE: N/A — no schema/cue/proto/candy changes; the floor consumes the existing embedded CUE contract.
  • Comment intake: thread empty; nothing to re-derive.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 7, 2026 00:17
@github-actions
github-actions Bot merged commit f8b035e into main Sep 7, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 7, 2026
@aitrawog
aitrawog deleted the feat/executor-declared-fields branch September 25, 2026 19:07
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