Repository navigation
Show average savings per extra dollar over a forward window - #116
Conversation
/api/calculate's marginal_savings_rate was the donation sweep's central difference at the nearest grid point, which averages the rates on either side of a kink. A single filer giving $1,000 in 2026 sits on the 170(p) cap, so Texas showed 14.7% where the next dollar saves nothing, and Massachusetts 19.7% where it saves 5%. The rate now comes from a point run at the gift plus $100, in the same parallel batch as the $0 and gift runs: (net tax at the gift - net tax $100 above) / 100. Smaller steps turn float32 rounding into rate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
policyengine-us returns taxes as float32, whose spacing grows with the tax. Over a fixed $100 window, a $100 million earner's 35% read 32% and a $25 million earner's 37.7% read 39.0%, worse than the old sweep figure. The window is now $100, or 2,000 float32 spacings of the net tax when that is wider ($125 from $524,288 of net tax, $8,000 at $40 million). A wider window costs one more point run, alongside the sweep. The FAQ states the window from faqRules.json, which a test ties to the API. Comments in App.tsx, headlineFirst.ts and CLAUDE.md now say where the card's rate comes from. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 1 of the review (a Codex cloud review at 83f8269) found the card promised the next $1 while showing the average over a $100 window: a Texan giving $925 saves 22% on the next $75 and 0% after the cap, so the card read 16.5%. The card now reads "Average savings per extra dollar", "Change in net taxes if you give a little more", and the FAQ says the figure is the reduction in net taxes per dollar over the next $100, how the range widens, and what a negative rate means. Also from the review: the FAQ threshold uses the magnitude of net tax (a -550,000 check), a comment notes that intermediate rounding can still move the displayed figure, and the float32 spacing example is corrected. A test pins the $925 blend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An in-session check of #113 at bfcda89 confirmed three P2 findings: - The card's description, "Change in net taxes if you give a little more", sat under a figure that is positive when net taxes fall. It now reads "Reduction in net taxes if you give a little more", the FAQ's convention, and a test pins it. - After the site's /api/savings call the gift + $100 run is /api/calculate's only new point run, and the wizard sweep waited for it. calculate_donation now starts the three point runs, waits for $0 and the gift, starts the sweep, then waits for the rate's run. A test with fake runs on a thread pool fails at bfcda89 and passes here. point_metrics_many is now start_points plus point_results. - A step in net tax inside the window counts in full. A comment and a unit test say so, and point to PolicyEngine/policyengine-us#11282, where a gift that tips an itemization election makes such a step. Also pins the Giving Tuesday posts' joint link (TX, $150,000, $2,000: 0%) and renames the parametrized test, which covers a blend case too. Tests: test_next_dollar_rate 18 passed; test_simulation_cache, test_workers and test_faq_numbers 41 passed; test_household_payload -k agree_at_the_endpoint 5 passed; vitest 274 passed; tsc clean; lint 0 errors (1 existing warning); black and isort clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Agent review for Max, written by Codex and posted by Antigravity for Max Ghenis (exact reviewed head VERDICT: REQUEST_CHANGES
The other two prior findings are closed. The subtitle describes a positive rate as a reduction in net taxes at Cap arithmeticFor 2026, § 170(p) caps the federal deduction for qualifying cash gifts by nonitemizers at $1,000 single and $2,000 joint. At
At a $925 Texas gift, the literal next dollar saves 22 cents and the card averages VerificationReviewed the combined diff from main, including all frontend changes. Frontend tests, lint, and |
|
Addressed the P1 and two P2 findings at
Verified locally in |
…Q artifact wording
|
Updated
|
|
Sol r3 independent review (
|
|
Agent-written for Max, by Antigravity for Max Ghenis. Merge audit for
|
|
Post-merge production verification (
|
Replaces the nearest-grid central difference on the US results card with the average reduction in net taxes per extra dollar over a forward window above the gift (includes and supersedes #113).
What changes
api/main.py,api/schemas.py,api/simulations.py):/api/calculatecomputes(net tax at gift − net tax at gift + window) / windowusingNEXT_DOLLARS($100) or 2,000 float32 spacings of|net_tax|when wider, shares the point cache with/api/savings, and returnsmarginal_savings_windowinCalculateResponse.api/main.py,api/simulations.py): Splitspoint_metrics_manyintostart_pointsandpoint_resultsso the wizard sweep launches immediately after the baseline resolves rather than waiting for the extra-gift point run.frontend/src/components/Results.tsx,frontend/src/lib/types.ts): Displays"Average savings per extra dollar"/"Reduction in net taxes if you give a little more"whenmarginal_savings_windowis present, and falls back to step-agnostic copy ("Marginal tax savings rate"/"Estimated tax savings per dollar over a small extra gift") if an older API deployment omits the field.frontend/src/components/faq/questions.tsx,frontend/src/lib/faqRules.json,tests/test_next_dollar_rate.py,tests/test_faq_numbers.py): Documents the $100 window, the ~$500,000 net-tax widening threshold, and negative-rate model estimates (including itemization-election flip artifacts, Itemization choices ignore state subtractions for non-itemizers, so state tax jumps when a gift tips the choice (Colorado, Minnesota) policyengine-us#11282); pins the § 170(p) cap cases, $925 blend, overlap scheduling, and fallback card rendering.