Repository navigation
fix(refs): honor CHARLY_REPO_OVERRIDE at the fetch LEAF, not just one caller - #139
Conversation
… caller RCA: CHARLY_REPO_OVERRIDE (the documented "verify an uncommitted tree before you push" mechanism) was enforced ONLY in the loader-side orchestration (sdk/loaderkit.EnsureRepoDownloaded). The fetch LEAF the standalone generators call directly — spec/refs.DownloadRepo — ignored it entirely, so `charly marketplace generate`, `charly docs generate`, and pluginsgen silently fetched the PINNED REMOTE at every tag even with an override set. That is the R4 hole: a mechanism that exists to test uncommitted work, bypassed by every leaf consumer. Fix (root, one implementation): - Move the override parse to spec/proc (next to RepoOverrideEnv) as proc.RepoOverrideDir — its natural home, and the ONE parse both sides share. - Enforce it in spec/refs.DownloadRepo, so EVERY caller inherits it; the override tree is used verbatim and never migrated (migration would mutate the dev's tree). - sdk/loaderkit.RepoOverrideDir now delegates to proc.RepoOverrideDir (R3 — one implementation per behavior, no duplication). Coverage (both fail without the fix, verified by neutralizing the short-circuit): - spec/refs TestDownloadRepoHonorsOverrideAtTheLeaf — the leaf resolves the local tree with NO network fetch (an impossible version proves no fetch). - spec/proc TestRepoOverrideDir_LocalResolution / _HardErrors — the parse and its loud-failure contract. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: code (spec contract module: Security screen: no finding (no secrets/egress; the change removes a fetch rather than adding one; no guardrail/validator/rulebook surface touched). Comments: none on the PR. Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: code (spec contract module: Security screen: no finding (no secrets/egress; the change removes a fetch rather than adding one; no guardrail/validator/rulebook surface touched). Comments: none on the PR. Blocks
Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
…he duplicate
Validator round 1 on spec#139:
- R3: normalizeOverrideRepoPath duplicated the auto-prefix rule the file's own
comment attributes to spec.NormalizeRepoSpec. Deleted; canonicalRepoPath now calls
the canonical spec helper (one implementation).
- R4: the comparison normalized only the LHS, so RepoOverrideDir("opencharly/x",
"opencharly/x=<dir>") — a BARE repoPath against a bare entry — was SILENTLY ignored
(the exact bypass this PR exists to close). Both sides are now canonicalized, with a
regression case for every bare/qualified combination.
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Review — BLOCKHead SHA: Change class: code — spec contract module ( Comments considered (2, both the same prior review at head
Blocks
Non-blocking, tool-limited disposition: the eval-bed Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: code — spec contract module ( Comments considered (2, both the same prior review at head
Blocks
Non-blocking, tool-limited disposition: the eval-bed Verdict: BLOCK opencode/deepseek-v4.1-flash — action-review. |
Review — PASSHead SHA: Security screen: PASS (T1–T4 no finding — no secrets/egress; the change removes a fetch rather than adding one; no guardrail/validator/rulebook/CI-script surface touched; no embedded instruction directed at this review). Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
[step: review]Review — PASSHead SHA: Security screen: PASS (T1–T4 no finding — no secrets/egress; the change removes a fetch rather than adding one; no guardrail/validator/rulebook/CI-script surface touched; no embedded instruction directed at this review). Verdict: PASS opencode/deepseek-v4.1-flash — action-review. |
R1: sdk main is RED — sdk#266 (the loaderkit -> proc.RepoOverrideDir delegation) merged before its producer (opencharly/spec#139) tagged, and it did not bump the github.com/opencharly/spec require. Against the old pin, loaderkit fails to build: loaderkit/refs_collect.go:72:14: undefined: proc.RepoOverrideDir spec#139 is now merged and tagged v0.2026262.957. This adopts that tag; the sdk tree builds, vets, and tests green again. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Summary of changes
RCA + root fix:
CHARLY_REPO_OVERRIDEwas honored at a CALLER, not at the fetch LEAF.CHARLY_REPO_OVERRIDEis the documented "verify an uncommitted tree before you push" mechanism (spec/proc.RepoOverrideEnv): it points an@githubrepo ref at a local working tree so an uncommitted candy/charly.yml change can be built and evaluated by ANY consumer before it is pushed. It was enforced in exactly ONE place —sdk/loaderkit.EnsureRepoDownloaded(the loader-side orchestration).But the standalone generators call the fetch leaf (
spec/refs.DownloadRepo) directly:plugin-marketplace(charly marketplace generate) —readkinds.go:37→candywalk.CollectEntitiesRemote(roots, refs.DownloadRepo)plugin-docs(charly docs generate) —sources.go:152charly/charly/internal/pluginsgen—main.go:102None of them goes through
EnsureRepoDownloaded, so every one silently ignored the override and fetched the pinned REMOTE ref even when the developer had set an override pointing at their live tree. That is the R4 hole: a mechanism whose whole purpose is to test uncommitted work, bypassed by the consumers that need it (I hit it regenerating the marketplace corpus from a skill branch: the override was set, and the generator still read the pinned tag).Fix (root, one implementation):
Move the override parse to
spec/proc(next toRepoOverrideEnv) asproc.RepoOverrideDir— its natural home, shared by both sides.Enforce it in
spec/refs.DownloadRepo, the fetch LEAF, so EVERY caller inherits it. The override tree is used verbatim and never migrated (migration would mutate the dev's tree).Concrete edits (2 code files + tests, spec repo):
proc/repo_override.go— addRepoOverrideDir; itscanonicalRepoPathhelper delegates to the ONE canonicalspec.NormalizeRepoSpec(no second copy of the auto-prefix rule), and the comparison canonicalizes both sides (so a bareowner/reporepoPathmatches a bare entry and vice versa — a one-sided compare silently ignored that form).refs/git.go—DownloadRepoconsults the override first, before any cache/fetch.proc/repo_override_test.go,refs/git_test.go— regression coverage (incl. the bare/bare case).Consumer leg — landed and its ordering caveat.
sdk/loaderkit.RepoOverrideDirdelegating toproc.RepoOverrideDiris already merged asopencharly/sdk#266. That PR did NOT bump thegithub.com/opencharly/specrequire (it merged before this producer tagged), sosdkmaincurrently fails to build (undefined: proc.RepoOverrideDir) — the cross-repo ordering violation. The heal is a follow-upsdkPR bumping its spec pin to this PR's merge tag, which I will open the moment this tags. Landing order: this PR (spec) merges + tags FIRST → then the sdk pin-bump PR.Change class
cross-repo — producer
spec(this PR). Thesdkdelegation isopencharly/sdk#266(already merged; it needs this PR's tag — see the ordering section). The marketplace/docs/pluginsgen consumers need NO change: they callrefs.DownloadRepo, which is now correct for all of them.Closes / relates to: relates to
opencharly/sdk#266(the delegation, already merged — it needs this PR's tag to heal; see the ordering section).Breaking change + rollback: none — an additive enforcement at an existing documented seam. Rollback: revert.
How R10-tested — exact gate, commands, and pasted output
specmodule'sgo build/go vet/go testplus the NEW regression tests, which fail without the fix. The end-to-end effect was proven through a realcharly marketplace generaterun against the fixed generator (below).N/A — a pure Go ref-resolution change in the spec contract module; spec ships no beds. The end-to-end proof is a REAL generator run (below).DownloadRepo's override branch executed in a realcharly marketplace generate(both the hard-fail and the local-serve arms, below).N/A — a pre-fetch short-circuit.Evidence — put each item in the block whose label names it.
1. Fresh-rebuild gate output (real per-package output + the new tests):
2. Each changed code path executing (the lines proving the changed branch ran, not that it built):
3. Docs-only evidence:
N/A — not a docs-only change.Attribution tier
fully tested and validated— the new tests fail without the fix (verified), and the changed path executed live through a realcharly marketplace generaterun in both arms (broken override → hard fail; valid override → local tree served).Harness rulebook compliance — state HOW each is satisfied (or
N/A — <reason>)/charly-internals:marketplace,/charly-internals:go,/charly-internals:pluginloaded.DownloadRepois the one shared leaf; fixing it covers all three direct consumers — no consumer is left bypassing.proc), using the canonicalspec.NormalizeRepoSpec;loaderkitdelegates (opencharly/sdk#266). Before, it existed once but at the wrong layer.RepoOverrideDirgains one canonical home.git statuschecked; append-only commits; no force-push.N/A — no generated-artifact change in this repo.N/A — no deployable target; the regression tests ship and fail without the change.N/A.N/A — a contract-leaf fix; no concrete-kind logic.N/A — no destroy/rebuild.gofmt -l .empty,go vetclean,go test ./...green.N/A by construction — written at merge by charly-auto-merge[bot] from this body.Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)