Repository navigation
fix(loaderkit): the per-host deploy overlay is not a config-stack layer - #270
Conversation
The layered config stack (system → user → in-dir) raw-merged the per-host deploy overlay (~/.config/charly/charly.yml, spec.DefaultDeployConfigPath) as a PROJECT document layer. That overlay is a DeployConfig — per-host runtime state, not an authored project — and raw-merging it injects its deploy entries into the authored deploy map BEFORE FoldMembers runs. A member-bearing check bed declares its members NESTED under the bed root, while the overlay persists each deploy-level member FLATTENED to a top-level key (MarshalDeployNode unwraps the member tree to siblings, so a member's own `charly config` can address it by name). Raw-merging put both copies into the deploy map, and FoldMembers then hard-failed: peer name "preempt-holder" (declared under deploy "check-preempt-live-pod") collides with an existing deploy/bed/peer entry seen live on every member-bearing bed (check-preempt-live-pod, check-cross-pod-cdp, both FAIL steps=1) and reproducible deterministically from the merged bytes alone. The overlay has ALWAYS been applied the correct way: a per-field MERGE onto the loaded project tree (deploykit.MergeDeployConfigs / deploy.MergeDeployNode, driven by loaderkit.ResolveMergedTreeViaExecutor and deploykit.MergedDeployTree), whose lookup recurses into a node's Member tree, so it can never create a stray top-level key. That merge remains the overlay's ONE application (R3). This stack is projects only: system (/etc/charly/charly.yml, the packaged fallback project) + in-dir. Regression window: the beds were green at distro-fedora #49 (charly 2026.250.0215) the same day sdk #230 landed the stack; the fold's collision guard predates both. R10 (live, charly rebuilt against this sdk): - check-preempt-live-pod: PASS (steps=22) (was FAIL steps=1) - check-cross-pod-cdp: PASS (steps=19) (was FAIL steps=1) Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: code/config (sdk Go library — Security screen: no T1–T4 finding (diff does not touch the validator spec, rulebook, gates, or supply chain; the scope matches the body's 4-file accounting). Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — BLOCKHead SHA: Change class: code/config (sdk Go library — Security screen: no T1–T4 finding. The diff does not touch the validator spec, the rulebook, any gate, or the supply chain, and the scope matches the body's 4-file accounting. Placement (B16): the change lives in the sdk Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS — no T1–T4 finding (4-file scope matches the body's accounting; no change to the validator spec, rulebook, gates, or supply chain). Comment intake:
No surviving blocking finding; the diff, the body, and the pasted evidence are internally consistent. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…tale test comments (#631) Bumps github.com/opencharly/sdk to v0.2026265.2104 (the merged fix from opencharly/sdk#270: the per-host deploy overlay is no longer raw-merged as a config-stack PROJECT layer) and sweeps the three test comments that documented the OLD three-layer merge. opencharly/sdk#270 removed `spec.DefaultDeployConfigPath()` from loaderkit/config_stack.go's stack. Before it, a per-host deploy overlay was raw-merged as a project document layer, injecting a deploy-level member's top-level persisted copy next to the member its owner still declares nested — which FoldMembers rejects (`peer name "..." collides with an existing deploy/bed/peer entry`). Every member-bearing bed failed at steps=1. With the pin advanced, three test comments asserting the OLD behavior are now false, and the per-test `t.Setenv("XDG_CONFIG_HOME", t.TempDir())` they justified is no longer needed (TestMain already sets XDG_CONFIG_HOME package-wide; the per-test isolation existed ONLY to shield against the user-layer merge, which is gone). Swept (#630): - charly/layers_test.go - charly/plugin_bootstrap_test.go - charly/unified_test.go `go mod tidy` also advances github.com/opencharly/spec to v0.2026262.957 (the version the bumped sdk requires). R10 (live, charly rebuilt against the bumped pin): - check-preempt-live-pod: PASS (steps=22) - full charly package: go test -count=1 . = ok (252.777s); go build ./... exit 0; go vet . exit 0; gofmt -l . empty Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated) Co-authored-by: Andreas Trawoeger <[email protected]>
* fix(merge): delete the dead layered-config-stack wrapper merge.MergeConfigStack (with its private cloneUnified/cloneRawMap/cloneDeployMap/ clonePluginKinds helpers) merges a (system, user, project) layered stack into one spec.UnifiedFile. It is DEAD: zero production callers anywhere in the ecosystem — neither charly nor sdk ever imported it, and grep across every repo returns only its own test. The live config stack is sdk/loaderkit/config_stack.go (raw yaml.Node, in-dir wins), which the loader actually drives. It is also WRONG: like the sdk stack before opencharly/sdk#270, it models the per-host DEPLOY OVERLAY (~/.config/charly/charly.yml) as a project layer. That overlay is a DeployConfig — per-host runtime state — and merging it as a document layer puts a deploy-level member's TOP-LEVEL persisted copy next to the member its owner still declares nested, which FoldMembers rejects: peer name "..." collides with an existing deploy/bed/peer entry One canonical implementation (R3): the sdk's config_stack.go owns the project stack; the overlay's ONE application is the per-field deploy-node merge (deploykit.MergeDeployConfigs / deploy.MergeDeployNode), which recurses into the Member tree and cannot create a stray top-level key. The dead duplicate and its test are deleted in full (R5). merge.MergeUnified is UNTOUCHED — it remains the live document merge. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated) * docs: re-freeze the PR body against the final head * docs: re-freeze the PR body against the final head * docs: re-freeze the PR body against the final head --------- Co-authored-by: Andreas Trawoeger <[email protected]>
… overlay fix (#21) * fix: re-pin sdk so the in-plugin project load honors the config-stack overlay fix Bump github.com/opencharly/sdk v0.2026253.1947 -> v0.2026265.2104 (and the spec require it carries) so this plugin's OWN project self-load stops raw-merging the per-host deploy overlay as a config-stack PROJECT layer. WHY. This plugin is an out-of-process deploy:vm substrate: it self-loads the project (loaderkit.LoadUnifiedViaExecutor, lifecycle.go) to resolve the VM entity for PrepareVenue. Under the pin above, that load used the pre-fix config stack: it raw-merged ~/.config/charly/charly.yml (a DeployConfig — per-host RUNTIME state) as a project document layer. For a member-bearing bed that injects a deploy-level member's TOP-LEVEL persisted copy next to the member its owner still declares nested, and FoldMembers rejects it: peer name "preempt-vm-taker" (declared under deploy "check-preempt-vm-live") collides with an existing deploy/bed/peer entry Observed live on check-preempt-vm-live (distro-fedora AND the relocated plugin-preempt copy), failing at bring-up-members (steps=9). charly core and the compiled-in plugins got this fix via opencharly/sdk#270 + the charly re-pin (opencharly/charly#631); an OUT-OF-PROCESS plugin vendors its OWN loaderkit, so each must re-pin in its own repo. This is that re-pin for plugin-deploy-vm. R10 (live): check-preempt-vm-live re-run against a charly binary whose CHARLY_REPO_OVERRIDE points this repo at the bumped tree: - bring-up-members: FAIL (steps=9) before -> PASS after - bed verdict: PASS (steps=20), 0 FAIL; the VM-venue arbiter assertions preemptor-vm-lease-recorded + preemptor-vm-stopped-the-holder both PASS, proving the pluginHolderStop/pluginHolderStart addr.Vm!="" dispatch live. - go build ./... exit 0; go vet ./... exit 0; go test ./... ok Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated) * docs: re-freeze the PR body against the final head --------- Co-authored-by: Andreas Trawoeger <[email protected]>
Summary of changes
The layered config stack (
loaderkit/config_stack.go) raw-merged the per-host deploy overlay (~/.config/charly/charly.yml,spec.DefaultDeployConfigPath) as a PROJECT document layer. That overlay is aDeployConfig— per-host RUNTIME STATE (deploy entries + cache/ledger/system), not an authored project. Raw-merging itsdeployentries into the authored deploy map beforeFoldMembersruns injects top-level keys that duplicate the project's nested members, andFoldMembersthen hard-fails:This breaks every member-bearing check bed (
check-preempt-live-pod,check-cross-pod-cdp, …), which fail atsteps=1on the first member build.The overlay has ALWAYS had its own correct application path: a per-field MERGE onto the loaded project tree (
deploykit.MergeDeployConfigs→deploy.MergeDeployNode, driven byloaderkit.ResolveMergedTreeViaExecutoranddeploykit.MergedDeployTree), whose lookup (deploykit.FindDeployNode) recurses into a node'sMembertree — so it can never create a stray top-level key.Concrete edits:
loaderkit/config_stack.go— the stack is now system → in-dir (projects only).readConfigStackno longer readsspec.DefaultDeployConfigPath(). File + function headers document why the overlay is not a layer and name its ONE application path.loaderkit/load_unified.go— the config-stack comment corrected (system → in-dir).loaderkit/config_stack_test.go— tests updated to the two-layer stack; newTestConfigStack_DeployOverlayIsNotALayeris the R1 regression (a project bed root with a NESTED member + an overlay that persists the same member TOP-LEVEL; asserts the overlay does NOT leak into the merged project doc).TestConfigStack_UserWinsOverSystem→TestConfigStack_SystemLayerFormsProject(the packaged/etc/charlyfallback, the feature feat(packagekit+loaderkit): systemd units + /etc/charly config in native packages; layered config stack #230 actually added).loaderkit/test_main_test.go— comment corrected;CHARLY_DEPLOY_CONFIGstill isolated (the per-field merge path must not pick up the operator's real overlay).Change class
charly-or-sdk Go (sdk library:
loaderkit).Closes / relates to: relates to #230 (introduced the layer), opencharly/spec#142 (companion: deletes the dead sibling
merge.MergeConfigStack— see below), and the member-bearing bed failures in opencharly/distro-fedora and opencharly/plugin-preempt.Companion leg — opencharly/spec#142 (already open):
spec/merge/merge_stack.gocarries a zero-production-caller duplicatemerge.MergeConfigStackimplementing the same superseded three-layer design. It is dead code, so it has no ordering dependency on this PR — it can merge before, after, or independently. Its own R1/R5 disposition is its own PR's; this PR only needs it NAMED (it is: opencharly/spec#142).The charly test-comment sweep — opencharly/charly (to land in the sdk re-pin PR): three charly test files carry the comment "sdk v0.2026250.702+ LoadUnified merges system → user → in-dir" plus a defensive
t.Setenv("XDG_CONFIG_HOME", …)that the comment justifies. These comments are NOT currently false — they describe charly's pinned sdk (v0.2026260.1434), which still merges the user layer. They become stale only once THIS PR merges AND charly re-pins the sdk; sweeping them in this commit would make them FALSE (they would name a stack the pinned sdk does not have). R5 sweeps false/outdated claims; there is no false claim here. The sweep is filed as opencharly/charly#630 and rides the charly sdk-re-pin PR — the PR that bumpsgithub.com/opencharly/sdkto this PR's merge tag, changing exactly these three files:charly/charly/layers_test.go:561,charly/charly/plugin_bootstrap_test.go:47,charly/charly/unified_test.go:26. Measured now against this branch: removing the threet.Setenv("XDG_CONFIG_HOME", …)lines and running the FULL charly package (go test -count=1 ., sdk patched) passes (238s, 0 failures), proving the isolation is already unnecessary post-fix.Breaking change + rollback: no exported Go symbol is removed (
readConfigStack/mergeConfigStackRaware package-private). The BEHAVIOR change: a project directory with nocharly.ymlwhose only content was the per-host overlay no longer forms a project from the overlay alone (the overlay is applied by the per-field merge instead). Rollback: revert this commit; the collision returns.How R10-tested — exact gate, commands, and pasted output
charly check run <bed>for the touched code path — the loader/config-stack change is exercised by every member-bearing bed; the two that regressed arecheck-preempt-live-pod(plugin-preempt) andcheck-cross-pod-cdp(distro-fedora).check-preempt-live-pod | pod | ok | 22 steps | ~430s(plugin-preempt)check-cross-pod-cdp | pod | ok | 19 steps | ~900s(distro-fedora)charly version= 2026.249.2125 (built fromopencharly/charlyorigin/main48daeec1withreplace github.com/opencharly/sdk => <this branch>); shared calvers.check/check-preempt-live-pod/2026.265.1919/and.check/check-cross-pod-cdp/2026.265.1927/.GOWORK=off go build -buildvcs=false -ldflags "-X main.BuildCalVer=2026.249.2125"),charly version= 2026.249.2125; the beds ransteps=22/steps=19at zero un-allowlisted warnings (one allowlisteddev-worktree-binary-noticeper step, the expected dev-worktree notice).readConfigStackis on the load path of everycharlysubprocess. The pre-fix failure was atimage-build-preempt-holder/image-build-chrome(steps=1, the FoldMembers collision); post-fix those steps PASS and the full bed runs to verdict. See evidence block 2.CHARLY_DEPLOY_CONFIG) was exercised.Evidence — put each item in the block whose label names it.
1. Fresh-rebuild gate output (
charly version+ the gate run, at zero warnings):2. Each changed code path executing (the lines proving the changed branch ran, not that it built):
3. Docs-only evidence: N/A — code change class.
Attribution tier
fully tested and validated. The changed path (
readConfigStack) executed live in everycharlysubprocess of both bed runs from a fresh rebuild; the beds that regressed now pass end-to-end (steps=22,steps=19), and the new regression test was proven to FAIL without the change.Harness rulebook compliance — state HOW each is satisfied (or
N/A — <reason>)go(sdk Go module + gates),root-cause-analyzer(the R1 mandate),strict-policy(R1–R5 operationalization),git-workflow,cache(ruled out a cache artifact).FoldMemberscollision; reproduced deterministically from the merged bytes and in the beds' originaldistro-fedorahome; regression window pinned to sdk feat(packagekit+loaderkit): systemd units + /etc/charly config in native packages; layered config stack #230 (beds green at distro-fedora fix(deploykit): ignore empty builder-backed base #49 the same day). Gate output has zero un-allowlisted warnings (one allowlisted dev-worktree notice).spec/merge.MergeConfigStackis a different repo and cannot live in this commit — it is named as the concrete companion fix(merge): delete the dead layered-config-stack wrapper spec#142 (already open, dead code, no ordering dependency). The three charly test-comment hits become stale only after this merges + charly re-pins, so they are tracked by sweep the stale config-stack test comments in the sdk re-pin PR charly#630, swept in the charly sdk-re-pin PR (a concrete named target) — with the post-fix full-packagego test(238s, 0 failures, isolation lines removed) as the measured proof the sweep is correct.MergeDeployConfigs/MergeDeployNode); this change RESTORES that single path by deleting the duplicate raw-merge of the overlay. The dead spec duplicate is deleted in fix(merge): delete the dead layered-config-stack wrapper spec#142.git grepoutput pasted in block 2 —MergeConfigStackhas ZERO hits in the sdk (exit 1); the stalesystem → user → in-dirclaim has ZERO hits inloaderkit/(exit 1). The claim-keyed sweep is complete for every surface whose truth THIS commit changes; the three charly comments are truth-preserved until this merges (swept in the named re-pin PR). No transitional/dual-mode path.git status+git stash popverified around the R7 stash experiment; commit onfix/branch, PR-only, no force-push.go test; plus the regression test proven to fail without the fix.charly versionmatches (2026.249.2125); no new runtime OS deps.disposable: truebeds only, fresh rebuild, zero un-allowlisted warnings; shipsTestConfigStack_DeployOverlayIsNotALayer, which fails without the change.dc937e2, thefix(loaderkit):commit); the trailingdocs: re-freeze the PR body against the final headempty commit(s) only re-trigger the validator; no Phase-2/TODO left in scope.loaderkitis a generic loader Mechanism; no concrete-kind schema/switch leaked.disposable: true.gofmt -l loaderkit/empty;go vet ./loaderkit/clean;go test ./...green (all 14 packages ok) atGOWORK=off.CHANGELOG/is written by thecharly-auto-mergebot from the PR body at merge (verified:ef5283ais a bot commit). No file staged.Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)