Repository navigation
fix(loaderkit): preserve PluginKinds at every diamond/multi-alias namespace path - #283
Conversation
…espace path capturePluginKindsSeen/restorePluginKindsSeen used a global pointer-identity seen guard, so a shared UnifiedFile mounted at MULTIPLE namespace paths (a diamond import: c at a.c and b.c; a multi-alias mount: arch + cachyos.arch) recorded its PluginKinds at only the FIRST path (map-order dependent). Every later alias restored with EMPTY PluginKinds, so a namespaced bed (b.c.check-*, from: vm) false-failed 'not defined'. Switch to a path-scoped ancestor stack: every path round-trips while a genuine cycle still terminates. Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
… path FillBoxPlans had the same global pointer-visited guard: a shared config reached at multiple alias paths recorded only the first, dropping later aliases' box plans. Path-scoped ancestor stack; every path folds, cycles still terminate. Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
Assisted-by: opencode deepseek-v4.1-flash (documentation reviewed)
Review — PASSHead SHA: Security screen: PASS — no scope mismatch, secrets, egress, dependency, or guardrail changes; PR content contains no embedded directives. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…ment - sortedRawKeys now actually sorts (its name promised determinism; the map-order output was the very defect class this fix removes). - The ProjectTemplates comment no longer claims to mirror FillBoxPlans's guard: that guard had the SAME bug and is fixed in opencharly/sdk#283. Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: sdk Go code — loaderkit wire codec (loaderkit commit) + deploykit box-plan fold (deploykit commit). Blocks
Comment dispositions
NoteThe loaderkit fix itself ( Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…amespace ValidateIterateBed read the agent: catalog from the merged ROOT, so a namespaced iterate bed (charly.check-preflight-local, agent: claude defined in its own namespace) false-failed 'agent claude is not defined'. Thread the bed's owning scope (BedScope) into the agent-catalog read, the same scope fix as its from:-cross-ref sibling. Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: sdk Go code — loaderkit wire codec + deploykit box-plan fold, plus two tests. Contract module, so Security screen: no finding (no secrets/egress/dep/guardrail changes; no embedded directives). Blocks
Comment dispositions
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: sdk Go code — loaderkit wire codec + deploykit box-plan fold + loaderkit check-bed validation; contract module, so Security screen: T3 scope mismatch — the diff changes Blocks
Comment dispositions
The loaderkit Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…155) * fix(loadmodel): fold every alias of a shared namespace template map fillNamespacedTemplates used a global pointer-visited guard, so when one namespace repo is mounted at multiple alias paths (distro-arch at charly.arch, charly.cachyos.arch, charly.omarchy.arch) only the FIRST alias's templates were qualified — map-iteration-order dependent. A bed in a skipped alias (charly.arch.check-arch-vm, from: arch) then resolved against a scope missing its own template. Switch to a path-scoped ancestor stack: every alias path folds, while a genuine self-cycle still terminates. Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated) * fix(spec): sort the test helper + correct the FillBoxPlans-mirror comment - sortedRawKeys now actually sorts (its name promised determinism; the map-order output was the very defect class this fix removes). - The ProjectTemplates comment no longer claims to mirror FillBoxPlans's guard: that guard had the SAME bug and is fixed in opencharly/sdk#283. Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated) * docs: re-freeze the PR body against the final head Assisted-by: opencode deepseek-v4.1-flash (documentation reviewed) --------- Co-authored-by: atrawog <[email protected]>
Locks the owning-scope agent catalog read (validateIterateBedScoped); FAILS without it (agent catalog read from the merged root). Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)
Assisted-by: opencode deepseek-v4.1-flash (documentation reviewed)
Review — PASSHead SHA: Security screen: PASS — pure mechanism fixes (path-scoped guard shape + owning-scope catalog read); no secrets/egress/dependency/guardrail change, no embedded directives, and the body accounts for all 6 changed files (no T3 scope mismatch). Comment dispositions:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
Summary of changes
Fix latent namespace-defects sharing ONE root cause — a global pointer-identity guard used where a namespace tree can be reached at MULTIPLE alias paths — exposed while making bed validation namespace-aware (the check-bed roster cutover). THREE fixes, all the same class:
loaderkit/materialize_wire.go—capturePluginKindsSeen/restorePluginKindsSeenused a globalseen map[*UnifiedFile]bool.spec.UnifiedFile.PluginKindsisjson:"-", so this codec carries the maps across a reverse-leg[]bytepayload. The same*UnifiedFileis mounted at multiple paths by design (a diamond import:cata.candb.c; a multi-alias mount:arch+cachyos.arch). The global guard recordedPluginKindsunder only the FIRST path (map-order dependent); every later alias round-tripped with EMPTYPluginKinds, so a namespaced bed (b.c.check-*,from: vm) false-failedreferences vm entity "vm" which is not defined.deploykit/resolved_project.go—FillBoxPlanscarried the SAME globalvisited map[*spec.Config]boolguard: a shared config reached at multiple alias paths recorded box plans at only the first path. Same fix.loaderkit/validate_check_beds.go—ValidateIterateBedread theagent:catalog from the merged ROOT, so a namespaced iterate bed (charly.check-preflight-local,agent: claudedefined in its own namespace) false-failedagent "claude" is not defined. ExtractedvalidateIterateBedScopedand changed the call site to read the catalog from the bed's OWNING scope (BedScope), the same scope fix as itsfrom:-cross-ref sibling.Fix shape (all three): replace the global visited/seen set with a path-scoped ancestor stack (
ancestors[x]=true; defer delete(ancestors,x)) so EVERY alias path folds/round-trips while a genuine self-referential cycle still terminates.Tests (all fail without their fix):
loaderkit/materialize_wire_diamond_test.go,deploykit/fill_box_plans_diamond_test.go, andloaderkit/validate_check_beds_namespace_test.go::TestValidateCheckBeds_NamespacedIterateAgentScoped.Closes / relates to: sibling opencharly/spec#155 (MERGED) fixed the same guard shape in
fillNamespacedTemplates. Supports the check-bed roster cutover (spec#154 / sdk#281).Breaking change + rollback: none (pure fixes). Rollback is a revert.
Change class
sdk Go(contract/mechanism module). Gate:GOWORK=off go test ./....How R10-tested — exact gate, commands, and pasted output
GOWORK=off go mod verify && GOWORK=off go build ./... && GOWORK=off go test ./....N/A (contract module); the defects are reproduced by minimal synthetic projects + unit tests, and the fix was verified by a real concurrent roster load (below).N/A— no binary.charlyload of a 129-box/628-candy multi-namespace project.1. Full gate output (verbatim, ALL packages incl. deploykit):
2. loaderkit changed paths executing (verbatim
-v):3. deploykit changed path executing (verbatim
-v;CandyModel = spec.CandyReaderis a type alias,deploykit/candy_model.go:12):4. Coverage FAILS without each change:
5. Live end-to-end: a synthetic project with
cimported by bothaandb→ before:charly box validateFAILb.c.check-c-vm references vm entity "vm" which is not defined(map-order flaky); after:charly box validate: OK — checked 7 distros, 7 builders; 0 warnings, 0 errors. The real umbrella-root project (628 candies, 129 boxes, 7 distros) →OK — 0 warnings, 0 errors.Attribution tier
fully tested and validated— every changed path ran live under test (all three packages' output pasted) + a real multi-namespace project load; each fix has a pasted fail-without-change proof.Harness rulebook compliance — state HOW each is satisfied (or
N/A — <reason>)/charly-internals:go,/charly-internals:plugin.fillNamespacedTemplates(spec) is fixed in spec#155.ancestorsin all three).git statuschecked; no destructive action.N/A— contract module; logic unit-gated + live-reproduced.N/A.N/A.N/Afor beds; §4 pastes each fail-without-change proof.main.N/A.gofmtclean;go test ./...green.N/A— post-merge bytag-on-mergefrom this body.Assisted-by: opencode deepseek-v4.1-flash (fully tested and validated)