Skip to content

Pin Cloudflare account for R2 publishing and fix publish-raw failures - #148

Open
MaxGhenis wants to merge 1 commit into
mainfrom
pin-r2-account-and-fix-publish
Open

Pin Cloudflare account for R2 publishing and fix publish-raw failures#148
MaxGhenis wants to merge 1 commit into
mainfrom
pin-r2-account-and-fix-publish

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

What

  • Pin the Cloudflare account in wrangler.toml so every wrangler r2 call made by chronicle publish-raw / publish-derived / fetch-artifact --upload-r2 targets the PolicyEngine account without any environment setup. Non-interactive wrangler cannot select an account when the logged-in user belongs to more than one, and subprocess-driven uploads are always non-interactive — this is exactly the failure multi-account contributors hit, and it reads like a permissions error. Verified empirically that wrangler r2 honors wrangler.toml account_id (a deliberately wrong ID makes it target that wrong account).
  • Let publish-raw handle label-keyed manifest file entries. db/data/ssa/ssi_monthly_statistics_2024_12/manifest.yaml has a source_capture entry (HTML capture alongside the CSV); _publish_raw_manifest_entry crashed on int("source_capture"). build_r2_key only ever stringifies the year segment — its existing stored key already uses the literal source_capture segment — so pass the value through and widen the annotation to int | str. Test added reproducing the SSA shape.
  • Drop --force from wrangler 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).
  • README: document that wrangler login is the only auth step, and swap the npx example for bunx.

Context

R2 storage for ledger-raw / ledger-derived moved 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

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant