Skip to content

Fix Virginia Spouse Tax Adjustment wrongly applied to Social Security recipients#8744

Open
PavelMakarchuk wants to merge 3 commits into
mainfrom
fix-va-sta-social-security
Open

Fix Virginia Spouse Tax Adjustment wrongly applied to Social Security recipients#8744
PavelMakarchuk wants to merge 3 commits into
mainfrom
fix-va-sta-social-security

Conversation

@PavelMakarchuk

@PavelMakarchuk PavelMakarchuk commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #8743. Virginia's Spouse Tax Adjustment (STA) was wrongly granted to couples where one spouse's only income is Virginia-exempt (e.g. Social Security, railroad retirement, unemployment, military/disability income), because the per-person Virginia AGI used by the STA worksheet (va_agi_less_exemptions_person) did not subtract that spouse's exempt income.

Root cause

va_agi_person prorated all subtractions by each person's federal AGI share. With a high-earner spouse, exempt-income subtractions were shifted onto that spouse, leaving the exempt-income-only spouse's separate VAGI inflated by income Virginia actually exempts — pushing the couple over the STA eligibility threshold.

Primary source

Virginia's "Worksheet for Determining Separate Virginia Adjusted Gross Income" (Form 760 instructions) attributes each subtraction to the spouse who received the income (STEP 2, Lines 14–17), then sets each spouse's separate VAGI.

Fix

Introduce va_subtractions_person, which attributes every Virginia subtraction to the recipient spouse, and have va_agi_person subtract it directly (federal AGI per person, less that person's own subtractions, plus prorated additions).

Per-person attribution covers: age deduction, taxable Social Security, Tier 1 railroad, unemployment, US government interest, military basic pay, disability income, federal/state-employee salary, and the military benefit subtraction. The National Guard subtraction (capped on the household total) is allocated by each person's military service income; the 529 deduction (a household contribution, not a person's income — so it cannot cause this bug) is prorated by federal AGI share.

The per-person subtractions sum exactly to the tax-unit va_subtractions across every income type tested, so tax-unit va_agi (and all downstream tax-unit results) are unchanged. The existing tax-unit subtraction variables are untouched.

Verification (issue scenario: VA MFJ, both age 70, head wages $125,714, interest $511 split, SS $28,783 split)

Before After
spouse va_agi_less_exemptions_person $8,730.73 0
va_spouse_tax_adjustment $195.48 0
va_income_tax $5,599.76 $5,795.24

Also verified STA → $0 for a spouse whose only income is unemployment, railroad, disability, military retirement, military basic pay, or US government interest; and that a genuine two-earner couple still receives the STA ($257.50). The per-person/tax-unit invariant (Σ va_subtractions_person == va_subtractions, Σ va_agi_person == va_agi) holds across all of these.

Tests

  • va_subtractions_person cases (unemployment, disability, military basic pay attribution)
  • va_agi_person cases (Social-Security-only and unemployment-only spouse → separate VAGI 0)
  • Integration cases: Social-Security-only and unemployment-only spouse → STA 0 / not eligible; two-earner couple → STA retained
  • Full VA baseline suite: 458 passed (incl. va_agi_share → VA EITC) — no regressions

🤖 Generated with Claude Code

… recipients

va_agi_person prorated all non-age subtractions (including the Social Security
subtraction) by federal AGI share, shifting a Social-Security-only spouse's
exempt benefits onto the higher-income spouse and inflating the first spouse's
separate VAGI. This pushed couples over the Spouse Tax Adjustment eligibility
threshold.

Per Virginia's "Worksheet for Determining Separate Virginia Adjusted Gross
Income" (Form 760 instructions, Lines 8 and 15), each spouse's own taxable
Social Security is attributed to and subtracted from that spouse. Apply the
taxable Social Security subtraction at the person level and prorate only the
remaining subtractions; the per-person values still sum to the tax unit VAGI.

Adds a regression integration test (the issue scenario) and a person-level
va_agi_person test; both fail before the fix and pass after.

Closes #8743

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

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (90fbe7a) to head (8a0002e).
⚠️ Report is 42 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #8744    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           19         2    -17     
  Lines          308        55   -253     
  Branches         0         1     +1     
==========================================
- Hits           308        55   -253     
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.

PavelMakarchuk and others added 2 commits June 24, 2026 13:11
…arden tests

Self-review found the Social-Security-only fix left the same bug live for other
Virginia-exempt income types. Virginia's separate-VAGI worksheet attributes all
subtractions to the recipient spouse (Lines 14-17), so a spouse whose only
income is unemployment or railroad retirement was likewise pushed into Spouse
Tax Adjustment eligibility.

Attribute every person-level Virginia subtraction (taxable Social Security,
railroad retirement, unemployment compensation) plus the age deduction to the
recipient spouse, and prorate only the remaining tax-unit-level subtractions by
federal AGI share. The per-person values still sum to the tax-unit VAGI.

Tests: add unemployment regression cases (integration + person-level), an
over-correction guard confirming a genuine two-earner couple still receives the
adjustment, and an explicit eligible=false assertion; tighten the integration
margin so a zero adjustment is asserted exactly.

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

Completes the per-person attribution: rather than handling only Social
Security, railroad, and unemployment, introduce va_subtractions_person which
attributes every Virginia subtraction to the spouse who received the underlying
income, mirroring the separate-VAGI worksheet (Lines 14-17). va_agi_person now
subtracts this person-level total directly.

Covered per person: age deduction, taxable Social Security, Tier 1 railroad,
unemployment, US government interest, military basic pay, disability income,
federal/state employee salary, and military benefit subtractions. The National
Guard subtraction (capped on the household total) is allocated by each person's
military service income, and the 529 deduction (a household contribution, not a
person's income, so it cannot cause the bug) is prorated by federal AGI share.

The per-person subtractions sum exactly to the tax-unit va_subtractions across
all income types (verified), so tax-unit va_agi is unchanged. Adds a
va_subtractions_person test and updates the legacy va_agi_person cases to the
new per-person dependency. Full VA suite: 458 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PavelMakarchuk PavelMakarchuk requested a review from hua7450 June 24, 2026 21:00
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.

Virginia Spouse Tax Adjustment wrongly applied to Social Security recipients (per-person VAGI includes VA-exempt SS)

1 participant