Skip to content

Add Fiscal Lab's year-by-year values beside each bill's total - #267

Merged
MaxGhenis merged 5 commits into
mainfrom
sources/fiscal-lab-annual-20261129
Nov 29, 2026
Merged

MaxGhenis merged 5 commits into
mainfrom
sources/fiscal-lab-annual-20261129

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On 2026-11-29 Max asked for the scorecard to carry more detail than Fiscal Lab's ten-year totals, "at a minimum the year by year". #261 staged each of the 110 Memo Bill Scores bills' FY2027-2036 total (248 claims). This PR adds each bill's central case for each fiscal year, FY2027 to FY2036, beside its unchanged total: 1,100 single-year claims, 1,348 in all.

  • Extract (sources/fiscal-lab-memo-scores/adapter.py)
    • Each row gains annual, the CSV's ten FY columns. They are printed by the same to_fixed3 that rebuilds the page's CSV, so the pinned CSV hash covers every year.

    • New QC 10 has three parts:

      • the adapter reads the rebuilt CSV back and checks each bill's years against its own FY cells, in order;
      • the years add exactly to the printed total;
      • the score table's total line is the same path.

      It holds on all 110 bills.

  • Ingest (scorecard_db/ingest_fiscal_lab.py)
    • Shape: one claim per bill and year, as PWBM, JCT and NZ Treasury stage their years. The period is the fiscal year, with no period_start or period_end, and the conditions are the central total's minus window_kind.
    • Checks: the ingest checks the years again: FY2027-FY2036 in order, exactly three decimals (fullmatch), and an exact sum. A test pins each clause to its own message.
    • Publication: a year's publication says what it is.
      • Its window is FY<year>, and its scope note says Fiscal Lab gives no low or high case by year.
      • It carries Fiscal Lab's effect label as ten_year_effect, since the label describes the total: a $0 year can sit on a bill that adds to deficits. It carries no range note and no superseded values.
      • H.R. 4849's years are the November 25 path, and the released path is not recorded. They say so in path_note, in their window (FY2027 (revised build)) and in their source column. The app shows the last two.
    • Scope notes: they say interest, which every page shows, is shown separately, and that the figure leaves out spending subject to appropriation. This changes the totals' scope_note in the DB; the feed doesn't export it.
    • Gap rows: the 101 pe_gap bills' years get valueless pe_gap rows through the unchanged gap_rows (1,010). The 9 not_computed bills' years get none.
    • Reruns: the stale and kept deletes go in chunks of 500 ids, under SQLite's oldest 999-variable limit.
    • Totals: the 248 totals keep their claim ids. A test pins their sha256 to main's.
  • App: opening a window total now lists its own single years under "Year by year".
    • yearPath matches source, reform, metric, unit and basis, and conditions with the period labels (window_kind, fy) set aside on both sides. When two rows claim one year it shows no path.
    • Years print in one unit per table: the largest unit in which up to 3 decimals print every external year exactly ($70.736B, NZ$15M). A PolicyEngine value the column would round to zero gets more decimals or its own unit.
    • NZ Treasury's totals pick up their five years too.
  • Feeds: populations.json (both copies) gains the 1,100 rows, going from 23.1 MB to 26.4 MB each. No existing row changes or moves. lanes.json's Fiscal Lab note gives the new count.
  • Docs: NOTES.md and source.json record the new shape, the 1,351 committed figures (1,348 current, 3 superseded) and Max's direction.

Terms

#261 committed 251 Fiscal Lab figures on Max's d3450. This PR commits 1,100 more, following his 11-29 request quoted above. The merge stays Max's call (d3576): the repository would go from 251 to 1,351 Fiscal Lab figures. Nobody has contacted Fiscal Lab, and nobody will.

Not in this PR

  • No range by year. The page gives no low or high case by year, so the ranges stay ten-year only.
  • Other lines left out: Table 1 components, interest, debt, direct spending and revenue lines, on- and off-budget splits, coverage tables and State tables. The components overlap the H.R. 4849 and H.R. 1428 counterpart work (d3472). Interest and debt need metrics the scorecard does not have yet.
  • No released path for H.R. 4849. The November 21 page has it, but that page is not committed.

