Skip to content

Validate comparables and reconcile scorecard feeds - #271

Draft
MaxGhenis wants to merge 31 commits into
feat/comparables-gatefrom
codex/2547-policyengine-scorecard-pr208-draft-record-every-comparable-exte
Draft

MaxGhenis wants to merge 31 commits into
feat/comparables-gatefrom
codex/2547-policyengine-scorecard-pr208-draft-record-every-comparable-exte

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

This pull request was written by a Codex cloud task for Max Ghenis and builds on #208. No session owns it yet.

Scorecard changes

  • Bring in the merged main-branch scorecard changes. Fiscal Lab's 1,348 external-only scores include ten-year totals, low and high cases, and central estimates by year. In the reform-validation UI, 110 Fiscal Lab totals and two NZ Treasury totals show their individual years. The US scope note includes Fiscal Lab, and the population feed note distinguishes absent results from gap results without a value. The standalone Fiscal Lab ingest reads the pinned aggregate extract and retains the status of each score.
  • Update public labels and provenance notes to use Microcosm. The UK runtime accepts UK_MICROCOSM_H5 and retains UK_POPULACE_H5 as an alias. Mission Control counts claims with a current PolicyEngine value for its harvest, Fiscal Lab and NZ stages.
  • Keep the UK childcare ingest safe to rerun concurrently and avoid repeated scans in the Autumn Budget 2025 duplicate accounting. Rebuild the combined feeds while preserving the public claim values.
  • Validate comparables against all eligible counterparts and require a stated calendar or financial base year for real-price comparisons. Preserve the printed scale of accounting amounts, distinguish negative table entries from range punctuation, and evaluate unsigned bounds together. Keep past finds tied to their search-date producer lists and store comparable estimate history in UTC. Reject dates that put an estimate's replacement or a search citing its results before the computation. Permit calculators without estimates and limit the due list to supported countries.
  • Emit valid JSON for unbounded gaps and keep unexplained gaps visible in report. Describe the limits of the scorecard gate and the proposed downstream checks. Clarify in the README which claims have PolicyEngine counterparts.

Open validation finding

A fiscal-year span written with to can still make the parser mistake the minus on a following amount for range punctuation when validating a range endpoint.

UK figure comparison

The output below is from the command that follows, run from the repository root with the PR branch checked out. Each external or PolicyEngine estimate is counted once per claim or result version. The derived cells are the sign-normalized value, ratio and delta. The actual PR-base comparison emits the complete list, including the values and data_bundle for any change.

{"base": "origin/feat/comparables-gate", "claim_ids": 0, "estimates": 0, "derived_cells": 0, "changes": []}
{"base": "origin/main", "claim_ids": 22, "estimates": 44, "derived_cells": 66}
python - origin/feat/comparables-gate HEAD origin/main <<'PY'
import json
import subprocess
import sys

pr_base, head, main = sys.argv[1:]
root = "app/public/data/"
population = root + "populations.json"


def git(*args):
    return subprocess.check_output(["git", *args])


def read(ref, path):
    return json.loads(git("show", f"{ref}:{path}"))


def figures(ref):
    rows = read(ref, population)["rows"]
    result = {}
    for row in rows:
        if row["country"] != "UK":
            continue
        claim = row["claim_id"]
        latest = row["latest"]

        def add(key, value, bundle, kind):
            if value is not None:
                identifier = f"{claim}/{key}"
                assert identifier not in result, identifier
                result[identifier] = (value, bundle, kind)

        bundle = latest["data_bundle"]
        add("external_value", row["external_value"], bundle, "estimate")
        for version in row["results"]:
            add(f"result/{version['computed_at']}", version["value"],
                version["data_bundle"], "estimate")
        assert latest["value"] == (row["results"][-1]["value"] if row["results"] else None)
        add("external_value_pe_sign", row["external_value_pe_sign"], bundle, "derived")
        for field in ("ratio", "delta"):
            add(f"latest/{field}", latest[field], bundle, "derived")
    return result


def compare(base, emit):
    changed = git("diff", "--name-only", base, head, "--", root).decode().splitlines()
    for path in changed:
        if path == population:
            continue
        before, after = read(base, path), read(head, path)
        if path == root + "lanes.json":
            assert "rows" not in before and "rows" not in after
        else:
            assert before["rows"] == after["rows"], path

    before, after = figures(base), figures(head)
    changes = []
    for key in sorted(before.keys() | after.keys()):
        old, new = before.get(key), after.get(key)
        if old != new:
            entry = new or old
            changes.append({
                "id": key, "before": old[0] if old else None,
                "after": new[0] if new else None, "data_bundle": entry[1],
                "kind": entry[2],
            })
    print(json.dumps({
        "base": base,
        "claim_ids": len({row["id"].split("/")[0] for row in changes}),
        "estimates": sum(row["kind"] == "estimate" for row in changes),
        "derived_cells": sum(row["kind"] == "derived" for row in changes),
        **({"changes": changes} if emit else {}),
    }))


