Skip to content

Update policyengine-us to 2.154.3 - #100

Merged
MaxGhenis merged 7 commits into
mainfrom
bump-policyengine-us
Nov 29, 2026
Merged

MaxGhenis merged 7 commits into
mainfrom
bump-policyengine-us

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

GiveCalc's API moves from policyengine-us 2.49.2 (October 16) to 2.154.3 (November 28). 2.154.3 requires policyengine-core 3.37.2 or later, and uv.lock resolves 3.38.0, up from 3.33.4. uv.lock and the Modal image pins move together (tests/test_modal_pins.py). The image now also pins spm-calculator 1.1.0, the version uv.lock resolves (2.154.3 requires 1.1.x). GiveCalc's own code doesn't call it, but policyengine-us loads it, with its bundled SPM forecast, whenever it builds its tax-benefit system, which importing policyengine-us does. policyengine-uk stays at 2.134.6; a UK bump gets its own PR.

The new version needs five changes in GiveCalc:

  • Social Security inputs. Since 2.72.0 (October 27) the four benefit components (social_security_retirement, _disability, _survivors, _dependents) are formulas, so at 2.154.3 the API refused them with a 422. When a household loads, policyengine-us now moves a value sent for one onto its _reported input, which the formula reads. Every benefit lever defaults to one, so the component still equals the value sent. The API accepts the four names again. For six households, taxable benefits, AGI, income tax, state tax and net income match 2.49.2 to the cent, and they match 26 U.S.C. 86 (for example, $40,000 of wages plus a $30,000 benefit gives $22,350 taxable). The API refuses three kinds of request it would otherwise mishandle:

    • a component together with its _reported twin, which would silently zero the second person's benefit;
    • a negative benefit, on a component or its twin, which policyengine-us would turn into a 500;
    • a _source other than reported on any component. 2.72.0 added these inputs (social_security_retirement_source and the like), and their default, reported, takes the amount sent. For every other source, policyengine-us raises NotImplementedError on a disability or dependents benefit and ValueError on a retirement or survivors benefit, which the API answered with a 500. Three of those pairs can instead run policyengine-us's benefit calculator when ss_calculator_source matches (supplied_aime or supplied_pia for retirement, supplied_ratio_survivor for survivors), but the calculator raised in all seven partial records tried; a complete record wasn't tried. These inputs don't exist at 2.49.2, so this refuses nothing 2.49.2 accepted, and sending reported gives the same answer as sending nothing.

    Nothing else on the route from these inputs to the benefit can raise at the pinned version. Each parameter that switches on a benefit lever (COLA changes and the COLA means test, the across-the-board and payable-share cuts, PIA reforms including S.770) has a single neutral value at 2.154.3 in every year the API accepts. A sweep of 412 single-person California cases for 2026, with a few values each for the 96 accepted inputs whose names contain social_security or start with ss_, found only the source values raising, and every case that computed before this change gives the same figures after it.

    The API doesn't turn model errors into 422s in general: ValueError also comes from numpy and pandas in GiveCalc's own calculations, so a blanket rule would report a GiveCalc bug as bad input. Two inputs still get a 500, as they do at 2.49.2, so this PR leaves them alone: tax_unit_role_input set for some people but not all (or not naming exactly one head and at most one spouse), and state_name PR (Invalid value(s) ['nan'] for enum SNAPRegion). A sweep of the 153 accepted enum inputs outside Social Security on single California adults for 2026 found only these two; it didn't cover number or true/false inputs, other households or other years.

    GiveCalc's own form and share links send no Social Security field. The vendored wizard sends retirement and disability, and its validate() passes a negative amount for either, which the API refuses with a 422. Its current main has the same gap (read, not run): PolicyEngine/policyengine-household-wizard#17.

  • Inputs policyengine-us replaced get a 422 that says what to send instead. Besides the four Social Security components, the API accepted 22 inputs at 2.49.2 (and from 2024 to 2028) that 2.154.3 replaces:

    • Sixteen state additions totals now add a new input: md_total_additions and the <state>_additions of AZ, DE, ID, KS, KY, ME, NC, NE, NM, NY, OK, OR, UT, VA and WV each add <state>_other_additions (policyengine-us#10199, policyengine-us#10302). North Carolina's also adds the 2020-only charitable deduction for non-itemizers, which is zero in the years the API accepts.
    • Five inputs were removed in favour of new ones: il_schedule_m_additions, il_schedule_m_subtractions and oh_other_add_backs (policyengine-us#10302), and in_other_add_backs and in_other_deductions (policyengine-us#10354), replaced by il_other_additions, il_other_subtractions, oh_other_additions, in_other_additions and in_other_subtractions. policyengine-us's changelog calls both changes breaking for callers that send the old inputs.
    • Ohio's oh_uniformed_services_retirement_income_deduction is now a formula over military retired pay (policyengine-us#10182).

    policyengine-us routes none of these old names to a new input, as it does for Social Security, so the API keeps refusing them, and the 422 now names the replacement: for example, tax_units.tax_unit: ny_additions is computed by policyengine-us; send ny_other_additions instead. Accepting an old total as sent would override its formula. GiveCalc could move an old value onto its replacement itself, but eight replacements (the Maine, North Carolina, New Mexico, West Virginia, Indiana and Ohio additions, and the Illinois and Indiana subtractions) are documented as leaving out lines the model now computes, such as claim-of-right repayments in Illinois and Indiana (policyengine-us#10195, policyengine-us#10196). A value moved unchanged could count such a line twice (inferred), and only the caller knows what its value holds. For a single filer with $100,000 of wages, or a couple with $150,000 and two children, in 2025 or 2026, $5,000 on each of the 21 renamed replacements at 2.154.3 changes state income tax by the same amount as $5,000 on the old name did at 2.49.2, and leaves federal AGI and income tax unchanged.

    Ohio's case isn't a rename: the 422 tells the caller to send the retired pay as military_retirement_pay (or military_retirement_pay_survivors) rather than as pension income. The model then computes the deduction and counts the pay in federal gross income. For the single filer, $30,000 of pay at 2.154.3 moves AGI and federal income tax as $30,000 of public pension income plus the deduction did at 2.49.2; Ohio tax comes out $200 higher, because at 2.49.2 the pension input also drew Ohio's pension-based retirement income credit. military_retirement_pay was an input at 2.49.2 too, but it stayed out of federal gross income until policyengine-us#10182, so a caller who sends the same pay as both pension income and military pay now counts it twice. The API accepts both inputs at both versions, so it can't flag that.

    GiveCalc's form, share links and vendored wizard send none of the 22 and no military pay. GitHub code search for the API's host (givecalc-fastapi-app, policyengine--givecalc) finds no code outside this repository; it searches only indexed default branches of repositories this account can read. The README now says how the API answers a replaced input.

  • The premium tax credit stays out of net tax and net income. Since 2.118.7, policyengine-us has counted premium_tax_credit_in_force as a refundable credit in household_tax and household_net_income. By default the model enrolls every eligible tax unit in Marketplace coverage (takes_up_aca_if_eligible is true) and gives no one an offer of employer coverage. GiveCalc asks about neither, so givecalc/calculations/tax.py takes the credit back out. It adds the credit to net tax and subtracts it from net income, which keeps both on 2.49.2's footing. This is a product choice. It moves the level of every figure built on net tax or net income, but not the difference a gift makes. The examples below are API requests in the income/state_code form, which make adults 30 and children 10 and put all wages on the first adult.

    • Net tax and net income. The results show four figures that move: "Baseline net tax (no donation)", "Net tax at" the gift, "Baseline net income" and "Net income after donation". The net tax curve moves too. For a married Texas couple with two children and $100,000 of wages, the API gives a baseline net tax of $10,890 and net income of $89,110. If the credit counted, they would be −$2,457 and $102,457, a credit of $13,347.
    • Percentage targets. With is_percentage, /api/target-donation sets the target as that percentage of baseline net income (calculate_target_donation in givecalc/calculations/donations.py). Counting the credit in income would therefore raise the target. To cut the same couple's net income by 10%, the API asks for a $9,151 gift. With the credit it would ask for $10,486. A single 30-year-old Nevadan with $50,000 of wages, who would get a $2,053 credit, needs a $4,356 gift instead of $4,561. A dollar target asks for the same gift either way, but the percentage reported with it moves. Cutting the couple's net income by $5,000 takes a $5,240 gift. The $5,000 cut is 5.61% of their net income, or 4.88% with the credit. No frontend code calls /api/target-donation, and the app's pledge mode takes its percentage of the income entered on the form, so neither changes.
    • Savings don't change. The saving on a $5,000 gift is $240 for the couple and $120 for the Nevadan, with the credit or without it. The credit depends on modified AGI, and in every year GiveCalc accepts (2024 on) policyengine-us takes the charitable deduction after AGI. A gift therefore shouldn't change the credit for any household (inferred from the code).

    Reverting the choice takes more than deleting _premium_tax_credit. Its result enters in three places: net tax and net income in calculate_donation_metrics, and net tax in calculate_donation_effects. Those three uses come out too. The savings oracle in tests/test_savings.py makes the same exclusion and needs the same change. test_net_tax_leaves_out_the_premium_tax_credit goes, and someone commits the faqNumbers.json that the FAQ numbers job records. With only tax.py reverted, these tests fail:

    • four households in test_savings_matches_calculate_to_the_cent;
    • the california2025 case in the FAQ test;
    • both cases of test_net_tax_leaves_out_the_premium_tax_credit.

    Apart from test_savings_invariants, the rest of test_savings.py, test_savings_wizard.py, test_donations.py, test_household_payload.py and test_faq_numbers.py passes. So do test_tax.py, test_realistic_scenarios.py, test_multi_person_household.py, test_giving_season.py, test_input_wiring.py, test_simulation.py, test_situation.py, test_axes.py, test_year_bounds.py and test_debug.py. That check didn't run test_invariants.py, the rest of test_model_contract.py, the other test files or the FAQ numbers job.

  • The monotonicity property test allows one rise in Colorado and Minnesota, and only where the itemization choice switches. policyengine-us makes the itemization choice without counting the state subtraction for non-itemizers, so net tax can jump when a gift tips the choice: $388 for the test's Colorado household (from a $9,319 to a $9,320 gift) and $136 for its Minnesota one (from $6,187 to $6,188). When a curve rises, the test simulates the same household over the API's donation axis and reads tax_unit_itemizes (Colorado) or mn_itemizing (Minnesota) at each curve point. It fails on a second rise, on a rise between two points where that choice doesn't switch to itemizing, on a rise more than $1 above the state income tax increase across those points, and on a rise of more than $1 in the other four sampled states (California, New York, Texas and Vermont); every check in the test allows $1 for float noise. An unrelated rise inside the switch interval still passes if the total stays under that state income tax increase. test_known_itemization_cliffs checks that each fixture's rise spans its gift and comes within 5% of the size the curve's grid gives ($369.70 and $54.45). 2.49.2 has the same Colorado cliff, and the Minnesota household's curve rises only at 2.154.3. Filed as policyengine-us#11282. test_known_itemization_cliffs will fail once upstream fixes it, so the allowance can then go.

  • Test figures recorded at 2.49.2 are re-recorded, with the reason each one moved (below).

There's also a new test, tests/test_model_contract.py. It fails if a future release turns a wizard input into a formula, moves a total that GiveCalc accepts onto another input, or makes GiveCalc's net tax or net income depend on whether a household gets the premium tax credit. For the credit, it builds a 40-year-old Nevadan with $50,000 of wages. As a Marketplace enrollee, this earner gets a $2,939 credit from the model. The test compares two sets of GiveCalc figures for this earner with those for the same earner without the credit, either declining Marketplace coverage or with an employer offer of coverage that bars the credit. The first set is net tax and net income at gifts of $0 and $5,000. The second is net tax at each point of the donation curve. The test doesn't repeat GiveCalc's arithmetic. It fails if GiveCalc stops taking the credit out. It also fails if policyengine-us stops counting the credit in household tax or net income while GiveCalc still takes it out. The file also fails if an input the API's 422 names as a replacement stops being an input on the same entity, if a Social Security source stops defaulting to reported, if another source stops raising its source-selection error on the benefit itself (so the refusal can be revisited), or if retired pay sent as military_retirement_pay or military_retirement_pay_survivors stops giving an Ohio head the uniformed services deduction in full. A new CI job, FAQ numbers, reruns bun run faq-numbers against the API at the locked versions and checks the result against the committed faqNumbers.json. A model bump can then refresh the FAQ without a local environment.

Why

At 2.49.2, GiveCalc gives the wrong 2026 state saving in Hawaii, Minnesota and Montana, and for $1 million filers in Maryland and New Mexico. Later releases fixed these. A household sweep ran four households with and without a gift in all 50 states and DC, for 2025 and 2026, and compared the model's state income tax saving with the saving the law gives, from a law audit of statutes and revenue department instructions that AI research agents carried out and a tax professional hasn't reviewed. That comparison covers 383 cases in 40 states and DC; the nine states without a wage income tax and West Virginia aren't among them. 2.49.2 matched the law within $1 in 343 of the 383 cases and 2.154.1 in 353. No state saving that 2.49.2 got right is wrong at 2.154.1. The federal saving changed in other ways (below), one of them a regression.

The 10 cases that 2.154.1 fixes (state income tax saving on the gift):

State Household, 2026 Gift Law 2.49.2 2.154.1
HI Single, $75,000, standard deduction $1,000 $76.00 $0.00 $76.00
HI Joint, $150,000, standard deduction $2,000 $152.00 $0.00 $152.00
MN Single, $75,000, standard deduction $1,000 $0.00 $4.25 $0.00
MN Joint, $150,000, standard deduction $2,000 $0.00 $25.50 $0.00
MN Single, $200,000, itemizes $10,000 $628.00 $706.50 $628.00
MT Single, $75,000, standard deduction $1,000 $56.50 $0.00 $56.50
MT Joint, $150,000, standard deduction $2,000 $113.00 $0.00 $113.00
MT Single, $1 million $100,000 → $110,000 $534.46 $565.00 $534.46
MD Single, $1 million $100,000 → $110,000 $591.22 $625.00 $591.22
NM Single, $1 million $100,000 → $110,000 $558.11 $590.00 $558.10

The sweep ran at 2.154.1. Between 2.154.1 and 2.154.3, policyengine-us changed how some formulas record parameter reads (no values change), a pre-2024 New York child credit read, and historical SNAP work-requirement exemptions. None of these touch the charitable deduction or a 2025 or 2026 income tax.

Still wrong at 2.154.x

  • State savings. Thirty of the 383 cases, in 13 states and DC, still differ from the law at 2.154.1: Oregon 6, Massachusetts 4, Arizona 3, Wisconsin 3, Arkansas 2, Colorado 2, Idaho 2, Virginia 2, and one each in Delaware, DC, Kentucky, Mississippi, Nebraska and Oklahoma. Four of them are 2025 cases, three in Oregon and one in Virginia. 2.49.2 misses the same 30, and the bump moves only one of their estimates, by 3 cents: Virginia's $1 million filer in 2026 goes from $551.64 to $551.67, against $565.80 in law. Each was checked against policyengine-us main (fa8c98f) and either filed there or matched to an open PR:
  • Itemization cliffs in Colorado and Minnesota (policyengine-us#11282). Where a gift tips the itemization choice, GiveCalc can show a saving of a few cents, or a negative marginal rate, while the cheaper choice would save hundreds. A sweep at 2.154.3 of 216 childless households in six states (CA, CO, MN, NY, TX and VT, 36 each) found cliffs in Colorado (9 households, up to $1,149) and Minnesota (10, up to $614), and none in the other four. The sweep didn't run at 2.49.2. The property test's Colorado household has the same $388 cliff at both versions, and a second Minnesota household has a cliff at both ($225 at 2.49.2, $217 at 2.154.3), so the mechanism predates the bump. The test's explicit Minnesota fixture (MN_CLIFF) differs: at 2.49.2 it itemizes for Minnesota at every gift sampled, and at 2.154.3 Minnesota's $10,000 cap on property taxes (law since 2019) and its 1% floor on gifts (from 2026), both correct and both added in policyengine-us#10872, bring its Minnesota itemized deductions down to the standard deduction, where the cliff sits. Whether the bump puts more Minnesota households near the cliff wasn't measured.
  • Local sales tax in 16 states, a regression (policyengine-us#11283). 2.49.2 estimated local sales tax as 20% of the state table amount. 2.154.x follows the IRS worksheet, which needs a locality rate, and it has no rate files for AL, AK, AZ, CA, CO, FL, HI, ID, IL, LA, MO, MS, NM, PA, SC and TX. In policyengine-us, a household in those states gets $0 of local sales tax unless it enters a combined or local rate. GiveCalc can't pass either: its input check refuses combined_sales_tax_rate and local_sales_tax_rate as computed by policyengine-us, so every GiveCalc household in those states gets $0. Under the worksheet, a Texan in a 2% locality deducts 32% of the state amount on top of it (2 ÷ 6.25), so for that Texan 2.49.2's 20% was closer than 2.154.x's $0.

Federal saving

The sweep makes 612 federal comparisons: each household's federal income tax saving on each gift, against no gift, in all 50 states and DC for 2025 and 2026. 2.49.2 and 2.154.1 agree within $0.50 in 584. The other 28 are the $1 million single filer's $100,000 and $110,000 gifts, in both years, in seven of the nine states without a wage income tax (FL, NV, SD, TN, TX, WA and WY). With no gift, that filer takes the standard deduction. A $100,000 gift makes them itemize, and the sales tax deduction then counts. The saving on the first $100,000 moves by between −$118.03 (Texas, 2025) and +$169.66 (Washington, 2026). The extra saving on the next $10,000 moves by between −$0.03 and +$0.04.

The sweep doesn't record the sales tax deduction, so a New Hampshire filer making the same gift, with no sales tax to deduct, serves as a control (inferred). In the sweep's run with section 68 switched off, the Texas filer's 2026 federal tax at the $100,000 gift sits $724.22 below New Hampshire's at 2.49.2 and $603.87 below at 2.154.1. At the 37% rate, that implies a sales tax deduction of $1,957 at 2.49.2 (about $1,631 of state sales tax plus the 20% local estimate) and $1,632 at 2.154.1 (the state amount alone, #11283). The saving falls in Florida and Texas, which have no locality rate files. It rises in Nevada, South Dakota, Tennessee, Washington and Wyoming, which have them; there, 2.154.x takes the local amount from the state's population-weighted rate instead of 20% of the state amount (inferred: these moves were not decomposed).

A second check ran GiveCalc's own calculation for two 2026 households in every state and DC, and compared the saving in net tax, measured as household_tax less household_benefits, so a change in any tax or benefit counts. That was GiveCalc's US net tax when the check ran (commit 787f714). GiveCalc now also adds back the premium tax credit. For these households the credit doesn't change with the gift, so the adjustment cancels in each saving and the table stands. One married couple has $100,000 of wages and gives $5,000. The other has $200,000 of wages, $20,000 of mortgage interest and $8,000 of property tax, and gives $10,000. Savings moved in 12 cases in 11 states:

State Household 2.49.2 2.154.3 Change Why
HI $100,000 couple $240.00 $384.00 +$144.00 Hawaii now adds the federal non-itemizer deduction to its standard deduction (Act 35), as in the table above
MT $100,000 couple $240.00 $334.00 +$94.00 Montana tax now falls with the gift, as in the table above (inferred)
MN $100,000 couple $376.00 $359.00 −$17.00 Minnesota's 1% floor on gifts, as in the table above (inferred from the arithmetic below)
MN $200,000 couple $2,415.20 $2,347.20 −$68.00 same (inferred from the arithmetic below)
TX $200,000 couple $1,430.47 $1,368.23 −$62.24 no local sales tax (#11283)
FL $200,000 couple $1,420.21 $1,359.67 −$60.54 no local sales tax (#11283) (inferred)
WA $200,000 couple $1,468.54 $1,559.56 +$91.02 local amount from the state's rate instead of the 20% estimate (inferred)
TN $200,000 couple $1,553.85 $1,607.45 +$53.60 same (inferred)
SD $200,000 couple $1,421.02 $1,462.70 +$41.68 same (inferred)
WY $200,000 couple $1,295.48 $1,322.61 +$27.13 same (inferred)
NV $200,000 couple $1,419.94 $1,420.81 +$0.87 same (inferred)
UT $200,000 couple $2,084.27 $2,086.09 +$1.82 not traced

Only the Texas and Hawaii rows were traced to a cause. The Texas pledge household below has the same income and deductions and moves by the same −$62.24 with a $20,000 gift: its sales tax deduction falls by $282.91 (the 20% local estimate, less a small rise in the state amount), and 22% of that is $62.24. Hawaii's $144 is Hawaii income tax: 2.154.3 adds the federal non-itemizer deduction to Hawaii's standard deduction. The Minnesota moves match the arithmetic of Minnesota's 1% floor on gifts from 2026 (policyengine-us#10872), where 2.49.2 applied the federal 0.5% floor (inferred: not decomposed). For the $100,000 couple, the floor rises by $500, the subtraction for non-itemizers takes half of that, and at Minnesota's 6.8% rate that is $17. For the $200,000 couple, the floor rises by $1,000, and at 6.8% that is $68. Washington, Tennessee, South Dakota, Wyoming and Nevada have locality rate files, and with only a state, as here, 2.154.x applies the state's population-weighted combined rate, where 2.49.2 added 20% of the state amount. That reason, like the Florida and Montana ones, comes from the method, not a decomposition. Utah has an income tax, so the rate-file reason may not fit its $1.82.

Test figures that moved

  • Pledge figures (tests/test_savings.py, pledge.test.ts, Results.test.tsx). For each of the review's 10% pledge households: this year's saving / every-year saving / bunched saving / gain.
    • CA: 353/692/1,037/345 → 348/682/1,025/343. California published its 2026 indexing (standard deduction $5,900, brackets), and 2.154.x uses it where 2.49.2 projected $5,835.
    • NY: 1,589/3,033/5,853/2,820 → 1,589/3,021/5,853/2,832. Next year's saving falls $12 because Rev. Proc. 2026-35 sets the 2027 standard deduction at $16,600, where 2.49.2 projected $16,550.
    • TX: 3,630/7,063/8,030/967 → 3,568/6,926/7,968/1,042. The local sales tax regression, plus the 2027 standard deduction.
    • MA: unchanged.
  • The wizard's 64- and 65-year-old Texan (test_savings_wizard.py): 2027 savings fall from $965.56/$461.56 to $900.94/$396.94, for the same two reasons as TX. The comment now says correctly that the gift makes the donor itemize at both ages.

FAQ figures

The FAQ quotes API answers from frontend/src/lib/faqNumbers.json. b299737 took the file from the FAQ numbers job's artifact at 2.154.3, so it names http://localhost:8000, the API the job starts. This head then changes the California 2025 household's four net tax and net income figures by $461.89 each, the premium tax credit it now leaves out, and the job compares the file's model versions and US and UK answers with the API's. The figures the FAQ quotes:

Figure 2.49.2 2.154.3
California, $75,000: saving on $1,000 and on $5,000, 2026; on $1,000, 2025 $220 / $220 / $0 unchanged
Texas, $1 million: extra saving on $110,000 vs $100,000 $3,499.97 $3,500.00
New York, $150,000: saving next year without bunching $1,444.14 $1,432.13
New York: gain from bunching two years' gifts $2,819.61 $2,831.62
UK higher-rate and basic-rate Gift Aid unchanged unchanged

The California household's tax without a gift moves −$36 in 2026 and −$75 in 2025, but its savings don't, and the FAQ doesn't quote the tax itself. The file's unquoted California case with an $8,000 gift now saves $388.00 instead of $393.18.

Speed and memory

  • Speed. In a local run on a loaded machine, a California single filer's point simulation (one simulation, about $60,000 of wages, 2026) took 1.6–1.7× as long at 2.154.3 as at 2.49.2, both in a plain process (median 0.56 s to 0.90 s) and in a forked worker (0.56 s to 0.89 s). Donation curves weren't timed side by side. modal_app.py sizes max_inputs=8 for eight headlines of two simulations each: four rounds on four workers, about 10 s at the 2.3 s per simulation it records. If every simulation slowed by the same ratio, that would take about 15–17 s (inferred). The request timeout is 300 s. The live API at 2.49.2, measured on November 29 at 00:10 UTC, answered eight /api/calculate requests sent at once in 14.3 s wall time (2.4 s for the first answer, 14.3 s for the last). Each of those requests runs three simulations (no gift, the gift and the donation curve), so the burst ran 24, eight of them curves. The check after the deploy repeats the same burst.
  • Memory. Measured locally on Apple silicon with one forkserver and one worker, 2.154.3 uses less memory than 2.49.2. The forkserver's resident memory at the fork point drops from 2,296 MiB to 1,323 MiB. The worker's private memory levels off at 465 MiB instead of 758 MiB, after 189 runs covering every state and the UK. The app's own process, after loading both models and before any simulation, is 55–139 MiB larger at 2.154.3 (1,210–1,292 MiB in three native arm64 readings, against 1,153–1,155 MiB in three at 2.49.2). Four workers at 2.154.3 haven't been measured: these local runs used one, and the live API still runs 2.49.2. memory=8192 is a request, not a limit. The 6.6–7.5 GiB measured on Modal at 2.49.2 was flat across 144 UK simulations, so neither version's figure covers four workers that have each seen all 51 states. A memory test that reaches that plateau will come as a follow-up PR, calibrated against a Modal reading taken after this deploy.

Deploying

A merge deploys the live API (deploy-modal.yml). After the deploy, I will run the same check I ran before (givecalc_live_check.py) and confirm:

  • /api/health reports simulation_workers: 4.

  • A single filer with $75,000 of wages giving $1,000 in 2026 gets the $220 federal saving plus the state saving in the table above:

    State Live at 2.49.2 (checked Nov 29) Expected at 2.154.3
    Hawaii $220.00 $296.00
    Minnesota $224.25 $220.00
    Montana $220.00 $276.50
  • The same burst of eight /api/calculate requests (24 simulations, eight of them donation curves), against the 14.3 s baseline.

  • Container memory on Modal.

Reverting this PR restores 2.49.2.

🤖 Generated with Claude Code

Moves the deployed model from policyengine-us 2.49.2 (2026-10-16) to
2.154.3 (2026-11-28), with policyengine-core 3.38.0, which 2.154.x
requires. uv.lock and the Modal image pins move together, as
tests/test_modal_pins.py requires.

Adds a CI job that reruns `bun run faq-numbers` against the API at the
locked versions and uploads the result, so a model bump can refresh
faqNumbers.json without a local environment.

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

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
givecalc Ready Ready Preview Nov 29, 2026 3:11am UTC

Request Review

MaxGhenis and others added 2 commits November 28, 2026 13:14
From the FAQ numbers job's artifact (run 46174340220), which ran
`bun run faq-numbers` against the API at the locked versions in CI.

Quoted figures that move: the Texas $1 million filer's saving on a
$100,000 gift falls from $27,978 to $27,864, as the sales tax deduction
the gift lets them itemize falls from $1,957 to $1,632 (the model's
sales tax); the extra $10,000 still saves $3,500. The New York bunching
comparison moves by $12 a year. The California savings do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The FAQ renders the gain from faqNumbers.json; the tests quote it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 (P2): spm-calculator is a policyengine-us import that Modal
resolved on its own; a fresh build could pick another patch release than
CI tested. The FAQ numbers job now also runs when the files that build its
requests change (frontend/src/lib, the vendored wizard, bun.lock), and
each health probe times out after 10 seconds. The FAQ test says where the
recorded answers come from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes from the first review of the bump:

- Accept the four Social Security components again. policyengine-us
  2.154 computes them, but routes a value sent for one to its
  _reported input, so the benefit still equals the value sent. Refuse
  a component sent with its _reported twin, which would zero another
  person's benefit, and a negative benefit, which the model raises on.
- Leave the premium tax credit out of net tax and net income, as
  before 2.154. The model assumes Marketplace enrollment and no
  employer offer, and GiveCalc asks about neither. Savings don't move.
- Let the monotonicity property allow one rise in Colorado and
  Minnesota, where the model's itemization choice ignores the state
  subtraction for non-itemizers (PolicyEngine/policyengine-us#11282),
  with explicit examples and a test that fails once that is fixed.
- Re-record the pledge, bunching and wizard figures at 2.154.3, with
  the reason each moved (California's 2026 indexing, the 2027 federal
  standard deduction, and Texas local sales tax at $0 without a rate
  file, PolicyEngine/policyengine-us#11283).
- Add tests/test_model_contract.py, which fails when a release changes
  what a wizard input or a moved total means.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes from the second review of the bump:

- Refuse a Social Security _source other than reported with a 422.
  policyengine-us 2.154 raises on every other source without benefit
  calculator inputs, which the API answered with a 500.
- Name the replacement in the 422 for the 22 inputs 2.49.2 accepted
  that later releases replaced (16 state additions totals, five
  removed inputs and Ohio's uniformed services deduction), and say so
  in the README.
- Allow a Colorado or Minnesota curve to rise only where the state's
  itemization choice switches, no more than the state tax increase
  there, and pin each known cliff's place and size.
- Test the premium tax credit exclusion against the same earner
  without the credit, so it fails whichever side changes.
- Correct comments: where the FAQ figures come from, and since when
  policyengine-us counts the premium tax credit in household tax.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes from the third review of the bump:

- test_other_social_security_sources_raise now calculates the benefit
  whose source is set and matches the source-selection error, so an
  unrelated model error can't pass it.
- The Ohio contract now calculates the uniformed services deduction for
  an Ohio head with retired pay sent as each of the two inputs the
  API's 422 names, and checks both are person inputs.
- The PointMetrics net-tax comment says the premium tax credit term is
  US only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review November 29, 2026 03:36
@MaxGhenis
MaxGhenis merged commit 87edfe4 into main Nov 29, 2026
7 checks passed
@MaxGhenis
MaxGhenis deleted the bump-policyengine-us branch November 29, 2026 03:36
@MaxGhenis

MaxGhenis commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Checked live after the deploy (Deploy to Modal run 46221122775, 2026-11-29 UTC):

  • /api/health: healthy, simulation_workers 4.
  • Every request in faqNumbers.json (seven US, two UK) gets the recorded answer from the live API to the cent, including the hand-edited California 2025 figures.
  • /api/savings, single filer, $75,000 wages, $1,000 gift, 2026: Hawaii $296.00, Minnesota $220.00, Montana $276.50, the 2.154.3 figures (2.49.2 gave $220.00, $224.25 and $220.00). The first run, a minute after the deploy finished, still got the 2.49.2 answers for Hawaii and Minnesota (inferred: containers from the old deployment were still serving). Two reruns a few minutes later matched.
  • Eight /api/calculate requests at once took 23.2 s and 24.2 s wall time, against 14.3 s at 2.49.2: about 1.65× slower, in line with the 1.6–1.7× slower simulations measured locally, and well inside the 300 s timeout.
  • 204 /api/calculate requests, four for every state and DC, eight at a time: no failures.
  • Container memory (cgroup memory.usage_in_bytes, one container): 4,879 MiB after the checks above, 5,449 MiB after 102 of the state requests and 5,498 MiB after all 204. Resident memory (VmRSS) is 1,376 MiB for the app process, 1,386 MiB for the forkserver and 1,307–1,313 MiB for each of the four workers. Resident memory counts pages processes share, so these don't add up to the container figure.
  • givecalc.org's FAQ now reads "$2,832 more in tax" (was $2,820).

MaxGhenis added a commit to PolicyEngine/policyengine-app-v2 that referenced this pull request Nov 30, 2026
policyengine-us 2.64.0 sets the local general sales tax amount to $0 in Texas when no rate is entered (it was 20% of the state table amount). GiveCalc picked that up with 2.154.3 on 2026-11-29 (PolicyEngine/givecalc#100), after the post went live; 2.156.4 gives the same figures. Correct the method sentence, which had credited 2.156.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis added a commit to PolicyEngine/policyengine-app-v2 that referenced this pull request Dec 1, 2026
* Update GiveCalc 2026 post figures for policyengine-us 2.156.4

GiveCalc moved to policyengine-us 2.156.4 on 2026-11-30 (PolicyEngine/givecalc#108). Rerunning the post's saved requests on the live API changed two totals: the $1 million earner ($27,978/$31,478 to $27,864/$31,364; the extra $10,000 still saves $3,500) and the two-year example ($2,314/$1,874 to $2,269/$1,829). The table's figures are unchanged. The post now says when we reran them.

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

* Say why the two totals moved: Texas local sales tax

policyengine-us 2.64.0 sets the local general sales tax amount to $0 in Texas when no rate is entered (it was 20% of the state table amount). GiveCalc picked that up with 2.154.3 on 2026-11-29 (PolicyEngine/givecalc#100), after the post went live; 2.156.4 gives the same figures. Correct the method sentence, which had credited 2.156.4.

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

* Describe the current method and record the update in a dated note

Per independent review: the method paragraph now says how GiveCalc counts sales tax for Texas itemizers; the publication history moves to an Update section in the site's correction-note form; the $1 million row links both the $100,000 and $110,000 calculations; the extra-$10,000 sentence gives the filer the verb.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview – givecalc — 41de5e70 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