Skip to content

Add dedicated South Carolina dependent exemption parameter#8691

Merged
PavelMakarchuk merged 3 commits into
PolicyEngine:mainfrom
DTrim99:sc-dependent-exemption-parameter
Jun 23, 2026
Merged

Add dedicated South Carolina dependent exemption parameter#8691
PavelMakarchuk merged 3 commits into
PolicyEngine:mainfrom
DTrim99:sc-dependent-exemption-parameter

Conversation

@DTrim99

@DTrim99 DTrim99 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

What this does

South Carolina's dependent exemption (§12-6-1140(13)) had no parameter of its own — both sc_dependent_exemption and sc_young_child_deduction read the young-child deduction's amount. This adds proper, separate parameters for the two distinct statutory provisions, each in its own folder:

  • gov.states.sc.tax.income.deductions.dependent_exemption.amount — §12-6-1140(13), a deduction for every dependent (read by sc_dependent_exemption).
  • gov.states.sc.tax.income.deductions.young_child.amount — §12-6-1160, the additional deduction for dependents under 6 (read by sc_young_child_deduction).

§12-6-1160 sets its amount equal to the §12-6-1140 amount, so both parameters carry identical values — but keeping them separate lets each be modelled/adjusted independently (e.g. in the Child Poverty Impact Dashboard).

No behavior change

Pure restructure — values are identical. A dependent under 6 still correctly receives both deductions (~$8,220 combined), which is real SC policy. The existing SC baseline tests pass unchanged:
sc_young_child_deduction.yaml (4) + sc_dependent_exemption.yaml (2) — 6 passed.

🤖 Generated with Claude Code

SC's dependent exemption (Section 12-6-1140(13)) had no parameter of its own —
both sc_dependent_exemption and sc_young_child_deduction read the young child
deduction's amount param (gov.states.sc.tax.income.deductions.young_child.amount),
which is backwards: Section 12-6-1160 defines the young child deduction as
"equal to the dependent exemption amount," so the amount belongs to 12-6-1140.

Move the amount param to gov.states.sc.tax.income.deductions.dependent_exemption.
amount, point sc_dependent_exemption at it, and have sc_young_child_deduction
reference it (keeping its own ineligible_age). No change to calculated values —
the existing SC baseline tests pass unchanged.

This also lets the amount be adjusted independently of the young child
deduction's age gate (useful for the Child Poverty Impact Dashboard).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e0c18f7) to head (dc91deb).
⚠️ Report is 41 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #8691    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           18         1    -17     
  Lines          292        13   -279     
==========================================
- Hits           292        13   -279     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Per review, give the South Carolina young child deduction (Section 12-6-1160)
its own amount parameter rather than referencing the dependent exemption amount.
There are now two independent parameters in their correct folders:
- gov.states.sc.tax.income.deductions.dependent_exemption.amount (Section 12-6-1140)
- gov.states.sc.tax.income.deductions.young_child.amount (Section 12-6-1160)

Values are identical (the statute sets 1160 equal to 1140), so no calculated
values change; the existing SC baseline tests pass unchanged. Keeping them
separate lets the two be modelled independently.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DTrim99 DTrim99 requested a review from PavelMakarchuk June 19, 2026 20:19

@PavelMakarchuk PavelMakarchuk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Program Review — Add dedicated South Carolina dependent exemption parameter

Scope: SC income tax parameter restructure (no-op), 2019–2025 · CI: ✅ 27/27 passing

Clean, well-justified restructure: it splits the shared parameter so sc_dependent_exemption (§12-6-1140(13)) and sc_young_child_deduction (§12-6-1160) each read their own dedicated parameter, with identical values and no calculated-value change. The statute is verified (§12-6-1140(13) is a genuine per-dependent exemption; §12-6-1160 sets the young-child deduction equal to it; the two stack), references corroborate every value 2019–2025, and the variable repoint is wired correctly with no dangling references. Requesting changes to add test coverage that locks in the separation this PR enables before merge.

Requested changes

  1. Add a test that guards the split. Because both parameters currently carry identical values, the existing sc_dependent_exemption.yaml (2 cases, both 2022) would pass even if the variable still read the old young_child parameter — so nothing actually pins the repoint. Since the whole point of the split is to let the two diverge (Child Poverty Impact Dashboard), please add a case that exercises the dependent exemption against its own parameter so future drift is caught.

  2. Test the stacking claim. The PR states a dependent under 6 receives both deductions (~$8,220 combined), but no test combines them — each existing test exercises only one provision. Add a single case asserting both the dependent exemption and the young-child deduction fire for an under-6 dependent, to lock in the headline behavior.

  3. Add per-year symmetry (lower priority). sc_dependent_exemption is tested only at 2022 while young_child covers 2022 + 2025. Now that the dependent exemption has its own parameter, add a 2025 dependent-exemption case for symmetry.

Suggestions (non-blocking, pre-existing)

  • The SC statute text reads "four thousand one hundred ten" ($4,110) for the base, while the 2019 parameter value is 4_100 (carried unchanged into the new file, not introduced here). Worth a one-time confirmation against the earliest SC1040 instructions.
  • The 2022 reference points to the SC1040 form (p.2) rather than the instructions — confirm the value appears there.

Validation Summary

Check Result
Regulatory Accuracy ✅ Statute verified — §12-6-1140(13) per-dependent exemption; §12-6-1160 equal to it; the two stack
Reference Quality ✅ Every value 2019–2025 corroborated; new file complete metadata + references; young_child edits reorder (don't weaken) citations
Code Patterns ✅ Variable repointed correctly; no dangling references; values identical; changelog present; folder convention correct
Test Coverage ⚠️ No test exercises the split independently; stacking case untested
CI Status ✅ Passing (27/27)

To auto-fix: /fix-pr 8691

🤖 Generated with Claude Code

- Add a parameter-override test proving sc_dependent_exemption reads the
  new dependent_exemption parameter, not young_child (would yield 18000
  vs 2000 if it still read young_child)
- Add a stacking test confirming an under-6 dependent receives both the
  dependent exemption and the young-child deduction independently
- Add a 2025 case for per-year symmetry

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DTrim99

DTrim99 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

Fixes Applied

Addressed the review (no critical issues; CI was green throughout). All changes are test additions — no model/parameter logic changed.

Should-address

  • Repoint pin — added a parameter-override test that sets dependent_exemption.amount and young_child.amount to distinct values and asserts sc_dependent_exemption follows the new dependent_exemption parameter (yields 18,000 = 2×9,000). Confirmed it would fail against the old young_child parameter (would produce 2,000), so the repoint is genuinely pinned.
  • Stacking — added a test confirming an under-6 dependent receives both the dependent exemption and the young-child deduction independently for the same household.

Suggestion

  • Added a 2025 case for per-year symmetry.

Out of scope (pre-existing, untouched)

  • The $4,110-vs-$4,100 statute value and the 2022 form-vs-instructions reference are pre-existing and not introduced by this PR; left for a separate change.

Verification

  • sc_dependent_exemption.yaml: 5/5 pass; SC deductions+exemptions regression: 19/19 pass.
  • No expected-value corrections were needed.
  • ruff format + ruff check: clean.

@PavelMakarchuk PavelMakarchuk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed after the latest commit — all three requested test changes are addressed:

  • Case 3 (repoint pin): overrides both parameters to distinct values and asserts the variable reads dependent_exemption (2 × $9,000 = $18,000), so a future mis-pointing now fails.
  • Case 4 (stacking): an under-6 dependent gets both sc_dependent_exemption and sc_young_child_deduction ($4,930 each, 2025), proving §12-6-1140 / §12-6-1160 stack.
  • Case 5 (2025 symmetry): 3 dependents → $14,790.

CI is green. Approving. 🤖

@PavelMakarchuk PavelMakarchuk merged commit b271748 into PolicyEngine:main Jun 23, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants