Fix Maine PTFC senior benefit base (mis-typed marginal scale) (#8813)#8814
Open
DTrim99 wants to merge 2 commits into
Open
Fix Maine PTFC senior benefit base (mis-typed marginal scale) (#8813)#8814DTrim99 wants to merge 2 commits into
DTrim99 wants to merge 2 commits into
Conversation
…yEngine#8813) benefit_base/senior.yaml lacked metadata.type: single_amount, so its brackets loaded as a MarginalAmountTaxScale whose calc() treats the threshold as exclusive. At the exact age-65 threshold it returned 0 instead of $4,100, so me_property_tax_fairness_credit_base_cap silently fell back to the non-senior single base and under-computed the credit for 65+ filers (tax years 2024+). Add type: single_amount (matching cap.yaml) plus threshold_unit/amount_unit, and add an age-exactly-65 regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PavelMakarchuk
requested changes
Jul 2, 2026
PavelMakarchuk
left a comment
Collaborator
There was a problem hiding this comment.
Review: Fix Maine PTFC senior benefit base (mis-typed marginal scale)
Good catch and a correct, minimal fix. Requesting changes mainly to fix a pre-existing uprating bug that lives in the exact metadata block this PR edits — cheap to fix now — plus a wrong reference link and two test additions.
Verified correct (the fix)
- Adding
type: single_amountmakessenior.calc(65)return $4,100 (inclusive threshold), $0 below 65, unchanged at 66+, and $0 pre-2024 — verified empirically againstSingleAmountTaxScale.calc. The bug was isolated to exactly age 65 (the marginal scale returned $0 there, tripping thesenior_benefit_base != 0fallback to the non-senior base). Metadata now matches siblingproperty_tax/cap.yaml; the incorrect pre-fixunit: currency-USDis correctly removed. - Values confirmed against Maine sources: senior base $4,100 (2025 Schedule PTFC/STFC line 8) / $4,000 (2024, §5219-KK(1)(A-1)(4)), non-senior single $2,550, 4% rate, age 65+ (one spouse suffices), effective TY2024+. Regression test (age 65, 2025, $60k, $5k → $1,700 vs pre-fix $150) discriminates the senior path correctly; 9/9 tests pass.
Requested changes
- Fix the senior base's uprating while you're in this block (pre-existing, but in-scope now).
senior.yaml:14-18declares uprating at the bracket level (uprating: gov.irs.upratingwith a siblingrounding:key) instead of the working nested form used insingle.yaml(uprating: {parameter: gov.irs.uprating, rounding: {...}}). Effect: the senior base stays flat at $4,100 for 2026+ instead of inflation-adjusting per 36 M.R.S. §5403, whereassingle.yamlcorrectly steps 2,550 → 2,600 → … It's latent onmain(not a regression) and doesn't affect the explicit 2024/2025 values — but since this PR is already rewritingsenior.yaml's scale metadata, converting the uprating to the working nested form here avoids leaving the senior base understated in later years. - Reference fix: the "2024 Form 1040ME" entry (
senior.yaml) links to23_1040me_sched_pstfc_ff.pdf— the same URL as the 2023 entry. Point it at the actual 2024 form PDF (locate the real filename on maine.gov/revenue; a naive24_…guess 404s). - Tests:
- The age-64 case doesn't isolate the base (its output is driven by the under-65 cap, so it'd pass even if the senior base wrongly applied at 64). Add a discriminating age-64 mirror of the age-65 case (2025, $60k, $5k → $150).
- Add an MFJ / one-spouse-65+ case (e.g. head 60 / spouse 67, 2025) to exercise the
greater_age_head_spouseselection.
Suggestions
- Replace the
senior_benefit_base != 0sentinel inme_property_tax_fairness_credit_base_cap.py:19with an explicit age / in-effect check for clarity (functionally correct today). senior.yamldescription verb "allows for" isn't in the approved verb list (limits/provides/sets/excludes/deducts/uses) — pre-existing.- Add
absolute_error_marginto the older cases (1-4) for consistency with the newer ones.
🤖 Reviewed with Claude Code
…ence, boundary tests - Convert the senior benefit-base bracket uprating to the working nested form so it inflation-adjusts for 2026+ per 36 M.R.S. §5403 (the flat form with a sibling rounding key silently left it flat at $4,100). - Repoint the 2024 Form 1040ME reference from the 2023 PDF to the actual 2024 Schedule PTFC/STFC PDF (verified live; shows $4,000 senior base). - Add a discriminating age-64 test (->$150, senior base does not apply) and an MFJ one-spouse-67 test (->$1,700, senior base selected via greater_age_head_spouse); add absolute_error_margin to the older cases; fix the description verb. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
Author
Fixes applied (addressing @PavelMakarchuk's review)Pushed as Requested changes
Suggestions
CI running now. |
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.
Fixes #8813.
Problem
The Maine Property Tax Fairness Credit under-computed the credit for filers whose older of head/spouse is exactly age 65+ (tax years 2024+): the enhanced senior benefit base silently never applied.
Root cause
parameters/.../fairness/property_tax/benefit_base/senior.yamlwas missingmetadata.type: single_amount, so itsbracketsloaded as aMarginalAmountTaxScaleinstead of aSingleAmountTaxScale. The marginal scale treats the bracket threshold as exclusive, sosenior.calc(65)returned0at the exact threshold. The guard inme_property_tax_fairness_credit_base_cap(senior_benefit_base != 0) then fell back to the non-senior single base.(This is why the existing age-66 test passed — above the threshold the marginal scale coincidentally returns the right amount; only age exactly 65 was broken.)
Fix
type: single_amount(plusthreshold_unit: year/amount_unit: currency-USD, matching the siblingcap.yaml) tosenior.yaml.me_property_tax_fairness_credit_base_cap.yaml: 2025 single filer, income $60,000, countable rent property tax $5,000 → base cap $1,700 (senior base $4,100 − 4% × income). Before the fix this returned $150 (fallback to the $2,550 single base).References
🤖 Generated with Claude Code