compare(pr_base, emit=True)
compare(main, emit=False)
PY

The comparison ran at head 737ed36186de82e13fd4d5e38776ec40518d06c9 and used origin/feat/comparables-gate at dd8ed68b4b8c17723d28e63bf7384ddc2b2fca1c and origin/main at 9b6d1f50467c0635ba894130a527acdd6ba2df1a.

Verification

The comparables, population-export, Fiscal Lab and build-chain tests, Ruff, the Bun tests and the app build passed. The locally regenerated population feed and event archives matched the committed bytes. The optional Fiscal Lab raw-page and pinned-engine-source checks require inputs absent from this checkout. No model data were fetched.

Opened by a Codex cloud task (queue file 2547-policyengine-scorecard-pr208-draft-record-every-comparable-exte).

MaxGhenis and others added 27 commits November 16, 2026 19:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rename Populace to Microcosm in prose and code
Stage all 248 claims from Fiscal Lab's Memo Bill Scores, released on
2026-11-24 and staged from the November 25 build: 110 FY2027-2036 federal
deficit totals, plus the low and high cases on 69 of them. They sit on
primary_deficit_change, held out, against current law. Every bill is
staged, including the 101 that PolicyEngine can run little or none of.

- sources/fiscal-lab-memo-scores:
  - adapter.py rebuilds the extract from the fetched, hash-pinned page and
    checks the rebuilt CSV against the hash of the captured copy. It reads
    the CSV's closing source line from the page's own code, so the line is
    not in the repository. It also checks each bill's score-table total
    against its figure and range, and flags the 6 bills whose CSV range
    rounds that total to $0.1 billion.
  - source.json records every raw file by URL, fetch date and SHA-256, with
    stored_in_repo false.
  - pe_status.json marks each bill not_computed (9, all partial) or pe_gap
    (101: 91 none, 10 partial), judged against the policyengine-us 2.2.2
    source.
  - NOTES.md documents the source.
- data/externals/fiscal-lab-memo-scores.json holds, per bill, identifiers
  and the bill's title, Fiscal Lab's model and effect labels, the printed
  values and links: 251 figures, 248 current plus H.R. 4849's 3 superseded
  values from the November 21 build. No raw Fiscal Lab file is committed;
  raw/ is git-ignored.
- scorecard_db/ingest_fiscal_lab.py writes the claims, valueless pe_gap
  result rows and the fiscal-lab-memo-scores lane. build_db runs it. A
  rerun keeps other runs' results and diagnoses, and the lane follows the
  NZ Treasury ingest's stage rules, counting what the feed shows.
- The feeds gain 248 US rows in populations.json and the new lane in
  lanes.json.

No PolicyEngine number is recorded. H.R. 4849 and H.R. 1428 stay
not_computed until the results in PolicyEngine/fiscal-lab-comparison pass
review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Max ruled on 2026-11-26 (decision d3450) to publish the 251 Fiscal Lab
figures in this public repository. The terms note in source.json and
NOTES.md now records that ruling in place of the open question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The independent review of #261 found reasons that misstate how
policyengine-us 2.2.2 works, and four ingest and fetch defects. A sweep
of all 110 reasons found more of the same kind; 32 are reworded against
the source:

- Medicaid: ACA expansion adults get one national expansion match and
  every other enrollee the state's regular match, not one rate per state.
  Cost per enrollee is each state's spending total split by a
  benchmark-premium cost index, not a state average.
- Each enrollee's Part B premium is computed (the standard premium plus
  the income-related adjustment, less Medicare Savings Program
  coverage); only the standard premium is a parameter.
- Medicare spending reasons cite medicare_gross_cost and per_capita_cost,
  not medicare_cost, which nets out each person's premiums.
- H.R. 3257's and H.R. 6455's levers are restated to what a reform can
  apply. H.R. 9833 moves from pe_gap partial to none: its one score line
  is the dental wraparound, which the only lever would price as full
  CHIP. The tally is 9 not_computed (partial) and 101 pe_gap (92 none,
  9 partial).

Code:

