Skip to content

refactor(refs): one resolver for the repo cache; the retired override is deleted - #396

Merged
github-actions[bot] merged 7 commits into
mainfrom
feat/repo-cache-one-resolver-e
Nov 19, 2026
Merged

github-actions[bot] merged 7 commits into
mainfrom
feat/repo-cache-one-resolver-e

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

refs.RepoCacheDir read a second override, CHARLY_REPO_CACHE, and hand-built $HOME/.cache/charly/repos
when it was unset. D-STORE-1 (DESIGN.md:2482) admits exactly one override:

$ grep -n 'D-STORE-1' DESIGN.md
2482:| **D-STORE-1** | The roots, resolved by ONE resolver on the contract surface — `spec/storeroot` … cache `$XDG_CACHE_HOME/charly` (single override `CHARLY_CACHE_DIR`) |

It now returns storeroot.Dir(storeroot.RootCache) joined with repos.

How tested

The reader, at both refs — a zero with its control:

$ git -C spec grep -c 'os.Getenv("CHARLY_REPO_CACHE")' origin/main -- '*.go'
refs/cache.go:1
$ git -C spec grep -c 'os.Getenv("CHARLY_REPO_CACHE")' HEAD -- '*.go'
(rc 1 — no match)

The RED, which must fail without the change:

--- FAIL: TestRepoCacheDirIsGovernedByTheOneResolver (0.00s)
    cache_root_test.go:38: RepoCacheDir = ".../001/retired-repo-cache", want ".../002/repos"

The gate, on the committed tree:

$ GOWORK=off go build ./...    (rc 0)
$ GOWORK=off go vet ./...      (rc 0)
$ gofmt -l refs/               (empty)
$ GOWORK=off go test ./...     (no failures)

The name survives; the reader does not

$ git grep -n 'CHARLY_REPO_CACHE' HEAD -- '*.go'
refs/cache.go:19:// This used to read a SECOND override, `CHARLY_REPO_CACHE`, and otherwise hand-build
refs/cache_root_test.go:8:// `RepoCacheDir` read a second override (`CHARLY_REPO_CACHE`) and then hand-built
refs/cache_root_test.go:31:	t.Setenv("CHARLY_REPO_CACHE", filepath.Join(home, "retired-repo-cache"))
refs/cache_root_test.go:38:		t.Fatalf("RepoCacheDir = %q, want %q — CHARLY_REPO_CACHE is a second override, and D-STORE-1 admits exactly one (CHARLY_CACHE_DIR)", got, want)
refs/cache_root_test.go:43:	t.Setenv("CHARLY_REPO_CACHE", "")

Two comments and three lines of the test that asserts the resolver ignores it. No line reads the variable.

