Fix SNAP expected contribution rounding per 7 CFR 273.10(e) - #9318
Draft
hua7450 wants to merge 3 commits into
Draft
Fix SNAP expected contribution rounding per 7 CFR 273.10(e)#9318hua7450 wants to merge 3 commits into
hua7450 wants to merge 3 commits into
Conversation
Round net income to the nearest dollar (1-49 cents down, 50-99 cents up, 7 CFR 273.10(e)(1)(ii)(A)) and round 30 percent of net income up to the next higher dollar (7 CFR 273.10(e)(2)(ii)(A)(1)), replacing the prior floor-then-multiply formula. Add boundary tests against the FNS Basis of Issuance table and categorical-eligibility ceiling tests. Fixes #9312 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9318 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 1 -2
Lines 65 14 -51
=========================================
- Hits 65 14 -51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The 31 SNAP pins in the analytics-coverage partner tests shift by $1-$11 per year under the legally correct rounding (net income to the nearest dollar, 30 percent rounded up to the next dollar). Approved by Ziming. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…g fix The 33 signature-replay SNAP pins (masked in the first CI run by the edge-case failures) shift under the corrected rounding, and the edge-case comments now show the ceil-of-30-percent arithmetic that produces the updated pins. Approved by Ziming. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Summary
Fixes the rounding in
snap_expected_contribution, which previously computedfloor(net_income) * 0.3with no rounding of the product.Fixes #9312
Legal basis
np.floor(x + 0.5)rather thannp.round's half-to-even).np.ceilso float32 noise (e.g.50 * 0.3 = 15.0000009) cannot push an exact dollar amount up to the next dollar.Impact
Benefits shift weakly downward only (
EC_new >= EC_oldalways): at most ~$1.10/month (up to ~$0.99 from rounding 30% up, plus up to ~$0.30 when net income rounds upward), i.e. $1–$13 per year on annual totals.Tests
snap_normal_allotment_basis_of_issuance.yaml(13 cases): 3-person allotments at net-income boundaries validated against the FNS Basis of Coupon/EBT Issuance table (Oct 1, 2025), including the net income $3.49 vs $3.50 half-up boundary and the exact-multiple $50/$51 rows.snap_categorical_eligibility_ceiling.yaml(3 cases): categorically eligible units above the issuance-table maximum (2-person gets the minimum allotment, 3-person gets $0 but stays flagged eligible per 7 CFR 273.10(e)(2)(iii) not converting to denial in the model).230.40 → 230) — artifacts of the missing rounding.Partner contract tests (updated with approval)
64 SNAP pins under
tests/policy/baseline/partners/analytics_coverage/shift by $1–$13/year under the corrected rounding and were updated with Ziming's approval:round net half-up → 30% rounded up), e.g.EC 337.20 → ceil(1,124 × 0.3) = 338.The change responds directly to the API partner's own rounding report, which serves as partner notice.
Test plan
🤖 Generated with Claude Code