- The lane counts a claim as computed only when its latest result
  carries a value, as the populations feed and the app do.
- ingest() takes BEGIN IMMEDIATE before reading the registry, so
  overlapping ingests run one after the other.
- ingest() refuses two results on one claim at the same computed_at,
  which the feed would otherwise order by insert id.
- adapter.py fetch replaces the pinned page only when the body matches
  its hash, and saves a differing page beside it.

Each code fix has a test that fails without it. The feeds change only in
the reworded Fiscal Lab rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 2 of the independent review (Subfleet job
20261126-213745-scorecard-261-review-r2) raised 4 P1s and 5 P2s.

Status reasons (pe_status.json; no status, scope or gap class changed):
- A structural reform can move pay from taxable wages into employer-paid
  premiums, but policyengine-us 2.2.2's certified default dataset has no
  employer-paid or pre-tax premium amounts. The method and the pe_gap
  legend now say a lever needs its base in that dataset. H.R. 5509,
  5448, 3415, 9257, 7227, 9941, 3762, 6423, 3069, 7023 and 9702 place
  the employer exclusion gap in the data.
- H.R. 3415 and 9257 name the Basic Health Program's premium
  adjustment factor as a lever.
- S. 4886: msp_federal_cost leaves out full Medicaid enrollees.
- H.R. 3257's below-poverty credit needs a state-limited override.
- H.R. 4206, 711 and 6609: narrower wording.

NOTES.md gives the right counts: 9 pe_gap partial, and after round 1,
30 reworded reasons plus 2 path-only fixes.

Code:
- fetch stages each page in a temporary file of its own, so overlapping
  fetches cannot swap bodies.
- The gap-row refresh deletes every classifier run's rows (by run-id
  prefix), so a later dated reclassification leaves no stale gap.

Each code fix has a test that fails on the old code. The lane-feed race
in the shared sync_lane_feed is filed as #262.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The NZ Treasury ingest counted a claim as computed when its latest result
was anything but not_computed, and harvest's advance_computed_lanes counted
any claim with any result. Both now count a claim only when its latest
result, by computed_at then id, carries a PolicyEngine value: the rule
export_populations and populations.ts use for "with a value", and the one
PR #261's _write_lane follows. A valueless pe_gap or mismatch as the latest
row no longer makes a lane computed, and NZ's regressed note now says the
claims retain no PolicyEngine value.

No harvest or NZ claim has a valueless latest result today, so the built
database and feeds do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ingest_uk_childcare_100k read the registry's old claims before any write
lock, so two overlapping ingests could both read an empty registry. Both
then deleted nothing and each inserted every result, leaving each claim's
result twice per run. The ingest now takes BEGIN IMMEDIATE before the read,
as ingest_fiscal_lab does in PR #261, so overlapping runs serialise. The
connection now closes in a finally block, so a lock timeout or a failed
write no longer leaves it open.

The new test starts two ingests on one database and holds each at its
registry read until the other reads, then compares the rows with a single
ingest's. On the old code the two reads meet and every pe_results row is
doubled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stage() tallied each source's merged twins by scanning the kept claims for
every row and rehashing each one: about 1.9 million claim_id hashes for
8,881 rows. That took about 14 of a full build_db's 27 seconds. Each score
is now hashed once, and the kept claims are indexed by id.

The tally is a transliteration of the old one: a row counts as a merged
twin when its claim id is kept by a different row (the first kept row with
that id), and the tally goes to the family of the last row with that id.
stage()'s full return (every score row in order, and the accounting dict in
its key order) is byte-identical to origin/main's, and stage() now takes
0.26 s.

The new test counts claim_id calls through stage(). The old code hashes
one score 1,147 times; the new code hashes each at most four times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An in-session adversarial check of 62bc0ce found two gaps (P2):
- Every test inserted rows in date order, so a latest-row rule ordered by
  id alone still passed.
- No test had a lane with both valued and valueless claims, so nothing
  checked that N and updated_at come from the counted claims alone.

New harvest cases insert a newer-dated row before an older one, either
way round. New mixed-lane tests (harvest and NZ) check "1 of N", the
lane's date and, for NZ, the populations feed's count. The old modules
fail 10 of these tests, an id-only ORDER BY fails 3, and an NZ date taken
over every latest row fails 1.

Two small cleanups: the second harvest read skips a claim missing from
the first, as the old code did, rather than raising KeyError; and an
over-long NZ docstring line is rewrapped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 3 of the independent review (Subfleet job
20261127-012145-scorecard-261-review-r3-scoped) closed round 2's four
P1s and raised two new P1s and two P2s.

