Repository navigation
feat(mctx): default cache reads to the R2 mirror (cache.minimal.dev) - #1234
Conversation
Reads were GCS-by-default with R2 as an opt-in env override, which made zero-egress reads something every CI fleet and laptop had to discover and wire individually (webapp#380, pkgs#613, build-servers#239, ...). Flip the default for READS ONLY, precedence: MINIMAL_REMOTE_CACHE_URL env override, then an explicitly configured location, then https://cache.minimal.dev/. The write path is untouched: the writer still derives its bucket from the configured value (default gs://minimal-staging-cache), and an HTTPS mirror still cannot be written to. In-cloud readers are unaffected: res-servers pin gs:// explicitly (buildbot always sends remote_cache_gcs_bucket), keeping free same-region reads. Escape hatch back to direct GCS: MINIMAL_REMOTE_CACHE_URL=gs://<bucket>. Also logs the chosen read location + source (env-override / configured / default-r2-mirror) at info — selection was previously silent, and attributing egress took GCS access-log forensics. Gated on infra PR (cache.minimal.dev custom domain + index.shisha bypass route) being deployed and verified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe cache configuration adds an R2 mirror for default reads. Explicit settings and environment overrides retain precedence. Default writes continue to use the GCS bucket. A test verifies the reader and writer split. ChangesRemote cache configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
cache.minimal.dev is live — verification transcript (2026-08-17)Deployed via infra#422 (custom domain) + infra#423 (zone-plane routes; also opts the cache host out of the 1. Artifact byte-parity — same object from all three hosts, sha256
2. Mutable root index served fresh — 3. Semantics intact — missing object → clean 404 (the reader's "empty index" signal, unrewritten); per-commit closure snapshot serves correctly (62,424 bytes). Ready for review — un-drafting is @bryan-minimal's call per the plan. Smoke-test the flip today without waiting for the channel build: |
…#1252) The gcs_access_logs forensics for 2026-08-18/19 show 25-36 GB/day of billed GCS internet egress from GitHub-hosted runners, and the index objects those readers fetch (github.com/gominimal/pkgs/b1a1b1b7....shisha — this repo's own .minimal pin) attribute it to our CI: jobs run the min built from the branch under test, so any PR branched before #1234 defaults the package-cache reader to gs:// and pays internet egress for every artifact. Only one ci.yml step had the override (the build-servers#145 canary), still pointing at the legacy hostname. Set MINIMAL_REMOTE_CACHE_URL=https://cache.minimal.dev/ at workflow level in the eight workflows that exercise min, and move the ci.yml canary to the canonical hostname. Harmless where a job never reads the package cache; the mutable index.shisha is edge-bypassed to live GCS (infra#277), and artifacts are immutable + edge-cached (infra#429). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
DRAFT until infra#422 is deployed and verified — the cache.minimal.dev custom domain + index.shisha bypass route must be live before this default can ship. I'll mark ready-for-review with the verification transcript once the domain passes the three-curl parity check (artifact bytes ≡ .farm ≡ GCS, fresh index, 404 passthrough).
What flips
Read-side default only. Precedence after this change:
MINIMAL_REMOTE_CACHE_URLenv override → explicitly configured location →https://cache.minimal.dev/. Ends the per-repo whack-a-mole (webapp#380, pkgs#613, build-servers#239 — all become harmless no-ops) and covers every laptop and future consumer with zero wiring.What deliberately does NOT change
gs://bucket; an HTTPS mirror remains read-only. The read default cannot leak into the writer (new test pins this).gs://explicitly (buildbot sendsremote_cache_gcs_bucketunconditionally — verified at the single call site), keeping free same-region GCS reads.MINIMAL_REMOTE_CACHE_URL=gs://minimal-staging-cachereturns any client to direct GCS.Also in here
The chosen read location + source is now logged at
info— selection was previously silent, which made "is this client actually on the mirror?" unanswerable from logs (this month's egress attribution took GCS access-log forensics; that gap dies here).Safety case
Same objects, byte-identical (R2 is Sippy-fed from authoritative GCS; verified); every artifact is sha256-verified client-side regardless of source; the mutable root
index.shishais served fresh from GCS by the edge Worker on both hostnames; per-commit snapshots (the default read path since #912/#995) are immutable. The env-var version of this exact routing has run in webapp CI since July 8 and is canaried by dogfood (#667).Local validation:
cargo check -p mctxclean; clippy findings identical to baseline (10 pre-existing); mctx's test target doesn't compile on macOS at baseline either (pre-existing, unrelated) — Linux CI is authoritative for the new test.🤖 Generated with Claude Code
Note
Default remote cache reads to the R2 mirror (cache.minimal.dev) in
mctxConfigBuilder.buildnow selects the read URL by precedence: env override (MINIMAL_REMOTE_CACHE_URL) > explicitly configured value > newDEFAULT_REMOTE_CACHE_READ_URLconstant pointing athttps://cache.minimal.dev/.parse_remote_cache_url.infolog is emitted at build time indicating the selected read URL and which precedence level chose it.Macroscope summarized d502ef2.
Summary by CodeRabbit