Repository navigation
Tax Maryland's capital gains surtax on net capital gain as the Internal Revenue Code defines it - #9898
Tax Maryland's capital gains surtax on net capital gain as the Internal Revenue Code defines it#9898MaxGhenis wants to merge 6 commits into
Conversation
Md. Code, Tax-General 10-105(a)(3) taxes an additional 2% of "net capital gain, as defined and determined under the Internal Revenue Code" included in Maryland AGI, less gain from excepted assets; (a)(4) applies it when federal AGI is over $350,000. Technical Bulletin No. 58 gives the IRC 1222(11) definition: net long-term capital gain over net short-term capital loss. The model summed every tax unit member's long- and short-term gains, subtracted the capital loss deduction again, left out capital gain distributions, and tested Maryland AGI against the threshold. - md_net_capital_gain (new, Form 502CG line 1): the head and spouse's max(0, min(Schedule D line 15, line 16)), with distributions reported without Schedule D floored per person. A net short-term gain and qualified dividends are not part of it. - md_capital_gains_surtax_excepted_gain (new input, Form 502CG line 8). - md_capital_gains_surtax: 2% of max(0, line 1 - line 8) (line 9). - md_capital_gains_surtax_applies: federal AGI over the threshold. - Parameter references to the statute, ch. 604 and the 2025 forms. Tests: YAML cases with Schedule D and Form 502CG line comments, including the Technical Bulletin 58 example (line 9 = $168,000); property tests with a differential against the federal net_capital_gain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9898 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 4
Lines 76 58 -18
Branches 2 1 -1
=========================================
- Hits 76 58 -18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR Review: Tax Maryland's capital gains surtax on net capital gain as the Internal Revenue Code defines itPR #9898 (author: MaxGhenis, head SummaryThe PR rebuilds Maryland's 2% capital gains surtax (Form 502 line 21b) on the statutory base.
The law and the code agree:
Two documentation-level items need a fix before approval:
Neither changes a result. Critical (must fix)None. Should address1. Two new variable references point to pages that don't show what the title cites.
2. The test file says the deterministic grid "runs without Hypothesis", but without Hypothesis the whole file is skipped.
Suggestions
Verified correct
Axiom line assessmentValid
CI statusAll green: 37/37 checks pass ( Branch status
Verdict: REQUEST_CHANGES |
DTrim99
left a comment
There was a problem hiding this comment.
The surtax base is right: net capital gain under IRC § 1222(11), the treatment of capital gain distributions and qualified dividends, the strict federal AGI threshold, and line 9 (TB-58 gives 3,360) all check out, local tax is untouched, and rulespec-us#1518 is dispatch-ready. Two should items (see the comment above): S1, two reference anchors don't show what their titles cite (booklet line 21b is on #page=22, and the TB-58 example is on p. 3), so use one reference per page and fix the PR body's anchor too; and S2, the invariants file says the grid runs without Hypothesis, but the module-level importorskip skips the whole file, so split the module or correct the comment and the PR body.
PR Review (round 2): Tax Maryland's capital gains surtax on net capital gain as the Internal Revenue Code defines itPR #9898 (author: MaxGhenis). Head SummaryBoth round-1 should-address findings and all nine suggestions are fixed.
There are no new critical or should-address findings. Three suggestions remain:
CI. 25 of 27 checks pass. The two failures are one ratchet failure on Prior findings
S1 details
I checked the page text for each: Line 20a is on booklet p. 21 and Line 21b on p. 22. TB-58 p. 2 has "the dwelling sold for less than $1,500,000", and the Jane McDonald example is on p. 3. S2 details
Suggestion 4 details
New findingsCritical (must fix)None. Should addressNone. Suggestions1. Merge the per-page reference entries into one entry per document, following the house convention.
2. Update the source-conflict backlog item this PR makes stale.
3. Refresh the PR body's Validation section after the next merge with
VerifiedLaw (re-checked against the sources)
Hand checks of every new or changed expectation
The optional-Hypothesis change
Other checks
Axiom line assessmentValid rulespec-us#1518 meets every requirement:
rulespec-us#1490 (the § 852(b)(3)(B) dependency) is OPEN and labelled CI status25 of 27 checks pass; 2 fail (run 39531581561 at
Branch status
Verdict: APPROVE |
DTrim99
left a comment
There was a problem hiding this comment.
Round 2: all prior findings are fixed. The reference anchors are corrected, and the Hypothesis split means the grid runs without it. The law re-checks against TB-58, Form 502CG and ch. 604 s. 34, and the new witnesses hand-check. The two red checks are only the known FL/SD LIHEAP ratchet failure (no MD file listed; the run predates #10334), so merge main and re-run. Three suggestions, including merging the per-page reference split I asked for in round 1 back into one entry per document, per CLAUDE.md. Full report in the comment above.
Change
Maryland's capital gains surtax now uses IRC § 1222(11) net capital gain and the strict federal AGI threshold in Md. Code, Tax-General § 10-105(a)(3)–(4). A positive net short-term gain does not enlarge the surtax base; a net short-term loss reduces it. Capital gain distributions reported without Schedule D are included, qualified dividends are excluded, and only the head and spouse contribute capital income.
md_net_capital_gaincomputesmax(0, min(L15, L16)), where L15 is the filers' net long-term capital gain including distributions reported without Schedule D, and L16 adds their net short-term gain or loss. Distributions are floored per person; distributions and carryovers already inside Schedule D net long-term gain are not counted twice.md_capital_gains_surtax_appliestests federal AGI strictly above the parameterized threshold ($350,000 under current law), regardless of filing status. Maryland additions or subtractions do not move a filer across that threshold.md_capital_gains_surtax_excepted_gainis a tax-unit input for the total excepted gain on Form 502CG line 8. Negative supplied amounts are treated as zero.max(0, md_net_capital_gain - max(0, excepted_gain)). It remains part of state income tax before credits. The county tax base is unchanged.For example, long-term gain of $100,000 plus short-term gain of $50,000 yields a $2,000 surtax for an eligible filer; short-term gain alone yields none. Technical Bulletin 58's example gives
(610,000 - 442,000) × 0.02 = 3,360.Statute and form interpretation
The controlling base is Md. Code, Tax-General § 10-105(a)(3), which incorporates the Internal Revenue Code's definition of net capital gain. 26 U.S.C. § 1222(11) and Technical Bulletin 58, section I define that amount as net long-term capital gain less net short-term capital loss. Capital gain distributions receive long-term treatment under 26 U.S.C. § 852(b)(3)(B). Qualified dividends are added only for the separate federal § 1(h) calculation.
Form 502CG's instructions instead direct residents to Form 502 line 1c, which uses federal Form 1040 line 7a (resident booklet, page 13). That figure also includes positive net short-term gain. This implementation follows the statute and TB-58; the choice is explicit in
md_net_capital_gaindocumentation and the witness tests.Further references:
Validation
Final head
49558d1f4d93accf947a0df3b7d80bca16c47cdfmerges upstream/main7545b2c92ffb30d18615ff64d5e573627777733ain a real merge commit and was pushed fast-forward. This final merge includes release metadata and #10003's federal mortgage-deduction changes. Maryland's income-tax variables, parameters, YAML tests and both Maryland Python test files are byte-identical to tested head6e3b0d0605ee867b3bd02172e331d49b07c1cb81. The complete policy tree differs, however, and mortgage deductions can affect Maryland itemized deductions indirectly. Post-merge functional validation is pending; the results below belong to the pre-merge tested head.test_source_conflicts.py::test_conflict_sounding_comments_do_not_grow, names four Florida LIHEAP paths and one South Dakota LIHEAP path. Those five paths and the guard are unchanged in final head; no Maryland path was named. The newer pre-merge Python Rest job had not completed at the final check, and final-head CI remains pending.6e3b0d0, one file per foreground CLI process with all required thread caps set to four: 7 files / 61 cases passed, including all 39 capital-gains cases and 22 other income-tax cases. 5 CLIs exited cleanly. The surtax and applicability files reported all 27 + 5 cases passed, then required cleanup interruption and reaping (actual child exits −2). The controller reached its cutoff and reaped a subsequent incomplete file, exiting 124. 43 files / 205 cases remain incomplete locally. No assertion failure was reported in the completed files.ModuleNotFoundError: 2 passed in 606.73 seconds, clean exit 0; total process elapsed time 1,673.00 seconds. The normal Hypothesis test was verified by CI rather than a completed local run.make formatleft 7,148 files unchanged and Ruff lint passed. The authored diff's whitespace check against merged main and the unstaged whitespace check passed. No local microsimulation was run.The Python grid and generated properties check netting identities, dependent invariance, monotonicity, the federal differential, and the surtax's single insertion into state tax; the YAML files hold policy witnesses. This revision retains the existing two deterministic checks and moves the existing generated property into its own optional-dependency module, with 25 Hypothesis examples unchanged. The split does not increase the Python test count or add CI runners. Generation is derandomized with the slow-generation and data-size health checks suppressed.
Coverage includes the statute-first witnesses (positive short-term gain, short-term gain only, long-term loss with short-term gain, federal versus Maryland AGI, and TB-58's example), negative and excessive excepted gain, a head-of-household filer, and a 2029 case.
Response to @DTrim99
surtax_appliesreferences.md_capital_gains_surtax_applies & (md_net_capital_gain > 0). The PE applicability variable intentionally tests the federal AGI threshold alone. Corrected Step 2 in the existing rulespec-us#1518 issue body to use this conjunction; all other issue-body text was preserved.derandomize=Trueand suppressedHealthCheck.too_slowandHealthCheck.data_too_large.md_net_capital_gain.documentation.Limits and parity follow-up
Excepted-asset categories are supplied as one aggregate input; their sale-price, holding-period and other qualifications are not inferred from household data. Maryland subtractions that specifically remove capital gain from Maryland AGI (including the listed U.S.-obligation, MDOT-acquisition and race-course provisions), nonresident allocation, and fiduciary returns remain outside this change.
In rulespec-us#1518, Step 2 now maps
additional_capital_gain_tax_appliestomd_capital_gains_surtax_applies & (md_net_capital_gain > 0)and the tax output directly tomd_capital_gains_surtax. This avoids false mismatches for the zero-net-capital-gain cases B, C and E.The source-conflict registration required by current contributor guidance needs a separate
rulespec-usPR. This assignment permits one PR, so a concrete registration handoff has been prepared for the hub. Registration remains pending: the existing candidate is unreviewed and is not registration, and this revision changes neither source-conflict markers nor the vendored pin.axiom: TheAxiomFoundation/rulespec-us#1518 queued for Md. Code, Tax-General § 10-105(a)(3)–(4).
us-md/statutes/gtg/10-105.yamlencodes the 2% rate and the $350,000 federal AGI threshold but defersadditional_capital_gain_tax. The issue is dispatch-ready: verbatim law, required outputs, a pasteablereview_finding, and 11 companion tests from the statute, TB-58 and Form 502CG. It is blocked only because the OpenAI-billed signed re-encode needs approval. The base it imports,us:statutes/26/1222#net_capital_gain(§ 1222(11)), is already encoded; capital gain distributions as long-term gain (852(b)(3)(B)) remain TheAxiomFoundation/rulespec-us#1490, queued.