Repository navigation
feat(loaderkit)!: relocate LoadUnified/ApplyDiscover orchestration from charly core - #103
Conversation
…de dispatch policy Adds spec.MaterializedProject / spec.MaterializeSeams / spec.Materializer to loader_seam.go (mirroring ProjectWalker's shape) and loaderkit.Materialize, the per-node kind-decode NOT-FOUND policy (route to the bundle builder / defer during the connect pre-pass / warn-and-skip / hard error) faithfully ported from charly core's former normalizeNodeInto fallback branch. The actual registry resolve + live Provider dispatch (clause M) stays host-side, reached through the seam's DecodeEntity/BuildBundleEntity callbacks — this package never touches the provider registry directly, exactly like WalkSeams above it. Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system)
…oid fields Companion to the charly-side fix (foldStandaloneTemplateReply's kind-word switch elimination): these 5 fields are no longer needed on the accumulator — the 5 standalone-substrate-TEMPLATE kinds now fold into PluginKinds[disc] [name] like every other templated kind, so there is nothing left for a per-kind-word switch to route between. Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system)
K1 keystone (task #24), unit 1: UnifiedFile is the typed, in-memory result of loading a project's charly.yml. Every field type was already sdk-portable (spec.*/deploykit.*/plain maps — Box was already spec.BoxMap, Candy already a plain map[string]json.RawMessage), so the type carried no charly-core dependency of its own; only the definition needed to move. Moved as loaderkit.UnifiedFile methods: BoxConfig/HasBox/BoxNames/ SetBox/SetCandy, VM/Pod/K8s/Local/Android, CheckBeds, ProjectConfig/ projectConfigCached, ProjectBundleConfig — every one needs nothing beyond the struct's own fields. Moved as exported loaderkit package functions: ResolvePluginKindViaPlugin/DecodePluginKindMap — these already took their registry-coupled resolve callback as a PARAMETER, so the loop itself was pure; charly-core's Distros/Builders/resolveInits (which supply the callback) stay charly-core free functions, since Go forbids defining new methods on a type outside its package. InlineCandy (+ DecodeInlineCandy/EncodeInlineCandy) moved alongside it, since it's UnifiedFile.SetCandy's value type. Assisted-by: Claude Code Anthropic Claude Sonnet 5 (fully tested and validated)
K1 keystone (task #24), unit 2: LoadUnified itself — the top-level entry point every command calls to load a project's charly.yml — moves to sdk/loaderkit as a kind-blind orchestration function. The sequence (bootstrap phase, early + post-merge schema gate, kind-blind walk, registry materialize, venue flatten, member fold, descent stamp, the validation chain) is ported verbatim; every step that touches the provider registry, or is a standing K5-final-decision core file (bundle_members.go's foldMembers/validateMembers), is threaded through a new loaderkit.LoadSeams struct — the same injected-seam pattern spec.WalkSeams/spec.MaterializeSeams already established. Also relocates gateSchemaVersion and the normalizeV4Aliases no-op, both zero-registry- coupling. charly/unified.go's LoadUnified(dir) becomes a ~15-line wrapper that builds a LoadSeams from its existing host-coupled functions. Verification: go build/vet ./... clean; go test ./... green across every sdk package (the one sdk/kit timeout — TestStartProcessWaitMonitorNeverClosesConsumerPipes — reproduced in isolation in 0.02s; the SAME shared-host flake previously RCA'd this session, unrelated to this change, which touches no kit files). Assisted-by: Claude Code Anthropic Claude Sonnet 5 (fully tested and validated)
K1 keystone (task #24), unit 3: exposes RunDiscover(rootDir, specs, seams) — a thin wrapper around the walker's existing runDiscover/ parseDiscoveredManifest mechanism (already used internally by Walk's own depth-0 discover pass), so charly's ApplyDiscover (a standalone entry point used by ScanAllCandy/validate_project_host.go, never on LoadUnified's own call graph) can reuse the SAME walk+parse mechanism instead of duplicating it in charly core. Deliberately bypasses the spec.ProjectWalker plugin-swap indirection: ApplyDiscover has never gone through the whole-project walker (it talks to the parser/threaded seam primitives directly, same as Walk's own internal discover call), so this preserves that pre-existing scope exactly rather than changing it. Verification: go build/vet ./... clean. Assisted-by: Claude Code Anthropic Claude Sonnet 5 (fully tested and validated)
Assisted-by: Claude Code Anthropic Claude Sonnet 5 (documentation reviewed)
pr-validator — CHANGES REQUESTED ❌Change class: charly-or-sdk Go ( Security & anti-tampering screen (T1–T4)Clean. The diff is 4 files, purely additive (+520/−0, confirmed via Checklist
Item 1 — Description completeness (BLOCKING)The PR template ( The actual PR body (
This is the sole blocking finding. I independently re-derived and confirmed every substantive claim the PR makes (see items 2/5/11/12/13/17/18 below) — the underlying code is compliant. This is a body-only fix: the author (or a fresh commit) needs to amend the PR description to (a) paste the actual verification output and (b) add the per-rule compliance walk-through. No code change is required. Per the git-workflow skill, "Update the PR; never close-and-recreate" — Items 2 / 5 / 11 — R10 gate class, R1 zero-warnings, R10 substance (independently re-run by me, NOT taken on the PR's word)I checked out the PR head ( I additionally re-ran gofmt note (R1 RCA, not a violation): R10 gate-class judgment: this producer leg is sdk-only, purely additive Go code with no runtime surface of its own (sdk has no Item 12 — RDD / ADE / SDD
Item 13 — Concurrency mandate (checked, not waved off)The concurrency mandate names "the loader / discover walk" explicitly among shared-state paths requiring a concurrent-roster gate. I considered this carefully rather than dismissing it: the mandate's actual mechanism concern is multiple beds contending on a shared host resource (podman store lock, port, exclusive token) under simultaneous execution. Item 15 — Architecture gate (placement)This PR touches zero placement: CORRECT. I read Items 17 / 18
Comments consideredNone — the PR carries zero comments ( Cross-PR interactions considered
DecisionFAIL — CHANGES REQUESTED, solely on item 1 (description completeness). I independently re-derived and confirmed every technical claim this PR makes — the sdk producer-leg code is fully compliant (build/vet/gofmt/lint/test/mod-tidy/cue:gen-reproducibility all clean, SDD wire-type precedent correctly applied, placement correct, R5/R2/R3/R4 clean, CHANGELOG well-formed). The PR body itself, however, does not meet the mandatory template's evidentiary bar: it narrates verification results instead of pasting them, and it carries no per-rule (R0–R10 + pillars) compliance walk-through at all. Per my own operating spec this is explicitly a FAIL condition regardless of the underlying code's quality — "the burden is on the PR to supply the evidence, never on you to infer it." To fix: amend the PR body (no code change needed) to (1) paste the actual terminal output for the build/vet/gofmt/lint/test/mod-tidy/cue:gen commands already referenced, and (2) add a "Harness rulebook compliance" section walking through R0–R10 + RDD/ADE/SDD + Hard Cutover + the kernel/plugin boundary law + disposable-only autonomy + clean-architecture/Go-gates + CHANGELOG, one line of HOW-evidence each (or Assisted-by: Claude Code Anthropic Claude Sonnet 5 (analysed on a live system) |
pr-validator — APPROVED ✅ (round 2 — body-fix re-gate)Change class: charly/sdk Go (sdk producer leg of the K1 keystone, task #24; B2 producer-first) Round 1 (this PR's prior validator comment, same head SHA) independently verified the code fully compliant and FAILED solely on item 1 — the PR body narrated verification instead of pasting output and lacked a per-rule R0–R10 walk-through. I re-derived everything myself from scratch (fresh context, no inheritance from round 1's reasoning), re-ran the standalone battery independently, and additionally re-read the body to confirm the fix. Security & anti-tampering screen (T1–T4)Clean. Diff is 4 files, purely additive (+520/−0), confined to Checklist
My independent battery (re-run from scratch, fresh checkout of 698a5c6)
Comments considered
Cross-PR interactions considered
DecisionPASS. The round-1 code-compliance finding stands (independently re-confirmed by me from a fresh context, not inherited): purely additive, correctly placed (K1-proper Assisted-by: Claude Code Anthropic Claude Sonnet 5 (fully tested and validated) |
pr-validator merge-time stamp: rename CHANGELOG/2026.206.1230.md -> CHANGELOG/2026.206.1046.md and rewrite its H1 to match (byte-equal filename<->heading), per the git-workflow skill's CalVer-generated-at-merge rule. Assisted-by: Claude Code Anthropic Claude Sonnet 5 (fully tested and validated)
Summary
K1 keystone (task #24), sdk producer leg (B2 producer-first — land + tag before the charly consumer leg). Relocates the TOP-LEVEL loader orchestration —
LoadUnifieditself and the standaloneApplyDiscoverwalk — out of charly core intosdk/loaderkit, extending the seam-injection patternspec.WalkSeams/spec.MaterializeSeamsalready established by the prior K1-unit-1 Materializer seam (banked in cutover 1's sdk leg,1bfa4b1).Full diff vs
main: 3 files, purely additive, 0 deletions (466 insertions).loaderkit/unified_file.go—UnifiedFile/InlineCandyrelocated fromcharly/unified.go(K1 unit 1). Zero behavior change; every field was already sdk-portable.loaderkit/load_unified.go(new) —LoadUnified(dir, seams LoadSeams): the kind-blind orchestration (bootstrap phase, schema gates, walk, materialize, venue flatten, member fold, descent stamp, the validation chain) ported verbatim from charly's former inline body.LoadSeamsis an 11-field callback struct threading every registry-coupled / standing-core-resident step back to the host.loaderkit/discover.go— addsRunDiscover(rootDir, specs, seams), reusing the SAMEwalker.runDiscover/parseDiscoveredManifestmechanismWalk's own depth-0 discover pass already used internally, instead of duplicating it.Disclosure
.go/.md/.cuefound no stale references; the one historical hit (CHANGELOG/2026.197.1537.md) is a past-tense history file, the sanctioned R5 exception.spec.MaterializedProject5-dedicated-field →PluginKindsconsolidation is already onmain(cutover 1's own CHANGELOG2026.206.0837.md) — not part of this diff, not something this PR needs to re-disclose.gofmt -l .flagsvmshared/cloud_init_iso.go— pre-existing onmainitself (confirmed:git diff --stat origin/main HEAD -- vmshared/cloud_init_iso.gois empty, andgofmt -lon the file checked out fromorigin/maindirectly flags the same issue). Not touched by this PR; not this cutover's to fix (R2 separability test — this leg's own R10 passes without it).CHANGELOG/2026.206.1230.md.Verification (pasted, fresh re-run against 698a5c6)
(Caveat for the record: on earlier runs against the same tree,
sdk/kit'sTestStartProcessWaitMonitorNeverClosesConsumerPipestimed out 5x under this session's concurrent multi-teammate host load — always reproduced clean in isolation in ~0.02s each time; this final fresh run above shows it green in the full suite too, 10.5s, no timeout. RCA'd as host-scheduling contention, not a code defect — this diff touches zero files insdk/kit.)R0–R10 + pillars compliance
/charly-internals:go,/charly-internals:plugin,/charly-internals:install-plan,/charly-core:deploywhile scoping/implementing this move.plan:/description:to add).sdk/kitsuite-timeout above was RCA'd (isolation re-runs, host-load correlation with a concurrent teammate bed build) rather than dismissed as "flake" without investigation.vmshared/cloud_init_iso.gogofmt finding is pre-existing onmainand untouched by this diff — passes the R2 separability test (this leg's own R10 doesn't depend on it); flagged, not silently hidden.RunDiscoverreuses the existingwalker.runDiscover/parseDiscoveredManifestmechanism instead of re-deriving a second walk+parse loop;LoadSeamsextends the establishedWalkSeams/MaterializeSeamspattern rather than inventing a new one.check-podbed R10 (PASS, 13 steps, 169s, fresh-rebuild incl. check-live-rebuild + feature-run-rebuild, zero warnings) run against the paired charly consumer branch, plus the two independent byte-equivalence proofs below — both exercise this exact code path end-to-end.loaderkit.LoadSeams/the relocatedUnifiedFileare hand-written, same-process pipeline-state types — the documented non-wire precedentspec/loader_seam.goalready establishes for this exact family (ParsedProject/LoadedProject/CandyRefs/ScannedCandy/MaterializedProject/WalkSeams/MaterializeSeams): same-process state crossing only the compiled-in typed seam, never marshaled, so it is correctly OUTSIDE the CUE wire-type mandate (which governs cross-process/wire-marshaled types) — no new@go(-), no hand-written wire struct.loaderkit.LoadUnified/RunDiscoverare kind-blind Mechanism code (walk/materialize orchestration, never a per-kind branch) living in the sdk mechanism kit where it belongs; every registry-coupled step (bootstrap, walk, materialize, the validation chain, foldMembers/validateMembers per the standing FINAL/K5 ruling) stays host-side, reached via theLoadSeamscallback struct — the same seam-injection precedentWalkSeams/MaterializeSeamsset. K1-proper placement per the plugin skill's kernel/plugin boundary ledger.Byte-equivalence proof (paired with the charly consumer-leg proof)
Built a throwaway harness (git worktree at
origin/main's cutover-1 tip vs the merged keystone tree) dumping a canonicalized JSON projection of the materialized*UnifiedFile(Version/Repo/Box/Candy/Bundle/VM/Pod/K8s/Local/Android/ProjectConfig) for two real project fixtures — this repo's own rootcharly.yml(complex: full distro/builder/init/resource vocab + discover + many beds) andbox/fedora'scharly.yml(multiple inlinevm:entities + check beds). After normalizing only the checkout-path prefix and the already-bankedPluginKinds-vs-5-dedicated-fields shape difference (unrelated to this leg — see Disclosure above), the two dumps are byte-for-byte identical on both fixtures (diffexit 0, zero output, both fixtures).Independently corroborated by the orchestrator's own materialized-Containerfile diff across check-pod/fedora/fedora-builder/composition-app (byte-identical modulo the CalVer timestamp) and the orchestrator's own
check-podbed R10 (PASS, 13 steps, 169s, fresh-rebuild).Assisted-by: Claude Code Anthropic Claude Sonnet 5 (fully tested and validated)