$ git grep -n 'CHARLY_REPO_CACHE' HEAD -- ':!*.go'
CHANGELOG/0.2026266.1044.md:130:$ CHARLY_REPO_CACHE=<copy of the real poisoned cache> go run .
CHANGELOG/0.2026296.2332.md:14:Measured COLD (fresh `CHARLY_REPO_CACHE`, the real `charly marketplace generate`,
CHANGELOG/0.2026296.2332.md:85:$ export CHARLY_REPO_CACHE=$(mktemp -d)           # COLD: no entry for the ref at all

Three entries, all CHANGELOG/, which is where D-CODE-4 sends history.

Consumers, measured

$ for r in charly sdk spec marketplace; do printf '%-12s ' "$r"; \
    git -C $r grep -c 'CHARLY_REPO_CACHE' origin/main | awk -F: '{s+=$NF} END{print s+0}'; done
charly       11
sdk          9
spec         16
marketplace  7
$ git -C sdk grep -n 'RepoCacheDir' origin/main -- '*.go'
origin/main:loaderkit/deploy_load.go:239:	cacheDir, err := refs.RepoCacheDir()

One code path calls the resolver, and logicalRepoMount applies filepath.Rel(cacheDir, rootDir) — correct for every path the resolver produces.

Three consumer sites set the retired variable and are filed in the repos that own them: charly/main_repo_test.go:55,60 and check/docs-sources/main.go:135,158 at opencharly/charly#1213; three corpus skill files at opencharly/marketplace#629. Producer-first: this PR is the producer and touches neither repo.

Rulebook compliance

  • R0 — git-workflow, go, design loaded before the first git action.
  • R1 — the fixture failures were diagnosed to their mechanism before any edit; the consumer sites are filed in their owning repos.
  • R2 — one resolver; the second is deleted, not deprecated.
  • R3 — no workaround: the env read and the hand-built path are removed.
  • R4 — no documented command breaks. One documented claim did: spec's own .agents/skills/image/SKILL.md:99 named the retired override, and this PR fixes it.
  • R5 — the claim-keyed grep at both refs is in ## How tested.
  • R6 — git status read; worktree off fresh origin/main; the commit list is pasted below; no amend after the first push, no force-push.
$ git log --oneline origin/main..HEAD
9bd3810 docs(refs): the cache comment states the consumer truth, not that nothing referred to it
965793c Merge remote-tracking branch 'origin/feat/repo-cache-one-resolver-d' into feat/repo-cache-one-resolver
3b040a6 docs(skills): the image skill names the ONE cache root, not the retired override
fe3e343 Merge branch 'main' into feat/repo-cache-one-resolver-d
ba0a525 docs(refs): the package comment names the present resolver, not the retired variable
1220615 fix(refs): the second fixture needs the same level as the first
e4deec2 refactor(refs): one resolver for the repo cache; the retired override is deleted

Five authored repairs and two update-branch merges.

  • R7 — the RED fails without the change and both assertions are pasted.
  • R8 — no live service crossed.
  • R9 — no charly binary is rebuilt, but the resolution behaviour changes: the retired variable is ignored and entries go to the path D-STORE-1 names. Stated rather than answered with "no runtime change".
  • R10 — spec carries no per-repo candy gate; the module suite is pasted above.
  • R11 — conforms to D-STORE-1. The change removes a second override the row forbids and a hand-built path that bypassed the contract resolver. No amendment is owed. The residual gap is D-STORE-3's (a plain directory, not a store entry), tracked at #569; this PR does not touch that leg.

Change classification

Kind: spec contract-module Go — one function's resolution, plus its fixtures.

Breaking change + rollback: a consumer that set CHARLY_REPO_CACHE loses that override and falls back to $XDG_CACHE_HOME/charly/repos — the path D-STORE-1 names and the one the contract resolver already returns. No wire shape changes; no generated code changes. Rollback restores the function and its fixtures together.

Filed issues

Agent: lead · DeepSeek Harness session 0d9af4c2ae6e
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

aitrawog and others added 7 commits November 19, 2026 01:53
… is deleted

D-STORE-1 (DESIGN.md:2482) is the roots resolved by ONE resolver on the contract surface,
single override CHARLY_CACHE_DIR. RepoCacheDir read a SECOND override, CHARLY_REPO_CACHE,
and hand-built ~/.cache/charly/repos when it was unset. Both are gone: the function now
returns storeroot.Dir(storeroot.RootCache) joined with repos.

THE RED is an equivalence claim, not an assertion. refs/cache_root_test.go carries two arms:
with CHARLY_CACHE_DIR set and CHARLY_REPO_CACHE ALSO set, RepoCacheDir must return the
CHARLY_CACHE_DIR/repos path -- before the change it returned the retired variable directory;
and with XDG_CACHE_HOME unset, its default must equal what storeroot.Dir(RootCache) returns.
The second is the one that needs an instrument.

THE FIXTURES NEEDED A LEVEL, AND THAT IS THE INTERESTING PART. Three test files set the retired
variable, which meant THE REPOS DIRECTORY; the new one means THE CACHE ROOT. A mechanical rename
therefore put every derived expectation one level off, and two tests failed on absolute paths
rather than on the resolver. Each fixture now measures from the repos level under the cache
root, and the cache_test.go mk helper writes there too. The instrument that saw it was the full
go test ./..., not the new test.

Measured at spec origin/main f26ee24: go build clean, go vet clean, gofmt -l refs empty,
go test ./... with no failures.

Agent: lead
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
cache_test.go:79's TestIsRepoCached_LegacyProvenanceIsNotCached builds its cache path the same
way mk() did -- at the cache root -- and the entries now live one level down, under repos/. The
first fix patched mk() and left this one, which is the same defect in a second instance.

Swept: grep -rn 'filepath.Join(cacheDir,' refs/*_test.go | grep -v repos returns nothing, and
GOWORK=off go test ./... passes.

Agent: lead
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…etired variable

The cache.go header still read "$CHARLY_REPO_CACHE / ~/.cache/charly/repos" after the function
stopped reading either. It now names the repos entry of the ONE cache root that storeroot
resolves (D-STORE-1), which is where the bytes actually go.

The one remaining mention of the retired name is the deliberate sentence below RepoCacheDir that
records what it used to do -- present tense about the present, and a reason, not a history of
what is gone.

Gate: go build clean, go vet clean, gofmt -l refs empty, go test ./... no failures.

Agent: lead
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…ed override

The line documented the override as CHARLY_REPO_CACHE; D-STORE-1 admits exactly one,

CHARLY_CACHE_DIR, and the entries live under <cache root>/repos/. Found by sweeping

the non-Go surface the .go-only grep missed.

Agent: lead

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)
…hing referred to it

It said the variable was never named in DESIGN.md so nothing outside this file's own history

referred to it. The second half was false: three consumer sites named it and are filed at

charly#1213 and marketplace#629. DESIGN.md never named the variable -- that part holds -- but

the conclusion drawn from it did not.

Agent: lead

Assisted-by: DeepSeek Harness deepseek-v4.1-flash (documentation reviewed)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 9bd3810c45d2ae0cde103c4fcba5cf9e058106be (branch: feat/repo-cache-one-resolver-e)

Security screen: PASS — no injection, no secrets/egress, no guardrail weakening; the change removes a second resolver and aligns to D-STORE-1.
Checklist: All applicable rules PASS or NA.

Notes (non-blocking, tool-limited): the override arm is a genuine RED (pasted); the default arm is a delegation/regression guard rather than a second RED; os remains imported in refs/cache.go and is presumably used by the unchanged tail of the file (not visible in the diff), consistent with the pasted go build rc 0. No rulebook violation found.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant