Skip to content

feat(loaderkit): the uniform ordered member tree — parse preserves the authored depth, the fold stamps position (Cutover C task 0, parse half) - #221

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

Conversation

@atrawog

@atrawog atrawog commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Cutover C task 0's PARSE half (the nested-capture plan): the sdk consumes spec #103's ONE uniform ordered member tree (Deploy.Member []Member{Name, Position, Node}) end to end — the parse PRESERVES the authored depth, the FOLD stamps Member.Position from it, and the dual Children/Members map construction DIES from sdk. Re-pins github.com/opencharly/spec to v0.2026249.1948 (the #103 tag).

  • Unified classification (8a) — the three drift-prone member-kind spellings (classifyKind's asChild arm, parseNode's parent-allow check, IsResourceDisc's fold set) collapse into ONE Threaded-fed function, memberDisc (clause-D data: resource kinds ∪ threaded structural kinds ∪ threaded deploy substrates). classifyKind(asChild) now consults t.StructuralKinds — the external-structural-child-under-external-structural-parent parse bug dies.
  • Parse preserves intent — an entity-kind key INSIDE a disc value body parses as an IN-SUBSTRATE member child of that substrate, recursively (detection: a mapping value carrying a memberDisc discriminator — the same rule the node level applies); a key BESIDE the kind key parses as a DEPLOY-LEVEL member. Duplicate member names within a node are a hard parse error. The authored body KEEPS the in-body member keys (the fold's position channel), and every body EMITTER (discValue/AssembleEntityBody/EntityBodyJSON) omits them — which is how substrate closedness stops rejecting resource-member keys.
  • Fold by position — BuildFleetNode's Target == "" root-kind branch is DELETED; BuildResourceMemberChildren returns the ordered []spec.Member per the frozen spec seam, stamping Position (in-substrate = named by a top-level key of the authored disc body; deploy-level = not). The dual-map construction is gone.
  • Consumers migrated (no dual representation survives in sdk): loaderkit/fleet_load.go (FlattenFleetVenues/hoistVenueSubtree/FoldMembers/ValidateMembers over the ordered list — venue flattening now reads Position, not node kind), loaderkit/validate_check_beds.go (HasMembers), deploykit/deploy_nodeform.go (the overlay writer flattens the ONE ordered list; member/member_of skip-keys), deploykit/deploy_state.go (FleetWalkPre/PostOrder recurse IN-SUBSTRATE members — the old Children-only semantics; FindFleetNode searches BOTH positions at any depth), deploykit/deploy_tree.go (WalkDeploymentTree → in-substrate members), deploykit/fleet_members.go (BringUp/TearDownMembers over DeployLevelMembers; the new fleet.DeployNestedLocalChildren(parent, node, apply) signature), deploykit/member_dns_preflight.go (deploy-level member set), deploykit/deploy_fleet_ops_aliases.go (the dead SortedNestedKeys alias removed), kit tests (descent recursion + VM domain lock over the Member tree).

Deliberately untouched (accounting): FleetNode is NOT renamed (the fleet-vocabulary retirement rides a later task); spec.StructuralKindLoadEnv.Members stays the plugin wire map per spec #103's accounting — charly's runPluginKind call site adapts in the charly PR of the wave (expected breaking surface, same as the spec PR declared).

How tested

go build ./... — clean (no output).

go vet ./... — clean (no output).

go test -count=1 ./... (fresh, uncached):

ok  	github.com/opencharly/sdk	0.062s
ok  	github.com/opencharly/sdk/agentkit	1.100s
ok  	github.com/opencharly/sdk/buildkit	0.009s
ok  	github.com/opencharly/sdk/candywalk	0.009s
ok  	github.com/opencharly/sdk/deploykit	1.967s
ok  	github.com/opencharly/sdk/enginekit	0.005s
ok  	github.com/opencharly/sdk/kit	2.096s
ok  	github.com/opencharly/sdk/loaderkit	0.037s
ok  	github.com/opencharly/sdk/packagekit	0.016s
ok  	github.com/opencharly/sdk/vmshared	0.110s

New tests (loaderkit/member_tree_test.go):

  • TestParseFold_PreservesAuthoredDepth — in-body member under a VM bed NESTS (Position: in-substrate), bare deploy-level sibling STAYS deploy-level, both under a workload root (the deleted root-kind branch used to collapse these); recursive depth proven (a member inside an in-body member nests).
  • TestParse_MemberCarrierKeysStrippedFromBody — the authored body keeps the member key; EntityBodyJSON/AssembleEntityBody emit it stripped (closedness clean), real data intact.
  • TestMemberDisc_Unity — classifyKind(asChild), IsResourceDisc, and memberDisc agree over resource/structural/substrate/plain-kind/unknown probes.
  • TestParse_ExternalStructuralChildUnderExternalStructuralParent — the 8a regression; a non-member kind still rejects members.
  • TestDeployNodeHasNoDualMaps — reflect gate: no Children/Members/Inside field on spec.Deploy.
  • TestNoDualMapConstruction — EXECUTED grep sweep (not prose) over every non-test Go file in the module for SortedMemberKeys, SortedNestedKeys, .HasChildren(, and the dual-map construction spellings. Real catch during authoring: the gate flagged the identifier surviving in a fleet_load.go comment — fixed (the gate works).

Executed sweep claims (all paste-verified during authoring):

$ go build ./... && go vet ./...   # both clean (no output)
$ gofmt -l loaderkit deploykit kit   # only the pre-existing kit/sshconfig_test.go (untouched by this PR)
$ git grep -n "SortedMemberKeys\|SortedNestedKeys\|\.HasChildren(" -- '*.go' | grep -v _test.go
(no output)

Rulebook compliance

  • R0 — skills loaded before the first tool call (/charly-internals:git-workflow, /charly-internals:go; sdk/CLAUDE.md signpost read; the nested-capture plan's Cutover C + spec feat(loaderkit)!: relocate LoadUnified/ApplyDiscover orchestration from charly core #103's PR body re-read before designing).
  • R1 — the doc-vs-reality fold bug was RCA'd in the plan's spike (RDD-1); this implements the anchored root fix's parse half. One mid-task RCA: the grep gate flagged a residue — root cause was the identifier surviving in a comment (mine), fixed in-tree; no blind retry.
  • R3 — ONE member representation (the ordered tree), ONE classification function (memberDisc) consumed by parse-child, parse-parent-allow, and fold alike, ONE body-emit strip point (discValue).
  • R5 — cutover complete for sdk: the dual-map construction, the map-era ordering helpers (SortedNestedKeys alias, SortedMemberKeys forwarder), and the root-kind branch are deleted, no aliases; the missing-disposition lesson applied — every removed surface is named above with its replacement, and the one deliberately-kept surface (StructuralKindLoadEnv.Members, a plugin WIRE contract) is accounted.
  • R6 — no force-push, no direct main push, no hook bypass; feat/ branch + PR-only landing.
  • R7 — the gate is proven on the final committed tree: build/vet/test tails above pasted from the live run (not prose).
  • R10 — fresh disposable proof: go test -count=1 (uncached) over the committed tree; the grep-gate test re-executes the dead-code sweep inside the suite so it can never rot.
  • Missing disposition — nothing silently dropped: group kind removal, the fleet-vocabulary retirement, and charly core's consumer migration are the wave's next PRs (task 1/step 2 of the cutover), NOT residuals of this one.

Change classification

Change class: mechanism migration + parse semantics fix (loaderkit/deploykit/kit, sdk module); verification gate: go build ./... && go vet ./... && go test -count=1 ./... green on the final tree + the in-suite executed sweeps; attribution tier: fully tested and validated (changed paths executed live: parse, fold, member walks, overlay writer paths via the suite).

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

…e authored depth, the fold stamps position (Cutover C task 0, parse half)
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: 0a39dcdb1cbe240c2d118ea5bc672df02f6d179b (branch: feat/loaderkit-uniform-member-tree)

Security screen: PASS — no secrets/exfiltration, no scope mismatch (all 19 files accounted in the body), no weakened guardrails, no unexpected supply-chain change (spec re-pin is the intended #103 tag, consistent across go.mod/go.sum).

Checklist: All applicable rules PASS or NA.

  • A1/A2/A3 — Body is complete: summary accounts for every file, How-tested names the gate (go build/go vet/go test -count=1 fresh) with pasted output, attribution tier fully tested and validated is justified (changed parse/fold/walk/overlay paths executed via the suite), and the *Assisted-by: pi openrouter/deepseek/deepseek-v4-flash-0731 (fully tested and validated)* footer is present in the exact required form.
  • R1/R2 — Genuine RCA for the one mid-task failure (grep gate flagged a comment residue, fixed in-tree); no forbidden framing. The "deliberately untouched" surfaces (FleetNode rename, StructuralKindLoadEnv.Members, group-kind removal, charly consumer migration) are each routed to a NAMED wave PR (task 1/step 2 of the cutover), not a vague follow-up.
  • R3/R5 — Three drift-prone member-kind spellings collapse into ONE memberDisc; dual-map construction, SortedNestedKeys alias, SortedMemberKeys forwarder, and the root-kind branch are all deleted. The in-suite TestNoDualMapConstruction re-executes the dead-code sweep so it cannot rot.
  • R10 — Fresh uncached go test -count=1 over the committed tree, all packages ok; new tests prove the new behavior (position stamping, closedness strip, classification unity, 8a regression, reflect gate) and would fail without it.
  • B16 placement — CORRECT: the member tree is a spec wire shape consumed by the loader (loaderkit) and deploy mechanisms (deploykit); no capability moved into core, no new aliases (one removed), no *Legacy* identifiers, no new kit imports into core.
  • B18 — Diff is gofmt-clean and lint-clean; no dead code, no shadowing defects, no magic numbers. (gofmt claim cross-checked as plausible; tool-limited.)

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) September 6, 2026 19:59
@github-actions
github-actions Bot merged commit 735ccaa 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
…ng is meaningful — the parent-disc guard (#222)

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 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/member-tree-parse 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