Repository navigation
feat(candywalk): add a per-file RefScope seam to the remote walk - #626
Conversation
CollectEntitiesRemote keeps its full-closure contract (remote candy discovery, progress, skip behavior; its tests are unchanged). CollectEntitiesRemoteScoped lets a consumer narrow the refs a file contributes. The corpus generator will use it to follow only the candies that own a skill/hook/marketplace entity, so a source's test fixture can no longer drag a retired repo into the corpus. Test: TestCollectEntitiesRemoteScoped_NarrowsOneFile. Package gates: go test ./candywalk, go vet ./candywalk. Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — additive, kind-blind API seam; no secrets, network, guardrail or supply-chain changes; description matches the two-file diff. Non-blocking note: in Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
The corpus now has an explicit retirement list: retired.cue at the generator's --root, validated against the plugin's #Retired (a CLOSED CUE definition) at read time. A retired repo is never resolved — not from the refs list, not from a fetched tree's composition list, not transitively — and a refs list that pins one fails the run instead of half-applying. readKinds walks through candywalk.CollectEntitiesRemoteScoped (opencharly/sdk#626, released v0.2026327.1226). Two structural closure rules were implemented and measured against the full 362-skill corpus first, and both were rejected: they removed 11 and 6 PUBLISHED skills respectively, because a retired repo and a live repo reachable only through an old tree have the same shape. Retirement is data. Measured on the real corpus: with retired.cue carrying pod-immich-ml, generate removes exactly immich/skills/immich-ml (362 -> 361 skills, index.json updated, nothing else moves) and drift reports clean. Closes #63. Files #64 (subpath refs still drag whole old trees in — the residue). Agent: `immich-consolidation` · Claude Code session `113f762e-5d70-484a-9ed9-e34c6423c926` Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Summary
sdk/candywalkgains a per-file ref seam, and keeps its full-closure contract:type RefScope func(path, candyName string, ents []Entity, all []string) []string— decides which@githubrefs ONE walked file contributes to the remote fix-point.allis exactly whatcollectRefsfound;entsare the file's entities.CollectEntitiesRemoteScoped(roots, resolve, scope)— the same remote walk with that seam.CollectEntitiesRemoteis nowCollectEntitiesRemoteScoped(…, nil)and is behaviourally unchanged: the scope is only consulted when non-nil, in the two places a walked file contributes refs — a repo root'scandy/<name>/charly.yml(andbox/<name>/charly.yml) and a fetched repo's rootcharly.yml. Every existing walk test (remote candy discovery, the progress line, skip-and-warn, files-only fetch) runs against that path and passes untouched.Why a seam and not a stricter walker. The rule this unlocks — "follow a source's corpus manifests, never its fixtures" — is the CONSUMER's policy. This kit is shared and must stay kind-blind (sdk
AGENTS.mdboundary law): it hands the caller the file, the entities and the refs, and the caller decides. Other consumers ofCollectEntitiesRemote(the loader's own scan) genuinely need the full closure, so tightening the walker itself would regress them. The alternative measured in the consumer repo — forking the walk — duplicates the fix-point, the cache contract and the skip-and-warn policy; this seam adds one comparison to the existing function instead (R2).The test
TestCollectEntitiesRemoteScoped_NarrowsOneFilefixtures a local tree with an owner candy (require:+candy:refs) and a non-owner box, applies an owner scope, and asserts the two owner refs are resolved and the box's ref is not. The same fixture returned unfiltered before the seam — the assertion fails without the change (R7).How tested
The full module gate from
sdk/AGENTS.md+.github/workflows/ci.yml, run insdk/on this exact commit (81f4fc671f890fb825121f7c7ff47e2ec3d388d0):golangci-lint(the workflow's pin),GOTOOLCHAIN=go1.26.8:Cross-compile matrix,
CGO_ENABLED=0:The consumer-side proof (the corpus regeneration that the scope exists for) is the marketplace-generator PR that adopts this entry point; it is not claimed here.
Rulebook compliance
/charly-internals:plugin,/charly-internals:go,/charly-internals:marketplace,/charly-internals:git-workflow,/charly-internals:strict-policy.RefScopehas no predecessor).feat/corpus-walk-scope; no other session's branch, worktree or file touched.TestCollectEntitiesRemoteScoped_NarrowsOneFileasserts a behaviour that is false without the seam (the fixture ref was followed before); it executes the real walker, and the module's existing tests pin the untouched full-closure path.Change classification
Additive API.
CollectEntitiesRemote's observable behaviour is unchanged (a nil scope short-circuits the filter), so no consumer needs to move. No!marker; no breaking change and no rollback procedure is required beyond reverting this commit, which removes only the new symbols.Filed issues
None.
Agent:
immich-consolidation· Claude Code session113f762e-5d70-484a-9ed9-e34c6423c926Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated)