Repository navigation
fix(loaderkit): terminate a cyclic namespace graph on the materialized wire - #350
Conversation
…d wire
MarshalMaterialized serialized a materialized spec.UnifiedFile as
materializedEnvelope{UF: uf}, and spec.UnifiedFile.Namespaces is JSON-serialized
(it carries only `yaml:"-"`). The graph it holds is CYCLIC BY DESIGN:
MaterializeLoadedProject reference-mounts the SAME *UnifiedFile pointer to break
cycles and preserve diamonds ("the intentional main<->cachyos mutual import"),
and this package's own capturePluginKindsSeen documents that cycle. encoding/json
therefore rejects the marshal:
json: unsupported value: encountered a cycle via map[string]*spec.UnifiedFile
which made `charly box validate` / `charly task <name>` fail on any project whose
import graph contains such a cycle (opencharly/opencharly#330).
The codec now carries the namespace tree FLAT — one materializedNamespace per
PATH, each File a shallow copy with its own Namespaces cleared — exactly as it
already carries PluginKinds by path. Every path a finite walk reaches survives
(the diamond and multi-alias mounts included); a genuine back-edge truncates,
which is exactly the set UnifiedFile.collectBeds enumerates (it returns the
instant it re-enters a namespace already on the current path).
The materialized-tree cache key already includes the sdk module version, so the
wire-format change re-keys every entry and no stale payload is served.
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…forms The first revision qualified only a LOCAL ref's identity. A remote `@host/org/repo[/sub]` ref still dropped its sub-path, so a subdirectory project addressed remotely collapsed to its enclosing repo — the same false back-edge on the other path. ParseRemoteRef already exposes SubPath; RepoIdentity now carries it, mirroring the local branch's toplevel-relative qualification, so one rule covers both forms. The test header also now names WHICH of the two coupled fixes each consequence belongs to: this identity fix (the project resolves as a definition mount, so the namespace is delivered at all) versus the loaderkit wire codec's back-edge truncation (opencharly/sdk#350), which with the identity collapse still present silently dropped the namespace instead of crashing. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — no scope mismatch, secrets/exfiltration, weakened guardrail, or supply-chain change; only Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…e enclosing repo (#202) * fix(spec): resolve a local import ref to its PROJECT identity, not the enclosing repo RepoIdentity() returned the git `origin` identity of the ref's directory, and `git remote get-url origin` walks UP to the enclosing repository. A namespaced import of a subdirectory project inside the same repo therefore inherited the ROOT's identity, so walkNamespace's repo-identity cycle-break resolved it as a REFERENCE mount to the root — a degenerate self-cycle. The materialized wire marshaller then failed with `json: unsupported value: encountered a cycle via map[string]*spec.UnifiedFile` (opencharly/opencharly#330's signature), and once that marshaller was made cycle-safe the whole namespace was silently dropped. ProjectRepoIdentity() now owns the rule uniformly (RootRepoIdentity is a thin forward to it): an explicit `repo:` in the project's charly.yml is authoritative; otherwise the git origin identity is QUALIFIED by the project's path relative to the git toplevel whenever the project is not itself the repo root. A repo-root project (a local submodule) keeps the bare identity, so the local<->remote mutual-import short-circuit is unchanged. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * fix(spec): scope an import ref's identity to its PROJECT on BOTH ref forms The first revision qualified only a LOCAL ref's identity. A remote `@host/org/repo[/sub]` ref still dropped its sub-path, so a subdirectory project addressed remotely collapsed to its enclosing repo — the same false back-edge on the other path. ParseRemoteRef already exposes SubPath; RepoIdentity now carries it, mirroring the local branch's toplevel-relative qualification, so one rule covers both forms. The test header also now names WHICH of the two coupled fixes each consequence belongs to: this identity fix (the project resolves as a definition mount, so the namespace is delivered at all) versus the loaderkit wire codec's back-edge truncation (opencharly/sdk#350), which with the identity collapse still present silently dropped the namespace instead of crashing. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
The validator's prescribed remedy for the R10 finding: an in-repo `disposable: true` bed that exercises the changed dotted-local dispatch. The repo root IMPORTS its own testdata/dotted-local-fixture project as the namespace `dottedfix`, so that project's kind:local bed is reachable ONLY as the namespace-qualified `dottedfix.dottedfix-bed` — the dotted-key shape the local arm must resolve. check-dotted-local-resolve drives it through a real `charly check live` and asserts the fixture's step id, which the pre-fix code never reaches (it exits non-zero with `local deployment ... not found`). This shape requires the two producer fixes that make it possible at all: opencharly/spec#202 (an import ref's identity names its PROJECT, so a subdirectory project mounts as a definition rather than a self-reference) and opencharly/sdk#350 (the materialized wire codec terminates the cyclic namespace graph instead of rejecting it). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…#78) (#85) * fix(check): resolve a dotted local bed with the dispatcher's resolver The local live arm resolved a dotted name with an in-substrate-only member walk, which cannot reach a NAMESPACE-QUALIFIED deploy key (charly.check-task — its dots are namespace separators), so every dotted local bed reported "local deployment … not found" before its plan ran. Use resolveDeployNodeByPath (exact-key-first), the SAME resolver the dispatcher checkLocalTarget already uses, and tighten checkLocalTarget to dispatch on a RESOLVED leaf's venue instead of falling through to its root. * test(check): host-root + non-host-leaf dispatch case (#78) checkLocalTarget now dispatches on a RESOLVED leaf's venue; add the case that distinguishes it (my-local.pod-child -> not local), which returns true on the pre-fix code and so fails without the change. * test(check): add the in-repo disposable dotted-local R10 bed (#78) The validator's prescribed remedy for the R10 finding: an in-repo `disposable: true` bed that exercises the changed dotted-local dispatch. The repo root IMPORTS its own testdata/dotted-local-fixture project as the namespace `dottedfix`, so that project's kind:local bed is reachable ONLY as the namespace-qualified `dottedfix.dottedfix-bed` — the dotted-key shape the local arm must resolve. check-dotted-local-resolve drives it through a real `charly check live` and asserts the fixture's step id, which the pre-fix code never reaches (it exits non-zero with `local deployment ... not found`). This shape requires the two producer fixes that make it possible at all: opencharly/spec#202 (an import ref's identity names its PROJECT, so a subdirectory project mounts as a definition rather than a self-reference) and opencharly/sdk#350 (the materialized wire codec terminates the cyclic namespace graph instead of rejecting it). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * revert(check): drop the speculative leaf-venue dispatch change (#78) The resolver fix (resolveLocalDeployNode + the local arm using it) is the whole of #78's defect, and the in-repo R10 bed witnesses it: its target dottedfix.dottedfix-bed resolves to a HOST leaf, so `charly check run check-dotted-local-resolve` fails before the fix and passes after it with NO change to checkLocalTarget. The accompanying checkLocalTarget dispatch change (a RESOLVED non-host leaf under a HOST root must not be local-routed via its root) alters a DIFFERENT behavior, and its only witness is a unit case — the local-bed R10 cannot distinguish it. It is therefore separable from this cutover and moves to its own named change (#86), which must carry a runtime witness bed. Also corrects charly.yml's stale header comment ("This file declares no entities of its own - it only tells charly where to look"), which is false since this file now declares the import and the R10-witness entities. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…orktree-safe
Two changes in one commit: the pin advance this PR came for, and the fix for the defect that
stopped its OWN gate from running.
1. Policy-B pin advance (via `charly task pins MODE=bump`, scoped to the charly gitlink):
charly 350435d789836d135304c2e49af40211cd5f10e9 -> 214692903edee807d9149f518fcd6896c7c294f6
What the pin carries (the merged producer chain): opencharly/spec#202 (an import ref's
identity names its PROJECT), opencharly/sdk#350 (the wire codec terminates the cyclic
UnifiedFile.Namespaces graph), opencharly/plugin-check#85 (the local arm resolves a
namespace-qualified bed with the dispatcher's resolver) and opencharly/plugin-check#87 (a
resolved non-host leaf under a host root dispatches on its own venue). Together these
close #330: `./charly/bin/charly task list` from the umbrella root
loads and lists every maintenance task instead of aborting at project load with
`json: unsupported value: encountered a cycle via map[string]*spec.UnifiedFile`.
No distro-* move is required: charly's box/* gitlinks are identical at 350435d7 and
21469290, so policy B already holds for the twins.
2. scripts/check-harness-config.mjs: the self-test no longer aborts on an unmaterialized
submodule surface. `stage()` copied every surface unconditionally, so a checkout without
the `marketplace` submodule -- the session-worktree layout Part II rule 2 REQUIRES --
threw ENOENT out of the self-test and made `charly task verify` un-runnable there. It now
SKIPS such a surface with a NOTICE, the same precondition the gate already guards at
checks 8/12/13, and the four corpus-measured arms (check 12's two, check 13's coverage
and collision) are skipped in the same voice; the report names how many arms were live.
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…+ loader-cycle fixes (#330) (#424) * chore(pins): advance charly to v2026.280.1631 -- the dotted-local-bed + loader-cycle fixes Policy-B pin advance via `charly task pins MODE=bump` (scoped to the charly gitlink): charly 350435d789836d135304c2e49af40211cd5f10e9 -> 945f9d7d35d3383bee4863f1aa00d10c6a48e3a9 What the pin carries (the merged producer chain): - charly#821 adopts spec v0.2026280.1255 (opencharly/spec#202 -- an import ref's identity names its PROJECT), sdk v0.2026280.1251 (opencharly/sdk#350 -- the wire codec terminates the cyclic UnifiedFile.Namespaces graph) and plugin-check v0.2026280.1309 (opencharly/plugin-check#85 -- the local arm resolves a namespace-qualified bed with the dispatcher's resolver). Together these fix #330: `./charly/bin/charly task list` from the umbrella root now loads and lists every maintenance task (rc=0) instead of aborting at project load with `json: unsupported value: encountered a cycle via map[string]*spec.UnifiedFile`. No distro-* move is required: charly's box/* gitlinks are unchanged between the old and the new pin, so policy B already holds for the twins (verified). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * chore(pins): advance charly to v2026.280.1725 and make the pin gate worktree-safe Two changes in one commit: the pin advance this PR came for, and the fix for the defect that stopped its OWN gate from running. 1. Policy-B pin advance (via `charly task pins MODE=bump`, scoped to the charly gitlink): charly 350435d789836d135304c2e49af40211cd5f10e9 -> 214692903edee807d9149f518fcd6896c7c294f6 What the pin carries (the merged producer chain): opencharly/spec#202 (an import ref's identity names its PROJECT), opencharly/sdk#350 (the wire codec terminates the cyclic UnifiedFile.Namespaces graph), opencharly/plugin-check#85 (the local arm resolves a namespace-qualified bed with the dispatcher's resolver) and opencharly/plugin-check#87 (a resolved non-host leaf under a host root dispatches on its own venue). Together these close #330: `./charly/bin/charly task list` from the umbrella root loads and lists every maintenance task instead of aborting at project load with `json: unsupported value: encountered a cycle via map[string]*spec.UnifiedFile`. No distro-* move is required: charly's box/* gitlinks are identical at 350435d7 and 21469290, so policy B already holds for the twins. 2. scripts/check-harness-config.mjs: the self-test no longer aborts on an unmaterialized submodule surface. `stage()` copied every surface unconditionally, so a checkout without the `marketplace` submodule -- the session-worktree layout Part II rule 2 REQUIRES -- threw ENOENT out of the self-test and made `charly task verify` un-runnable there. It now SKIPS such a surface with a NOTICE, the same precondition the gate already guards at checks 8/12/13, and the four corpus-measured arms (check 12's two, check 13's coverage and collision) are skipped in the same voice; the report names how many arms were live. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Summary
MarshalMaterializedserialized a materializedspec.UnifiedFileasmaterializedEnvelope{UF: uf}, andspec.UnifiedFile.Namespacesis JSON-serialized (it carries onlyyaml:"-"). The graph it holds is cyclic by design:MaterializeLoadedProjectreference-mounts the SAME*UnifiedFilepointer to break cycles and preserve diamonds ("the intentional main↔cachyos mutual import"), and this package's owncapturePluginKindsSeendocuments that cycle.encoding/jsontherefore rejects the marshal:That made
charly box validate/charly task <name>fail on any project whose import graph contains such a cycle — opencharly/opencharly#330.The codec now carries the namespace tree flat: one
materializedNamespaceper PATH, eachFilea shallow copy with its ownNamespacescleared — exactly as the same envelope already carriesPluginKindsby path. Every path a finite walk reaches survives (diamond and multi-alias mounts included); a genuine back-edge truncates, which is exactly the setUnifiedFile.collectBedsenumerates (it returns the instant it re-enters a namespace already on the current path).UnmarshalMaterializedrebuilds the tree from the flat levels.The materialized-tree cache key already includes the sdk module version (
loader_identity), so the wire-format change re-keys every entry and no stale payload is served.Head
6b1e7cb8d69bb2b7b2a6c8e0a8b66bb5f32bc459, diff vsorigin/main:How tested
The new tests FAIL on the pre-fix code — the coverage is real, not vacuous. The same test file run against a clean
origin/mainworktree:On this head the module gate (
.github/workflows/ci.yml) is green:The pre-existing
TestMarshalMaterialized_DiamondPreservesAllPathsand the PluginKinds tests still pass in that full run — the flat form preserves the diamond and every alias.Live, on the acceptance case opencharly/opencharly#330 names — a charly binary built against THIS sdk worktree only (its linked
specis the ordinary pinnedv0.2026279.2018, no replace), run from the umbrella root:The umbrella root previously failed with the cycle error and could not list a single task.
Rulebook compliance
git-workflow,go,plugin,install-planskills loaded before any edit.PluginKindsin the SAME envelope; no second marshal path.MarshalMaterialized/UnmarshalMaterializedkeep their names and contract, whose docs now state the cycle-safe rule.git statusclean before and after the commit; PR-only branch; no force-push.Change classification
fully tested and validated— the CI-equivalent gate passed on the final tree and the changed path ran live on the real acceptance case.Related: opencharly/opencharly#330 (this lands the wire-codec half; the identity half is opencharly/spec#202), opencharly/plugin-check#85.
Agent:
plugin-check-85-takeover· sessionsession-fe6a1287-a711-4e47-b913-70b78d262fd1Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)