From 1ceb1e95cab537b61a1ba2237549acff6ea69123 Mon Sep 17 00:00:00 2001 From: David Trimmer Date: Fri, 27 Feb 2026 14:17:40 -0500 Subject: [PATCH 1/7] Add Montana newborn credit reform Implements a proposed Montana newborn credit with: - $1,000 credit per qualifying child under age 1 - $1 earned income requirement (like MT CTC) - SSN required for both filer and child (ITIN not accepted) - Phase-out thresholds: $60k (Single/HOH/MFS), $120k (MFJ/Surviving Spouse) - $50 reduction per $1,000 (or part) above threshold - Effective 2027 Co-Authored-By: Claude Opus 4.5 --- changelog.d/mt-newborn-credit.added.md | 1 + .../states/mt/newborn_credit/age_limit.yaml | 9 + .../states/mt/newborn_credit/amount.yaml | 9 + .../states/mt/newborn_credit/in_effect.yaml | 9 + .../mt/newborn_credit/reduction/amount.yaml | 9 + .../newborn_credit/reduction/increment.yaml | 9 + .../newborn_credit/reduction/threshold.yaml | 28 + policyengine_us/reforms/reforms.py | 5 + .../states/mt/newborn_credit/__init__.py | 1 + .../mt/newborn_credit/mt_newborn_credit.py | 131 +++ .../mt/newborn_credit/mt_newborn_credit.yaml | 915 ++++++++++++++++++ 11 files changed, 1126 insertions(+) create mode 100644 changelog.d/mt-newborn-credit.added.md create mode 100644 policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml create mode 100644 policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml create mode 100644 policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml create mode 100644 policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml create mode 100644 policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml create mode 100644 policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml create mode 100644 policyengine_us/reforms/states/mt/newborn_credit/__init__.py create mode 100644 policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py create mode 100644 policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml diff --git a/changelog.d/mt-newborn-credit.added.md b/changelog.d/mt-newborn-credit.added.md new file mode 100644 index 00000000000..bf110b0ea02 --- /dev/null +++ b/changelog.d/mt-newborn-credit.added.md @@ -0,0 +1 @@ +Add Montana newborn credit reform. diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml new file mode 100644 index 00000000000..513134cd4b5 --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml @@ -0,0 +1,9 @@ +description: Montana newborn credit requires the child to be under this age at the end of the tax year. + +values: + 2027-01-01: 1 + +metadata: + unit: year + period: year + label: Montana newborn credit child age limit diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml new file mode 100644 index 00000000000..588978aa18b --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml @@ -0,0 +1,9 @@ +description: Montana newborn credit provides this amount per qualifying child. + +values: + 2027-01-01: 1_000 + +metadata: + unit: currency-USD + period: year + label: Montana newborn credit amount diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml new file mode 100644 index 00000000000..7188717ee0f --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml @@ -0,0 +1,9 @@ +description: Whether Montana newborn credit reform is in effect. + +values: + 0000-01-01: false + +metadata: + unit: bool + period: year + label: Montana newborn credit in effect diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml new file mode 100644 index 00000000000..b46b434f1e9 --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml @@ -0,0 +1,9 @@ +description: Montana newborn credit reduces by this amount for each income increment above the threshold. + +values: + 2027-01-01: 50 + +metadata: + unit: currency-USD + period: year + label: Montana newborn credit reduction amount diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml new file mode 100644 index 00000000000..64fca0aeffa --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml @@ -0,0 +1,9 @@ +description: Montana newborn credit reduces for each of these income increments (or part thereof) that AGI exceeds the threshold. + +values: + 2027-01-01: 1_000 + +metadata: + unit: currency-USD + period: year + label: Montana newborn credit reduction increment diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml new file mode 100644 index 00000000000..eb3ee2e1143 --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml @@ -0,0 +1,28 @@ +description: Montana newborn credit begins to phase out when AGI exceeds this threshold. + +SINGLE: + values: + 2027-01-01: 60_000 + +HEAD_OF_HOUSEHOLD: + values: + 2027-01-01: 60_000 + +JOINT: + values: + 2027-01-01: 120_000 + +SEPARATE: + values: + 2027-01-01: 60_000 + +SURVIVING_SPOUSE: + values: + 2027-01-01: 120_000 + +metadata: + unit: currency-USD + period: year + label: Montana newborn credit phase-out threshold + breakdown: + - filing_status diff --git a/policyengine_us/reforms/reforms.py b/policyengine_us/reforms/reforms.py index 323ac631597..e4f6a2ffbc5 100644 --- a/policyengine_us/reforms/reforms.py +++ b/policyengine_us/reforms/reforms.py @@ -88,6 +88,9 @@ from .states.mt.ctc import ( create_mt_ctc_reform, ) +from .states.mt.newborn_credit import ( + create_mt_newborn_credit_reform, +) from .congress.golden import ( create_fisc_act_reform, ) @@ -281,6 +284,7 @@ def create_structural_reforms_from_parameters(parameters, period): create_nyc_school_tax_credit_with_phase_out_reform(parameters, period) ) mt_ctc = create_mt_ctc_reform(parameters, period) + mt_newborn_credit = create_mt_newborn_credit_reform(parameters, period) fisc_act = create_fisc_act_reform(parameters, period) tax_employer_social_security_tax = ( create_tax_employer_social_security_tax_reform(parameters, period) @@ -409,6 +413,7 @@ def create_structural_reforms_from_parameters(parameters, period): limit_salt_deduction_to_property_taxes, nyc_school_tax_credit_with_phase_out, mt_ctc, + mt_newborn_credit, fisc_act, tax_employer_social_security_tax, tax_employer_medicare_tax, diff --git a/policyengine_us/reforms/states/mt/newborn_credit/__init__.py b/policyengine_us/reforms/states/mt/newborn_credit/__init__.py new file mode 100644 index 00000000000..edc2dbecbea --- /dev/null +++ b/policyengine_us/reforms/states/mt/newborn_credit/__init__.py @@ -0,0 +1 @@ +from .mt_newborn_credit import create_mt_newborn_credit_reform diff --git a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py new file mode 100644 index 00000000000..258c5540dcf --- /dev/null +++ b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py @@ -0,0 +1,131 @@ +from policyengine_us.model_api import * +from policyengine_core.periods import period as period_ +from policyengine_core.periods import instant + + +def create_mt_newborn_credit() -> Reform: + class mt_newborn_credit_eligible_child(Variable): + value_type = bool + entity = Person + label = "Montana newborn credit eligible child" + definition_period = YEAR + defined_for = StateCode.MT + + def formula(person, period, parameters): + p = parameters(period).gov.contrib.states.mt.newborn_credit + # Child must be under age limit (under 1 year old) + age = person("age", period) + age_eligible = age < p.age_limit + # Must be claimed as dependent + is_dependent = person("is_tax_unit_dependent", period) + # Child must have SSN (not ITIN) + ssn_card_type = person("ssn_card_type", period) + ssn_types = ssn_card_type.possible_values + has_ssn = (ssn_card_type == ssn_types.CITIZEN) | ( + ssn_card_type == ssn_types.NON_CITIZEN_VALID_EAD + ) + return age_eligible & is_dependent & has_ssn + + class mt_newborn_credit_eligible(Variable): + value_type = bool + entity = TaxUnit + label = "Eligible for the Montana newborn credit" + definition_period = YEAR + defined_for = StateCode.MT + + def formula(tax_unit, period, parameters): + # Must have at least $1 of earned income (like EITC requirement) + earned_income = tax_unit("tax_unit_earned_income", period) + has_earned_income = earned_income > 0 + # Must have qualifying children + qualifying_children = add( + tax_unit, period, ["mt_newborn_credit_eligible_child"] + ) + has_qualifying_children = qualifying_children > 0 + # Filer (head or spouse) must have SSN + person = tax_unit.members + head_or_spouse = person("is_tax_unit_head_or_spouse", period) + ssn_card_type = person("ssn_card_type", period) + ssn_types = ssn_card_type.possible_values + has_ssn = (ssn_card_type == ssn_types.CITIZEN) | ( + ssn_card_type == ssn_types.NON_CITIZEN_VALID_EAD + ) + filer_has_ssn = tax_unit.any(head_or_spouse & has_ssn) + return has_earned_income & has_qualifying_children & filer_has_ssn + + class mt_newborn_credit(Variable): + value_type = float + entity = TaxUnit + label = "Montana newborn credit" + definition_period = YEAR + unit = USD + defined_for = "mt_newborn_credit_eligible" + + def formula(tax_unit, period, parameters): + p = parameters(period).gov.contrib.states.mt.newborn_credit + # Check if reform is in effect + in_effect = p.in_effect + # Count qualifying children + qualifying_children = add( + tax_unit, period, ["mt_newborn_credit_eligible_child"] + ) + # Calculate base credit + base_credit = p.amount * qualifying_children + # Calculate phase-out + filing_status = tax_unit("filing_status", period) + agi = tax_unit("adjusted_gross_income", period) + threshold = p.reduction.threshold[filing_status] + increment = p.reduction.increment + reduction_amount = p.reduction.amount + # Number of increments (ceiling - any fraction triggers reduction) + excess = max_(agi - threshold, 0) + increments = np.ceil(excess / increment) + # Calculate reduction + reduction = reduction_amount * increments + return in_effect * max_(base_credit - reduction, 0) + + def modify_parameters(parameters): + # Add mt_newborn_credit to Montana refundable credits list + refundable = parameters.gov.states.mt.tax.income.credits.refundable + current_refundable = refundable(instant("2027-01-01")) + if "mt_newborn_credit" not in current_refundable: + new_refundable = list(current_refundable) + ["mt_newborn_credit"] + refundable.update( + start=instant("2027-01-01"), + stop=instant("2100-12-31"), + value=new_refundable, + ) + return parameters + + class reform(Reform): + def apply(self): + self.update_variable(mt_newborn_credit_eligible_child) + self.update_variable(mt_newborn_credit_eligible) + self.update_variable(mt_newborn_credit) + self.modify_parameters(modify_parameters) + + return reform + + +def create_mt_newborn_credit_reform(parameters, period, bypass: bool = False): + if bypass: + return create_mt_newborn_credit() + + p = parameters.gov.contrib.states.mt.newborn_credit + + reform_active = False + current_period = period_(period) + + for _ in range(5): + if p(current_period).in_effect: + reform_active = True + break + current_period = current_period.offset(1, "year") + + if reform_active: + return create_mt_newborn_credit() + else: + return None + + +mt_newborn_credit = create_mt_newborn_credit_reform(None, None, bypass=True) diff --git a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml new file mode 100644 index 00000000000..d31f02c3e60 --- /dev/null +++ b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml @@ -0,0 +1,915 @@ +# Montana Newborn Credit Tests + +# Basic Eligibility Tests + +- name: Case 1 (single filer with newborn under income threshold) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 2 (MFJ with newborn under income threshold) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent1: + age: 35 + is_tax_unit_head: true + employment_income: 60_000 + ssn_card_type: CITIZEN + parent2: + age: 33 + is_tax_unit_spouse: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent1, parent2, child] + filing_status: JOINT + households: + household: + members: [parent1, parent2, child] + state_code: MT + output: + # AGI $100k < $120k threshold for MFJ + mt_newborn_credit: 1_000 + +- name: Case 3 (two newborns - double credit) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 50_000 + ssn_card_type: CITIZEN + child1: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + child2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child1, child2] + filing_status: SINGLE + households: + household: + members: [parent, child1, child2] + state_code: MT + output: + mt_newborn_credit: 2_000 + +# Age Eligibility Tests + +- name: Case 4 (child age 0 is eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 5 (child age 1 not eligible - must be under 1) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 1 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 6 (child age 2 not eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 2 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 7 (one newborn eligible, one older child not) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 35 + is_tax_unit_head: true + employment_income: 50_000 + ssn_card_type: CITIZEN + newborn: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + toddler: + age: 3 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, newborn, toddler] + filing_status: SINGLE + households: + household: + members: [parent, newborn, toddler] + state_code: MT + output: + # Only newborn qualifies + mt_newborn_credit: 1_000 + +# SSN Requirement Tests - Child + +- name: Case 8 (child with SSN CITIZEN qualifies) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 9 (child with SSN NON_CITIZEN_VALID_EAD qualifies) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: NON_CITIZEN_VALID_EAD + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 10 (child with ITIN only - OTHER_NON_CITIZEN - not eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: OTHER_NON_CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 11 (child with no SSN - NONE - not eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: NONE + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +# SSN Requirement Tests - Filer + +- name: Case 12 (filer with SSN CITIZEN qualifies) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 13 (filer with SSN NON_CITIZEN_VALID_EAD qualifies) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: NON_CITIZEN_VALID_EAD + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 14 (filer with ITIN only - OTHER_NON_CITIZEN - not eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: OTHER_NON_CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 15 (filer with no SSN - NONE - not eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: NONE + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 16 (MFJ one spouse has SSN - qualifies) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent1: + age: 35 + is_tax_unit_head: true + employment_income: 60_000 + ssn_card_type: CITIZEN + parent2: + age: 33 + is_tax_unit_spouse: true + ssn_card_type: OTHER_NON_CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent1, parent2, child] + filing_status: JOINT + households: + household: + members: [parent1, parent2, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 17 (MFJ neither spouse has SSN - not eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent1: + age: 35 + is_tax_unit_head: true + employment_income: 60_000 + ssn_card_type: OTHER_NON_CITIZEN + parent2: + age: 33 + is_tax_unit_spouse: true + ssn_card_type: OTHER_NON_CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent1, parent2, child] + filing_status: JOINT + households: + household: + members: [parent1, parent2, child] + state_code: MT + output: + mt_newborn_credit: 0 + +# Earned Income Requirement Tests + +- name: Case 18 (no earned income - not eligible) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 0 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 19 (exactly $1 earned income - qualifies) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 1 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 1_000 + +# Phase-out Tests + +- name: Case 20 (single at exactly threshold - full credit) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 60_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $60k = threshold, no reduction + mt_newborn_credit: 1_000 + +- name: Case 21 (single $1 above threshold - one increment reduction) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 60_001 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $60,001 exceeds $60,000 by $1 + # Ceiling($1 / $1,000) = 1 increment + # Reduction = $50 * 1 = $50 + # Credit = $1,000 - $50 = $950 + mt_newborn_credit: 950 + +- name: Case 22 (single $500 above threshold - one increment) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 60_500 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $60,500 exceeds $60,000 by $500 + # Ceiling($500 / $1,000) = 1 increment (fraction triggers full increment) + # Reduction = $50 * 1 = $50 + # Credit = $1,000 - $50 = $950 + mt_newborn_credit: 950 + +- name: Case 23 (single $1000 above threshold - one increment) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 61_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $61,000 exceeds $60,000 by $1,000 + # Ceiling($1,000 / $1,000) = 1 increment + # Reduction = $50 * 1 = $50 + # Credit = $1,000 - $50 = $950 + mt_newborn_credit: 950 + +- name: Case 24 (single $1001 above threshold - two increments) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 61_001 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $61,001 exceeds $60,000 by $1,001 + # Ceiling($1,001 / $1,000) = 2 increments + # Reduction = $50 * 2 = $100 + # Credit = $1,000 - $100 = $900 + mt_newborn_credit: 900 + +- name: Case 25 (single fully phased out) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 100_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $100,000 exceeds $60,000 by $40,000 + # Ceiling($40,000 / $1,000) = 40 increments + # Reduction = $50 * 40 = $2,000 (exceeds $1,000 credit) + # Credit = max($1,000 - $2,000, 0) = $0 + mt_newborn_credit: 0 + +- name: Case 26 (MFJ at exactly threshold - full credit) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent1: + age: 35 + is_tax_unit_head: true + employment_income: 70_000 + ssn_card_type: CITIZEN + parent2: + age: 33 + is_tax_unit_spouse: true + employment_income: 50_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent1, parent2, child] + filing_status: JOINT + households: + household: + members: [parent1, parent2, child] + state_code: MT + output: + # AGI $120k = threshold for MFJ, no reduction + mt_newborn_credit: 1_000 + +- name: Case 27 (MFJ above threshold - partial phase-out) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent1: + age: 35 + is_tax_unit_head: true + employment_income: 70_000 + ssn_card_type: CITIZEN + parent2: + age: 33 + is_tax_unit_spouse: true + employment_income: 55_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent1, parent2, child] + filing_status: JOINT + households: + household: + members: [parent1, parent2, child] + state_code: MT + output: + # AGI $125,000 exceeds $120,000 by $5,000 + # Ceiling($5,000 / $1,000) = 5 increments + # Reduction = $50 * 5 = $250 + # Credit = $1,000 - $250 = $750 + mt_newborn_credit: 750 + +# Filing Status Threshold Tests + +- name: Case 28 (HOH uses $60k threshold) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 65_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: HEAD_OF_HOUSEHOLD + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $65,000 exceeds $60,000 by $5,000 + # Ceiling($5,000 / $1,000) = 5 increments + # Reduction = $50 * 5 = $250 + # Credit = $1,000 - $250 = $750 + mt_newborn_credit: 750 + +- name: Case 29 (MFS uses $60k threshold) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 55_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SEPARATE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $55k < $60k threshold for MFS + mt_newborn_credit: 1_000 + +- name: Case 30 (surviving spouse uses $120k threshold) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 35 + is_tax_unit_head: true + employment_income: 115_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SURVIVING_SPOUSE + households: + household: + members: [parent, child] + state_code: MT + output: + # AGI $115k < $120k threshold for surviving spouse + mt_newborn_credit: 1_000 + +# Reform Toggle Test + +- name: Case 31 (reform not in effect by default) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: MT + output: + mt_newborn_credit: 0 + +# Non-MT Resident Test + +- name: Case 32 (non-MT resident gets zero) + period: 2027 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + parent: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + child: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [parent, child] + filing_status: SINGLE + households: + household: + members: [parent, child] + state_code: NY + output: + mt_newborn_credit: 0 From c44be7a1a277ad96b0df0188304d318af566874c Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Sat, 28 Feb 2026 17:00:58 +0100 Subject: [PATCH 2/7] Fix review findings: reuse existing SSN variable, improve tests and descriptions - Replace duplicated SSN logic with meets_eitc_identification_requirements - Add early return for in_effect toggle instead of multiplicative pattern - Fix parameter descriptions to follow PolicyEngine conventions - Expand test suite from 32 to 38 cases with boundary, multi-child, and filing status tests - Add absolute_error_margin and fix naming conventions in all tests Co-Authored-By: Claude Opus 4.6 --- .../states/mt/newborn_credit/age_limit.yaml | 2 +- .../states/mt/newborn_credit/amount.yaml | 2 +- .../states/mt/newborn_credit/in_effect.yaml | 2 +- .../mt/newborn_credit/reduction/amount.yaml | 2 +- .../newborn_credit/reduction/increment.yaml | 2 +- .../newborn_credit/reduction/threshold.yaml | 2 +- .../mt/newborn_credit/mt_newborn_credit.py | 53 +- .../mt/newborn_credit/mt_newborn_credit.yaml | 594 ++++++++++++------ 8 files changed, 415 insertions(+), 244 deletions(-) diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml index 513134cd4b5..002d50df283 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml @@ -1,4 +1,4 @@ -description: Montana newborn credit requires the child to be under this age at the end of the tax year. +description: Montana limits child age to this threshold under the newborn credit program. values: 2027-01-01: 1 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml index 588978aa18b..2d25d308ea8 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml @@ -1,4 +1,4 @@ -description: Montana newborn credit provides this amount per qualifying child. +description: Montana provides this amount per qualifying child under the newborn credit program. values: 2027-01-01: 1_000 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml index 7188717ee0f..a81b8445078 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml @@ -1,4 +1,4 @@ -description: Whether Montana newborn credit reform is in effect. +description: Montana uses this indicator to determine whether the newborn credit reform is in effect. values: 0000-01-01: false diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml index b46b434f1e9..c1e45f001ae 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml @@ -1,4 +1,4 @@ -description: Montana newborn credit reduces by this amount for each income increment above the threshold. +description: Montana sets this amount as the phase-out reduction per income increment under the newborn credit program. values: 2027-01-01: 50 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml index 64fca0aeffa..4a4e2530957 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml @@ -1,4 +1,4 @@ -description: Montana newborn credit reduces for each of these income increments (or part thereof) that AGI exceeds the threshold. +description: Montana sets this amount as the income increment for phase-out calculations under the newborn credit program. values: 2027-01-01: 1_000 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml index eb3ee2e1143..3b3c9c14ca1 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml @@ -1,4 +1,4 @@ -description: Montana newborn credit begins to phase out when AGI exceeds this threshold. +description: Montana limits the newborn credit to taxpayers with AGI at or below this amount. SINGLE: values: diff --git a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py index 258c5540dcf..ae431bb86c1 100644 --- a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py +++ b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py @@ -13,18 +13,10 @@ class mt_newborn_credit_eligible_child(Variable): def formula(person, period, parameters): p = parameters(period).gov.contrib.states.mt.newborn_credit - # Child must be under age limit (under 1 year old) age = person("age", period) - age_eligible = age < p.age_limit - # Must be claimed as dependent is_dependent = person("is_tax_unit_dependent", period) - # Child must have SSN (not ITIN) - ssn_card_type = person("ssn_card_type", period) - ssn_types = ssn_card_type.possible_values - has_ssn = (ssn_card_type == ssn_types.CITIZEN) | ( - ssn_card_type == ssn_types.NON_CITIZEN_VALID_EAD - ) - return age_eligible & is_dependent & has_ssn + has_ssn = person("meets_eitc_identification_requirements", period) + return (age < p.age_limit) & is_dependent & has_ssn class mt_newborn_credit_eligible(Variable): value_type = bool @@ -34,22 +26,18 @@ class mt_newborn_credit_eligible(Variable): defined_for = StateCode.MT def formula(tax_unit, period, parameters): - # Must have at least $1 of earned income (like EITC requirement) - earned_income = tax_unit("tax_unit_earned_income", period) - has_earned_income = earned_income > 0 - # Must have qualifying children - qualifying_children = add( - tax_unit, period, ["mt_newborn_credit_eligible_child"] + has_earned_income = tax_unit("tax_unit_earned_income", period) > 0 + has_qualifying_children = ( + add( + tax_unit, + period, + ["mt_newborn_credit_eligible_child"], + ) + > 0 ) - has_qualifying_children = qualifying_children > 0 - # Filer (head or spouse) must have SSN person = tax_unit.members head_or_spouse = person("is_tax_unit_head_or_spouse", period) - ssn_card_type = person("ssn_card_type", period) - ssn_types = ssn_card_type.possible_values - has_ssn = (ssn_card_type == ssn_types.CITIZEN) | ( - ssn_card_type == ssn_types.NON_CITIZEN_VALID_EAD - ) + has_ssn = person("meets_eitc_identification_requirements", period) filer_has_ssn = tax_unit.any(head_or_spouse & has_ssn) return has_earned_income & has_qualifying_children & filer_has_ssn @@ -63,29 +51,22 @@ class mt_newborn_credit(Variable): def formula(tax_unit, period, parameters): p = parameters(period).gov.contrib.states.mt.newborn_credit - # Check if reform is in effect - in_effect = p.in_effect - # Count qualifying children + if not p.in_effect: + return 0 qualifying_children = add( tax_unit, period, ["mt_newborn_credit_eligible_child"] ) - # Calculate base credit base_credit = p.amount * qualifying_children - # Calculate phase-out filing_status = tax_unit("filing_status", period) agi = tax_unit("adjusted_gross_income", period) threshold = p.reduction.threshold[filing_status] - increment = p.reduction.increment - reduction_amount = p.reduction.amount - # Number of increments (ceiling - any fraction triggers reduction) excess = max_(agi - threshold, 0) - increments = np.ceil(excess / increment) - # Calculate reduction - reduction = reduction_amount * increments - return in_effect * max_(base_credit - reduction, 0) + # Ceiling: any fraction of an increment triggers reduction + increments = np.ceil(excess / p.reduction.increment) + reduction = p.reduction.amount * increments + return max_(base_credit - reduction, 0) def modify_parameters(parameters): - # Add mt_newborn_credit to Montana refundable credits list refundable = parameters.gov.states.mt.tax.income.credits.refundable current_refundable = refundable(instant("2027-01-01")) if "mt_newborn_credit" not in current_refundable: diff --git a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml index d31f02c3e60..6c9ad344a8b 100644 --- a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml +++ b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml @@ -2,914 +2,1104 @@ # Basic Eligibility Tests -- name: Case 1 (single filer with newborn under income threshold) +- name: Case 1, single filer with newborn under income threshold. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 1_000 -- name: Case 2 (MFJ with newborn under income threshold) +- name: Case 2, MFJ with newborn under income threshold. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent1: + person1: age: 35 is_tax_unit_head: true employment_income: 60_000 ssn_card_type: CITIZEN - parent2: + person2: age: 33 is_tax_unit_spouse: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person3: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent1, parent2, child] + members: [person1, person2, person3] filing_status: JOINT households: household: - members: [parent1, parent2, child] + members: [person1, person2, person3] state_code: MT output: # AGI $100k < $120k threshold for MFJ mt_newborn_credit: 1_000 -- name: Case 3 (two newborns - double credit) +- name: Case 3, two newborns double credit. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 50_000 ssn_card_type: CITIZEN - child1: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN - child2: + person3: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child1, child2] + members: [person1, person2, person3] filing_status: SINGLE households: household: - members: [parent, child1, child2] + members: [person1, person2, person3] state_code: MT output: mt_newborn_credit: 2_000 # Age Eligibility Tests -- name: Case 4 (child age 0 is eligible) +- name: Case 4, child age 0 is eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 1_000 -- name: Case 5 (child age 1 not eligible - must be under 1) +- name: Case 5, child age 1 not eligible must be under 1. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 1 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 -- name: Case 6 (child age 2 not eligible) +- name: Case 6, child age 2 not eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 2 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 -- name: Case 7 (one newborn eligible, one older child not) +- name: Case 7, one newborn eligible one older child not. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 35 is_tax_unit_head: true employment_income: 50_000 ssn_card_type: CITIZEN - newborn: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN - toddler: + person3: age: 3 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, newborn, toddler] + members: [person1, person2, person3] filing_status: SINGLE households: household: - members: [parent, newborn, toddler] + members: [person1, person2, person3] state_code: MT output: - # Only newborn qualifies mt_newborn_credit: 1_000 +- name: Case 8, child not claimed as dependent not eligible. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: false + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + mt_newborn_credit: 0 + # SSN Requirement Tests - Child -- name: Case 8 (child with SSN CITIZEN qualifies) +- name: Case 9, child with SSN CITIZEN qualifies. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 1_000 -- name: Case 9 (child with SSN NON_CITIZEN_VALID_EAD qualifies) +- name: Case 10, child with SSN NON_CITIZEN_VALID_EAD qualifies. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: NON_CITIZEN_VALID_EAD tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 1_000 -- name: Case 10 (child with ITIN only - OTHER_NON_CITIZEN - not eligible) +- name: Case 11, child with ITIN only OTHER_NON_CITIZEN not eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: OTHER_NON_CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 -- name: Case 11 (child with no SSN - NONE - not eligible) +- name: Case 12, child with no SSN NONE not eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: NONE tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 # SSN Requirement Tests - Filer -- name: Case 12 (filer with SSN CITIZEN qualifies) +- name: Case 13, filer with SSN CITIZEN qualifies. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 1_000 -- name: Case 13 (filer with SSN NON_CITIZEN_VALID_EAD qualifies) +- name: Case 14, filer with SSN NON_CITIZEN_VALID_EAD qualifies. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: NON_CITIZEN_VALID_EAD - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 1_000 -- name: Case 14 (filer with ITIN only - OTHER_NON_CITIZEN - not eligible) +- name: Case 15, filer with ITIN only OTHER_NON_CITIZEN not eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: OTHER_NON_CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 -- name: Case 15 (filer with no SSN - NONE - not eligible) +- name: Case 16, filer with no SSN NONE not eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: NONE - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 -- name: Case 16 (MFJ one spouse has SSN - qualifies) +- name: Case 17, MFJ one spouse has SSN qualifies. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent1: + person1: age: 35 is_tax_unit_head: true employment_income: 60_000 ssn_card_type: CITIZEN - parent2: + person2: age: 33 is_tax_unit_spouse: true ssn_card_type: OTHER_NON_CITIZEN - child: + person3: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent1, parent2, child] + members: [person1, person2, person3] filing_status: JOINT households: household: - members: [parent1, parent2, child] + members: [person1, person2, person3] state_code: MT output: mt_newborn_credit: 1_000 -- name: Case 17 (MFJ neither spouse has SSN - not eligible) +- name: Case 18, MFJ neither spouse has SSN not eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent1: + person1: age: 35 is_tax_unit_head: true employment_income: 60_000 ssn_card_type: OTHER_NON_CITIZEN - parent2: + person2: age: 33 is_tax_unit_spouse: true ssn_card_type: OTHER_NON_CITIZEN - child: + person3: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent1, parent2, child] + members: [person1, person2, person3] filing_status: JOINT households: household: - members: [parent1, parent2, child] + members: [person1, person2, person3] state_code: MT output: mt_newborn_credit: 0 # Earned Income Requirement Tests -- name: Case 18 (no earned income - not eligible) +- name: Case 19, no earned income not eligible. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 0 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 -- name: Case 19 (exactly $1 earned income - qualifies) +- name: Case 20, exactly $1 earned income qualifies. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 1 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 1_000 # Phase-out Tests -- name: Case 20 (single at exactly threshold - full credit) +- name: Case 21, single at exactly threshold full credit. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 60_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: # AGI $60k = threshold, no reduction mt_newborn_credit: 1_000 -- name: Case 21 (single $1 above threshold - one increment reduction) +- name: Case 22, single $1 above threshold one increment reduction. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 60_001 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $60,001 exceeds $60,000 by $1 - # Ceiling($1 / $1,000) = 1 increment - # Reduction = $50 * 1 = $50 - # Credit = $1,000 - $50 = $950 + # ceil($1 / $1,000) = 1 increment, reduction = $50 mt_newborn_credit: 950 -- name: Case 22 (single $500 above threshold - one increment) +- name: Case 23, single $500 above threshold one increment. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 60_500 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $60,500 exceeds $60,000 by $500 - # Ceiling($500 / $1,000) = 1 increment (fraction triggers full increment) - # Reduction = $50 * 1 = $50 - # Credit = $1,000 - $50 = $950 + # ceil($500 / $1,000) = 1 increment, reduction = $50 mt_newborn_credit: 950 -- name: Case 23 (single $1000 above threshold - one increment) +- name: Case 24, single $1000 above threshold one increment. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 61_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $61,000 exceeds $60,000 by $1,000 - # Ceiling($1,000 / $1,000) = 1 increment - # Reduction = $50 * 1 = $50 - # Credit = $1,000 - $50 = $950 + # ceil($1,000 / $1,000) = 1 increment, reduction = $50 mt_newborn_credit: 950 -- name: Case 24 (single $1001 above threshold - two increments) +- name: Case 25, single $1001 above threshold two increments. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 61_001 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $61,001 exceeds $60,000 by $1,001 - # Ceiling($1,001 / $1,000) = 2 increments - # Reduction = $50 * 2 = $100 - # Credit = $1,000 - $100 = $900 + # ceil($1,001 / $1,000) = 2 increments, reduction = $100 mt_newborn_credit: 900 -- name: Case 25 (single fully phased out) +- name: Case 26, single last $50 of credit before full phase-out. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 79_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + # excess = $19,000, ceil($19,000/$1,000) = 19, reduction = $950 + mt_newborn_credit: 50 + +- name: Case 27, single exactly at full phase-out boundary. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 80_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + # excess = $20,000, ceil($20,000/$1,000) = 20, reduction = $1,000 + mt_newborn_credit: 0 + +- name: Case 28, single well above full phase-out. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: age: 30 is_tax_unit_head: true employment_income: 100_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $100,000 exceeds $60,000 by $40,000 - # Ceiling($40,000 / $1,000) = 40 increments - # Reduction = $50 * 40 = $2,000 (exceeds $1,000 credit) - # Credit = max($1,000 - $2,000, 0) = $0 + # reduction exceeds credit, clamped to 0 mt_newborn_credit: 0 -- name: Case 26 (MFJ at exactly threshold - full credit) +- name: Case 29, MFJ at exactly threshold full credit. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent1: + person1: age: 35 is_tax_unit_head: true employment_income: 70_000 ssn_card_type: CITIZEN - parent2: + person2: age: 33 is_tax_unit_spouse: true employment_income: 50_000 ssn_card_type: CITIZEN - child: + person3: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent1, parent2, child] + members: [person1, person2, person3] filing_status: JOINT households: household: - members: [parent1, parent2, child] + members: [person1, person2, person3] state_code: MT output: # AGI $120k = threshold for MFJ, no reduction mt_newborn_credit: 1_000 -- name: Case 27 (MFJ above threshold - partial phase-out) +- name: Case 30, MFJ $1 above threshold partial phase-out. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent1: + person1: + age: 35 + is_tax_unit_head: true + employment_income: 70_001 + ssn_card_type: CITIZEN + person2: + age: 33 + is_tax_unit_spouse: true + employment_income: 50_000 + ssn_card_type: CITIZEN + person3: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2, person3] + filing_status: JOINT + households: + household: + members: [person1, person2, person3] + state_code: MT + output: + # AGI $120,001, excess = $1, ceil($1/$1,000) = 1, reduction = $50 + mt_newborn_credit: 950 + +- name: Case 31, MFJ above threshold partial phase-out. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: age: 35 is_tax_unit_head: true employment_income: 70_000 ssn_card_type: CITIZEN - parent2: + person2: age: 33 is_tax_unit_spouse: true employment_income: 55_000 ssn_card_type: CITIZEN - child: + person3: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent1, parent2, child] + members: [person1, person2, person3] filing_status: JOINT households: household: - members: [parent1, parent2, child] + members: [person1, person2, person3] state_code: MT output: - # AGI $125,000 exceeds $120,000 by $5,000 - # Ceiling($5,000 / $1,000) = 5 increments - # Reduction = $50 * 5 = $250 - # Credit = $1,000 - $250 = $750 + # AGI $125,000, excess = $5,000, 5 increments, reduction = $250 mt_newborn_credit: 750 # Filing Status Threshold Tests -- name: Case 28 (HOH uses $60k threshold) +- name: Case 32, HOH phase-out uses $60k threshold. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 65_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: HEAD_OF_HOUSEHOLD households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $65,000 exceeds $60,000 by $5,000 - # Ceiling($5,000 / $1,000) = 5 increments - # Reduction = $50 * 5 = $250 - # Credit = $1,000 - $250 = $750 + # excess = $5,000, 5 increments, reduction = $250 mt_newborn_credit: 750 -- name: Case 29 (MFS uses $60k threshold) +- name: Case 33, MFS phase-out uses $60k threshold. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true - employment_income: 55_000 + employment_income: 63_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SEPARATE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $55k < $60k threshold for MFS - mt_newborn_credit: 1_000 + # excess = $3,000, 3 increments, reduction = $150 + mt_newborn_credit: 850 -- name: Case 30 (surviving spouse uses $120k threshold) +- name: Case 34, surviving spouse phase-out uses $120k threshold. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 35 is_tax_unit_head: true - employment_income: 115_000 + employment_income: 125_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SURVIVING_SPOUSE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: - # AGI $115k < $120k threshold for surviving spouse - mt_newborn_credit: 1_000 + # excess = $5,000, 5 increments, reduction = $250 + mt_newborn_credit: 750 + +# Phase-out with Multiple Children + +- name: Case 35, two newborns with partial phase-out. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 65_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + person3: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2, person3] + filing_status: SINGLE + households: + household: + members: [person1, person2, person3] + state_code: MT + output: + # base = $2,000, excess = $5,000, 5 increments, reduction = $250 + # credit = max($2,000 - $250, 0) = $1,750 + mt_newborn_credit: 1_750 # Reform Toggle Test -- name: Case 31 (reform not in effect by default) +- name: Case 36, reform not in effect by default. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: MT output: mt_newborn_credit: 0 # Non-MT Resident Test -- name: Case 32 (non-MT resident gets zero) +- name: Case 37, non-MT resident gets zero. period: 2027 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true people: - parent: + person1: age: 30 is_tax_unit_head: true employment_income: 40_000 ssn_card_type: CITIZEN - child: + person2: age: 0 is_tax_unit_dependent: true ssn_card_type: CITIZEN tax_units: tax_unit: - members: [parent, child] + members: [person1, person2] filing_status: SINGLE households: household: - members: [parent, child] + members: [person1, person2] state_code: NY output: mt_newborn_credit: 0 + +# Integration Test + +- name: Case 38, end-to-end credit flows through mt_income_tax. + period: 2027 + absolute_error_margin: 1 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + mt_newborn_credit: 1_000 From 802bcd3341f7e5a14f9f55aaf5422ddfcb45a672 Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Mon, 2 Mar 2026 11:51:00 +0100 Subject: [PATCH 3/7] Add references, docstring, comments, and edge case tests to MT newborn credit Address review findings: add reference metadata to all 6 parameter files and 3 variable classes, add factory function docstring, document SSN any-vs-all logic and modify_parameters ordering dependency, fix integration test error margin from 1 to 0.01, and add 6 edge case tests (self-employment income, unearned-only income, adult-only unit, MFJ full phase-out, multi-child full phase-out, negative SE income). Co-Authored-By: Claude Opus 4.6 --- .../states/mt/newborn_credit/age_limit.yaml | 3 + .../states/mt/newborn_credit/amount.yaml | 3 + .../states/mt/newborn_credit/in_effect.yaml | 3 + .../mt/newborn_credit/reduction/amount.yaml | 3 + .../newborn_credit/reduction/increment.yaml | 3 + .../newborn_credit/reduction/threshold.yaml | 3 + .../mt/newborn_credit/mt_newborn_credit.py | 15 ++ .../mt/newborn_credit/mt_newborn_credit.yaml | 175 +++++++++++++++++- 8 files changed, 206 insertions(+), 2 deletions(-) diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml index 002d50df283..161e950fabe 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml @@ -7,3 +7,6 @@ metadata: unit: year period: year label: Montana newborn credit child age limit + reference: + - title: PolicyEngine Montana newborn credit reform design + href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml index 2d25d308ea8..29cf8fd3cac 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml @@ -7,3 +7,6 @@ metadata: unit: currency-USD period: year label: Montana newborn credit amount + reference: + - title: PolicyEngine Montana newborn credit reform design + href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml index a81b8445078..8b489850bd1 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml @@ -7,3 +7,6 @@ metadata: unit: bool period: year label: Montana newborn credit in effect + reference: + - title: PolicyEngine Montana newborn credit reform design + href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml index c1e45f001ae..46b8bf344e2 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml @@ -7,3 +7,6 @@ metadata: unit: currency-USD period: year label: Montana newborn credit reduction amount + reference: + - title: PolicyEngine Montana newborn credit reform design + href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml index 4a4e2530957..6c4468f22e8 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml @@ -7,3 +7,6 @@ metadata: unit: currency-USD period: year label: Montana newborn credit reduction increment + reference: + - title: PolicyEngine Montana newborn credit reform design + href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml index 3b3c9c14ca1..d3379ec7a1b 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml @@ -26,3 +26,6 @@ metadata: label: Montana newborn credit phase-out threshold breakdown: - filing_status + reference: + - title: PolicyEngine Montana newborn credit reform design + href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py index ae431bb86c1..6965a10b6dd 100644 --- a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py +++ b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py @@ -4,12 +4,20 @@ def create_mt_newborn_credit() -> Reform: + """Montana newborn credit reform. + + Provides a $1,000 refundable credit per qualifying child under + age 1 with phase-out based on AGI. This is a PolicyEngine-designed + contrib reform; no enacted legislation exists. + """ + class mt_newborn_credit_eligible_child(Variable): value_type = bool entity = Person label = "Montana newborn credit eligible child" definition_period = YEAR defined_for = StateCode.MT + reference = "https://github.com/PolicyEngine/policyengine-us/pull/7513" def formula(person, period, parameters): p = parameters(period).gov.contrib.states.mt.newborn_credit @@ -24,6 +32,7 @@ class mt_newborn_credit_eligible(Variable): label = "Eligible for the Montana newborn credit" definition_period = YEAR defined_for = StateCode.MT + reference = "https://github.com/PolicyEngine/policyengine-us/pull/7513" def formula(tax_unit, period, parameters): has_earned_income = tax_unit("tax_unit_earned_income", period) > 0 @@ -38,6 +47,8 @@ def formula(tax_unit, period, parameters): person = tax_unit.members head_or_spouse = person("is_tax_unit_head_or_spouse", period) has_ssn = person("meets_eitc_identification_requirements", period) + # Uses any() not all(): at least one filer needs SSN, + # unlike EITC which requires all filers to have SSN. filer_has_ssn = tax_unit.any(head_or_spouse & has_ssn) return has_earned_income & has_qualifying_children & filer_has_ssn @@ -48,6 +59,7 @@ class mt_newborn_credit(Variable): definition_period = YEAR unit = USD defined_for = "mt_newborn_credit_eligible" + reference = "https://github.com/PolicyEngine/policyengine-us/pull/7513" def formula(tax_unit, period, parameters): p = parameters(period).gov.contrib.states.mt.newborn_credit @@ -67,6 +79,9 @@ def formula(tax_unit, period, parameters): return max_(base_credit - reduction, 0) def modify_parameters(parameters): + # NOTE: MT CTC reform hard-codes the refundable credits list, + # so this reform must run after MT CTC in reforms.py to + # correctly append mt_newborn_credit via read-then-append. refundable = parameters.gov.states.mt.tax.income.credits.refundable current_refundable = refundable(instant("2027-01-01")) if "mt_newborn_credit" not in current_refundable: diff --git a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml index 6c9ad344a8b..00163798c7e 100644 --- a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml +++ b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml @@ -1077,9 +1077,9 @@ # Integration Test -- name: Case 38, end-to-end credit flows through mt_income_tax. +- name: Case 38, end-to-end credit flows through mt_refundable_credits. period: 2027 - absolute_error_margin: 1 + absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true @@ -1103,3 +1103,174 @@ state_code: MT output: mt_newborn_credit: 1_000 + +# Additional Edge Case Tests + +- name: Case 39, self-employment income satisfies earned income requirement. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + self_employment_income: 40_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + mt_newborn_credit: 1_000 + +- name: Case 40, unearned income only does not satisfy earned income requirement. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 65 + is_tax_unit_head: true + social_security: 40_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 41, adult-only tax unit gets zero credit. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1] + filing_status: SINGLE + households: + household: + members: [person1] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 42, MFJ full phase-out boundary at $140k. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 35 + is_tax_unit_head: true + employment_income: 80_000 + ssn_card_type: CITIZEN + person2: + age: 33 + is_tax_unit_spouse: true + employment_income: 60_000 + ssn_card_type: CITIZEN + person3: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2, person3] + filing_status: JOINT + households: + household: + members: [person1, person2, person3] + state_code: MT + output: + # AGI $140k, excess = $20k, ceil($20k/$1k) = 20, reduction = $1,000 + mt_newborn_credit: 0 + +- name: Case 43, two newborns full phase-out requires $40k above threshold. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 100_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + person3: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2, person3] + filing_status: SINGLE + households: + household: + members: [person1, person2, person3] + state_code: MT + output: + # base = $2,000, excess = $40k, ceil($40k/$1k) = 40, reduction = $2,000 + mt_newborn_credit: 0 + +- name: Case 44, negative SE income with zero employment income not eligible. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + self_employment_income: -10_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + mt_newborn_credit: 0 From 7e387c17d058c5040b03b1e1c926ce3543b68d0d Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Mon, 2 Mar 2026 13:12:36 +0100 Subject: [PATCH 4/7] Remove invalid PR URL references from MT newborn credit This is a PolicyEngine-designed contrib reform with no enacted legislation, so the PR URL is not a valid primary source. Other hypothetical contrib reforms (UBI Center, CRFB, etc.) omit references entirely, which is the correct pattern here. Co-Authored-By: Claude Opus 4.6 --- .../gov/contrib/states/mt/newborn_credit/age_limit.yaml | 3 --- .../gov/contrib/states/mt/newborn_credit/amount.yaml | 3 --- .../gov/contrib/states/mt/newborn_credit/in_effect.yaml | 3 --- .../gov/contrib/states/mt/newborn_credit/reduction/amount.yaml | 3 --- .../contrib/states/mt/newborn_credit/reduction/increment.yaml | 3 --- .../contrib/states/mt/newborn_credit/reduction/threshold.yaml | 3 --- .../reforms/states/mt/newborn_credit/mt_newborn_credit.py | 3 --- 7 files changed, 21 deletions(-) diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml index 161e950fabe..002d50df283 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/age_limit.yaml @@ -7,6 +7,3 @@ metadata: unit: year period: year label: Montana newborn credit child age limit - reference: - - title: PolicyEngine Montana newborn credit reform design - href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml index 29cf8fd3cac..2d25d308ea8 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/amount.yaml @@ -7,6 +7,3 @@ metadata: unit: currency-USD period: year label: Montana newborn credit amount - reference: - - title: PolicyEngine Montana newborn credit reform design - href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml index 8b489850bd1..a81b8445078 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/in_effect.yaml @@ -7,6 +7,3 @@ metadata: unit: bool period: year label: Montana newborn credit in effect - reference: - - title: PolicyEngine Montana newborn credit reform design - href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml index 46b8bf344e2..c1e45f001ae 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/amount.yaml @@ -7,6 +7,3 @@ metadata: unit: currency-USD period: year label: Montana newborn credit reduction amount - reference: - - title: PolicyEngine Montana newborn credit reform design - href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml index 6c4468f22e8..4a4e2530957 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/increment.yaml @@ -7,6 +7,3 @@ metadata: unit: currency-USD period: year label: Montana newborn credit reduction increment - reference: - - title: PolicyEngine Montana newborn credit reform design - href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml index d3379ec7a1b..3b3c9c14ca1 100644 --- a/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml +++ b/policyengine_us/parameters/gov/contrib/states/mt/newborn_credit/reduction/threshold.yaml @@ -26,6 +26,3 @@ metadata: label: Montana newborn credit phase-out threshold breakdown: - filing_status - reference: - - title: PolicyEngine Montana newborn credit reform design - href: https://github.com/PolicyEngine/policyengine-us/pull/7513 diff --git a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py index 6965a10b6dd..de224228234 100644 --- a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py +++ b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py @@ -17,7 +17,6 @@ class mt_newborn_credit_eligible_child(Variable): label = "Montana newborn credit eligible child" definition_period = YEAR defined_for = StateCode.MT - reference = "https://github.com/PolicyEngine/policyengine-us/pull/7513" def formula(person, period, parameters): p = parameters(period).gov.contrib.states.mt.newborn_credit @@ -32,7 +31,6 @@ class mt_newborn_credit_eligible(Variable): label = "Eligible for the Montana newborn credit" definition_period = YEAR defined_for = StateCode.MT - reference = "https://github.com/PolicyEngine/policyengine-us/pull/7513" def formula(tax_unit, period, parameters): has_earned_income = tax_unit("tax_unit_earned_income", period) > 0 @@ -59,7 +57,6 @@ class mt_newborn_credit(Variable): definition_period = YEAR unit = USD defined_for = "mt_newborn_credit_eligible" - reference = "https://github.com/PolicyEngine/policyengine-us/pull/7513" def formula(tax_unit, period, parameters): p = parameters(period).gov.contrib.states.mt.newborn_credit From 81e26bf28ae31d5bcf2065cf86abb4164c18d2eb Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Mon, 2 Mar 2026 13:39:26 +0100 Subject: [PATCH 5/7] Remove redundant in_effect guard and add mt_income_tax integration checks The in_effect check in the formula is redundant since create_mt_newborn_credit_reform already gates on it. Removed the guard and the test case that depended on it. Added mt_income_tax output checks to verify the credit flows through the full tax computation. Co-Authored-By: Claude Opus 4.6 --- .../mt/newborn_credit/mt_newborn_credit.py | 2 - .../mt/newborn_credit/mt_newborn_credit.yaml | 55 ++++++------------- 2 files changed, 16 insertions(+), 41 deletions(-) diff --git a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py index de224228234..8bd9edc26dc 100644 --- a/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py +++ b/policyengine_us/reforms/states/mt/newborn_credit/mt_newborn_credit.py @@ -60,8 +60,6 @@ class mt_newborn_credit(Variable): def formula(tax_unit, period, parameters): p = parameters(period).gov.contrib.states.mt.newborn_credit - if not p.in_effect: - return 0 qualifying_children = add( tax_unit, period, ["mt_newborn_credit_eligible_child"] ) diff --git a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml index 00163798c7e..15e379ade2f 100644 --- a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml +++ b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml @@ -4,7 +4,7 @@ - name: Case 1, single filer with newborn under income threshold. period: 2027 - absolute_error_margin: 0.01 + absolute_error_margin: 1 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true @@ -28,10 +28,12 @@ state_code: MT output: mt_newborn_credit: 1_000 + # Refundable credit exceeds tax liability, producing a negative mt_income_tax + mt_income_tax: -1_304 - name: Case 2, MFJ with newborn under income threshold. period: 2027 - absolute_error_margin: 0.01 + absolute_error_margin: 1 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true @@ -61,6 +63,8 @@ output: # AGI $100k < $120k threshold for MFJ mt_newborn_credit: 1_000 + # Baseline mt_income_tax ~$3,147 minus $1,000 refundable credit + mt_income_tax: 147 - name: Case 3, two newborns double credit. period: 2027 @@ -1018,37 +1022,9 @@ # credit = max($2,000 - $250, 0) = $1,750 mt_newborn_credit: 1_750 -# Reform Toggle Test - -- name: Case 36, reform not in effect by default. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 0 - # Non-MT Resident Test -- name: Case 37, non-MT resident gets zero. +- name: Case 36, non-MT resident gets zero. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1077,9 +1053,9 @@ # Integration Test -- name: Case 38, end-to-end credit flows through mt_refundable_credits. +- name: Case 37, end-to-end credit flows through to mt_income_tax. period: 2027 - absolute_error_margin: 0.01 + absolute_error_margin: 1 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit input: gov.contrib.states.mt.newborn_credit.in_effect: true @@ -1103,10 +1079,11 @@ state_code: MT output: mt_newborn_credit: 1_000 + mt_income_tax: -1_304 # Additional Edge Case Tests -- name: Case 39, self-employment income satisfies earned income requirement. +- name: Case 38, self-employment income satisfies earned income requirement. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1133,7 +1110,7 @@ output: mt_newborn_credit: 1_000 -- name: Case 40, unearned income only does not satisfy earned income requirement. +- name: Case 39, unearned income only does not satisfy earned income requirement. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1160,7 +1137,7 @@ output: mt_newborn_credit: 0 -- name: Case 41, adult-only tax unit gets zero credit. +- name: Case 40, adult-only tax unit gets zero credit. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1183,7 +1160,7 @@ output: mt_newborn_credit: 0 -- name: Case 42, MFJ full phase-out boundary at $140k. +- name: Case 41, MFJ full phase-out boundary at $140k. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1216,7 +1193,7 @@ # AGI $140k, excess = $20k, ceil($20k/$1k) = 20, reduction = $1,000 mt_newborn_credit: 0 -- name: Case 43, two newborns full phase-out requires $40k above threshold. +- name: Case 42, two newborns full phase-out requires $40k above threshold. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1248,7 +1225,7 @@ # base = $2,000, excess = $40k, ceil($40k/$1k) = 40, reduction = $2,000 mt_newborn_credit: 0 -- name: Case 44, negative SE income with zero employment income not eligible. +- name: Case 43, negative SE income with zero employment income not eligible. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit From 4c4c3dd6967e1652bf90bb5e9896fe91c091f31f Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Mon, 2 Mar 2026 13:47:55 +0100 Subject: [PATCH 6/7] Slim down MT newborn credit tests from 43 to 33 cases Remove 10 duplicate/redundant test cases that tested identical scenarios already covered by other cases. Co-Authored-By: Claude Opus 4.6 --- .../mt/newborn_credit/mt_newborn_credit.yaml | 336 ++---------------- 1 file changed, 30 insertions(+), 306 deletions(-) diff --git a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml index 15e379ade2f..9e11ece0942 100644 --- a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml +++ b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml @@ -99,34 +99,7 @@ # Age Eligibility Tests -- name: Case 4, child age 0 is eligible. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 1_000 - -- name: Case 5, child age 1 not eligible must be under 1. +- name: Case 4, child age 1 not eligible must be under 1. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -153,34 +126,7 @@ output: mt_newborn_credit: 0 -- name: Case 6, child age 2 not eligible. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: CITIZEN - person2: - age: 2 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 0 - -- name: Case 7, one newborn eligible one older child not. +- name: Case 5, one newborn eligible one older child not. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -211,7 +157,7 @@ output: mt_newborn_credit: 1_000 -- name: Case 8, child not claimed as dependent not eligible. +- name: Case 6, child not claimed as dependent not eligible. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -240,34 +186,7 @@ # SSN Requirement Tests - Child -- name: Case 9, child with SSN CITIZEN qualifies. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 1_000 - -- name: Case 10, child with SSN NON_CITIZEN_VALID_EAD qualifies. +- name: Case 7, child with SSN NON_CITIZEN_VALID_EAD qualifies. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -294,7 +213,7 @@ output: mt_newborn_credit: 1_000 -- name: Case 11, child with ITIN only OTHER_NON_CITIZEN not eligible. +- name: Case 8, child with ITIN only OTHER_NON_CITIZEN not eligible. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -321,63 +240,9 @@ output: mt_newborn_credit: 0 -- name: Case 12, child with no SSN NONE not eligible. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: NONE - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 0 - # SSN Requirement Tests - Filer -- name: Case 13, filer with SSN CITIZEN qualifies. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 1_000 - -- name: Case 14, filer with SSN NON_CITIZEN_VALID_EAD qualifies. +- name: Case 9, filer with SSN NON_CITIZEN_VALID_EAD qualifies. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -404,7 +269,7 @@ output: mt_newborn_credit: 1_000 -- name: Case 15, filer with ITIN only OTHER_NON_CITIZEN not eligible. +- name: Case 10, filer with ITIN only OTHER_NON_CITIZEN not eligible. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -431,34 +296,7 @@ output: mt_newborn_credit: 0 -- name: Case 16, filer with no SSN NONE not eligible. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: NONE - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 0 - -- name: Case 17, MFJ one spouse has SSN qualifies. +- name: Case 11, MFJ one spouse has SSN qualifies. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -489,7 +327,7 @@ output: mt_newborn_credit: 1_000 -- name: Case 18, MFJ neither spouse has SSN not eligible. +- name: Case 12, MFJ neither spouse has SSN not eligible. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -522,7 +360,7 @@ # Earned Income Requirement Tests -- name: Case 19, no earned income not eligible. +- name: Case 13, no earned income not eligible. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -549,7 +387,7 @@ output: mt_newborn_credit: 0 -- name: Case 20, exactly $1 earned income qualifies. +- name: Case 14, exactly $1 earned income qualifies. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -578,7 +416,7 @@ # Phase-out Tests -- name: Case 21, single at exactly threshold full credit. +- name: Case 15, single at exactly threshold full credit. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -606,7 +444,7 @@ # AGI $60k = threshold, no reduction mt_newborn_credit: 1_000 -- name: Case 22, single $1 above threshold one increment reduction. +- name: Case 16, single $1 above threshold one increment reduction. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -634,63 +472,7 @@ # ceil($1 / $1,000) = 1 increment, reduction = $50 mt_newborn_credit: 950 -- name: Case 23, single $500 above threshold one increment. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 60_500 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - # ceil($500 / $1,000) = 1 increment, reduction = $50 - mt_newborn_credit: 950 - -- name: Case 24, single $1000 above threshold one increment. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 61_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - # ceil($1,000 / $1,000) = 1 increment, reduction = $50 - mt_newborn_credit: 950 - -- name: Case 25, single $1001 above threshold two increments. +- name: Case 17, single $1001 above threshold two increments. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -718,7 +500,7 @@ # ceil($1,001 / $1,000) = 2 increments, reduction = $100 mt_newborn_credit: 900 -- name: Case 26, single last $50 of credit before full phase-out. +- name: Case 18, single last $50 of credit before full phase-out. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -746,7 +528,7 @@ # excess = $19,000, ceil($19,000/$1,000) = 19, reduction = $950 mt_newborn_credit: 50 -- name: Case 27, single exactly at full phase-out boundary. +- name: Case 19, single exactly at full phase-out boundary. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -774,35 +556,7 @@ # excess = $20,000, ceil($20,000/$1,000) = 20, reduction = $1,000 mt_newborn_credit: 0 -- name: Case 28, single well above full phase-out. - period: 2027 - absolute_error_margin: 0.01 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 100_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - # reduction exceeds credit, clamped to 0 - mt_newborn_credit: 0 - -- name: Case 29, MFJ at exactly threshold full credit. +- name: Case 20, MFJ at exactly threshold full credit. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -835,7 +589,7 @@ # AGI $120k = threshold for MFJ, no reduction mt_newborn_credit: 1_000 -- name: Case 30, MFJ $1 above threshold partial phase-out. +- name: Case 21, MFJ $1 above threshold partial phase-out. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -868,7 +622,7 @@ # AGI $120,001, excess = $1, ceil($1/$1,000) = 1, reduction = $50 mt_newborn_credit: 950 -- name: Case 31, MFJ above threshold partial phase-out. +- name: Case 22, MFJ above threshold partial phase-out. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -903,7 +657,7 @@ # Filing Status Threshold Tests -- name: Case 32, HOH phase-out uses $60k threshold. +- name: Case 23, HOH phase-out uses $60k threshold. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -931,7 +685,7 @@ # excess = $5,000, 5 increments, reduction = $250 mt_newborn_credit: 750 -- name: Case 33, MFS phase-out uses $60k threshold. +- name: Case 24, MFS phase-out uses $60k threshold. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -959,7 +713,7 @@ # excess = $3,000, 3 increments, reduction = $150 mt_newborn_credit: 850 -- name: Case 34, surviving spouse phase-out uses $120k threshold. +- name: Case 25, surviving spouse phase-out uses $120k threshold. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -989,7 +743,7 @@ # Phase-out with Multiple Children -- name: Case 35, two newborns with partial phase-out. +- name: Case 26, two newborns with partial phase-out. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1024,7 +778,7 @@ # Non-MT Resident Test -- name: Case 36, non-MT resident gets zero. +- name: Case 27, non-MT resident gets zero. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1051,39 +805,9 @@ output: mt_newborn_credit: 0 -# Integration Test - -- name: Case 37, end-to-end credit flows through to mt_income_tax. - period: 2027 - absolute_error_margin: 1 - reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit - input: - gov.contrib.states.mt.newborn_credit.in_effect: true - people: - person1: - age: 30 - is_tax_unit_head: true - employment_income: 40_000 - ssn_card_type: CITIZEN - person2: - age: 0 - is_tax_unit_dependent: true - ssn_card_type: CITIZEN - tax_units: - tax_unit: - members: [person1, person2] - filing_status: SINGLE - households: - household: - members: [person1, person2] - state_code: MT - output: - mt_newborn_credit: 1_000 - mt_income_tax: -1_304 - # Additional Edge Case Tests -- name: Case 38, self-employment income satisfies earned income requirement. +- name: Case 28, self-employment income satisfies earned income requirement. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1110,7 +834,7 @@ output: mt_newborn_credit: 1_000 -- name: Case 39, unearned income only does not satisfy earned income requirement. +- name: Case 29, unearned income only does not satisfy earned income requirement. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1137,7 +861,7 @@ output: mt_newborn_credit: 0 -- name: Case 40, adult-only tax unit gets zero credit. +- name: Case 30, adult-only tax unit gets zero credit. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1160,7 +884,7 @@ output: mt_newborn_credit: 0 -- name: Case 41, MFJ full phase-out boundary at $140k. +- name: Case 31, MFJ full phase-out boundary at $140k. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1193,7 +917,7 @@ # AGI $140k, excess = $20k, ceil($20k/$1k) = 20, reduction = $1,000 mt_newborn_credit: 0 -- name: Case 42, two newborns full phase-out requires $40k above threshold. +- name: Case 32, two newborns full phase-out requires $40k above threshold. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit @@ -1225,7 +949,7 @@ # base = $2,000, excess = $40k, ceil($40k/$1k) = 40, reduction = $2,000 mt_newborn_credit: 0 -- name: Case 43, negative SE income with zero employment income not eligible. +- name: Case 33, negative SE income with zero employment income not eligible. period: 2027 absolute_error_margin: 0.01 reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit From 94d3ebc57148d2dd23a9361b6463723736fe3cb8 Mon Sep 17 00:00:00 2001 From: David Trimmer Date: Mon, 2 Mar 2026 09:54:36 -0500 Subject: [PATCH 7/7] Add 3 edge case tests to MT newborn credit - Case 34: Child with SSN card type NONE not eligible - Case 35: Negative AGI with earned income still eligible - Case 36: Exactly $1,000 above threshold (ceiling boundary) Co-Authored-By: Claude Opus 4.5 --- .../mt/newborn_credit/mt_newborn_credit.yaml | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml index 9e11ece0942..fdd0bb63c46 100644 --- a/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml +++ b/policyengine_us/tests/policy/contrib/states/mt/newborn_credit/mt_newborn_credit.yaml @@ -975,3 +975,87 @@ state_code: MT output: mt_newborn_credit: 0 + +- name: Case 34, child with SSN card type NONE not eligible. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 40_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: NONE + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + mt_newborn_credit: 0 + +- name: Case 35, negative AGI with earned income still eligible. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 20_000 + short_term_capital_gains: -100_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + # AGI is negative due to capital losses, no phase-out applies + mt_newborn_credit: 1_000 + +- name: Case 36, single exactly $1000 above threshold one increment. + period: 2027 + absolute_error_margin: 0.01 + reforms: policyengine_us.reforms.states.mt.newborn_credit.mt_newborn_credit.mt_newborn_credit + input: + gov.contrib.states.mt.newborn_credit.in_effect: true + people: + person1: + age: 30 + is_tax_unit_head: true + employment_income: 61_000 + ssn_card_type: CITIZEN + person2: + age: 0 + is_tax_unit_dependent: true + ssn_card_type: CITIZEN + tax_units: + tax_unit: + members: [person1, person2] + filing_status: SINGLE + households: + household: + members: [person1, person2] + state_code: MT + output: + # ceil($1,000 / $1,000) = 1 increment, reduction = $50 + mt_newborn_credit: 950