Repository navigation
fix(refs): delegate mutable repo refs to the freshness-checked downloader - #163
Conversation
…ader EnsureRepoDownloaded reused any cached repo export without consulting the downloader: a mutable ref (a branch such as main, or an unversioned ref resolved to the default branch) froze at first-download content. A pre-#146 charly@main export kept serving protocol-v1 builder-plugin sources, so box builds with unversioned builder-plugin refs failed 'Plugin version: 1, Client versions: [2]' (#158) even after the box repos re-pinned to the protocol-v2 tag — the pin is the candy fetch coordinate, while out-of-process builder plugins resolve by canonical unversioned ref. Mutable refs now always delegate to the registered refs backend, which re-resolves the ref's current commit and refreshes a stale export (the sdk kit.DownloadRepo provenance contract, producer leg opencharly/sdk#77); tags and SHAs keep the offline cache-hit fast path. The decision uses the new shared kit.IsMutableRef classifier. Verified: TestEnsureRepoDownloaded_MutableRefAlwaysDelegates (mutable delegates when cached; tag hits offline), TestIsMutableRefCoreContract; go test ./... + go vet + golangci-lint (0 issues); live on the rebuilt binary: a stale charly@main export self-healed and arch-test (the issue repro) built. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
A cached remote-repo export was reused forever once downloaded: `kit.DownloadRepo` checked only that the cache directory existed, so a mutable ref (a branch such as `main`, or an unversioned ref resolved to the default branch) froze at its first-download content — a pre-#146 `charly@main` export kept serving protocol-v1 builder-plugin sources indefinitely, and box builds with unversioned builder-plugin refs failed `Plugin version: 1, Client versions: [2]` (opencharly/charly#158) even after the box repos re-pinned their candies to the protocol-v2 tag. `kit.DownloadRepo` now records the clone's resolved commit in a provenance sidecar (`<cache>.ref`) and reuses the cache ONLY when that provenance equals the ref's currently resolved commit — a moved branch is re-downloaded instead of silently serving stale content. Refresh is serialized per cache path (`<cache>.lock`, the existing `AcquireFileLock` primitive) and published via temp-clone + rename swap (complete old or new tree, never a half-clone; a publish failure restores the old export). Pre-contract caches have no sidecar → stale → self-heal on first access. Adds `kit.IsMutableRef`, the shared mutable-vs-immutable classifier, and `downloadRepoFrom` (URL-explicit variant) so the freshness contract is testable against a local `file://` remote. Coverage: `TestIsMutableRef`, `TestRepoCacheFresh`, `TestDownloadRepoFrom_RefreshesMovedBranch` (end-to-end against a local file:// remote: branch advance re-downloads, unmoved ref hits, no swap residue). Fresh-validator gate: sdk standalone battery (`GOWORK=off` tidy no-op, verify, build, vet, test) green; gofmt clean; `golangci-lint run ./...` 0 issues (isolated cache); live consumer proof corroborated on disk (`[email protected]` provenance sidecar + lock; `ghcr.io/opencharly/arch-test:2026.201.0740` built). Producer leg of the cross-repo cutover; the superproject consumer (opencharly/charly#163) lands next with the `EnsureRepoDownloaded` mutable-ref delegation + sdk gitlink bump. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
Bumps the sdk submodule to the merged opencharly/sdk#77 squash (7dcfc07, tag v0.2026201.852) — the producer leg of this refs-freshness cutover — and the charly/go.mod require to the same version. Assembly re-gate follows after the origin/main merge (W9 CandyReader adaptation). Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
Bring the W9 CandyReader adaptation (b4c6c69) into the branch; resolve the sdk gitlink to the descendant 7dcfc07 (ancestor chain 9b29e8b -> 5cf230d -> 7dcfc07 verified via merge-base) and the go.mod require to v0.2026201.852 (the W9 .649 content is included in .852). Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
pr-validator — CHANGES REQUESTED ❌Change class: charly/sdk Go (cross-repo consumer leg of opencharly/sdk#77) Bound identities (verified live by me, not from the envelope):
The blocking finding (deterministic, reproduced 4× by me)
Mechanism (RCA): Sibling sweep (complete blast radius): only these two subtests. Required fix: update Checklist
Comments considered: none — the PR carried no comments at validation time. Cross-PR interactions considered: #118 ( Decision: FAIL. The core Go gate is red on the final tree by the PR's own mechanism change; the existing Assisted-by: Kimi Code (Moonshot K3; analysed on a live system) |
TestCharlyRepo_FlagChdir seeded its hermetic cache at foo/bar@main and encoded the old short-circuit contract; with mutable refs now delegating to the downloader, the spawned binary ls-remote'd a fictional repo and failed (caught by the fresh pr-validator for #163). The test's subject is chdir-before-dispatch, not freshness, so it now seeds foo/[email protected] (immutable -> offline cache hit); the mutable-delegation path stays covered by TestEnsureRepoDownloaded_MutableRefAlwaysDelegates. Verified with pipefail: full go test ./... ok (100.7s), go vet clean, golangci-lint 0 issues, targeted FlagChdir PASS (both subtests), task build:binary rebuilt. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
pr-validator — APPROVED ✅Change class: charly/sdk Go (cross-repo consumer leg of opencharly/sdk#77) — re-validated from scratch by a fresh validator; supersedes the prior FAIL verdict, whose single blocking item is now verified fixed. Bound identities (verified live by me, never from the envelope):
My own gate re-runs on the final tree (ae21eb1) — all raw, all minePrior-round blocking item — independently re-verified FIXED: Live-proof artifact cross-check (item 11): Checklist
Comments considered: atrawog (prior pr-validator) — FAIL verdict on Cross-PR interactions considered: #118 ( Decision: PASS. The prior round's single blocking item is fixed in exactly the demanded shape and the complete candidate — code, tests, sdk producer-leg delta, description, gate — re-validates clean from scratch against every rulebook item, with the full core Go gate, lint, build, binary, and reproducibility checks re-run by me on the final tree at zero warnings. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system) |
Rename the placeholder CHANGELOG entry to the merge-time CalVer and re-stamp its H1 (pr-validator Phase 3, #163). Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
pr-validator — landing outcomes (all gated actions ALLOWED, verbatim)
Assisted-by: Kimi Code (Moonshot K3; analysed on a live system) |
…-#146 protocol skew) Post-#146 plugin-protocol skew repair (opencharly/charly#158): every `@github.com/opencharly/charly/...` pin in this repo moves from `v2026.183.1359` (and residual `v2026.200.1914`) to `v2026.201.0706` via `charly box reconcile --remote`. The pre-#146 pins fetched protocol-v1 candy content; under a protocol-[2] host binary every box build whose candies load out-of-process builder plugins failed `Plugin version: 1, Client versions: [2]`. Companion content-wave to the root fix (opencharly/sdk#77 + opencharly/charly#163 — the stale `@main` repo-export freshness contract). Gate (re-run by the fresh pr-validator on a rebuilt binary, version 2026.201.1004, tree byte-identical to protected main): `charly box validate` exit 0 with zero warnings (fetches and resolves every moved pin live); `charly box reconcile --dry-run` reports already reconciled. Author build evidence: `box build arch-test` tagged OK; `box build arch-coder` passes the builder-plugin phase and stops only at the documented external release-package 404 (no GitHub releases exist; release-packages runs queued on an unavailable self-hosted runner — not a candidate defect). CHANGELOG/2026.201.1045.md carries the cutover history; tag v2026.201.1045 marks this merge. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
…-#146 protocol skew) Post-#146 plugin-protocol skew repair (opencharly/charly#158): every @github.com/opencharly/charly/... pin in this repo moves from v2026.183.1359 to v2026.201.0706 via `charly box reconcile --remote`. The pre-#146 pins fetched protocol-v1 candy content; under a protocol-[2] host binary every box build whose candies load out-of-process builder plugins failed `Plugin version: 1, Client versions: [2]`. Companion content-wave to the root fix (opencharly/sdk#77 + opencharly/charly#163 — the stale `@main` repo-export freshness contract). Validated by a fresh pr-validator: `charly box validate` exit 0 (zero warnings), `box reconcile --dry-run` already-reconciled, and a full `box build debian-builder` re-run at zero warnings on a binary rebuilt from the current tree. Merge-time CalVer 2026.201.1046. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
…146 protocol skew) Post-#146 plugin-protocol skew repair (opencharly/charly#158): every `@github.com/opencharly/charly/...` pin in this repo moves from `v2026.183.1359` to `v2026.201.0706` via `charly box reconcile --remote` (171 pins; the `distro-arch` import aligns to `v2026.200.2132`). The pre-#146 pins fetched protocol-v1 candy content; under a protocol-[2] host binary every box build whose candies load out-of-process builder plugins failed `Plugin version: 1, Client versions: [2]`. Companion content-wave to the root fix (opencharly/sdk#77 + opencharly/charly#163). Gate (fresh pr-validator re-run, zero warnings): `charly box validate` exit 0; full `box build cachyos-pacstrap-builder` under the new pins (`ghcr.io/opencharly/cachyos-pacstrap-builder:2026.201.1042`). CHANGELOG: 2026.201.1048. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
…-#146 protocol skew) Post-#146 plugin-protocol skew repair (opencharly/charly#158): every @github.com/opencharly/charly/... pin in this repo moves from v2026.183.1359 to v2026.201.0706 via `charly box reconcile --remote`. The pre-#146 pins fetched protocol-v1 candy content; under a protocol-[2] host binary every box build whose candies load out-of-process builder plugins failed `Plugin version: 1, Client versions: [2]`. Companion content-wave to the root fix (opencharly/sdk#77 + opencharly/charly#163). Validator gate (fresh pr-validator, re-run): `box validate` exit 0 zero warnings; `box build ubuntu-builder` exit 0 zero warnings under the new pins (ghcr.io/opencharly/ubuntu-builder:2026.201.1041). Coder/debootstrap-VM legs blocked by the externally RCA'd release-package 404 (self-hosted runner unavailable) — not a candidate defect. CHANGELOG entry: CHANGELOG/2026.201.1049.md (merge-time CalVer). Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
…146 protocol skew) Post-#146 plugin-protocol skew repair (opencharly/charly#158): every @github.com/opencharly/charly/... pin in this repo moves from v2026.183.1359 to v2026.201.0706 via `charly box reconcile --remote`. The pre-#146 pins fetched protocol-v1 candy content; under a protocol-[2] host binary every box build whose candies load out-of-process builder plugins failed `Plugin version: 1, Client versions: [2]`. Companion content-wave to the root fix (opencharly/sdk#77 + opencharly/charly#163). Validator gate (fresh pr-validator, bin/charly 2026.201.1004 rebuilt from the protected-main-identical tree): `box validate` exit 0 zero warnings; `box generate fedora-builder` exit 0 zero warnings; `box build fedora-builder` tagged ghcr.io/opencharly/fedora-builder:2026.201.1041; `charly check run check-pod` run 2026.201.1054 PASS 12/12 (ok: true, 221s, zero warnings). Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
chore(box): bump distro gitlinks to the post-#146 reconcile mains (#164) The five distro submodule pointers advance to the merged post-#146 reconcile-wave commits (#158), each carrying the v2026.183.1359 → v2026.201.0706 pin alignment that fixes the protocol-v1/protocol-2 build skew: - box/arch → 80744558 (distro-arch#7, v2026.201.1045) - box/cachyos → 8423533c (distro-cachyos#6, v2026.201.1048) - box/debian → f3e8173d (distro-debian#4, v2026.201.1046) - box/ubuntu → 0530d26d (distro-ubuntu#4, v2026.201.1049) - box/fedora → e531a7f6 (distro-fedora#4, v2026.201.1102, check-pod PASS 12/12 on the final tree) Every bump is ancestor-verified against the previously recorded gitlink and points at the repo's live protected main HEAD. The protocol-skew root fix landed separately: opencharly/sdk#77 + #163, tagged v2026.201.1002. Validated by a fresh pr-validator: per-repo producer gates verified on the exact pinned commits (incl. on-disk check-pod summary 2026.201.1054); consumer gate re-run zero-warning (box validate exit 0, agent-config standards exit 0); merge-time CalVer 2026.201.1131 finalized at merge. Assisted-by: Kimi Code (Moonshot K3; documentation reviewed)
…cer-first prerequisite for the plugins projection) Two docs-only edits in the superproject, both producer-side sources for the plugins/ skill projection. ## candy/charly-internals/charly.yml — three corrections to the candy skill content 1. TZ=UTC0 fix in the git-workflow skill: scripts/calver.sh derives the CalVer from the HEAD commit UTC time (TZ=UTC0 git log -1 --format=%cd --date=format-local:%Y %j %H %M — the TZ=UTC0 is what makes the bare %cd UTC). 2. localpkg gotcha consolidation: the two pkg/arch makepkg/localpkg build gotchas folded into ONE generic gotcha (a disposable bed that builds from a submodule builds from the submodule ON-DISK WORKING-TREE checkout, NOT from the committed gitlink alone). 3. cumulative-cap bullet in the go skill: the sandbox TOTAL /tmp usage cap (beyond the per-command cap) — write error: Disk quota exceeded when /tmp fills to ~80% of the tmpfs; on this host 17G of tmp.* dirs had accumulated. ## PROGRAM/nfpm-packaging-north-star.md — the binding north-star doc - Phase 0 follow-on — Go-module-valid tags on the plugin repo: the plugin repo CalVer v2026.227.0013-style tags are semver-REJECTED as Go module versions; needs v0.2026227.13-style tags mirroring sdk v0.2026226.1201 scheme. - Expanded Phase 3: the superproject declaration of the external charly generate-packages plugin — a THIN re-export shim module under a discovered candy (candy/generate-packages/ with charly.yml + go.mod require+replace to the Go-module-tagged external module + cmd/serve shim + go.sum). ## Why producer-first The plugins/ skill files are generated from the candies skill: entities by charly marketplace generate. The plugins PRs #162/#163 carried hand-edits to those generated files; the round-5 validator correctly rejected them (a hand-edit of a generated file whose candy source is not landed). The correct path is producer-first: 1. This PR — land the candy source change in the superproject (cutover A). 2. Plugins cutover — after this lands, run charly marketplace generate and land ONE plugins PR carrying the regenerated output (byte-identical to the generator), superseding #162/#163. 3. Cutover B — bump the plugins gitlink in the superproject. The transitional marketplace drift after this landing is expected and resolved in step 2. Assisted-by: Claude Code deepseek-v4-flash:0731-cloud (documentation reviewed)
Summary of changes
EnsureRepoDownloadedreused any cached repo export without consulting thedownloader: a mutable ref (a branch such as
main, or an unversioned refresolved to the default branch) froze at its first-download content. A
pre-#146
charly@mainexport therefore kept serving protocol-v1builder-plugin sources, and box builds with unversioned builder-plugin refs
failed
Plugin version: 1, Client versions: [2](#158) evenafter the box repos re-pinned their candies to the protocol-v2 tag — the pin
is the candy fetch coordinate, but out-of-process builder plugins resolve by
canonical unversioned ref, so the reconcile alone could not clear the skew.
This is the core-side root fix; the sdk-side provenance contract is the
producer leg opencharly/sdk#77.
Concrete edits (the entire diff is accounted for here):
charly/refs.go(EnsureRepoDownloaded): mutable refs now ALWAYS delegateto the registered refs backend, which re-resolves the ref's current commit
and refreshes a stale export (the sdk
kit.DownloadRepoprovenancecontract). Immutable coordinates (tags, SHAs) keep the offline cache-hit
fast path. The decision uses the new shared
kit.IsMutableRefclassifier.charly/refs_fresh_test.go:TestEnsureRepoDownloaded_MutableRefAlwaysDelegates(stub downloader — mutable delegates when cached, tag hits offline),
TestIsMutableRefCoreContract.CHANGELOG/2026.201.0758.md: the placeholder entry (merge-time CalVer isfinalized by the pr-validator).
Change class
cross-repo — consumer leg. Repos + landing order: opencharly/sdk#77
(producer) FIRST → this PR, which then bumps the
sdkgitlink +go.modrequire to the merged sdk commit before validation (B2 order). The five
distro-repo reconcile PRs (the #158 content wave) are
independent consumers landing on their own tracks.
How R10-tested — exact gate, commands, and pasted output
go test ./...+go vet+golangci-lint+task build:binary+ content marker) +bin/charly box validate+ the live end-to-end proof below. No disposablebed exercises the repo-cache directly; the runtime verification is the
live self-heal + full box build.
N/A — the coverage is the new unit tests plus the live end-to-end proof (self-heal + repro build), not a bed.task build:binaryrebuilt from this tree;strings bin/charly | grep -c 'publishing repo cache\|acquiring repo cache lock'→ 2 (the fix is IN the binary).a stale
charly@mainexport (no provenance sidecar) self-healed on firstaccess (
Downloading github.com/opencharly/charly:main...→ exit 0), thesidecar recorded the current origin/main commit, the second resolution was
a provenance cache hit, and the issue's exact repro
charly -C box/arch box build arch-testpassed(
ghcr.io/opencharly/arch-test:2026.201.0740).state; the sdk-side refresh is serialized per cache path (
<cache>.lock)and published by temp-clone + rename swap. This PR's one-condition
delegation decision carries no new shared state.
Attribution tier
analysed on a live system — the changed code path (mutable-ref
delegation, self-heal, provenance hit) executed live against the real cache
and the issue's repro build, but no disposable-bed roster applies to this
class.
Harness rulebook compliance — state HOW each is satisfied (or
N/A — <reason>)git-workflow+go+strict-policy+checkloaded bypath before acting; B2 producer→consumer order followed (sdk#77 first).
(pin → unversioned plugin ref →
@mainresolution → existence-only cachereuse) before any fix; every gate output zero-warning.
wave is fixed HERE (sdk#77 + this PR), and the reconcile wave itself
proceeds as independent distro PRs — nothing parked.
kit.DownloadRepo),one classifier (
kit.IsMutableRef); core adds only the delegationcondition, no parallel freshness logic.
not a TTL, retry, or cache-busting heuristic.
longer take the stale-hit branch at all.
origin/main(6d436e2).in addition to unit tests.
marker ×2); no new OS deps.
TestEnsureRepoDownloaded_MutableRefAlwaysDelegates(mutable delegateswhen cached); live: the issue's repro build passes with a healed cache.
stale export → build passes; fixed binary → self-heal + hit). ADE N/A — no
candy. SDD N/A — no schema.
commit on main.
condition in the core refs orchestration (its documented home) using the
sdk kit mechanism — no kind-specific logic, no alias, no new kit import.
gofmtclean,go vetclean,go test ./...green,golangci-lint run ./...0 issues.CHANGELOG/2026.201.0758.mdstaged (placeholder CalVer —the pr-validator finalizes it at merge).
Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)