Skip to content

Fix Arkansas Status 4 proration and gambling loss attribution - #10222

Open
MaxGhenis wants to merge 5 commits into
mainfrom
ar-gambling-followup-tests
Open

MaxGhenis wants to merge 5 commits into
mainfrom
ar-gambling-followup-tests

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #9636. Adds official Arkansas games-of-skill references, fixes Status 4 itemized deduction proration, limits the gambling loss deduction to filers on the Arkansas return, and expands regression coverage.

  • References. gov.states.ar.tax.income.gross_income.sources.{joint,individual} comment that winnings from Arkansas electronic games of skill are not income "(Ark. Code § 26-51-1310(f), Act 732 of 2007); DFA applies this to winnings before July 1, 2019", but neither source was in metadata.reference. Added:
    • Act 732 of 2007, § 8, enacting § 26-51-1310(f) (arkleg 732.pdf#page=5, which has (f)(1) "Gaming winnings are not includable as income" and (f)(3) losses not deductible).
    • DFA Subject 208 (rev. 2/24/2023), the source for the July 1, 2019 cutoff.
  • Gambling loss deduction. Count winnings and losses only for filers on the Arkansas return. The paired dependent-winnings cases verify the deduction, taxable income, and final tax. The property tests check the exact cap, bounds, monotonicity, and the absence of a 2% floor for both itemization paths.
  • Status 4 proration. Round the primary filer’s AGI share to the nearest whole percent and give the spouse the remainder, following AR3 lines 30–35. Use half-up at exact ties, inferred from DFA’s dollar-rounding example. The 77% case allocates $53,900 and $16,100 from $70,000. The tests cover both primary assignments at an exact half-percent share and primary AGI one dollar to either side.
  • 2014 case comment. The standalone deduction test guards against adding a year restriction. The 2014 regular tax table works with directly supplied taxable income. The full household calculation needs Arkansas gross-income source lists, which start in 2015.

Tests

This PR passed 173 scoped cases across 13 YAML and three Python files on Linux. The same 13 YAML files passed 128 cases after merging main at version 2.156.7.

  • ar_gambling_winnings_and_losses.yaml and ar_gambling_loss_deduction.yaml passed 28 cases. The winnings-and-losses file contains main’s 10 cases and this PR’s eight.
  • test_ar_gambling_properties.py: 35 passed.
  • test_ar_gross_income_source_line_comments.py: 2 passed.
  • The eight Python spouse-label checks in test_state_tax_head_spouse_swap_invariance.py pass. Two paired 2025 Status 4 YAML cases verify $1,374 and $1,379 in Arkansas tax for the two primary assignments at an exact half-percent share.
  • The 2021, 2022 and 2026 mortgage premium cases in ar_itemized_deductions_indiv.yaml each give $10,000 of Arkansas itemized deductions. A two-spouse 2021 case verifies that the formula subtracts $2,000 in premiums from $12,000 of federal interest before splitting the $10,000 pool into $4,600 and $5,400.

axiom: needed

The existing gambling income and loss encoding debt is tracked in TheAxiomFoundation/rulespec-us#1417.

🤖 Generated with Claude Code

MaxGhenis and others added 2 commits October 14, 2026 02:22
…uction tests

Follow-up to #9636 from its review:
- Add Act 732 of 2007, § 8 (Ark. Code § 26-51-1310(f)) and DFA Subject 208 to
  the Arkansas gross income source references; the YAML comment already cites
  them for the electronic games of skill exclusion.
- The no-2%-floor property test now checks ar_itemized_deductions_indiv as well
  as _joint, for 2019 and 2025, and drops AGI 0, where a 2% floor is invisible.
- Pin status-4 proration of pooled itemized deductions, gambling losses
  included, by AGI (AR3 lines 31-35).
- Say that the 2014 case guards the formula only: Arkansas income tax is
  computed from 2015, where its parameters are backdated to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
@MaxGhenis MaxGhenis changed the title Cite the Arkansas games-of-skill sources and tighten the gambling deduction tests Fix Arkansas status-4 deduction proration and update gambling sources and tests Nov 29, 2026
policyengine_us/variables/gov/states/ar/tax/income/deductions/itemized/ar_itemized_deductions_indiv.py: Keep the Arkansas references and subtract disallowed interest before splitting deductions by the rounded primary share and spouse remainder.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.67%. Comparing base (8999568) to head (5add9a9).
⚠️ Report is 410 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##              main   #10222      +/-   ##
===========================================
- Coverage   100.00%   97.67%   -2.33%     
===========================================
  Files            1        2       +1     
  Lines           24       43      +19     
  Branches         0        1       +1     
===========================================
+ Hits            24       42      +18     
- Partials         0        1       +1     
Flag Coverage Δ
unittests 97.67% <100.00%> (-2.33%) ⬇️

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.

MaxGhenis and others added 2 commits December 1, 2026 05:27
Clarify half-up Status 4 rounding and cover both primary assignments, dependent gambling activity, and mortgage premium exclusion before proration.

Co-Authored-By: GPT-6.2 Sol <noreply@openai.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis MaxGhenis changed the title Fix Arkansas status-4 deduction proration and update gambling sources and tests Fix Arkansas Status 4 proration and gambling loss attribution Dec 1, 2026

@DTrim99 DTrim99 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

Base repository: PolicyEngine/policyengine-us
PR number: 10222
Reviewed head SHA: 5add9a9
Merge base SHA: 094934a
Mode: full
Scope: changed behavior and affected dependencies
Source manifest: /private/tmp/policyengine-command-runs/ea33c0bb2b64/pr-10222-review-sources.json
Review status: COMPLETE

Source Documents

Critical

None.

Should Address

A1 — Axiom line uses the external-contributor form for a maintainer PR and leaves the Status 4 change unmapped (OPEN)

  • Severity: SHOULD ADDRESS (repository-standard issue; consistent with how this run graded the axiom line on PR 10670).
  • Location: PR body, line axiom: needed.
  • Trigger: the CLAUDE.md "Axiom Parity" rule (snapshot CLAUDE.md:151-155) requires one of <legal id> encoded-correct | <rulespec PR> encoded | <rulespec issue> queued | n/a: <reason>. It reserves axiom: needed for "an external contributor [who] cannot complete the Axiom work".
  • Expected: the PR author (MaxGhenis) has author_association: MEMBER (gh api), so a conforming value is needed.
    • TheAxiomFoundation/rulespec-us#1417 is OPEN and labelled pe-parity. It records a blocker (blocked_primary_source for the Title 26 corpus). It covers Arkansas gambling winnings and losses (§§ 26-51-404, 26-51-424(a)(2)(B)) and the § 26-51-1310(f) games-of-skill exclusion. That supports axiom: TheAxiomFoundation/rulespec-us#1417 queued for the gambling parts.
    • #1417's title and body do not cover the Status 4 itemized-deduction proration (AR3 lines 31–35 rounding/remainder), which this PR fixes. No dependent-attribution companion case appears either.
  • Observed: axiom: needed, plus a prose pointer to #1417 described as existing "encoding debt".
  • Impact: no modeled-output effect. Parity tracking for the changed Status 4 rule is missing, and the line does not meet a required PR-body standard.
  • Fix: use the queued form. Extend #1417, or open a dispatch-ready pe-parity issue, to include AR3 lines 31–35 (2025 instructions p. 22) and a dependent-winnings companion case built from external values.
  • Source: snapshot CLAUDE.md and CONTRIBUTING.md#axiom-parity; gh issue view 1417 -R TheAxiomFoundation/rulespec-us.

Coordinator assessment: This has no effect on model output. I've rated it should-address to match how this round rated the same Axiom-line problem on #10670. Using TheAxiomFoundation/rulespec-us#1417 queued and extending #1417, or opening a companion issue, to cover AR3 lines 31-35 would resolve it.

Suggestions

S1 — The games-of-skill loss bar (§ 26-51-1310(f)(3)) is cited only on the gross-income parameters, not on the deduction it limits (OPEN)

  • Severity: SUGGESTION (documentation).
  • Location: policyengine_us/variables/gov/states/ar/tax/income/deductions/itemized/ar_gambling_loss_deduction.py (reference tuple and formula comment). Compare parameters/gov/states/ar/tax/income/gross_income/sources/{individual,joint}.yaml, where the PR adds the Act 732 reference titled "...their losses are not deductible".
  • Trigger: a TY2015–2019 household whose gambling_losses include electronic-games-of-skill wager losses incurred before July 1, 2019.
  • Expected: under § 26-51-1310(f)(3), those losses are not deductible. The deduction variable should say, as the gross-income comment does, that the single input cannot separate them.
  • Observed: the deduction counts all filer gambling losses up to winnings. Its comment and references are silent on (f)(3), and the model has no separate input.
  • Impact: no change to the tested values. This is a known input limitation that is documented on one side only.
  • Source: Act 732 of 2007 § 8, physical p. 5; DFA Subject 208.

S2 — swap-invariance test still claims every state's tax is label-invariant, which the PR now deliberately breaks for Arkansas Status 4 ties (OPEN)

  • Severity: SUGGESTION
  • Location: policyengine_us/tests/core/test_state_tax_head_spouse_swap_invariance.py:1-9 (module docstring) and :46-47 (check 1), together with :515-518. The PR changed only the comment at check 1.
  • Trigger: an Arkansas married couple filing separately on the same return (Status 4) who itemize, with an AGI share of exactly k.5%. The PR's own paired YAML cases (ar_gambling_winnings_and_losses.yaml, the 62.5% and 37.5% primary cases) give $1,374 and $1,379 for the two labellings.
  • Expected: the docstring states the exception, and the assertion excludes exact Arkansas Status 4 ties or checks them separately.
  • Observed: the docstring still says swapping labels "must leave each state's income tax unchanged". Check 1 still asserts equality to the cent for every sampled couple. The test passes at head only because the derandomized and seeded draws contain no Arkansas Status 4 itemizer with an exact half-percent share.
  • Impact: no output or behavior impact. If someone adds a crafted edge case at such a share, or a Hypothesis upgrade changes the derandomized examples, the test fails falsely, and the module documentation misstates the intended model behavior.
  • Fix: one docstring sentence, plus an exclusion or a separate tie assertion.

Evidence Gaps

No material gaps reported.

Notes

  • The model changes, tests and new references match Arkansas law and the DFA forms. Status 4 filers pool both spouses' itemized deductions; the primary filer takes their AGI share rounded to the nearest whole percent (2025 AR3 instructions, p. 22), and the spouse takes the remainder. Gambling losses are limited to winnings with no 2% floor (Ark. Code § 26-51-424(a)(2)(B)), and both spouses' amounts pool on one return. Dependents are left out, which matches how both Arkansas AGI variables already zero a dependent's income. Winnings from electronic games of skill are excluded under § 26-51-1310(f) (Act 732 of 2007), and DFA applies that only to winnings before July 1, 2019.
  • The remainder method fixes a real over-allocation. With 45.5% and 54.5% shares, the old formula gave out 101% of a $10,000 pool ($4,600 + $5,500).
  • No source says which way an exact half-percent tie rounds. The PR rounds it up, inferring that from DFA's dollar-rounding example, and says so.

Validation Summary

Local tests at the reviewed head (review venv, policyengine-core 3.37.2, matching uv.lock; imports resolved to the snapshot): 851 passed and 0 failed. They cover the four changed Python test files and all 55 Arkansas income tax YAML files. Every changed branch has a YAML case that fails on the base code. The property tests use a fixed grid and the swap test is seeded, so both are deterministic. The policy review re-derived every new expected value, including the tax-table rows and credits, and a diagnostic run reproduced the PR's $1,374 and $1,379. Sources: 7, and the manifest check passed. CI: 37/37 checks pass at 5add9a9.

Timing

setup seconds: 5.00s; scope seconds: 60.00s; parallel review seconds: 323.30s; policy role seconds: 323.30s; code role seconds: 297.30s; adjudication seconds: 120.00s; consolidation cleanup seconds: 34.50s; elapsed seconds: 516.00s

Review Severity

COMMENT. Open findings: 0 critical, 1 should address, 2 suggestions.

This branch has not been deployed

No deployments
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