Skip to content

feat(candywalk): add a per-file RefScope seam to the remote walk - #626

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/corpus-walk-scope
Nov 23, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/corpus-walk-scope

Conversation

@aitrawog

Copy link
Copy Markdown
Contributor

Summary

sdk/candywalk gains a per-file ref seam, and keeps its full-closure contract:

  • type RefScope func(path, candyName string, ents []Entity, all []string) []string — decides which @github refs ONE walked file contributes to the remote fix-point. all is exactly what collectRefs found; ents are the file's entities.
  • CollectEntitiesRemoteScoped(roots, resolve, scope) — the same remote walk with that seam.

CollectEntitiesRemote is now CollectEntitiesRemoteScoped(…, 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's candy/<name>/charly.yml (and box/<name>/charly.yml) and a fetched repo's root charly.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.md boundary law): it hands the caller the file, the entities and the refs, and the caller decides. Other consumers of CollectEntitiesRemote (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_NarrowsOneFile fixtures 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 in sdk/ on this exact commit (81f4fc671f890fb825121f7c7ff47e2ec3d388d0):

gofmt:[]
build=0
vet=0
ok  github.com/opencharly/sdk          0.443s
ok  github.com/opencharly/sdk/agentkit 0.927s
ok  github.com/opencharly/sdk/artifactkit 0.071s
ok  github.com/opencharly/sdk/auditkit 0.135s
ok  github.com/opencharly/sdk/buildcache 1.332s
ok  github.com/opencharly/sdk/buildkit 0.044s
ok  github.com/opencharly/sdk/buildkitdrive 0.049s
ok  github.com/opencharly/sdk/candywalk 0.008s
ok  github.com/opencharly/sdk/charlylib 0.020s
ok  github.com/opencharly/sdk/checkkit 0.009s
ok  github.com/opencharly/sdk/cmd/charly-lib-gen 0.007s
ok  github.com/opencharly/sdk/deploykit 21.310s
ok  github.com/opencharly/sdk/enginekit 0.008s
ok  github.com/opencharly/sdk/kit 13.173s
ok  github.com/opencharly/sdk/llmkit 3.574s
ok  github.com/opencharly/sdk/loaderkit 4.875s
ok  github.com/opencharly/sdk/packagekit 0.036s
ok  github.com/opencharly/sdk/rawbody 0.005s
ok  github.com/opencharly/sdk/storekit 1.382s
ok  github.com/opencharly/sdk/vmshared 0.193s
ok  github.com/opencharly/sdk/workflowkit 0.005s

golangci-lint (the workflow's pin), GOTOOLCHAIN=go1.26.8:

0 issues.

Cross-compile matrix, CGO_ENABLED=0:

cross linux/amd64=0
cross linux/arm64=0
cross linux/arm=0
cross linux/386=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

  • R0 — loaded /charly-internals:plugin, /charly-internals:go, /charly-internals:marketplace, /charly-internals:git-workflow, /charly-internals:strict-policy.
  • R1 — no failure, warning or anomaly in any gate above; nothing to file.
  • R2 — one walker. The new entry point is a thin parameterisation of the existing fix-point; there is no second discovery implementation, and the scope is applied at the existing ref-collection sites.
  • R3 — no sleep, retry, suppression or fixture; the scope is a pure function applied in-line.
  • R4 — not applicable (library surface, no documented command).
  • R5 — nothing legacy removed; no alias or shim introduced (RefScope has no predecessor).
  • R6 — work is on feat/corpus-walk-scope; no other session's branch, worktree or file touched.
  • R7 — TestCollectEntitiesRemoteScoped_NarrowsOneFile asserts 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.
  • R8 — not applicable (no live-service boundary).
  • R9 — not applicable (no binary; the repo is a Go module).
  • R10 — the change class is a library API addition; the repo's own gate (build, gofmt, vet, test, lint, cross-compile) ran on this exact commit. The downstream runtime proof belongs to the consumer PR.
  • R11 — no DESIGN shape is added or changed: an exported Go function is not a wire, persisted or authored shape. The seam stays kind-blind (it hands over the entities and the refs; it never names a kind), per the sdk boundary law.
  • ARCH — a mechanism in the shared kit, not capability code; no kind or verb word enters the package.

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 session 113f762e-5d70-484a-9ed9-e34c6423c926
Assisted-by: Claude Code ollama-cloud/deepseek-v4.1-flash (fully tested and validated)

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)
@github-actions

Copy link
Copy Markdown

Review — PASS

Head SHA: 81f4fc671f890fb825121f7c7ff47e2ec3d388d0 (branch: feat/corpus-walk-scope)

Security screen: PASS — additive, kind-blind API seam; no secrets, network, guardrail or supply-chain changes; description matches the two-file diff.
Checklist: All applicable rules PASS or NA (library API addition: bed/disposable-target obligations are N/A to a pure Go module; the module gate output is internally consistent and the scoped code path is exercised by TestCollectEntitiesRemoteScoped_NarrowsOneFile, whose retired@ negative assertion fails without the seam).

Non-blocking note: in candywalk/scope_test.go the needed@ positive assertion is a substring of also-needed@, so it does not independently distinguish the two owner refs — harmless here because the per-file scope returns all-or-nothing and the critical retired@ exclusion is sound, but worth tightening in a follow-up.

Verdict: PASS


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

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) November 23, 2026 12:25
@github-actions
github-actions Bot merged commit 1b30f48 into main Nov 23, 2026
8 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Nov 23, 2026
github-actions Bot pushed a commit to opencharly/plugin-marketplace that referenced this pull request Nov 23, 2026
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)
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