Checks

  • Full suite: CI runs it on this head. Locally it passed at 1c502c0 (5,907 passed, 19 skipped). This round's local run was stopped at 53%, with no failure by then, because Fleet ops held the local full write on disk margin.
  • Fiscal Lab tests: 97 passed, including the rebuild from the pinned page and the pe_paths check, which CI skips.
  • Double build: deterministic, content hash bb71418a….
  • App: 75 bun tests, oxlint and tsc -b pass.
  • Feed against 1c502c0: exactly 10 rows change (H.R. 4849's years, in window and source_column). All 7,244 claim ids keep their order.
  • yearPath over the real feed: 110 Fiscal Lab central totals with 10 years and 2 NZ totals with 5, the same under the old and new matcher.
  • Preview:
    • H.R. 4849's central total lists FY2027 (revised build) to FY2036 at $70.736B to $315.104B, and its low total shows no table.
    • H.R. 8908 reads in millions.
    • A zero bill lists $0 years.
    • NZ Treasury's Working for Families total lists NZ$0M to NZ$63M.
  • Ruff format is clean.

Review

This PR changes data that the scorecard site shows, so an independent review runs before merge.

  • Round 1 (1c502c0) asked for changes: 2 P1s and 4 P2s, all with values verified correct. The second and third commits answer each one with a test.

  • Round 2 (full, at 39b288c) found every round-1 item answered except one test gap. It raised:

    • P1: the source docs counted Max's request for year-by-year detail as his publishing call. They now quote the request and name the publishing call as d3576.
    • P2, fixed: the year formatter could print a nonzero year as zero.
    • P2, filed as Validation grid rounds away source precision and shows small amounts as $0 #268: the main grid rounds source figures for every source (1,839 cells across 40 sources at this head), so the fix is a cross-source display change.
    • Test gap: the superseded values' fullmatch now has its own test.

    68b4437 answers these.

  • Round 3 (scoped, at 68b4437) found the P1 closed: APPROVE, so the independent review has finished. It raised two P2s in the year formatter, both fixed in 62cc939:

    • a tolerance that called $7.0000005 exact at no decimals;
    • a sub-dollar PolicyEngine value that could print as $0.

    All 1,110 external cells in the 112 real year tables still print as at 39b288c.

The reviews are in ~/reviews/fiscal-lab-scorecard-2026-11-26/runs/review-annual-r{1,2,3}/.

🤖 Generated with Claude Code

Max asked on 2026-11-29 for the scorecard to carry more detail than the
ten-year totals, "at a minimum the year by year". This adds each bill's
central case for each fiscal year, FY2027 to FY2036, beside its unchanged
FY2027-2036 total: 1,100 single-year claims, 1,348 in all.

Extract (adapter.py)
- Each row gains `annual`: the CSV's ten FY columns, printed with the
  same to_fixed3 the CSV rebuild uses. So the pinned CSV hash covers every
  committed year.
- QC 10: the printed years add exactly to the printed total, and the
  score table's total line is the same path. Both hold on all 110 bills.

Ingest
- One claim per bill and year, shaped as PWBM, JCT and NZ Treasury shape
  their years: the period is the fiscal year, there is no window, and the
  conditions are the central total's without window_kind.
- validate_extract checks the years again: FY2027-FY2036 in order, the
  CSV's three decimals, and an exact sum to the total. A test pins each
  clause to its own message.
- A year's publication says what it is: window FY<year>, a one-year scope
  note saying the page gives no low or high case by year, and no range
  note or superseded values. H.R. 4849's years carry a path_note: they are
  the November 25 path, and the released path is not recorded.
- The 101 pe_gap bills' years get valueless pe_gap rows through the
  unchanged gap_rows (1,010 rows). The 9 not_computed bills' years get none.
- The 248 totals keep their claim ids, and a test pins their sha256.

App
- Opening a window total lists its own single years under "Year by year"
  (yearPath, with bun tests). NZ Treasury's totals pick up their years too,
  since a year's fy label is set aside.

Feeds
- populations.json (both copies) gains the 1,100 rows: 23.1 MB to 26.4 MB.
  No existing row changes or moves. The summary counts move with the rows.
- lanes.json's Fiscal Lab note gives the new count.

NOTES.md and source.json record the new shape, the 1,351 committed figures
(1,348 current, 3 superseded) and Max's direction.

Checks
- Full suite: 5,907 passed, 19 skipped (macOS, Python 3.12).
- Fiscal Lab file: 88 passed, including the rebuild from the pinned page,
  which CI skips.
- Double build: deterministic, content hash db0a1928....
- App: 68 bun tests, oxlint and tsc pass. In the preview, H.R. 4849's
  central total lists FY2027-2036 in order, and its low total shows no
  table. An NZ Treasury total lists its five years.
- Ruff format is clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
policyengine-scorecard Ready Ready Preview Nov 29, 2026 7:32pm UTC

Request Review

MaxGhenis and others added 2 commits November 29, 2026 14:01
Round 1 (codex sol62, REQUEST_CHANGES) found 2 P1s and 4 P2s. Each is fixed
here with a test:

- P1: year rows carried Fiscal Lab's ten-year effect label, so 51 $0 years
  read "adds to deficits" or "reduces deficits". A year now carries that
  label as ten_year_effect and has no effect of its own.
- P1: the scope notes said spending subject to appropriation is "shown
  separately"; the page's data carries it for 12 bills and only 11 of their
  notes show it. The notes now say only that the figure leaves it out, and
  that interest, which every page's glance table shows, is shown separately.
  This changes the totals' scope_note in the DB; the feed does not export it.
- P2: QC 10 could not see a permuted path. The adapter now reads the rebuilt
  CSV back and checks each bill's years against its own FY cells; tests use
  distinct years, so a permutation keeps the sum and only this check fails.
- P2: _VALUE.match accepted "70.736\n"; all three sites use fullmatch.
- P2: yearPath set fy aside only on candidates and kept duplicate years. It
  now drops fy and window_kind on both sides and shows no path when two rows
  claim one year. Tests cover the real NZ Budget 2025 shape.
- P2: the year table rounded to hundredths, and H.R. 4849's vintage lived
  only in path_note, which the feed does not export. Years now print at up
  to three decimals in one scale per table ($70.736B), and H.R. 4849's
  windows read "FY2027 (revised build)" with the vintage in source_column.
- P2: a rerun bound 1,351 variables in one IN list, over SQLite's oldest
  999 limit. Deletes go in chunks of 500; a test caps the limit at 999.
- Note: NOTES now says the changelog check reads structured figures.

Feeds are regenerated in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The year table now picks one decimal count per path, the fewest (up to
three) that print every external year exactly, so H.R. 4849's FY2032 reads
$250.940B beside $70.736B, and NZ Treasury's years stay NZ$15M.

The feeds are regenerated from the round-1 fixes. Against 1c502c0 exactly
10 rows change: H.R. 4849's FY2027-2036, in window ("FY2027 (revised
build)") and source_column (the build vintage). All 7,244 claim ids keep
their order, lanes.json is unchanged, and the double build is deterministic
(content hash bb71418a...).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 2 (full, codex sol62) found every round-1 item answered but one test
gap, and raised one P1 and two P2s:

- P1: NOTES.md and source.json said Max made the publishing call "in two
  steps", counting his request for year-by-year detail as the second. His
  request and his call on publishing the years are separate: the text now
  quotes the request and names the publishing call as his decision d3576
  on this change.
- P2: the year formatter could print a nonzero year as zero ($1 beside $2B,
  $250,000 beside $2B) and set the PolicyEngine column's decimals from the
  external years alone. The exactness check now works in currency units,
  the column moves to a smaller unit when three decimals of the larger one
  cannot print every external year, and a value the column's decimals would
  round to zero gets more decimals or its own unit. All 112 real year tables
  print as before.
- P2: the main grid rounds standalone years ($70.74B). Fixing it means
  changing the grid's formatter for every source (1,839 cells across 40
  sources), so it is filed as a follow-up issue rather than changed here.
- Round-1 item 4, partly answered: a test now covers the superseded
  values' own fullmatch; reverting that check fails it for all three cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 3 (scoped) found round 2's P1 closed and raised two P2s in the year
formatter:

- The exactness check allowed a millionth of a unit of currency, so
  $7.0000005 counted as exact at no decimals and a $0.51 PolicyEngine value
  beside it printed as $1. The bound is now float error: a billionth of a
  unit, or a trillionth of the value.
- A value under a dollar beside a path in millions fell through to fmtV and
  printed as $0. It now tries its own unit at up to three decimals, then
  two significant figures, so a nonzero value never reads as zero.

All 1,110 external cells in the 112 real year tables print as they did at
39b288c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review November 29, 2026 19:31
@MaxGhenis
MaxGhenis merged commit 9b5d85d into main Nov 29, 2026
15 checks passed

This branch was successfully deployed

1 active deployment
Preview — 62cc9398 Deployed Nov 29, 2026 by vercel[bot]
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