Skip to content

charly core cannot reach the ONE cache-root resolver: the import-purity gate forbids host→sdk, so core's cache paths stay hand-built (TODO 7.2's host half) #1119

Closed

Description

@aitrawog

What

charly core composes cache paths by hand because it cannot import the org's ONE cache-root
resolver. storekit.Dir/CacheDir live in github.com/opencharly/sdk/storekit, and this repo's
own import-purity gate forbids the host → sdk edge:

--- FAIL: TestImportPurity_HostImportsOnlySpecAndVettedThirdParty (0.01s)
    import_purity_test.go:222: IMPORT-PURITY gate: 1 UNDECLARED github.com/opencharly/sdk import(s) in charly/ core — a residual call site must be declared in residualSDKImportSites with a named exit:
        plugin_activity.go:13: forbidden import "github.com/opencharly/sdk/storekit" — the sdk mechanism kits (and the sdk root plugin-authoring package) are for PLUGINS, never the host; charly/ core imports spec/* + proto only
    import_purity_test.go:241: IMPORT-PURITY debt (tracked, with named exits): 3 residual sdk import(s):
        plugin_build_testhelper_test.go:23: forbidden import "github.com/opencharly/sdk/buildcache" ...
        plugin_dispatch_reverse.go:11: forbidden import "github.com/opencharly/sdk/buildcache" ...
        plugin_loader.go:18: forbidden import "github.com/opencharly/sdk/buildcache" ...

The measured consequence: after the sibling opencharly/sdk#497 lands, sdk composes no cache
path by hand, and this repo still does — charlyDaemonRoots-shaped code builds
$XDG_CACHE_HOME/charly and $XDG_RUNTIME_DIR/charly itself (charly/plugin_activity.go), so it
ignores CHARLY_CACHE_DIR and, on a relocated install, cannot see the detached buildkitd its own
idle guard exists to follow. TODO 7.2 ("the hand-built paths route through the same resolver") has
no reachable target for the host half until this is decided.

Why this is an architecture finding, not a bug in one file

storekit is correct where it is: D-SDK-1 puts the store and its roots in sdk, and D-CORE-1 has
core build the store on the sdk store. But the boundary law in charly/AGENTS.md says core
"imports only permitted contract surfaces" — spec/* + proto — and the gate enforces it. So the two
requirements meet in a place neither names: core needs the cache root, and the only resolver for it
is on the forbidden side of its own boundary.

The three buildcache residuals prove the shape is known: they are declared debt with named exits,
taken when a mechanism moved to sdk and the host call site had not yet migrated. The difference here
is direction — those are exits out of a legacy state; this would be an entry into one.

RCA

  • Mechanism. charly/import_purity_test.go classifies every github.com/opencharly/sdk/*
    import in core: an undeclared one fails the gate, a declared one is counted as debt. storekit
    is a mechanism kit, so the import is refused.
  • Missed control. The leg was measured with go vet ./... and a FILTERED go test -run 'TestCharlyDaemonRoots|TestCharlyDaemonPids|TestInvokeProvider' — the filter excluded the
    package's own gate, which lives in the same package under a different test name. The control that
    would have caught it is the repo's declared gate (go test ./...), not a filtered run; running it
    before writing the PR body caught it in 278.894s with exactly one failing test.
  • Blast radius. Every hand-built cache/state path in charly core: today
    charly/plugin_activity.go's daemon-root set, and whatever the next mechanism move adds. Each is
    invisible to CHARLY_CACHE_DIR and therefore to the one-store migration (opencharly/charly#896).
  • Root fix (needs an operator decision, one of):
    1. Move the resolver to spec — spec is a permitted contract surface for core and for
      plugins alike, so ONE resolver there serves both sides and D-STORE-1 holds with no exception.
      This is the only option that keeps both the boundary law and the one-resolver rule.
    2. Declare the sites as residual sdk imports with a named exit — permitted by the gate's own
      mechanism, but it writes new debt to undo an old workaround.
    3. Core stops composing the path and takes it from the host service / a plugin — correct by
      the boundary law, but the idle guard runs on the host side of every plugin call, so it would
      have to be called on a path that has no plugin in it.

Evidence

  • The failing gate output is pasted above, from go test . at 41085f40ba6519ab3534b93b53d459faf3c0e7b3
    on branch feat/daemon-roots-one-resolver (never pushed; the patch is kept, not landed).
  • The sibling change that makes this visible is opencharly/sdk#497 (kit.BuildActivityDir
    resolves through storekit.Dir(RootCache)); sdk may import sdk, so that half is unaffected.
  • Measured pristine behavior of the core site: with CHARLY_CACHE_DIR set to a temp dir,
    charlyDaemonRoots-equivalent code resolves /home/atrawog/.cache/charly — the relocated daemon
    is invisible there.

Agent: dsh-todo-3x

Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

Activity

  1. aitrawog commented on Nov 11, 2026

    @aitrawog
    ContributorAuthor

    CLAIM — resolving this via option 1 (move the resolver to spec), three ordered legs, producer-first.

    Plan, and what each leg owns:

    1. opencharly/spec — new package spec/storeroot carrying the 4-root computation and the
      CHARLY_CACHE_DIR override, moved verbatim out of sdk/storekit/roots.go (Root,
      RootConfig|RootCache|RootState|RootRuntime, Dir, CacheDir). storekit keeps only the
      store-ADDRESSING helpers (StoreDir, NamedStores), which already delegate to the cache root.
    2. opencharly/sdk — storekit/roots.go becomes a re-export (type Root = storeroot.Root,
      the four consts, Dir/CacheDir delegating), require github.com/opencharly/spec bumped to
      leg 1's tag. No behavioural change, proved by a before/after root dump.
    3. opencharly/charly — plugin_activity.go:780 (charlyDaemonPids) resolves its two roots
      through spec/storeroot, so CHARLY_CACHE_DIR is honoured and
      TestImportPurity_HostImportsOnlySpecAndVettedThirdParty passes unedited.

    Not touching: spec/cache's config-root store — that is opencharly/spec#233's own migration, and
    this leg does not relax or absorb it.

    Next update due: when leg 1's PR is open (head SHA + gate result).

    Agent: cache-root-resolver

    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  2. self-assigned this
    on Nov 11, 2026
  3. aitrawog commented on Nov 11, 2026

    @aitrawog
    ContributorAuthor

    STATUS — leg 1 is open: opencharly/spec#303 (head 96f9eb460f5c1f368acd89ee7e00b0dcd54a4153, branch feat/storeroot-resolver).

    What landed in it: spec/storeroot owns the four roots and the CHARLY_CACHE_DIR override, moved
    out of sdk/storekit/roots.go (same identifiers, same strings, same error text, same fallbacks).
    Zero verdicts moved — the four roots were dumped through the OLD implementation (sdk @
    origin/main) and the NEW one under four conditions (default, absolute override, relative
    override, no XDG at all) and the transcripts are byte-identical (diff rc=0, no output).

    Two measurements worth recording here because they change the shape of leg 3:

    1. The gate is real, and it is the gate — not a rule I worked around. Planting the naive fix
      (import "github.com/opencharly/sdk/storekit" in plugin_activity.go) makes
      TestImportPurity_HostImportsOnlySpecAndVettedThirdParty fail with exactly the message this
      issue pastes (plugin_activity.go:13: forbidden import …), while the spec/storeroot import
      passes that same gate with import_purity_test.go byte-identical to origin/main
      (sha256 6d724c7b…, empty git diff).
    2. Leg 3 is bigger than one file: the spec bump crosses a signature change. schemaparams.Generate
      lost its third parameter between spec v0.2026313.453 and origin/main
      (Generate(schemaDir, pkg, cueDir) → Generate(schemaDir, pkg)), and the
      plugin-candy pin charly carries (v0.2026281.948) still calls the three-argument form — so a
      spec bump alone makes charly fail to BUILD in a dependency, not in core. Measured:
      [email protected]/params.go:176: too many arguments in call to paramsPipeline.
      plugin-candy v0.2026313.1445 already carries the two-argument call, so the charly leg bumps
      plugin-candy alongside spec (and sdk). That is the real lockstep content; the vmshared
      alias concern in the plan did not reproduce (sdk builds green against the new spec).

    Next update due: when spec#303 reaches a verdict, and again at leg 2's PR.

    Agent: cache-root-resolver

    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  4. aitrawog commented on Nov 11, 2026

    @aitrawog
    ContributorAuthor

    WAITING — this leg is the blocked side: it waits on opencharly/sdk#499.

    The charly change (leg 3 of this issue: charlyDaemonPids resolves its two roots through
    spec/storeroot) is written, committed in a session worktree, and green on the tree it will push —
    but it pins github.com/opencharly/spec at v0.2026315.2118 (merged: opencharly/spec#303) and
    plugin-candy at v0.2026313.1445, and it does not open until the sdk re-export
    (opencharly/sdk#499) has merged and tagged, so that the three modules advance in producer-first
    order rather than in an order the next reader has to reconstruct.

    What I am waiting for: opencharly/sdk#499 merge + its v0.<YYYYDDD>.<HHMM> tag.

    What unblocks me: that tag. Nothing else — the charly side needs no code change for it.

    Agent: cache-root-resolver

    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  5. aitrawog commented on Nov 11, 2026

    @aitrawog
    ContributorAuthor

    CLEARED — with a correction I owe: the charly leg turned out NOT to need the sdk tag, so it did not
    wait.

    My WAITING above said this leg waits on opencharly/sdk#499 merge + tag. Re-measured while the sdk
    round was running: the charly diff imports nothing from github.com/opencharly/sdk (that is the
    whole point of the fix — core may import only spec/*), and this repo's go.mod does not require
    sdk at all. Its two pins are spec v0.2026315.2118 (merged: opencharly/spec#303) and
    plugin-candy v0.2026313.1445; sdk reaches the build only as a transitive requirement of the
    pinned plugin modules, at the version they already declare. So the charly leg is INDEPENDENT of the
    sdk leg and lands in parallel — the producer-first edge that matters is spec → charly, and it is
    satisfied.

    #1121 is open: head 0c546cd90969412e7bb6b769ae0a339e99c22ff5, branch
    feat/storeroot-core. TestImportPurity_HostImportsOnlySpecAndVettedThirdParty passes with
    import_purity_test.go byte-identical to origin/main, and the counterfactual (import
    sdk/storekit in the same spot) fails it with exactly the message this issue pastes.

    Agent: cache-root-resolver

    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system)

  6. aitrawog commented on Nov 11, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — all three legs merged, producer-first, with the import-purity gate UNEDITED.

    leg PR merged merge commit tag
    1 · spec opencharly/spec#303 2026-11-11T21:18:17Z 81f1a01108e45fea1c7503ff63855a5499c0f4bd v0.2026315.2118
    2 · sdk opencharly/sdk#499 2026-11-11T21:34:36Z afb01e64b620c9cadb8f9a7278f198d7deb67f8a v0.2026315.2134
    3 · charly #1121 2026-11-11T22:19:01Z a860393cbf96a8a32c96dfef17ee9246e79df7dc v2026.315.2219

    What the resolution is. Option 1 from this issue, exactly as written: the ONE resolver moved to
    spec (spec/storeroot — the four roots and the single CHARLY_CACHE_DIR override), and
    sdk/storekit became a re-export of it (type Root = storeroot.Root, the four consts, Dir and
    CacheDir delegating), so D-STORE-1 has its one resolver and the boundary law keeps core on
    spec/* + proto. This issue's premise is unchanged in both directions: no rule was relaxed.

    Proof, not assertion.

    • Zero verdicts moved. The four roots were dumped through the OLD implementation (sdk @
      origin/main), the contract one (spec/storeroot), and the RE-EXPORT, under four conditions
      (default / CHARLY_CACHE_DIR absolute / CHARLY_CACHE_DIR relative / every XDG var unset). All
      three transcripts are byte-identical — diff rc=0 with no output, pairwise.
    • The gate passes as written. charly/import_purity_test.go is byte-identical to origin/main
      (sha256 6d724c7b83962c10768c1040815abb2790dbd794f06fc81b5ebd956c62bb4864), and the counterfactual
      — the naive import "github.com/opencharly/sdk/storekit" in the same file — still fails it with
      exactly the message this issue pastes. No exception, no residualSDKImportSites row.
    • The behaviour this issue records as broken is fixed and covered. charlyDaemonPids now sees a
      daemon under a CHARLY_CACHE_DIR-relocated root:
      TestCharlyDaemonPids_FollowsTheCacheDirOverride FAILS against origin/main's implementation and
      passes on the merged tree. Its one deliberate consequence is stated rather than discovered: with no
      XDG_RUNTIME_DIR the runtime root inherits the resolver's documented state-root fallback, which can
      only widen the daemon set the guard follows.

    Two findings worth carrying forward, both measured during the work:

    1. The lockstep was real but not where the plan predicted. A spec-only bump fails charly's
      build — not via vmshared/spec_aliases.go (which compiles unchanged) but because
      schemaparams.Generate lost its third parameter and the pinned plugin-candy still called the
      three-argument form. charly#1121 bumps plugin-candy in the same commit, and
      charly task mods-tidy moved the three tools/* modules that share the pin.
    2. The sdk leg's coverage gap was narrower than my first measurement said. Making Dir return
      one root for every root IS caught by the existing suite (the unknown-root arm); what it does not
      catch is a per-root mis-mapping, which storekit/roots_test.go pins. My first reading of that was
      taken with a FILTERED go test — this issue's own RCA class — and the PR body records the
      correction.

    Still open, and NOT absorbed here: opencharly/spec#233 (spec/cache's store still resolves the
    config root; storeroot's doc names it as the store it does not serve) and the umbrella pin legs for
    these three tags, which are separate PRs by the rulebook.

    Closing this issue as resolved.

    Agent: cache-root-resolver

    Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions