Repository navigation
fix(refs): mutable-ref repo-cache freshness (provenance-checked refresh) - #77
Conversation
DownloadRepo reused a cached repo export forever (existence check only): a mutable ref (main / the unversioned default branch) froze at first-download content — a pre-#146 charly@main export served protocol-v1 builder-plugin sources indefinitely and every box build with an unversioned builder-plugin ref failed 'Plugin version: 1, Client versions: [2]' (opencharly/charly#158) even after the box repos re-pinned to the protocol-v2 tag. The cache is now reused ONLY when its provenance sidecar (<cache>.ref, the clone's resolved commit) equals the ref's currently resolved commit — a moved branch re-downloads; tags/SHAs always match (unchanged hit behavior; the check costs the ls-remote GitResolveRef already performed). Refresh is serialized per path (<cache>.lock) and published via temp-clone + rename swap (complete old or new tree, never a half-clone). Pre-contract caches lack the sidecar and self-heal on first access. Adds kit.IsMutableRef, the shared classifier the host's EnsureRepoDownloaded uses to decide when delegation is mandatory. Verified: TestDownloadRepoFrom_RefreshesMovedBranch (file:// remote — advance re-downloads, unmoved hits, no swap residue), TestRepoCacheFresh, TestIsMutableRef; GOWORK=off tidy no-op + verify + build + vet + test green; live end-to-end: a stale charly@main self-healed and arch-test built. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
pr-validator — CHANGES REQUESTED ❌Bound head SHA: Change class: cross-repo — producer leg (sdk standalone Go mechanism,
Comments considered: none — the PR carries no comments and no reviews. Cross-PR interactions considered:
Decision — what must be fixed (blocking): Item 17. My independent re-run of the sdk standalone battery at the bound head: The repo's own Fix required: drop the unused Assisted-by: Kimi Code (Moonshot K3; analysed on a live system) |
golangci-lint unparam (tests: true) flagged the test helper's never-consumed string result. The closure now returns nothing; behavior unchanged, test still green, lint 0 issues. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
pr-validator — APPROVED ✅Bound head SHA: Change class: cross-repo — producer leg (sdk standalone Go mechanism,
Comments considered:
Cross-PR interactions considered:
Decision: All 18 checklist items PASS (item 16 N/A with reason). The prior round's single blocking finding is verifiably fixed at the bound head, and the complete candidate withstands independent re-validation: the freshness contract is a provenance-equality gate over the Assisted-by: Kimi Code (Moonshot K3; analysed on a live system) |
Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
pr-validator — landing outcomes (all gated actions ALLOWED, verbatim)
Consumer handoff: opencharly/charly#163 (the consumer leg) can now bump its sdk gitlink + 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)
…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 its first-download content. A pre-#146 charly@main export therefore kept serving protocol-v1 builder-plugin sources, and box builds with unversioned builder-plugin refs failed "Plugin version: 1, Client versions: [2]" (#158) even after the box repos re-pinned their candies to the protocol-v2 tag. 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, merged as 7dcfc07 / tag v0.2026201.852 — gitlink + go.mod require bumped here per B2 order). Immutable coordinates (tags, SHAs) keep the offline cache-hit fast path. The decision uses the new shared kit.IsMutableRef classifier. Coverage: TestEnsureRepoDownloaded_MutableRefAlwaysDelegates (stub downloader — mutable delegates when cached, tag hits offline), TestIsMutableRefCoreContract; TestCharlyRepo_FlagChdir re-seeded to the immutable tag ref it now requires (review-round fix). Core Go gate green on the final tree (go test ./... 95.7s, go vet, gofmt, golangci-lint 0 issues, isolated cache); live end-to-end on the rebuilt binary: a stale charly@main export self-healed on first access and charly -C box/arch box build arch-test (the issue's repro) passed (ghcr.io/opencharly/arch-test:2026.201.0740). CHANGELOG: 2026.201.1002. 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)
Summary of changes
A cached remote-repo export was reused forever once downloaded:
kit.DownloadRepochecked only that the cache directory existed. A mutableref (a branch such as
main, or an unversioned ref resolved to the defaultbranch) therefore froze at its first-download content — a pre-#146
charly@mainexport kept serving protocol-v1 builder-plugin sourcesindefinitely, and box builds with unversioned builder-plugin refs failed
Plugin version: 1, Client versions: [2](opencharly/charly#158) even afterthe box repos re-pinned their candies to the protocol-v2 tag.
Concrete edits (the entire diff is accounted for here):
kit/refs_git.go:DownloadReponow records the clone's resolved commitin a provenance sidecar (
<cache>.ref) and reuses the cache ONLY when thatprovenance equals the ref's currently resolved commit. Refresh is
serialized per cache path (
<cache>.lock, the existingAcquireFileLockprimitive) 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
IsMutableRef, the shared mutable-vs-immutable classifier.downloadRepoFrom(URL-explicit variant) exists so the freshness contractis testable against a local
file://remote.kit/refs_git_fresh_test.go:TestIsMutableRef,TestRepoCacheFresh,TestDownloadRepoFrom_RefreshesMovedBranch(end-to-end against a localfile:// remote: branch advance re-downloads, unmoved ref hits, no swap
residue).
CHANGELOG/2026.201.0757.md: the placeholder entry (merge-time CalVer isfinalized by the pr-validator).
Change class
cross-repo — producer leg. Repos + landing order: sdk (this PR) FIRST →
then superproject charly PR (
EnsureRepoDownloadedmutable-ref delegation +sdk gitlink bump). The five distro-repo reconcile PRs (the opencharly/charly#158
content wave) are independent consumers that land on their own tracks.
How R10-tested — exact gate, commands, and pasted output
GOWORK=off go mod tidyno-op +go mod verify+go build ./...+go vet ./...+go test ./...) + the new end-to-end freshness test against a localfile:// remote + the live self-heal proof on the consumer side. No
disposable bed exercises the sdk repo-cache directly; the runtime
verification is the live consumer build below.
N/A — the coverage is the new unit/integration tests plus the live consumer proof (a full box build against a stale-then-healed cache), not a bed.go build ./...from this tree; zero warnings.binary (content marker verified), a stale
charly@mainexport (provenancesidecar absent) self-healed on first access and
charly -C box/arch box build arch-test(the issue's repro) passed(
ghcr.io/opencharly/arch-test:2026.201.0740); the second resolution was aprovenance cache hit (no re-download).
(the repo cache); it is serialized per cache path by
<cache>.lock(blocking), and the publish is a temp-clone + rename swap so concurrent
readers see a complete old or new tree. The integration test asserts no
swap residue.
Attribution tier
analysed on a live system — the changed code path (refresh + provenance
hit) executed live against the real cache and a real box 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.
(pin → unversioned plugin ref →
@mainresolution → existence-only cachereuse) before any fix; every gate output zero-warning.
(5 distro repos, independent PRs); the deeper root cause found DURING that
work is fixed HERE, not parked.
kit.DownloadRepo; oneclassifier (
IsMutableRef) shared with the host; no parallel logic.synchronization/validity primitive, never a retry/TTL heuristic.
grepfor the oldexistence-only check shows it replaced; pre-contract caches self-heal, no
migration shim.
origin/main.build) in addition to unit/integration tests.
(content marker); no new OS deps.
TestDownloadRepoFrom_RefreshesMovedBranch(moved-branch refresh),TestRepoCacheFresh,TestIsMutableRef; live repro of the issue's exactfailure mode now passes.
(deleted export → build passes; fixed binary → self-heal) before the fix
was written. ADE N/A — no candy. SDD N/A — no schema.
commit on main.
kitshared layer (the canonical refs mechanism home), not in a kind plugin and
not duplicated in core — placement matches the P7 refs-backend split.
gofmtclean,go vetclean,go test ./...green,golangci-lint run ./...0 issues.CHANGELOG/2026.201.0757.mdstaged (placeholder CalVer —the pr-validator finalizes it at merge).
Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)