Fix SNAP expected contribution rounding per 7 CFR 273.10(e) - #9318
Draft
hua7450 wants to merge 1 commit into
Draft
Fix SNAP expected contribution rounding per 7 CFR 273.10(e)#9318hua7450 wants to merge 1 commit into
hua7450 wants to merge 1 commit 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:
|
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.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 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,288.9 → 288) — artifacts of the missing rounding.Known CI failures (intentional)
~30 SNAP pins in
tests/policy/baseline/partners/**shift by $1–$11/year under the corrected rounding. Per repo policy those partner contract files are not edited in this PR; the partner shard will fail until that change is separately approved.Test plan
policyengine-core test ... -c policyengine_us)🤖 Generated with Claude Code