Skip to content

Run CliffWatch on policyengine.py's calculate_household - #45

Draft
MaxGhenis wants to merge 16 commits into
mainfrom
claude/cliffwatch-on-policyengine-py
Draft

MaxGhenis wants to merge 16 commits into
mainfrom
claude/cliffwatch-on-policyengine-py

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What this does

  • CliffWatch moves off its direct engine pins (policyengine-us 1.755.5 from a 2 July commit, policyengine-core 3.32.1 and spm-calculator 0.3.1) and onto pe.us.calculate_household from policyengine.py. One pin, policyengine[us]==6.17.1, now sets the engine: policyengine-us 2.2.1, policyengine-core 3.33.3 and spm-calculator 1.0.0. policyengine.py shipped #739 in 6.17.1. It lets calculate_household take several marital units, which a married couple with a child needs for Medicaid and SSI.
  • policyengine.py 6.17.2, its latest release, still pins policyengine-us 2.2.1 from 15 September, while policyengine-us has reached 2.116.21. CliffWatch's engine now moves when policyengine.py moves its pin.
  • policyengine-us 2.115.0 puts Middlesex and Norfolk counties in Massachusetts in rating area 5 from 2026 (Correct ACA rating areas and premiums from 2026, and add 2027 premiums policyengine-us#10682). 2.2.1 keeps both in area 3, as production's 1.755.5 does, so this PR leaves their benchmark premiums where they are.
  • On a grid of 51 states, 406 of 408 series move, and every change of $0.50 or more traces to a named cause.
  • The builders send 40 hours a week for every adult, in both of the engine's hours variables. policyengine-us 1.755.5 defaulted weekly hours to 40, and 2.2.1 defaults them to zero.
  • CliffWatch now sums SNAP and WIC over the calendar year instead of multiplying January by twelve, so the chart picks up changes during the year, such as October's SNAP cost-of-living adjustment.
  • The chart says "State and local taxes", because the engine's state total now includes Maryland's county income tax.
  • The function's dependencies exceed Vercel's 225 MiB bundle limit again, so a cold start installs 239 MiB of them in about 1.7 seconds. A complete install fits on top of a stopped one. Remove the cold-start install by trimming packages a calculation never imports #46, now on main, removed the install from main's engine.
  • /api/calculate, /api/series and /api/households get 120 seconds, since the first request on an idle instance takes 44 to 58 seconds.

API callers see two other changes. A household needs someone aged 18 or older, because the engine's default outputs measure SPM poverty. Years outside 2022 to 2035 raise an error, since spm-calculator's forecast has no entry for them.

Impact

The grid runs four households through the 50 states and DC in 2026 and 2027, at earnings from $0 to $100,000 in steps of $2,500: 408 series and 16,728 points. A single adult aged 30, a parent aged 30 with children aged 5 and 8, a couple aged 35 and 33 with a 2-year-old, and a 62-year-old with an $18,000 private pension make up the households. One adult in the couple earns, and both families pay $8,000 a year for child care. The grid sends no ZIP, so the engine gives every household its state's first county alphabetically and, in Maryland, Allegany County's income tax rate.

Against main, 24,110 displayed amounts move by $0.50 or more, and every one traces to a cause. policyengine-us 2.2.1 moves 23,625 of them, 7,471 together with the annual SNAP and WIC reads. The annual reads alone move 455, and the hours input moves 30 Maryland TANF amounts. At every point, the port's amounts match a direct policyengine-us simulation of the same household. frontend/src/policyengineApi.js still multiplies January by twelve in its own reads, but the app imports only buildCliffDrivers from that file, and that function works from the annual series.

Output Amounts that move Largest change Household, state, year, earnings Cause
SNAP 5,579 +$2,518.96 Couple, Maine, 2027, $55,000 2.2.1 moves Maine's categorical eligibility to the new poverty guidelines in January instead of October, and the annual read counts each month
Federal taxes before refundable credits 5,152 −$48.02 Parent, Alabama, 2027, $95,000 2.2.1 revises chained CPI, which moves the 2027 IRS parameters
State and local taxes before refundable credits 3,840 +$3,423.90 Age 62, Maryland, 2026, $100,000 2.2.1 adds Maryland's county income tax to the state total
WIC 2,614 +$733.78 Couple, Arizona, 2027, $52,500 2.2.1 raises Arizona's limit for categorical eligibility to 200% of the poverty guideline, and the annual read counts each month
Federal refundable credits 2,497 +$38 Parent, Arkansas, 2027, $55,000 2.2.1 revises chained CPI, which moves the 2027 IRS parameters
Free school meals 2,427 +$3,710.43 Parent, Alaska, 2026, $67,500 Under 2.2.1's revised SNAP uprating, the family gets SNAP from October, which makes the children categorically eligible for the year
State refundable credits 1,603 +$1,883.75 Parent, Colorado, 2027, $25,000 2.2.1 bases Colorado's child care credit on the federal credit before the federal liability limit, alongside revised chained CPI
TANF 192 +$3,150 Parent, New York, 2026, $22,500 2.2.1 raises New York's earnings disregard from 50% to 64%
CHIP premium 114 +$942 Parent, Missouri, 2027, $62,500 2.2.1 reads Missouri's premium charts month by month and switches charts in July
Child care subsidies 84 +$8,000 Parent, Nebraska, 2026, $0 2.2.1 computes Nebraska's subsidy, which 1.755.5 left at zero
Head Start 3 +$22,646.27 Parent, Alaska, 2026, $67,500 With the same October SNAP, the engine counts a year of Head Start
Early Head Start 3 +$24,960.25 Couple, Alaska, 2026, $67,500 With the same October SNAP, the engine counts a year of Early Head Start
Medicaid 2 −$10,335.71 Parent, Georgia, 2026, $10,000 2.2.1 lowers Georgia's parent income limit from 39% to 31% of the poverty guideline

Head Start, Early Head Start and school meals

Both engines count a full year of these services once a family gets SNAP in any month. is_head_start_categorically_eligible tests annual SNAP, TANF or SSI, and head_start and early_head_start return a year of state spending per enrolled child. school_meal_tier reads an annual categorical test the same way. So a calendar-year chart counts three months of SNAP as 3/12 of a year's SNAP and 12/12 of the services it unlocks.

Largest single-step fall in the 204 series with a young child main's engine This PR
Ends Head Start or Early Head Start 175 175
Of those, SNAP in October to December only 76, in 41 states 69, in 37 states
Of those, SNAP in 9 to 11 months 0 5
Of those, SNAP in all 12 months 93 95
Of those, TANF with no SNAP 6 6

The pattern predates the port. Across the grid, main's engine shows $11,244 to $31,542 of these services at 90 points where the chart shows SNAP, TANF and SSI at zero. The chart reads January's SNAP, and the engine reads the year. For example, a couple with a toddler in Nevada at $52,500 in 2026 gets $16.90 of SNAP a month from October, and with it $26,419.82 of Early Head Start. At $55,000, the couple loses both. This PR shows the SNAP at each of those points, and its engine pays $26.72 a month at the Nevada point.

The port adds six such points, in Alaska and Arizona, and removes none:

  • Alaska, 2026, $67,500, both families. Both engines make the family categorically eligible from October. main's engine misses a benefit by $2.35 a month, with a $1,037.75 maximum against a $1,040.10 contribution. This PR's engine pays $11.84, with a $1,050.84 maximum against $1,039. With that SNAP, the engine counts $22,646 of Head Start and $3,710 of school meals for the parent, and $24,960 of Early Head Start for the couple.
  • Arizona, 2026 and 2027, $52,500, both families. policyengine-us 2.2.1 raises Arizona's limit for broad-based categorical eligibility from 185% to 200% of the poverty guideline in March 2026. The family still gets no SNAP until October 2026, and gets it in every month of 2027.

This PR leaves open whether policyengine-us should prorate these values by qualifying months or the chart should keep them and say so.

Every cause on the grid

A point can have several causes, so the counts overlap.

What policyengine-us 2.2.1 does differently States Amounts Largest change on its own, or shared where noted
Rounds SNAP's net income, expected contribution and minimum benefit to whole dollars 51 3,044 +$7.51 SNAP (single, CA, 2027, $27,500)
Raises New York's TANF earnings disregard from 50% to 64% NY 64 +$3,150 TANF (parent, NY, 2026, $22,500)
Uses the published CPI-U, which revalues WIC and school meals and moves indexed tax parameters in Arkansas, Louisiana and Oregon 51 5,332 +$36.63 school meals (parent, AK, 2026, $0)
Uses California's published CPI and restores the indexing of its deductions CA 232 −$20.69 state tax (parent, CA, 2026, $97,500)
Tests CalEITC against federal AGI as well as earnings CA 10 −$201.64 state credits (age 62, CA, 2026, $5,000)
Raises Rhode Island's standard deduction and restores its indexing RI 245 −$76.38 state tax (age 62, RI, 2027, $87,500), shared with the next row and chained CPI
Updates Rhode Island's personal exemptions and brackets RI 245 −$76.38 state tax (age 62, RI, 2027, $87,500), shared with the row above and chained CPI
Revises SNAP uprating, which moves allotments and deductions and, through categorical eligibility, Head Start, Early Head Start and school meals 51 4,544 +$24,960.25 Early Head Start (couple, AK, 2026, $67,500)
Lowers Georgia's parent Medicaid limit from 39% to 31% of the poverty guideline GA 2 −$10,335.71 Medicaid (parent, GA, 2026, $10,000)
Computes Nebraska's child care subsidy eligibility and reimbursement NE 84 +$8,000 child care (parent, NE, 2026, $0)
Grants Florida's extra TANF earnings disregard only when a new applicant's earnings after the $90 disregard fall below the payment standard FL 12 −$2,876 TANF (parent, FL, 2026, $5,000)
Pays Arkansas's full TANF grant below its gross-income trigger AR 16 +$2,448 TANF (parent, AR, 2026, $10,000)
Exempts Georgia children under six from CHIP premiums GA 44 −$432 CHIP premium (parent, GA, 2026, $65,000)
Corrects New York's CHIP premium bands NY 2 +$360 CHIP premium (parent, NY, 2027, $70,000)
Moves each state's categorical-eligibility poverty guidelines in its own month: January in Maine, February in Massachusetts, March in Oregon and April in Washington MA ME OR WA 14 +$2,518.96 SNAP (couple, ME, 2027, $55,000), shared with SNAP rounding, SNAP uprating and the annual read
Bases Colorado's child care credit on the federal credit before the federal liability limit CO 48 +$1,847.50 state credits (parent, CO, 2026, $25,000)
Keeps the federal child care credit from before the One Big Beautiful Bill Act as the base for Maine's and Vermont's credits ME VT 126 −$648 state credits (parent, VT, 2026, $45,000)
Restores bracket indexing in Maine and Nebraska, and fairness-credit indexing in Maine ME NE 448 +$40 state credits (couple, ME, 2026, $55,000)
Revises chained CPI, which moves 2027 IRS parameters and the state parameters linked to them 51 11,141 +$259.60 state credits (parent, CT, 2027, $60,000)
Applies Arkansas's fixed child care credit before the federal liability limit AR 60 −$230.09 state tax (parent, AR, 2027, $30,000), shared with the published CPI-U
Rounds uprated tax parameters as their definitions require NM VT WA 333 +$2.18 state tax (single, VT, 2026, $65,000)
Tests actual rent against the renter cap in New York's real property credit NY 32 −$75 state credits (single, NY, 2026, $0)
Adds Maryland's county income tax to the state total MD 239 +$3,423.90 state tax (age 62, MD, 2026, $100,000)
Rounds New York's child credit phase-out income down to whole $1,000 NY 10 +$16.50 state credits (parent, NY, 2026, $77,500)
Raises Maine's 2026 standard deduction and indexes later years ME 234 −$98.60 state tax (couple, ME, 2027, $42,500)
Raises Arizona's limit for broad-based categorical eligibility from 185% to 200% of the poverty guideline in March 2026 AZ 20 +$24,065.55 Early Head Start (couple, AZ, 2027, $52,500)
Applies Missouri's enrolled-earner TANF disregard before its need test and work exemption MO 14 +$2,951.75 TANF (parent, MO, 2026, $17,500)
Raises Alabama's TANF work-expense deduction from 20% to 30% AL 8 +$1,500 TANF (parent, AL, 2026, $15,000)
Removes an unenacted 2023 increase from Virginia's TANF standard VA 22 −$2,160.78 TANF (parent, VA, 2026, $12,500)
Rounds Illinois's monthly TANF grant down to whole dollars IL 31 −$10.13 TANF (couple, IL, 2026, $2,500)
Rounds Louisiana's monthly FITAP deficit down to whole dollars LA 8 −$8 TANF (parent, LA, 2026, $17,500)
Rounds Nevada's monthly TANF grant down to whole dollars NV 8 −$8 TANF (parent, NV, 2026, $2,500)
Reads Missouri's CHIP premium charts month by month and switches charts in July MO 68 +$942 CHIP premium (parent, MO, 2027, $62,500)
Extends Virginia's larger standard deduction and raises it in 2027 VA 151 −$713.01 state tax (couple, VA, 2027, $85,000)
Keeps Virginia's 20% refundable EITC in 2027 VA 37 +$350 state credits (parent, VA, 2027, $17,500)
Indexes Washington's Working Families Tax Credit ceiling and corrects its phase-out WA 90 +$675 state credits (couple, WA, 2026, $50,000)
Raises Oregon's federal EITC match by five percentage points OR 107 +$365.80 state credits (parent, OR, 2026, $20,000)
Projects Oregon's Kids Credit with its statutory CPI-U formula OR 32 +$50 state credits (parent, OR, 2027, $0)
Raises New Jersey's child tax credit by 25% for 2026 to 2028 NJ 140 +$250 state credits (parent, NJ, 2026, $0)
Bases Kentucky's child care credit on the federal credit from before the One Big Beautiful Bill Act KY 50 +$180 state tax (parent, KY, 2026, $45,000)
Applies Hawaii's enacted 2027 rate schedule HI 109 −$115.20 state tax (couple, HI, 2027, $67,500)
Uses North Dakota's published 2026 brackets and restores later indexing ND 83 −$54.60 state tax (parent, ND, 2027, $92,500)
Uprates South Carolina's tax thresholds instead of its rates SC 78 −$145.56 state tax (age 62, SC, 2027, $100,000), shared with chained CPI
Removes an unsupported 2025 increase to Alabama's deduction phase-out threshold AL 30 +$8.75 state tax (couple, AL, 2026, $27,500)
Uses Wisconsin's published 2026 brackets and the rounding its uprating requires WI 207 +$2.96 state tax (couple, WI, 2026, $90,000)
Matches Indiana's EITC to the current year's federal EITC IN 38 +$31.28 state credits (parent, IN, 2027, $25,000), shared with chained CPI
Restores the uprating of Ohio's tax thresholds OH 108 −$18.57 state tax (parent, OH, 2027, $50,000), shared with chained CPI
What this PR does differently States Amounts Largest change on its own
Sums SNAP over the calendar year 51 5,312 +$1,604.17 SNAP (couple, AR, 2026, $35,000)
Sums WIC over the calendar year 51 2,614 +$183.65 WIC (couple, CO, 2027, $55,000)
Sends hours_worked_last_week, which raises Maryland's TANF child care deduction MD 30 +$2,400 TANF (parent, MD, 2026, $10,000)

Work hours

policyengine-us 1.794.3 moved the default for weekly_hours_worked_before_lsr from 40 to 0, so a household that sends no hours fails the engine's work-hours tests at every earnings level. The form doesn't ask about hours, and both situation builders already mark the household as meeting the child care activity test. So _base_person_data sends 40 weekly hours for each person aged 18 or over, including an adult with no earnings. For Medicaid's community engagement test, which starts in 2027, the engine reads a different variable, hours_worked_last_week, so the builders send 40 there too.

On the 51-state grid, the hours inputs change displayed amounts from main in one program: Maryland TANF. md_tca_childcare_deduction takes the highest adult monthly hours, which come from hours_worked_last_week and stay at zero on main. It caps the child care deduction at $200 a month per child at 100 hours or more, against $100 below. For example, the parent at $10,000 goes from $5,436 to $7,836 a year, and the couple at $5,000 from $7,236 to $8,436.

Everywhere else the inputs keep main's amounts, some by a different route. policyengine-us 2.2.1 exempts a 30-hour worker from SNAP work registration and takes that worker out of Medicaid's SNAP pass-through, so the engine now tests the single adult's 2027 Medicaid against hours_worked_last_week. Without either input, the grid would lose these amounts:

Amount States Largest loss
SNAP All 51 $6,293.71 (single adult, Hawaii, 2027, $0)
The single adult's Medicaid in 2027 42 $16,281.15 (DC, $0)
TANF DC, HI, MA, MD, MT, OK $9,512 (parent, Massachusetts, 2026, $20,000)
Child care subsidies ME, NH, RI $8,000

Idaho's state refundable credits would rise $155 for the single adult at $0 in 2026. Without hours_worked_last_week alone, the single adult would lose 2027 Medicaid in 40 states, up to $15,892.72 in Washington.

DC and Montana keep that Medicaid until both inputs go. Both builders declare TANF enrollment in every month when the form selects TANF, even where the engine pays no TANF, and the weekly hours pass those states' TANF work tests. policyengine-us counts the declared enrollment toward Medicaid's pass-through, which exempts a childless adult who gets no TANF from Medicaid's work test. main declares enrollment the same way.

Like production, the chart can't show adults who don't work losing benefits to the One Big Beautiful Bill Act's work tests. The README's scope notes state the assumption, and an hours field on the form would let the chart show those tests.

Packaging and cold start

#46's trim brought main's engine under Vercel's 225 MiB limit, so no install runs there. This engine adds 73 MiB of dependencies, 57 MiB of it from spm-calculator 1.0.0, whose two forecast files take 49 MiB. The install comes back in a smaller form:

Before #46 #46, now on main This PR
Deployment dpl_fBK2zhv7sdoyGi2D3D81eJKSc6cs dpl_BKG12Jgi9r3zn8jvjVsAwXEs3xhV dpl_6NTuKPaXjc71rRA9zbFpiHWMbefj
Function, by the builder's count 307 to 343 MiB 188.74 MiB 262 to 298 MiB
/tmp after a cold start 389.3 MiB 0.0 MiB 238.8 MiB
Files and directories in /tmp 31,436 11 7,426
Install at cold start 3.6 to 4.3 s of uv in production none 1.73 to 1.75 s of uv
Worst measured retry after a stop fails, no space nothing to retry succeeds, peak 480.3 MiB of 513.4
First /api/series on a fresh instance 27.84 s 30.75 s 40.66 s
Second /api/series 0.12 s 0.17 s 0.16 s

After all three previews sat idle and then took requests together on 5 November, the first /api/series took 34.54 s before #46, 32.82 s on #46 and 45.47 s on this PR.

In every test that stopped this PR's install between 0.3 and 1.5 seconds, the next run succeeded. A stop at 1.5 seconds leaves 237.1 MiB, the worst case, and the retry peaks at 480 MiB; by 2 seconds the install has finished. Two previews test the same thing in the platform's own init path.

  • With concurrent-downloads = 1, main's tree before Remove the cold-start install by trimming packages a calculation never imports #46 failed with production's error (dpl_DcSE4aRRtTVfmj9H5TLNXGRJwm39). This tree kept every route at 200 on all three rounds, with only the finished install in /tmp (dpl_2GMbGWf2CnyRxQm39R2ocK7qZcDN).
  • compile-bytecode = true (dpl_21MyaobJYW6ar2xVa2qJHfHkbs6y) pushes this tree's install past the limit. /tmp then holds a stopped attempt's 239.5 MiB directory beside the finished install, and every route still returns 200 on all three rounds.

tests/test_deploy_footprint.py fails when a complete install stops fitting on top of a stopped one, using the same 4 KiB block count the measurements use. If it fails after a version bump, give spm-calculator a URL source next; on a preview, that cut /tmp to 182.2 MiB (dpl_89Z64sLSFEQyNdMukVXrNZvWxWoY). This PR holds that back: this set already fits, and one URL pin costs less to maintain than two.

First requests take longer

The engine accounts for the extra time on a fresh instance.

Step on a fresh instance main This PR
Import policyengine_core 1.51 s 1.32 s
Import policyengine_us 18.93 s 24.27 s
Import policyengine not used 5.45 s
First series 6.33 s 8.24 s
Second series 0.96 s 1.68 s

On a Mac, import policyengine spends about half of its own time hashing 12,259 of policyengine-us's source files for a data-build fingerprint, which a household calculation doesn't read. At import, policyengine.py feeds that fingerprint to a dataset compatibility check that can raise an error. Its maintainers could defer the hash, or policyengine-us could compute it when it builds its wheel.

After idling, this PR's previews answered every first request with 200: /api/series in 43.68 to 51.2 seconds, /api/calculate in 45.12 to 51.15, /api/households in 49.3 to 57.85 and /api/metadata in 3.79 to 4.47. Sixty seconds would run close, so vercel.json gives the three calculation routes 120.

Invariants

  • For every household the validator accepts, engine.py's translation keeps every input and puts each person in exactly one marital unit (test_kwargs_keep_every_input_and_each_person_in_one_marital_unit, property test).
  • The translation refuses what calculate_household can't carry: values that vary within a year, and a tax unit or other shared group that doesn't hold one group of everyone in order (test_kwargs_refuse_values_that_vary_within_the_year, test_kwargs_refuse_anything_but_one_group_of_everyone).
  • Every read through calculate_household equals a direct Simulation of the same situation, for fixed households and for generated ones that carry Resolve a household's county from its ZIP code #47's ZIPs, counties and rating-area overrides (test_every_read_matches_a_direct_simulation and test_reads_match_a_direct_simulation_for_any_household, the differential tests).
  • All 51 states compute on both paths (test_every_state_computes_on_both_paths).
  • SNAP and WIC equal their calendar-year sums (test_snap_and_wic_are_calendar_year_sums).
  • Every person aged 18 or over carries the assumed hours in every situation form, and nobody younger does (test_every_adult_and_nobody_else_carries_the_assumed_hours, property test).
  • A complete install fits on top of a stopped one, and the footprint test's walk over uv.lock agrees with uv export on what the function contains (tests/test_deploy_footprint.py).

Plan

axiom: n/a: cliff-watch app engine dependency; no policy encoding change

🤖 Generated with Claude Code

MaxGhenis and others added 5 commits November 4, 2026 19:37
Cliff-watch set totals and derived variables as inputs. An input on a
policyengine-us variable that is computed from others replaces the
computation, so every rule reading a component or sibling saw zero:

- pension_income left taxable_pension_income, and so AGI and income
  tax, at 0; pensions now go to taxable_private_pension_income, with a
  new government pension field on taxable_public_pension_income.
- social_security left social_security_retirement at 0 and dropped
  SSDI from the total; it now sets social_security_retirement.
- dividend_income taxed all dividends as ordinary income; it now sets
  qualified_dividend_income.
- A tanf_gross_earned_income override on a second earner fixed the
  head's at 0, freezing TANF (and TANF-linked Head Start and WIC)
  across the earnings axis. Only employment_income is set now.
- The household path's aca_magi/medicaid_magi estimate left out Social
  Security; policyengine-us now derives MAGI on both paths.
- snap_assets hid savings from TANF and SSI resource tests; savings go
  to bank_account_assets.
- utility_expense gave no SNAP utility allowance; utilities go to
  heating_cooling_expense.

Pins policyengine-us 1.755.5, policyengine-core 3.28.0 and
spm-calculator 0.3.1 and commits uv.lock. That environment reproduces
production byte for byte. An unpinned redeploy would install 2.15.16,
which crashes the API.

Adds Hypothesis and fast-check invariants checked against the
policyengine-us variable graph, a JS-vs-Python builder differential, a
household-vs-series differential, engine-pinned regressions, opt-in
live-API checks, and a CI test workflow. Moves frontend tests to Vitest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main added seriesRefine.test.js on node:test after this branch moved the
frontend suites to Vitest, so the rebased suite found no tests in it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
policyengine-us adds the 20 gross income sources one at a time in
float32, so irs_gross_income can differ from the exact sum by up to
20 * 2**-24 of itself. An Alaska household with $523,288 of
miscellaneous income and $1 of SSDI computes $0.85 of taxable benefits,
but gross income comes back $0.875 above the other income, so the
fixed $0.01 tolerance failed on Hypothesis' random draws. The tolerance
now scales with that bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Savings go to a spouse only when the spouse is 65 or over or blind, the
  engine's own SSI test: the Disabled checkbox never sets
  meets_ssi_disability_criteria, so it made a disabled head keep the savings
  that an aged spouse's resource test needed. Both builders change; new tests
  cover that couple and compare _could_claim_ssi with the engine.
- New invariant: neither builder sets a formula variable unless
  KNOWN_COMPUTED_INPUTS lists it with what the input replaces.
- The gross-income invariant compares with the engine's
  taxable_social_security instead of a 0-85% band, and pins the September
  float32 household as an @example.
- The changelog no longer credits this PR with #41's pins and workflow, and
  notes the relabelled fields; the JS differential states its scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Depend on policyengine[us], whose extra pins policyengine-us 2.2.1,
policyengine-core 3.33.3 and spm-calculator 1.0.0. A new engine module
turns the calculator's situations into calculate_household's arguments
and answers its reads from the result, so the builders, the JS
differential and the payload invariants keep working.

Read SNAP and WIC for the calendar year, drop ccdf_age_group, which
2.2.1 removes, and take away the try/except around TANF and child care,
since those reads no longer run on their own. New tests compare every
read with a direct Simulation and run all 51 states on both paths.

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

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
cliff-watch Ready Ready Preview Nov 11, 2026 5:20am UTC

Request Review

MaxGhenis and others added 2 commits November 5, 2026 00:19
policyengine-us now reads missing hours as zero rather than 40, and zero hours
fail its work tests at every earnings level. CliffWatch doesn't ask about hours,
so on the new engine a childless adult lost SNAP at every earnings level and a
working parent lost child care subsidies in the states whose activity tests read
hours.

Both builders now send 40 hours for every adult, which keeps those results as
they were and matches the CCDF activity test they already mark as met. Medicaid's
community engagement test reads a second hours variable from 2027, so they set
that too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vercel's runtime installs public packages into /tmp when an instance starts. An
install that stops partway leaves its files behind, and on the 5 November windows
every later attempt on that instance failed with "No space left on device".

Drop plotly, tables, hf-xet and jedi from the install, none of which a household
calculation imports, and give policyengine-us a URL source so it stays in the
zip. The install now occupies 239 MiB rather than 390 MiB and a complete one fits
on top of a stopped one, which a new test enforces. Raise the calculation routes
to 120 seconds, since loading the engine takes about 40 on a cold instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
importlib.metadata raises TypeError on path=None rather than falling back to
sys.path, so the Linux-only test failed in CI. Mac runs skip that test, which
hid it. Also note in the README that a bump moves the wheel URL too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
policyengine-us added Maryland's county income tax to
household_state_tax_before_refundable_credits (changelog 1.756.0), so the
chart's "State taxes" number rose by up to $3,424 at $100,000 of earnings in
Maryland. The form doesn't ask for a county, and the engine falls back to
Allegany County's 3.03% rate. Rename the line "State and local taxes" and state
the assumption in the README's scope notes, along with what the wider-grid
attribution found about the TANF enrollment flag and Florida's disregard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main now carries #40, whose files match this branch's base, and #46, which
removes the cold-start install on main's engine. This branch's engine takes
the function past Vercel's 225 MiB bundle again, so the port keeps its
install-fits-twice test and README section, adding #46's 4 KiB block wording,
its note that main requires no checks, the size walk's sanity floor and the
CI summary line. The pyproject comment now names policyengine-us as the
package that brings in tables, as uv.lock shows. The cold-start changelog
entry becomes a change from main rather than a fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis changed the base branch from claude/blissful-zhukovsky-0d720c to main November 6, 2026 00:58
GitHub skipped the pull_request run for 07e66b8 because the PR still
targeted #40's branch when it arrived, and retargeting to main starts no run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 2 commits November 8, 2026 14:53
Conflicts:
- cliff_watch/calculator.py keeps the engine bridge's import beside #47's
  zip_county import.
- cliff_watch/variable_graph.py lists is_tanf_enrolled and slcsp_rating_area.
  This branch already keeps ssi in REVIEWED_TOTAL_INPUTS, so main's duplicate
  entry goes.

#47's engine test built its direct Simulation through
calculator._load_simulation, which this branch removed. It now imports
Simulation from policyengine_us, as the other engine tests do, and its 27
tests pass on policyengine-us 2.2.1.

The README's Maryland note now follows the county the API resolves from the
ZIP. Regenerating the variable-graph snapshot on 2.2.1 reproduces the merged
file, which adds #47's zip_code, slcsp_rating_area and
takes_up_housing_assistance_if_eligible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The port dropped `import sys` from cliff_watch/calculator.py, so
`python -m cliff_watch.calculator -` raised NameError when it read a payload
from stdin. tests/test_cli.py reads a payload from stdin and from a file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PolicyEngine/policyengine.py#739 merged on 9 November, and 6.17.1 on PyPI
contains it. Its `us` extra still pins policyengine-us 2.2.1,
policyengine-core 3.33.3 and spm-calculator 1.0.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The git pin kept policyengine in the function's zip, and the registry pin
sent it to the cold-start install, so test_url_sourced_packages_stay_in_the_zip
failed. The PyPI wheel URL keeps it in the zip, as policyengine-us's does.

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

This branch was successfully deployed

1 active deployment
Preview — f0c26646 Deployed Nov 11, 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