Skip to content

Commit EFO workbooks as fallback for OBR downloads#446

Merged
vahid-ahmadi merged 1 commit into
mainfrom
obr-efo-fallback
Jul 21, 2026
Merged

Commit EFO workbooks as fallback for OBR downloads#446
vahid-ahmadi merged 1 commit into
mainfrom
obr-efo-fallback

Conversation

@vahid-ahmadi

Copy link
Copy Markdown
Collaborator

Problem

Both full builds on main after #445 failed the same way: obr.uk returns 403 Forbidden to GitHub Actions runner IPs (confirmed in the job logs; the same URLs work from residential connections). The error is swallowed by design, so 28 of 34 OBR targets silently vanished, the calibration ran without income tax / NI / VAT / CGT-tax targets, and the degraded weights failed test_reform_impacts (VAT +2pp: £41.9bn vs £31.3bn) and the OBR registry tests — correctly blocking the data upload. Meanwhile the CGT band targets from #444/#445 all landed within 5-12% on the full build, so this 403 is the only thing between main and a publishable dataset.

Fix

  • Commit the EFO receipts (183KB) and expenditure (231KB) workbooks for the vintage pinned in sources.yaml under storage/obr_efo/, following the committed-not-fetched precedent of the HMRC size-of-gain table and ons_demographics.py.
  • _download_workbook still tries the live URL first (with the existing 429/5xx retry), but falls back to the committed workbook when the download ultimately fails; permanent errors like 403 no longer burn the retry budget.
  • Update the committed files together with the sources.yaml URLs on each EFO vintage change.

Tests

test_obr_efo_fallback.py: committed workbooks exist and parse (receipts sheet lookup works), 403 falls back without retrying, connection failures fall back, unknown URLs still raise, and the full 34-target OBR set builds fully offline.

🤖 Generated with Claude Code

obr.uk serves 403 Forbidden to GitHub Actions runner IPs (every attempt
on the 2026-07-21 push builds 403'd while the same URLs work from
residential connections). The swallowed error silently dropped 28 OBR
targets, so the build calibrated without income tax, NI, VAT or CGT-tax
targets and failed the reform-impact and registry tests, blocking the
data upload.

Commit the receipts and expenditure workbooks for the vintage pinned in
sources.yaml under storage/obr_efo/ (following the committed-not-fetched
precedent of capital_gains_size_distribution_hmrc.csv and
ons_demographics.py) and fall back to them whenever the download
ultimately fails. Permanent HTTP errors (403) no longer burn the retry
budget. Tests pin that the full 34-target OBR set builds fully offline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vahid-ahmadi
vahid-ahmadi merged commit d0d91f3 into main Jul 21, 2026
4 checks passed
@vahid-ahmadi
vahid-ahmadi deleted the obr-efo-fallback branch July 21, 2026 20:43
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