Pin Cloudflare account for R2 publishing and fix publish-raw failures - #148
Conversation
- Add wrangler.toml pinning the PolicyEngine account so non-interactive wrangler r2 calls work for contributors whose Cloudflare user belongs to multiple accounts. - Pass manifest file-entry years through to build_r2_key unchanged: label entries such as the SSA source_capture capture crashed int(year). - Drop --force from wrangler r2 object put: current wrangler removed the flag and put overwrites by default. - Document the wrangler login flow in the README. - census/population_projections_2023: record the artifact's actual R2 key (its manifest source_id never matched the historical key convention). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Independent verification pass (read-only, run locally against both branches):
Sequencing note: #149's verification used this PR's tooling, and without this PR #149 leaves the census manifest as the one id/key inconsistency — merge this first (or both together). With both in, the per-directory workaround in the UK PRs' publish instructions becomes unnecessary: whole-tree 🤖 Generated with Claude Code |
|
Full merge-readiness review (local merged preview of #148 + #149 on current main) — verdict: ready, merge this before #149. Code review:
Empirical, on the merged preview: 🤖 Generated with Claude Code |
What
wrangler.tomlso everywrangler r2call made bychronicle publish-raw/publish-derived/fetch-artifact --upload-r2targets the PolicyEngine account without any environment setup. Non-interactive wrangler cannot select an account when the logged-in user belongs to more than one, andsubprocess-driven uploads are always non-interactive — this is exactly the failure multi-account contributors hit, and it reads like a permissions error. Verified empirically thatwrangler r2honorswrangler.tomlaccount_id(a deliberately wrong ID makes it target that wrong account).publish-rawhandle label-keyed manifest file entries.db/data/ssa/ssi_monthly_statistics_2024_12/manifest.yamlhas asource_captureentry (HTML capture alongside the CSV);_publish_raw_manifest_entrycrashed onint("source_capture").build_r2_keyonly ever stringifies the year segment — its existing stored key already uses the literalsource_capturesegment — so pass the value through and widen the annotation toint | str. Test added reproducing the SSA shape.--forcefromwrangler r2 object put. Current wrangler removed the flag ("Unknown argument: force"), so every upload fails for anyone resolving a fresh wrangler — and put overwrites by default anyway (verified on 4.59.2: repeated puts of the same key succeed without the flag).wrangler loginis the only auth step, and swap thenpxexample forbunx.Context
R2 storage for
ledger-raw/ledger-derivedmoved to the PolicyEngine Cloudflare account (20d90f557651969925eece96e58e24dc) on 2026-08-07 — the original buckets were bootstrapped on a legacy cosilico-era account in May. All committed raw artifacts (~58 MB) were re-published to the new account; keys are content-addressed, so every manifest is byte-identical and no data files change in this PR.🤖 Generated with Claude Code