Repository navigation
refactor(storekit): re-export the roots resolver instead of computing it - #499
Conversation
storekit/roots.go stops computing the four roots and re-exports the contract module's ONE resolver (github.com/opencharly/spec/storeroot, spec tag v0.2026315.2118). Root becomes a type alias, the four consts become re-exports, and Dir/CacheDir delegate — so the plugin HOST, which may import only spec/*, reaches the SAME implementation every plugin already used (charly#1119). StoreDir and NamedStores stay: they are store ADDRESSING (a name joined onto the cache root, and the oci-layout marker test), not root computation. The public API does not move — same names, same signatures, same results — and the four conditions of the root dump are byte-identical before and after across all three implementations (origin/main's computation, spec/storeroot, and this delegation). storekit/roots_test.go pins what the existing suite leaves open: each root's resolved VALUE. The existing tests catch a Dir that collapses every root into one (the unknown-root arm), but a Dir that maps the config root onto the state root passes them — measured. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: code/config (Go mechanism-library relocation + Security screen: PASS (the Blocks
Comments consideredNone — the thread has 0 comments. Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
|
HOLDING — this PR is the blocking side; the consumer item is opencharly/charly#1119's leg 3. What I hold up: the What unblocks it: a Not blocked BY anything: the work is complete and gate-clean here (the consumer leg's tree also Agent: cache-root-resolver Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system) |
|
Round 1 RCA — both blocks were body/coordination defects, not code findings; the diff did not move. Missed control (the one that matters). The control that would have caught it: after ANY restructure of a body, grep the body for every Second block (COORD). The body named a consumer leg as where the assembled-bed proof lives, What did NOT change. No code, no Agent: cache-root-resolver Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system) |
Review — PASSHead SHA: Security screen: PASS Comments considered:
Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
|
STATUS — the consumer leg opened EARLIER than the Measured: the charly diff imports nothing from This PR is therefore not the blocking side of anything open. The Agent: cache-root-resolver Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (analysed on a live system) |
…re-exported by the sdk kit (#990) * docs: state where the four roots are resolved — the contract module, re-exported by the sdk kit DESIGN.md's D-STORE-1 said the roots are "resolved by one sdk package", and two other places repeated the same home: the CI-gates sentence ("store roots only via sdk") and TODO.md's store phase. That was true until opencharly/spec#303 / opencharly/sdk#499: the resolver now lives in spec/storeroot, because the plugin HOST may import only spec/* and must reach the SAME four roots every plugin reaches, and sdk/storekit re-exports it (type alias, four consts, two delegating functions) so no plugin's import changes. The record now says what the tree does, without restating D-SDK-1's list as if the roots were still an sdk-owned mechanism. Pure prose: no requirement id is added or renumbered, no table shape changes, and scripts/design-consistency.sh stays green. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (documentation reviewed) * docs: hold D-STORE-1's change to the resolver's home The D-STORE-1 row also gained a parenthetical about the runtime root falling back to the state root. That is real behaviour — spec/storeroot documents it and charly#1121 states it as the one deliberate consequence — but it is not a claim this PR is correcting, and mixing it in made the body's "three claims move, and nothing else" false. Dropped, so the diff is exactly the resolver's home plus the two sentences that repeated it. design-consistency.sh stays green. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (documentation reviewed) --------- Co-authored-by: aitrawog <[email protected]>
|
RESOLVED — this PR merged and tagged; the block I posted is discharged.
What remains owed is NOT in this repo: the umbrella's pin legs (spec → sdk → charly) are separate Agent: cache-root-resolver Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated) |
Summary
storekit/roots.gostops COMPUTING the four roots and starts RE-EXPORTING them.Leg 1 (
opencharly/spec#303, taggedv0.2026315.2118) moved the roots and the singleCHARLY_CACHE_DIRoverride intogithub.com/opencharly/spec/storeroot, becausecharlycore —the plugin HOST — may import only
spec/*and therefore could never resolve its cache rootthrough a mechanism kit (
opencharly/charly#1119). This PR is leg 2: the sdk side of that move.What the file is now:
DirandCacheDirdelegate;Rootis an ALIAS, sostorekit.Rootandstoreroot.Rootare one type and a value crosses the boundary in eitherdirection with no conversion.
Root, the four consts,Dir,CacheDir,StoreDirandNamedStoreskeep their names, signatures and results, so every plugin that importsgithub.com/opencharly/sdk/storekit—kit,buildcache,buildkitdrive,artifactkit—compiles and behaves exactly as before.
StoreDirandNamedStoresstay here, because they are store ADDRESSING, not rootresolution: they join a store name onto the cache root and test the
oci-layoutmarker. Theynow inherit the root from the contract resolver like everything else.
require github.com/opencharly/specis bumped to the tag that carries the new package.This is the lockstep leg. The bump and the re-export are one commit on purpose: an sdk that
bumped
specwithout re-exporting would leave the roots reachable only where they now are, and are-export with no bump would not resolve. The measured straddler is not
vmshared(it compilesagainst the new
specunchanged) — it is the reason the bump cannot be separated from the code:sdk's ownstorekitis the file that must stop computing.Files in this diff:
storekit/roots.gostorekit/roots_test.gogo.modrequire github.com/opencharly/spec→v0.2026315.2118go.sumgit diff --stat origin/main...HEAD:This head is
How tested
Every command below was run against this head (
ef7bb179d3d2bba4fb6904e64a738c66e9e1a088) and pasted from its capture file.1. Behaviour-identical — a three-way dump, four conditions, byte-identical
One probe (
probe_roots_scratch/main.go, never committed) prints all four roots plusCacheDir.It was built three times against three implementations and run under the same four environment
conditions, then the transcripts were diffed pairwise:
sdk@origin/main—storekitBEFORE the move (the reference).spec@ leg 1's tag —storeroot(the new home).storekitAFTER the move (the re-export).diff -u before.txt after.txtrc=0, no outputdiff -u before.txt sdk-after.txtrc=0, no outputdiff -u after.txt sdk-after.txtrc=0, no outputThe four conditions: (A) every
XDG_*pinned to a distinct scratch path withCHARLY_CACHE_DIRunset; (B)
CHARLY_CACHE_DIRabsolute; (C)CHARLY_CACHE_DIRrelative (rel-cache); (D) everyXDG_*unset withHOMEpinned — which is where the runtime root falls back to the state root.2. The module's own gates, on the committed tree
Lint, and which toolchain.
golangci-linthere is v2.13.2 built withgo1.27.3-X:nodwarf5and the host
gois the samego1.27.3-X:nodwarf5— the pair whose embedded type-checker readsonly export-data v4 while go1.27 writes v5. So the lint ran under
GOTOOLCHAIN=go1.26.8, thetoolchain
ci.ymlinstalls:3. What the delegation's coverage actually catches — one measured pair, and a correction
The package's PRE-EXISTING tests already catch a
Dirthat stops distinguishing roots at all,because they require an unknown root to error. Measured, unfiltered, with this PR's new test file
set aside:
What they do NOT pin is each root's RESOLVED VALUE:
storekit_test.go:510-527accepts anyerror-free path for the config and state roots and only compares runtime against state. So a
mis-mapping inside the delegation is invisible to them, and that is the class
storekit/roots_test.goexists for. The pair, measured arm against arm:Both arms are ASSERTION-level: the planted code compiles, so no build error can be mistaken for the
red.
And a correction this PR owes, because it is the same defect the issue is about. My first
measurement of this question was taken with a FILTERED
go test -run 'TestCacheRoot|TestNamedStores|TestOrphanedLayouts',which excluded the package's own gate — and the filtered run stayed green, from which I wrongly
concluded the package could not see the break at all. That is exactly the missed control
opencharly/charly#1119's own RCA records ("measured with … a FILTERED
go test— the filterexcluded the package's own gate"). The unfiltered re-measurement above is what stands, it is why
this section reads as two arms instead of a "gap", and the new test file's header states the same
distinction so the next reader is not misled either.
4. Attribution evidence (A3)
Rulebook compliance
R0 — skills first.
/charly-internals:git-workflow,/charly-internals:go,/charly-internals:strict-policyand/charly-internals:go-qualitywere loaded before thefirst tool action, and
sdk's ownAGENTS.mdwas read fromorigin/mainbefore the first edit.R1 — RCA every anomaly, then fix it or file it. Two fired, both on this change's own
surface, both fixed here. (a) The first lint run returned 2 findings on the new test file
(
ST1023onvar asContract storeroot.Root = RootCache,unconvertonstoreroot.Root(root)) — both were correct, and both were fixed by REMOVING the conversion andthe annotation, which incidentally makes the test stronger: the calls now type-check only
because the alias makes the two names one type. (b) The new test file's JUSTIFICATION was
first drafted from a FILTERED run and was wrong — the pre-existing suite does catch a collapsed
Dir— so §3 was re-measured unfiltered, arm against arm, and the claim narrowed to the classthe old suite is genuinely blind to (a per-root mis-mapping); the new file's own header states
the same distinction.
R2 — no duplication. This PR DELETES the second implementation: the four-root computation
leaves
storekitentirely, and what remains is an alias, four const re-exports and twodelegating functions.
grep -n 'os.UserCacheDir\|filepath.Join(base, "charly")' storekit/*.gohits nothing after this change.
R3 — no workarounds. Nothing is sleep- or retry-shaped; the delegation is the mechanism.
R4 — product before prose. The package doc was rewritten to describe present code: the roots
are the contract's, and this package re-exports them.
R5 — hard cutover, legacy deleted. The old computation is gone in the same commit that adds
the delegation — no shim, no dual path, no
deprecatedmarker, nothing kept "just in case".The identifier-keyed sweep, CALIBRATED IN BOTH DIRECTIONS: the predicate is the set of calls the
deleted computation made, and it must match on
origin/main(where that code lives) and matchnothing on this head. Both halves, run here:
Seven removed call sites, zero survivors. What the file still legitimately uses is the STORE
side —
filepath.Join(root, name)inStoreDirandos.ReadDir/os.StatinNamedStores—which is why the predicate names the calls, not the packages.
The one sibling prose that repeated the old ownership claim —
storekit/roots.go's package doc,which said DESIGN puts "the store and its roots" here — is rewritten in this commit, not left for
a follow-up.
R6 — preserve user work; Git safety.
git statusread before the first edit and after eachstep; the session worktree is
feat/storeroot-reexportoff freshorigin/main(
6e23e654df0c57780c6b73e1f069819212d71a2f); the scratch probe directory was untracked and removed; no reset, no checkout offoreign work, no force-push, no hook bypass, no direct push to
main.R7 — prove behaviour, not compilation. §1 executes the changed path under four conditions and
three implementations; §3 proves the new coverage fails without the change, with the restore
verified by hash.
go build ./...is additionally run forlinux/{amd64,arm64,arm,386}, thematrix
ci.ymldeclares.R8 — live or skip, never fake. N/A, reasoned: the changed boundary is the filesystem's XDG
layout. No service, credential or network is involved, so nothing can be mocked and nothing must
skip.
R9 — binary equals source. N/A, reasoned:
sdkships no binary. The module's freshness proofis §2's build + test on the committed tree, with the toolchain named.
R10 — fresh disposable proof. A mechanism-library change.
sdkdeclares no per-repo candygate and carries no
disposable: truebed (AGENTS.md: "this repo carries no per-repo candygate"), so the gate that owns it is CI's Go gate — run here on the committed tree, zero warnings
(
0 issues.). The assembled-bed proof belongs to the CONSUMER leg (charly), where acompiled-in plugin and the host both resolve through this code; that PR carries the evidence.
Change classification
Mechanism relocation, API-compatible. No exported identifier is added, removed or renamed:
Root,RootConfig,RootCache,RootState,RootRuntime,Dir,CacheDir,StoreDir,NamedStores,Store,OpenStore, … all keep their names, signatures and results. What moves isthe IMPLEMENTATION of the four roots — into the contract module — and what changes here is that
Dir/CacheDirdelegate instead of computing.Breaking change + rollback: nothing breaks for
sdk's consumers. The one observable differenceis where the roots are IMPLEMENTED, and that is invisible through this package's API; a plugin that
imports
storekitkeeps its compile and its behaviour (proved by the three-way dump in §1 and bythe whole module's suite). The
require github.com/opencharly/specline moves forward one tag, soa consumer that pins
sdkand also pinsspecbelowv0.2026315.2118must raise itsspecpin tomatch — otherwise MVS raises it for them at
go mod tidyand the build is unaffected. Rollback istwo commits, in this order: revert this repo's commit (the
go.modbump goes with it, returningto the previous
spec), and — only if the resolver itself must be withdrawn — revert leg 1'scommit in
spec. No data migration in either direction: the roots resolve to the directories theyalways did, which is exactly what §1 measures.
Filed issues
$XDG_DATA_HOME/charly)and, after this PR, the root set is edited in
spec/storeroot/roots.go;storekit/roots.gohasno
switchleft to extend. Posted on the issue so the next session does not spend a roundediting a re-export.
Agent: cache-root-resolver
Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated)