Skip to content

fix(loaderkit): the in-body member scan fires only where member nesting is meaningful — the parent-disc guard - #222

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/parse-guard
Sep 6, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/parse-guard

Conversation

@atrawog

@atrawog atrawog commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the parse regression sdk #221 introduced in the member-tree cutover: discEntityPairs/isEntityValue scanned EVERY disc-value body for kind words, so a schema block key whose mapping carries a member-disc word classified as an IN-BODY member. The live corpus shape (distro-arch check-agent-live, caught by charly's TestCueKinds_Corpus): a GROUP body's iterate: block carries an agent: key — an external structural kind WORD colliding with a group-schema FIELD name — so parseNode("iterate") classified agent as its disc, the remaining iterate fields became member pairs, and the scalar sandbox: check-agent-pod hard-failed with node sandbox: expected a mapping value, got yaml kind 8.

The design intent of Cutover C: member nesting = substrate bodies. The guard makes the in-body member scan parent-disc-aware — it fires ONLY when the parent disc is a DEPLOY SUBSTRATE (t.DeploySubstrates) or an external STRUCTURAL kind (t.StructuralKinds):

  • Substrate/structural bodies (vm/pod/local/android/kubernetes, external structural plugin kinds) keep scanning — the authored-depth channel (in-substrate vs deploy-level members) works exactly as feat(loaderkit): the uniform ordered member tree — parse preserves the authored depth, the fold stamps position (Cutover C task 0, parse half) #221 shipped it, recursively.
  • Arbitrary resource-kind bodies (group/check/candy/box — host-threaded kinds whose closed schemas define fields that can collide with kind words: agent:, sandbox:, ...) no longer scan — their body travels untouched as data and the closed-schema gates own it; their members are DEPLOY-LEVEL siblings only (the memberPairs loop, unchanged).
  • The dead in-body error branch (unreachable under the guard: every scan kind is a memberDisc kind) is removed in the same commit — nothing else changed.

How tested

Test-first: the fixture was written and observed FAILING with the exact corpus error before the fix:

--- FAIL: TestParse_InBodyScan_OnlyNestingKinds (0.00s)
    parse_guard_test.go:44: ParseDoc: node "sandbox": expected a mapping value, got yaml kind 8

After the guard, the full gate on the FINAL COMMITTED tree (b6b767a), -count=1:

$ go build ./... && go vet ./...        # BUILD_OK / VET_OK
$ go test ./... -count=1
ok  \tgithub.com/opencharly/sdk\t0.058s
ok  \tgithub.com/opencharly/sdk/agentkit\t0.527s
ok  \tgithub.com/opencharly/sdk/buildkit\t0.005s
ok  \tgithub.com/opencharly/sdk/candywalk\t0.002s
ok  \tgithub.com/opencharly/sdk/deploykit\t1.756s
ok  \tgithub.com/opencharly/sdk/enginekit\t0.005s
ok  \tgithub.com/opencharly/sdk/kit\t2.044s
ok  \tgithub.com/opencharly/sdk/loaderkit\t0.035s
ok  \tgithub.com/opencharly/sdk/packagekit\t0.014s
ok  \tgithub.com/opencharly/sdk/vmshared\t0.114s

New fixture proof (loaderkit/parse_guard_test.go), all green:

  • TestParse_InBodyScan_OnlyNestingKinds — the distro-arch corpus shape (group bed + iterate: block + agent: key + scalar sandbox), with agent threaded as a structural kind word: parses clean, the ONLY child is the deploy-level sibling watcher, and the FULL iterate body (sandbox/agent/plateau_iteration/...) travels intact as the group's data.
  • TestParse_InBodyScan_StructuralBodyStillScans — the guard's positive arm: an external STRUCTURAL body still nests IN-BODY members (the 8a external-structural channel does not regress).

All prior member-tree tests stay green: TestParseFold_PreservesAuthoredDepth (in-body nests + bare sibling, recursive), TestParse_MemberCarrierKeysStrippedFromBody, TestMemberDisc_Unity, TestParse_ExternalStructuralChildUnderExternalStructuralParent (8a), TestNoDualMapConstruction, and the full corpus.

Executed sweep for the removed spelling (committed tree): git grep -n "in-body member %q is not allowed" -- "*.go" → no residue (exit 1).

Rulebook compliance

  • R0 — skills loaded before first action: /charly-internals:git-workflow (this landing), plus the sdk CLAUDE.md signpost.
  • R1 — RCA performed before remediation: the parent-disc-kind design question resolved from the Cutover C intent (member nesting = substrate bodies; resource-kind bodies have closed schemas) before any edit.
  • R2 — no bypass of any gate; hooks intact.
  • R3 — no duplication: the guard reuses the existing Threaded DATA (t.DeploySubstrates/t.StructuralKinds) — no new vocabulary or parallel copy.
  • R4 — no workarounds: the fix is the guard itself, no sleeps/retries/hand-pins.
  • R5 — the dead in-body error branch is deleted in the SAME commit, with the executed sweep pasted above proving no residue.
  • R6 — git safety: git status verified before commit (clean post-commit), no force-push, no direct main push, no hook bypass; branch advances only by this commit.
  • R7 — the gate is proven, not planned: full go build ./... && go vet ./... && go test ./... -count=1 pasted above.
  • R8 — attribution footer below; change class stated.
  • R9 — scope: loaderkit parse + its test only; no other package touched.
  • R10 — fresh disposable proof: the full gate ran on the FINAL COMMITTED tree (b6b767a), never on an edited working state.

Change classification

  • Change class: Go bug fix (parse correctness) + regression tests — no schema change, no pin change, no generated-code drift.
  • Verification gate: the full module Go gate (build/vet/test -count=1) on the committed tree — pasted above.
  • Attribution tier: fully tested and validated (gate green on the final tree; the changed path executed live by the new fixture and the full suite).

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

…ng is meaningful — the parent-disc guard

The corpus regression (distro-arch check-agent-live, caught by charly's
TestCueKinds_Corpus after #221): a GROUP body's iterate: block carries an
agent: key — an external structural kind WORD colliding with a group-schema
FIELD name. discEntityPairs/isEntityValue scanned EVERY disc-value body for
kind words, so parseNode(iterate) classified agent as its disc; the remaining
iterate schema fields became member pairs and the scalar sandbox hard-failed
(node sandbox: expected a mapping value, got yaml kind 8).

The design intent: member nesting = substrate bodies. In-body member detection
now fires ONLY when the parent disc is a DEPLOY SUBSTRATE (t.DeploySubstrates)
or an external STRUCTURAL kind (t.StructuralKinds) — never inside an arbitrary
resource-kind body (group/check/candy/box) whose closed schema may define
fields colliding with kind words; such bodies travel untouched as data and
their members are deploy-level siblings only. The dead in-body error branch
(unreachable under the guard) is removed in the same commit.

New tests: the corpus fixture (group bed + iterate + agent + scalar sandbox)
proves the collision shape parses with its full body intact and the only child
being the deploy-level sibling; the structural positive arm proves an external
structural body still nests in-body members (the 8a channel keeps working).
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: b6b767a6cc71 (branch: feat branch)

Security screen: PASS — no scope mismatch (parse guard + test only, matches description), no secrets/network/guardrail changes, no supply-chain edits, no embedded directives.

Change class: Go bug fix (loaderkit parse correctness) + regression tests.

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3: body complete, accounts for both files, full go build/vet/test -count=1 pasted on the final committed tree, changed path executed live by the new fixtures; fully tested and validated tier justified.
  • B5 (R1): clear RCA (sdk feat(loaderkit): the uniform ordered member tree — parse preserves the authored depth, the fold stamps position (Cutover C task 0, parse half) #221 regression — structural kind word agent colliding with group-schema field), zero warnings in output.
  • B10 (R5): dead error branch removed in same commit with executed git grep sweep pasted (no residue).
  • B12 (R10): fresh rebuild, zero warnings, new tests that fail without the fix (fixture shown failing pre-fix); positive arm pins the structural channel.
  • B16 (placement): CORRECT — parse logic stays in the loader kit; no new core imports, no alias files, no capability pulled inward.
  • B18: diff is gofmt-clean, no visible lint issues.
  • No comments on the thread to disposition.

Tool-limited note: I cannot re-run the build; the pasted go test output is internally consistent (all packages incl. loaderkit compile+pass, which implies the retained allowMembers binding is still used elsewhere in parseNode). No contradiction with the diff, so no finding.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 6, 2026 20:24
@github-actions
github-actions Bot merged commit e6c7eb0 into main Sep 6, 2026
1 check passed
charly-auto-merge Bot added a commit that referenced this pull request Sep 6, 2026
github-actions Bot pushed a commit that referenced this pull request Sep 6, 2026
…e, minus the declared input-schema fields (#223)

Follow-up to #222 (parent-disc guard), incorporating the refined design
ruling. #222's parent gate alone does not fix the live corpus bug: group is a
STRUCTURAL kind (plugin-group declares Structural:true, #GroupInput), so the
#222 scan ran for group bodies and the value-shape channel
(isEntityValue) still classified iterate's `agent:` key as a disc. The
fixture threaded group as a non-structural kind — mis-modeled against the
live host.

The refined rule, data-driven from Threaded (zero hardcoded words):

- SUBSTRATE parent (t.DeploySubstrates) — UNCHANGED: the entity-keyed
  value-shape scan (discEntityPairs/isEntityValue). Substrate bodies have no
  colliding declared fields (their unknown keys are already rejected by their
  own decoders); the authored-depth sidecar shape keeps working.
- STRUCTURAL parent (t.StructuralKinds) — the KEY rule: an in-body key is a
  member iff the KEY ITSELF is a memberDisc word, minus the kind's DECLARED
  input-schema fields (new spec.Threaded channel StructuralDeclaredFields,
  fed by the host from the registered #XInput schema — spec#104,
  v0.2026249.2030). A non-kind key is opaque data whose value is NEVER looked
  inside (no transitive recursion — the `iterate:`-carrying-`agent:` collision
  class dies); a kind-word key that IS a declared field stays data; a kind
  with NO declared schema threaded falls back to every kind-word key being a
  member (documented + tested).

Tests rebuilt around the live threading: the exact distro-arch iterate fixture
(group STRUCTURAL + declared fields threaded) parses as DATA; the no-schema
fallback and the kind-word-named declared-field exclusion each pinned; all
prior surfaces (authored depth, member-carrier stripping, memberDisc unity,
8a external-structural, no-dual-map) stay green.

Gate: go build/vet/test ./... -count=1 green on the committed tree.
github-actions Bot pushed a commit that referenced this pull request Sep 6, 2026
…d #Deploy fields — the deploy-declared-fields channel (sdk #221 class) (#225)

The #222/#223 parent-disc + key-rule guards fixed the STRUCTURAL arm, but the
SUBSTRATE arm (t.DeploySubstrates) still scanned disc values by VALUE SHAPE
(discEntityPairs/isEntityValue): a declared #Deploy field whose value mapping
carries a kind-word key classified as an IN-SUBSTRATE MEMBER. The proven
repro (the canonical charly-cli ADE iterate-entity bed): a pod primary body
with iterate: {sandbox: check-agent-pod, agent: [check-agent-live-claude],
plateau_iteration: 1, ...} — `agent` is a kind word, so `iterate:` classified
as a member named "iterate", parseNode("iterate") took `agent` as ITS disc,
and the scalar `sandbox:` hard-failed "expected a mapping value, got yaml
kind 8". Renaming the key to agentsX got past the raw parse (then CUE:
field not allowed) — isolating the parse class.

Same mechanism as #223, extended to deploy substrates: membership semantics
live in the PARENT kind's declared schema — for substrates that is #Deploy's
OWN CUE schema. The new spec.Threaded.DeployDeclaredFields channel
(opencharly/spec#107, v0.2026249.2215 — the #104 StructuralDeclaredFields
twin) is consulted by the substrate branch: a pair whose KEY is a declared
#Deploy field is DATA — its value is never looked inside; every other
entity-keyed value-shape member (web:/chrome:/sidecar:) stays a member. A
substrate word with NO declared schema threaded keeps the plain value-shape
scan (the documented no-declared-schema fallback). Zero hardcoded lists.

Also pins spec v0.2026249.2215 (the channel's contract change).

Gate: go build/vet/test ./... -count=1 green on the committed tree; the
repro fixture + the full corpus (authored-depth, 8a external-structural,
TestParse_StructuralDeclaredFieldStaysData, TestNoDualMapConstruction) green.
@aitrawog
aitrawog deleted the feat/parse-guard 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