Repository navigation
Conversation
Add scripts/generate_uprating_table.py, which installs the pinned policyengine-us release, checks its files against the pinned commit, builds the tax-benefit system and writes one row per parameter file whose values grow and one per variable whose uprating is set, defaults included. Pin 2.116.0 (44f9211) and regenerate the file list. Work in progress: rows for the parameters policyengine-us grows by formula in code come next. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Example and Hypothesis property tests for owning_file, the spec helpers, category_for, the leaf-value readers and render_table, plus structural checks on public/data/uprating_analysis.csv. They load the script by path and need no policyengine-us. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add src/utils/upratingTable.js, which groups the generator's categories into index families and totals them, and a hook that loads the CSV. The forecasting section's counts and shares and the explorer's categories now come from public/data/uprating_analysis.csv, and the explorer links each formula-grown row to its formula. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vitest checks that the cards partition the table, that their counts and shares match a count made apart from the summary (on the committed table and on 300 seeded generated tables), that each curated example sits in its card, and that formula-grown rows link to their formulas' module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/generate_uprating_table.py now records which step of set_all_uprating_parameters writes each value. The table gains 23 files that formulas in parameters/uprating_extensions.py grow (Medicaid long-term care limits, NYC tax elimination thresholds, SSA wage-indexed amounts, Louisiana and Oregon amounts, the Washington millionaires tax deduction), and 6 rows whose metadata uprating a formula overrides now name that formula. 932 rows: 390 parameter files and 542 variables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Microsimulation extends its default dataset with the series that data/economic_assumptions.py overrides some columns with, then stores aggregates on their pre-response inputs and Social Security components on their reported twins. The generator now fails if a column it stores on a table row grows by another series than the row shows, and reports the columns that grow only there. At 2.116.0, 11 columns agree with their rows and 23 (computed variables such as rent and person weights) get no row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The card descriptions now name what each index grows in 2.116.0, including the formula-grown Medicaid long-term care limits, SSA wage-indexed amounts and veterans benefits, with examples drawn from those rows. The section and explorer copy use active verbs and name the actors (the IRS, the Social Security Administration, lawmakers), and headings and labels use sentence case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In next dev with Turbopack, the forecasting intro rendered "542 input variablesover time": the compiled text after the bold count lost its leading space when it held '. A plain apostrophe keeps the space, and the page shows the same character. The explorer read "Showing 1 items (1 parameters, 0 variables)" after a search that found one path. counted() moves to upratingTable.js, and both components use it; a test covers the singular and the plural. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Nov 10, 2026
On #54's branch, useUpratingTable fetches withBasePath(UPRATING_TABLE_PATH), a constant that upratingTable.js defines. The fetch check counted only a path written in the call, so it failed on a tree that merges #54, though the fetch still asks for a file public/ serves. The check now also accepts a fetch that names a constant, and looks up the value site code gives that constant. It fails when no site code defines the name, or when site code gives it more than one value. A unit test checks fetchedFile with a written path, a constant, a constant with two values and an undefined name. On a tree that merges #54, six breaks fail the check: a missing file, a constant with two values, a remote address in a constant, an undefined name, a template path and a fetch without the base path. Renaming the constant passes, and so does defining it twice with one value. The header-and-footer test and the BibTeX download test now get the 120-second limit the page tests have. Under load the header sweep took 6.5 seconds and failed Vitest's default 5-second limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Give a parameter file a row only when the build sets a value after the file's last date that differs from the one in force then. The two Romney files that hold only 0 and home_equity/limit.yaml drop out. - Give CMS's Medicare spending per enrollee a row, since three variables' formulas read it, and list the three CBO series that no value grows by and no variable names. - Write the lines of each formula's call, with the comment above it, to src/data/upratingFormulaLines.json, and link each formula row to them at the pinned commit. - Fetch the CSV once on /research and hand it to the explorer. - Describe the CPI-U, CPI-W and health cards, the explorer's intro, callout and How card from 2.116.0, and count parameter files. - Test the recorder's stop paths, call_spans and formula_links, and check the cards' partition with fast-check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 of 10 tasks
policyengine-us 2.116.0 extends three CMS health spending series (moop_per_capita, esi_premium_per_enrollee and direct_purchase_premium_per_enrollee) on a path that glides from their 2033-2034 growth rate toward the Medicare Trustees' long-range rates (parameters/uprating_extensions.py lines 1300-1340), so "own trend" misdescribed them. The docstring, two comments and the printed report now say only that policyengine-us extends the series, and the direct-series comment says what the row shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Nov 10, 2026
#54 adds a comment that uses the word fetch, and the check counted that word as a request with no served fetch to match it. The check now blanks every comment that espree finds before it counts. espree, the parser ESLint already runs on this code, leaves a URL inside a string whole. A request word in a string or in page copy still counts, and a file espree can't parse, such as a TypeScript file, keeps its comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR builds on #52 and targets its branch,
fix-broken-links. After #52 merges intomain, I'll rebase this branch ontomainand point the PR there.What changed
scripts/generate_uprating_table.pywritespublic/data/uprating_analysis.csvfrom the tax-benefit system that policyengine-us 2.116.0 builds (commit 44f9211, whichsrc/data/policyengineUsSnapshot.jsonpins). It installs the release with uv, resolving each dependency as PyPI served it a minute after the release's last upload, so a rerun at the same pin writes the same files. It then checks every installed file underparameters/andvariables/against the pinned commit, since each row links to its file there and each formula link to its lines.The script writes a row for a parameter file when the build grows at least one leaf parameter in it. The build grows a leaf when it sets a value after the last date the file sets, and that value differs from the one in force on that date. policyengine-core grows 8,512 leaf parameters by the series their metadata names, and policyengine-us grows 66 in 28 files with formulas in
parameters/uprating_extensions.py. The script writes each of those 28 files' uprating as<index> via <function>, and writes the lines of each formula's call, with the comment above it, tosrc/data/upratingFormulaLines.json.policyengine-us extends 28 index series, such as CPI-U, past their last projection. Of those, 24 grow other values and get no row. Three variables' formulas read CMS's projection of Medicare spending per enrollee directly (
medicare_cost,medicare_gross_costandqmb_cost_sharing), so that series gets a row:calibration.gov.hhs.medicare.per_capita_cost via extend_parameter_values. No value grows by the other three, CBO's projections of above-the-line deductions, IRS other income and taxable Social Security, and no variable names them. The script lists these three and the Medicare series, and stops on any other extended series that no value grows by.A variable gets a row when the built system sets its
uprating. Of the 542, 81 grow by the series their class names. policyengine-us grows the 382 that name none with CBO's adjusted gross income per person, and the 79 that name a national total with that total per person.The script stops and names the files involved when it finds:
uprating_extensions.py;policyengine_us/variables;To move the pin, edit the snapshot JSON and run:
uv run scripts/generate_uprating_table.py GITHUB_TOKEN=$(gh auth token) bun scripts/snapshot-policyengine-us-files.mjsThe second command rewrites
tests/fixtures/policyengine-us-files.txt, the file list that #52's link tests check every row against.uv run scripts/generate_uprating_table.py --checkexits 1 when the CSV or the line ranges differ from what the pinned release builds. CI doesn't run it, because it installs policyengine-us and builds the tax-benefit system.On /research
StochasticForecastingcounts the parameter files, the variables and each card's rows and share from the CSV withsummarizeUprating(src/utils/upratingTable.js), in place of hard-coded numbers.UPRATING_CARDSgroups the generator's 23 categories into seven cards by index family. A category that no card claims falls to an "Other indexes" card, which lists it by name, so a later release's new categories still show.UpratingVieweras itstableprop, so opening the explorer fetches nothing more. On its own, the viewer fetches the table itself.UpratingViewertakes its categories from the table, links each row to its file at the pinned commit, and links each formula row to its lines ofuprating_extensions.py, such as#L1205-L1212for the payroll tax cap.Table changes
The regenerated table adds 638 rows: 104 parameter files and 534 variables. Of those, 80 files and 315 variables sit at paths that 1.413.0 didn't have. The table on main had no row for the other 24 files and 219 variables, and 130 of those variables grow with CBO's adjusted gross income per person.
Of the 292 rows in both tables, 49 show a different uprating:
gov.irs.deductions.standard.amountreads{'parameter': 'gov.irs.uprating', 'rounding': {'type': 'downwards', 'interval': 50}}where main readgov.irs.uprating.uprating_extensions.py: the Social Security payroll tax cap, the blind and non-blind substantial gainful activity amounts, the dependent standard deduction, Louisiana's standard deduction and the start of Oregon's CTC reduction.gov.hhs.fpg_uprating, and state median income follows CBO's adjusted gross income per person from 2027.25 rows drop out:
gov.contrib.biden.budget_2025.capital_gains.income_threshold,gov.irs.income.exemption.phase_out.start,gov.states.co.tax.income.subtractions.collegeinvest_contribution.max_amountupratingon a parent with a filing-status breakdown, and the built system uprates none of its values. Two say in a comment that the parent uprating stays inactive pending PolicyEngine/policyengine-core#537.gov.contrib.congress.romney.family_security_act_2024.pregnant_mothers_credit.income_phase_in_end,gov.contrib.congress.romney.family_security_act_2_0.ctc.phase_in.income_phase_in_endgov.irs.credits.retirement_saving.rate.joint, Minnesota'ssocial_securitysubtractionalternative_amountandincome_amount,gov.usda.snap.asset_test.limitgov.irs.deductions.itemized.reduction.agi_thresholdspm_unit_broadband_subsidy_reported,spm_unit_capped_housing_subsidy_reported,spm_unit_energy_subsidy_reported,spm_unit_state_tax_reported,tanf_reportedsocial_security_retirement,_disability,_survivors,_dependents_reportedinputs grow with the IRS's Social Security total per person and have rows.person_weight,tax_unit_weight,spm_unit_weight,rent,spm_unit_capped_work_childcare_expenses,spm_unit_spm_thresholdDataset columns
Microsimulationgrows the columns of its default dataset by the series thatdata/economic_assumptions.pyassigns them, and by each column's own uprating otherwise. The script checks the 11 assigned columns that have rows against their rows' series and stops on any difference. The module also assigns series to 23 columns whose variables the built system computes with a formula or a sum and gives no uprating, so they get no row. None of the 23 appears among the 377 columns of the default dataset,populace_us_2024.h5:person_weight,tax_unit_weight,spm_unit_weight;rent;social_security,employment_income_last_year,partnership_s_corp_income,taxable_pension_income,total_self_employment_income;american_opportunity_credit,cdcc_relevant_expenses,energy_efficient_home_improvement_credit,foreign_earned_income_exclusion,foreign_tax_credit,interest_deduction,misc_deduction,pre_tax_contributions,savers_credit,self_employed_health_insurance_ald,self_employed_pension_contribution_ald,state_and_local_sales_or_income_tax,tax_exempt_pension_income,taxable_unemployment_compensation.Invariants
The generator's helpers hold these over Hypothesis-generated inputs (
analysis/tests/test_uprating_table.py, which CI runs):.or[, or to no file when none does.projection_differsandchanges_afterreport a change when, and only when, a day-by-day reading finds one.Example tests in the same file cover the rest.
call_spansmaps each statement in the entry function to its lines and the comment above it, andformula_linksgives each formula row its one call and stops on a row with none or several. The recorder credits each value to the call that set it. The growth check stops on a step it can't account for, a leaf that both metadata and a formula grow, a leaf that outruns what it held, and an uprating added after uprating.check_release_matches_commitstops on any installed file that differs from the commit, and--checkfails when either output differs from what the release builds, and writes neither.The same file checks the committed files for canonical order, one row per file or variable and a named category on every row. It also checks that formula rows match the generator's formula steps, and that every formula row has a line range at the pinned commit. The table must hold a row for each extended series that a variable's formula reads, and none for an unread series.
On the site, Vitest checks that:
summarizeUprating;Checks
I ran these checks at 2590555. The next commit, 31d3a47, changes only the generator's docstring, two comments and three lines of the report it prints, and ruff passes on it.
--checkin the pinned environment: both files match policyengine-us 2.116.0, and all 15,206 installed files underparameters/andvariables/match the commit.bun run lint -- --max-warnings=0passes, andbunx vitest run --maxWorkers=4passes 69 tests in 14 files.pytest analysis/testspasses 255 tests on Python 3.11 and skips the 13 that needpolicyengine_usormatplotlib, which CI doesn't install either. ruff passes both Python files.tests/e2e/images.spec.jspasses its 3 tests againstnext devat the default base path. A local Playwright config points it at the cached Chrome for Testing build.NEXT_PUBLIC_BASE_PATH=/ai-inequality bun run buildexits 0. Innext devand in the static export, /research shows 388 parameter files, 542 input variables and seven cards that sum to 930, and the export fetches the CSV once with the explorer open. The payroll tax cap row links tocap.yamland touprating_extensions.py#L1205-L1212at 44f9211, and both links return 200.axiom: n/a: site data and UI change
🤖 Generated with Claude Code