Code:
- The rerun delete now matches only the classifier's own rows: a run id
  of the prefix and an ISO date, status pe_gap, no value and the "no run"
  bundle. A counterpart survives a rerun whatever its run id. The ingest
  refuses a status run id that the delete would not find.
- fetch stages each page under a short fixed name, so a dest name of any
  length the filesystem accepts can be fetched to.

Each code fix has tests that fail on the old code, and a partial mutation
of each clause in the delete fails its own case.

Status reasons (pe_status.json; no status, scope or gap class changed):
- H.R. 3069 names the payroll-tax pre-tax list beside the income-tax one.
- H.R. 9702 names the Basic Health Program's premium adjustment factor:
  the program's reference premium reads slcsp_age_0, not slcsp.
- A sweep of every bill with a Basic Health Program line adds its lever
  to Medicare for Kids (minimum age), H.R. 1589 and H.R. 9432 (immigrant
  status list).

NOTES.md describes the round-3 changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 1 (Subfleet 20261127-095844-scorecard-263-review) raised two P2s
against the new tests:

1. The AB2025 test counted claim_id() calls only. A tally that hashes
   each score once but scans cached ids per row is still quadratic, and
   it passed. The test now also counts comparisons between claim ids,
   through a str subclass. The bounds are loosened to allow another linear
   pass (at most 8 hashes per score, 4 per row read, and 1 comparison per
   row read). The original code fails at 1,147 hashes of one score, a
   cached-id scan at 961,087 comparisons, and an extra uniqueness pass
   still passes.

2. The childcare overlap test waited at most a second for the other
   ingest's registry read. When one ingest started over a second late,
   the old code passed. Each ingest now holds at its read until the other
   has either read or started BEGIN IMMEDIATE, and a wait that times out
   fails the test. A new parameter starts either ingest half a second
   late. The old module fails all three cases, with a 1.5 s delay too, on
   doubled pe_results rows; the fixed module passes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
01b1ca5's message says a partial mutation of each clause in the rerun
delete fails its own case. That held for the run-id shape and the bundle
clause only: dropping the status clause or the value clause alone left
every test passing. The counterpart test now has a case for each column
that differs from a classifier row in that column alone, so dropping any
one clause fails its case.

fetch kept a changed page beside the pinned copy as
<stem>.<sha256[:12]><suffix>, 13 bytes longer than dest's name, so a
dest name over 242 bytes could not keep one. beside() now cuts the stem
on a character boundary when the name would pass 255 bytes.

All 14 tests added since 6155472 fail on its code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 found that the stage-level test, which counts claim-id
hashes and comparisons, passes an identity scan of `kept` per row
(quadratic, uncounted) and fails a harmless extra linear pass.

Move the tally into `_merged_twins(mine, kept)`, which stage() calls
when rows were merged. Its output and stage()'s are unchanged: the
staged scores and accounting match main byte for byte, and two builds
give content hash e451ad6b... with no feed drift.

Test the helper directly:
- the tally goes to the last row's family, in either row order;
- its traced Python steps grow at most 6x when the input grows 4x.
  The helper grows 4.0x. The old nested lookup grows 15.7x; an identity scan, an `in` scan,
  a cached-id scan and a cached-id index grow 15-16x; an extra linear
  uniqueness pass passes.

The stage-level hash bound stays, loosened to 8 per score and 4 per
row read, so a regression in stage() itself still fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix three latent ingest bugs: computed counts, childcare lock order, AB2025 rebuild cost
…copy

Round 4 (Subfleet 20261127-115939-scorecard-261-review-r4b-scoped) closed
the rerun-delete P1 and left two P1s open, both in the name fetch gives
the copy of a changed page that it keeps beside the pinned one.

- 5851df4 introduced an overwrite. Its beside() cut the stem to fit 255
  bytes, so a 255-byte dest whose stem already ended in the new page's
  ".<sha256[:12]>" got back dest itself, and the changed page replaced
  the pinned copy. 01b1ca5's uncut name could never equal dest.
- The cut also left a long suffix overflowing: for "d." + "x" * 242 the
  copy still needed 256 bytes.

beside() goes back to the uncut <stem>.<sha256[:12]><suffix>, exactly 13
bytes longer than dest's name and so never dest. fetch works out the
target before staging and, when a changed page's copy would pass 255
bytes, raises ValueError before it writes anything. A pinned fetch to a
255-byte name still works.

Tests:
- test_the_kept_copy_is_never_dest: a Hypothesis property over names
  padded up to 255 bytes, including names that already carry the digest.
- test_a_changed_page_never_overwrites_dest_whatever_it_is_called:
  round 4's collision case.
- test_a_changed_page_is_kept_beside_only_where_its_name_fits: 242 bytes
  fits; 243 bytes and the long suffix are refused.
- A counterpart case, other-run-id-shape, isolates the run-id clause of
  the rerun delete (round 4's P2). Dropping that clause fails only it.
- 5851df4's truncation tests are removed.

On 5851df4's adapter the property, collision and both refusal tests fail
(4); with the length check removed, the collision and refusal tests fail
(3). Fiscal Lab, build-chain and export tests: 82 passed. Ruff is clean.

Round 4's other P2, that pe_results rows carry no producer, is filed as
#265. Max ruled yes on d3497 (apply this fix, run a scoped round 5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s fit

Round 5 (Subfleet 20261127-140038-scorecard-261-review-r5-scoped) closed
round 4's two P1s and the run-ID P2. It raised one new P1 in 65f0635's
length check, which predicted the filesystem's name limit:

- It measured names with str.encode(), strict UTF-8. Linux filesystems
  take names whose bytes are not UTF-8, which Python decodes with
  surrogateescape, so a fetch to such a name raised UnicodeEncodeError,
  even for a page that matches the pin. 5851df4 saved that page.
- It also ran for a page that matches the pin, which needs no kept copy.
  So it refused a pinned page whose name passes 255 bytes, saying the
  page differs.

An in-session check of 65f0635 (workflow wf_46d09cdf-2ce) confirmed it.
It also measured APFS's limit: 255 UTF-16 units, not bytes. So a byte
check refuses names that APFS takes, a pinned 'é' * 128 among them,
which 5851df4 saved.

Every check on these lines that predicted the limit drew a new finding,
so fetch now predicts nothing and the filesystem decides:
- fetch stages the page under a short fixed name and renames it into
  place;
- when the filesystem refuses the kept copy's name as too long
  (ENAMETOOLONG), fetch removes its staging file and raises ValueError,
  saying the page differs, and dest is left as it was;
- any other error, and any refusal of dest's own name, is raised as it
  is;
- beside() keeps the uncut name, which is 13 bytes longer than dest's
  and so never dest.
NAME_MAX is gone.

The in-session check also found two wording errors, fixed here:
- beside()'s docstring;
- NOTES' fetch bullet, which said "saves" where the next sentence
  contradicted it.

Tests:
- test_a_changed_page_is_kept_beside_wherever_the_filesystem_takes_the_name:
  ASCII names of 242 and 243 bytes, the long suffix, and two-byte names
  of 242 and 243 bytes. The 243-byte two-byte name's copy fits on APFS
  alone.
- test_fetch_takes_a_name_whose_bytes_are_not_utf8 (pinned, changed). On
  Linux the page or its copy is saved. On macOS, APFS refuses the name
  with EILSEQ, which fetch raises as it is. Each branch asserts its
  platform.
- test_a_pinned_fetch_to_an_overlong_name_is_not_called_changed: a
  256-byte pinned name gets the filesystem's own ENAMETOOLONG.
- test_the_kept_copy_is_never_dest also draws names with a two-byte
  character or a non-UTF-8 byte, measured with os.fsencode.
- Round 4's collision test is kept.
- A counterpart case, run-id-date-not-digits, so a GLOB of ? wildcards
  in place of [0-9] fails it.

Mutations, each failing at least one test:
- 65f0635's pre-check (4);
- 5851df4's cut-short beside() (3);
- no translation of ENAMETOOLONG (3);
- every OSError on a changed page put as the page differing (1);
- a pinned page's own refusal put that way (1);
- the staging file left behind (6);
- ? in the run-id GLOB (1).

The Fiscal Lab, build-chain and export tests give 88 passed on macOS.
The Linux branches run only in CI (ubuntu-latest). Ruff is clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add Fiscal Lab's Memo Bill Scores as an external source
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>
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>
…0261129

Add Fiscal Lab's year-by-year values beside each bill's total
@vercel

vercel Bot commented Nov 30, 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 Dec 1, 2026 5:31pm UTC

Request Review

@MaxGhenis MaxGhenis changed the title Finish the comparables validation and merge Validate comparables and reconcile scorecard feeds Dec 1, 2026

This branch was successfully deployed

1 active deployment
Preview — 737ed361 Deployed Dec 1, 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