Repository navigation
Test the Working for Families rounding, NaN and period cases - #30
Merged
Merged
Conversation
Add the regression tests that issue #27 lists, none of which changes a formula: - A family whose income lies a cent below halfway between two 32-bit floats, which fails if the stored-value tie repair stops rounding down. - The neighbour test under a $2**49 threshold as well as the law's, with the families in both orders, now comparing the gross credits and the abatement too. - NaN income gives NaN Best Start to a family with an abatable child when a reform sets the amount to zero. - excess_dollars gives infinity for 1.7e308 over minus infinity and for infinity over 1.7e308. - year:2027-01-01 gives 2027's credits, 2027-05 a twelfth of them, and year:2026-04 raises for each credit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add the 0.1-rate witness: $100,000 at 10% over a zero threshold leaves one cent of a $10,000.01 Family Tax Credit, which fails if only that rate is narrowed to 32 bits. - Check each family in the neighbour test against its own results in both orders, assert its abatement, and add three ordinary families whose incomes sum in 64-bit integers, two of them with different positive Best Start amounts. - Give the zero-amount Best Start test a school-age-only family, which gets $0. - Use a two-year-old in the period tests, so a month gives $336.75 of Best Start, and reject year:2027-01-02 as well as year:2026-04 with the Working for Families period error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Agent-written for Max, by Claude Code for Max Ghenis. The first independent review (at f19f35d) found one P1 and five P2s. b92358b, 5573ebd and the description answer all of them:
The whole suite passes (1,624 tests), ruff matches main, and |
- Put a toddler's family with income beside the two NaN-income families in the zero-amount test, in both orders, so only the NaN-income toddler's family gets NaN. - Test a $0 amount on 1 April before $4,041 from 2 April, which pays 364 days and fails if the zero-amount guard stops the loop. - Reword the changelog fragment so that it says a year from another day raises an error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Agent-written for Max, by Claude Code for Max Ghenis. The second independent review (at 5573ebd) closed all six of the first review's findings and raised one P1 and three P2s. 15369ba and the description answer them:
The whole suite passes (1,625 tests) and |
This was referenced Dec 1, 2026
MaxGhenis
marked this pull request as ready for review
December 1, 2026 03:18
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.
Agent-written for Max, by Claude Code for Max Ghenis.
What this adds
The tests that issue #27 asks for under "Tests", plus a test that pins one of its helper items, which #24 already fixed. No formula changes. The helper fixes in #27 go in a separate PR, so this one can merge on its own.
Changes
test_a_rate_of_a_tenth_abates_exactlyis Working for Families helpers: int64, mixed-sequence and shape edge cases, and three missed mutations #27's 0.1-rate witness: $100,000 of wages at a 10% rate over a zero threshold abates $10,000 of a $10,000.01 Family Tax Credit, which leaves one cent, stored as $0.009999999776482582. With the rate narrowed to its 32-bit value, the credit would be $0.009850988164544106.test_a_neighbour_changes_no_familys_income_or_creditgains a family whose income lies a cent below halfway between two 32-bit floats: wages of $249 + $226 and −$0.01, and a child's investment income of $225 + $500. Its stored income is $562,950,020,530,176. The test runs under a $249 Family Tax Credit threshold as well as the law's. It compares every family's stored incomes, gross credits, abatement and net credits with that family's own results, in both orders, and asserts the abatement: 27.5% of the stored income's complete dollars over the threshold, which is $18,454,938 for both families near a midpoint under $2**49.test_ordinary_families_side_by_side_keep_their_own_resultsmakes the same comparison for three families whose incomes sum in 64-bit integers. Two have toddlers and different positive Best Start amounts, $4,041 and $1,731.test_nan_income_gives_nan_best_start_at_a_zero_amountchecks that, when a reform sets the Best Start amount to zero, NaN income gives NaN Best Start to a family with an abatable toddler, and $0 to a family with only a school-age child and to a toddler's family with $30,000 of wages, in both orders, asbest_start_sumsdocuments.test_a_zero_best_start_amount_on_one_day_skips_only_that_daysets the amount to $0 on 1 April and $4,041 from 2 April, and checks that a toddler's family with $30,000 of wages gets 364 days of $4,041 ÷ 365, stored as $4,029.9287109375.test_excess_dollars_of_extreme_amounts_is_infinitechecks thatexcess_dollarsgives infinity for 1.7e308 over minus infinity and for infinity over 1.7e308, under strict NumPy settings. Working for Families helpers: int64, mixed-sequence and shape edge cases, and three missed mutations #27 reported anOverflowErrorfor both at 3d30ce8; main already returns infinity.test_working_for_families_dates.py, for a family with an eight-year-old and a two-year-old,year:2027-01-01gives the same three credits as2027, and2027-05gives a twelfth of each ($14,375, $7,670 and $4,041 a year, so $336.75 a month of Best Start).year:2026-04andyear:2027-01-02each raise the Working for Families period error for each credit, as the README says.wff-test-coverage.added.md.Mutations
I applied each mutation below to
working_for_families.pyand ran the whole suite on main (c99fa58) and on this branch at its head. The table is a selection; the two reviews ran further mutations.storedstoredtest_stored_rounds_the_exact_value_onceand the five-cents-above neighbour casedaily_ratestest_a_rate_of_a_tenth_abates_exactlydaily_ratestest_the_smallest_positive_rate_computes, as 5e-324 underflowsbest_start_sumscasetest_a_zero_best_start_amount_on_one_day_skips_only_that_dayyear:2027-01-02caseTests
The whole suite passes: 1,625 tests. Ruff reports the same findings as on main, and the format check passes.
git merge-treewith main at d431c12 finds no conflicts.Revisions
axiom: no RuleSpec change (tests and changelog only)
🤖 Generated with Claude Code