Repository navigation
feat(refs): a files-only fetch, so a corpus source certifies only the tree it reads - #281
Conversation
… tree it reads spec/refs.DownloadRepo populates EVERY submodule a fetched repo declares and fails the whole fetch when one is unreachable (populateSubmodules, deliberate). That is right for a `--repo` cache — a whole project a user drives with the charly binary — and fatal for a corpus SOURCE fetch: `charly marketplace generate` reads a manifest and a .agents/ tree and no submodule at all, yet inherited the population. Measured in CI on opencharly/marketplace#566, pinning opencharly/opencharly (412 declared gitlinks): charly-registry needs credentials the runner lacks and pod-osm-tools fails on `could not set core.worktree`, and either one fails the entire corpus walk. The 431-gitlink population was already measured as a pure cost in spec#267. DownloadRepoFiles is the files-only fetch: same signature as candywalk's RemoteResolver, so the corpus generator passes it as the existing seam with no SDK change, while DownloadRepo keeps its signature and its submodule contract. It is a MODE, not a global opt-out: a per-fetch decision with its own cache entry (<repo>@<version>.files, because content decides the key), and its own freshness predicate — a tree export is complete without submodule content, a whole-project export never is. Tests (local file:// remotes, no network) prove the three arms the issue asks for: files-only fetch of a submodule-bearing repo succeeds and populates nothing; the whole-project fetch of the SAME repo still populates; a genuinely unreachable submodule still fails the whole-project fetch loud while the files-only fetch of that repo succeeds; and a tree export is fresh for the files-only reader and stale for the whole-project one. Closes #279 Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Review — PASSI re-derived every claim in the body against the six provided diffs and the single commit. No comments exist on this PR, so there is no sign-off to evaluate and no stale claim to dismiss; the change is judged on its own evidence. What the diff actually does
Correctness and scope
Minor, non-blocking body inaccuracies
Neither affects the substance: every arm the body claims is reproduced by the tests, the console messages ( CommentsThere are zero comment threads; nothing to disposition, and no maintainer sign-off is present, so the change stands on the evidence above — which it does. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
The umbrella's three general-guidance skills (agents, cutover-policy, root-cause-analyzer) have no code, plugin or config behind them, so their home is the one repo every consumer shares (opencharly/opencharly#600, AGENTS.md Part II #5). This is the pin #566 withdrew: a repo declaring 412 submodules could not be a corpus source at all while the walk's fetch populated every one of them and failed the whole fetch when one could not be fetched. Producer-first: opencharly/spec#281 landed the files-only fetch (refs.DownloadRepoFiles, tag v0.2026296.2332), opencharly/plugin-marketplace#49 made the corpus walk use it (tag candy/plugin-marketplace/v0.2026296.2345), and this PR takes both plus the pin. The corpus delta is ONE file — internals/skills/agents/references/ hooks-and-lifecycle.md — because the three bodies are byte-identical in both sources; the agents REFERENCE file is the only thing that differs, and it now matches the umbrella's, not [email protected]'s copy. 361 SKILL.md, 496 artifacts, no skill gained or lost. The carrier keeps publishing git-workflow and repo-setup, so its pin stays: its drain is its own PR. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) Co-authored-by: Andreas Trawoeger <[email protected]>
Agent: charly-spec279
Summary
spec/refs.DownloadRepoinitialises every submodule a freshly fetched repodeclares and fails the whole fetch when one cannot be fetched —
populateSubmodules,deliberately, because a
--repocache is a whole project a user drives with nothingbut the charly binary. That contract is right for
--repoand fatal for a corpusSOURCE fetch, which reads the fetched repo's
charly.ymland its.agents/treesand no submodule at all.
Measured COLD (fresh
CHARLY_REPO_CACHE, the realcharly marketplace generate,opencharly/opencharly:v2026.296.2037, 412 declared gitlinks):So
@github.com/opencharly/opencharly:<tag>could not be a corpus source at all —that is why the pin was withdrawn from
opencharly/marketplace#566— and the threegeneral-guidance skills the umbrella authors (
agents,cutover-policy,root-cause-analyzer; umbrellaAGENTS.mdPart II #5) had no reachable home. The samepopulation had already been measured as a pure cost on the same walk in
spec#267(431 gitlinks, ~3 min cold, 272 MB transient, none of it read).
The fix — the issue's candidate 1, as a sibling fetch rather than an options type
Why this candidate, and why spelled this way. The deciding criterion is that the
fetch should certify exactly what the reader needs and no more:
candywalk.RemoteResolverisfunc(repoPath, version string) (string, error), so asibling with that exact signature threads through the existing seam with no
sdkchange at all —
candywalk.CollectEntitiesRemote(roots, refs.DownloadRepoFiles).An options type would have needed either a wrapper closure at every call site or a
seam change in the SDK.
DownloadRepokeeps its signature AND its submodule contract, so no--repocallerchanges a line. Nothing is relaxed globally: the mode is a per-fetch decision.
requirement into the REF, where every consumer of that ref inherits it. A ref names a
repo at a version; what the fetch must certify is the CALLER's business.
Two mechanisms make it a mode rather than a flag:
<cache>/.files/<repo>@<version>, one directory level belowthe whole-project
<cache>/<repo>@<version>. Content decides the key: a tree exportis not a usable
--repocache and a populated export is a superset, so sharing onekey would make each caller re-download the other's entry on every run.
repoCacheFreshMode: a whole-project export mustcarry its submodule content (unchanged), while a files-only export is complete the
moment its tree is there, because that is the entire content its reader asked for.
The mode directory rather than a
.filessuffix on the basename was itself decidedby measurement:
plugin-marketplace'sresolve.goranks two sources that publish oneidentity by the CalVer it reads at the END of
Entity.SourceRoot(
@v<YYYY>.<DDD>.<HHMM>$). A suffix made every fetched source unparseable and anunparseable rank silently hands the identity to whichever twin still parsed. The
basename therefore stays
<repo>@<version>, and the mode lives one level up.The three arms
1. COLD + the umbrella ref → rc=0, and the tree is what got certified.
2. The
--repocaller still populates (refs.DownloadRepo, unchanged):3. A genuinely unreachable declared submodule still fails the whole-project fetch
LOUDLY — the fetch has not become universally lenient:
How tested
The change-class gate for this repo (
.github/workflows/ci.yml: build, test, gofmt,golangci-lint), run on the committed tree, plus the changed path executed live against
real remotes:
golangci-lintwas installed the CI way —go install …@v2.13.2underGOTOOLCHAIN=go1.26.0, the toolchaingo.modnames (go-version-file: go.mod) — nota host-built binary: a v2.13.2 linter built with the host's go1.27.3 cannot decode this
toolchain's export data (
opencharly/sdk#466), and a host-toolchain red would be anenvironment finding, not this diff's. Under the module's own toolchain: 0 issues.
file://remotes (no network) and fail without the change:DownloadRepoFilesdoes not exist before it, andTestRepoCacheFreshMode_…asserts atree export is fresh for the files-only reader and STALE for the whole-project one —
the pre-change predicate has no such distinction.
go test ./...run reportedTestGenReproduciblefailing withwrite /tmp/…: disk quota exceeded. Re-run withTMPDIRon the root filesystem itpasses (
ok github.com/opencharly/spec/spec), so the failure is this host's tmpfsquota, not the tree.
Rulebook compliance
downloadRepoFromMode), one clone (gitCloneMode), one population branch (populateByMode), one freshness predicate (repoCacheFreshMode). No second copy of any of them, and no test-only wrapper left behind.origin/main; one commit; no force-push, no direct push tomain.Change classification
Additive library change in the contract module: one new exported fetch
(
DownloadRepoFiles), two new internal cache-location helpers (repoFilesCachePathandthe mode dispatcher
repoCachePathFor) plus thefilesCacheDirconstant, one modeparameter threaded through the existing fetch/clone/freshness path, and five tests in
refs/git_files_test.go(the four remote-backed arms plus the mode-relative freshnesspredicate). No schema change, no wire change, no migration, no behavioural change for any
existing caller.
Filed issues
populateSubmodulesruns a multi-minute population under the60s transfer deadline, and the retry collides with the killed attempt's residue (the
proximate cause of the cold failure pasted above; NOT the unreachable-submodule case the
issue filed, and not blocking for a files-only fetch, which never populates).
and still calls
refs.DownloadRepo(sources.go:152,catalog.go:290), so it inheritsthe same population. Its own PR/tag chain; nothing here depends on it.
resolve.gorecovers a source's tag by parsingthe cache-path basename, so a cache-layout change degrades the dedupe SILENTLY. This
change's first cache-key design (a
.filessuffix) hit exactly that; the final layout(a
.filesdirectory, basename unchanged) preserves the shape it reads, and the issueasks for the structural read instead.
Attribution
This session's delivered system message reads, verbatim:
You are a coding agent powered by the deepseek-v4.1-flash model.— harnessDeepSeek Harness, modeldeepseek-v4.1-flash, the pair the footer names; cited together withopencharly/opencharly#538, the open record of this runtime being real and running
while the validator's model allowlist rejected it.
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)