Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
bba667c
CE1: coverage-rule schema, loader and refusing lookup
MaxGhenis Oct 24, 2026
9de8458
CE1: pinned sources and the assembled registry (partial)
MaxGhenis Oct 24, 2026
49400d1
CE1: keep the birth-evidence seal
MaxGhenis Oct 24, 2026
1be4b75
CE1: finish the coverage-rule registry's sources and histories
MaxGhenis Oct 25, 2026
39b5220
CE1: keep only the cited pages of five whole-act PDFs
MaxGhenis Oct 25, 2026
08b898e
Merge origin/master d8302233 into CE1
MaxGhenis Oct 25, 2026
28becb8
CE1: answer review round 1 (two high, twelve medium, 28 low)
MaxGhenis Oct 25, 2026
94219ed
CE1: rank coverage cases, first match wins (review r2 MED-1)
MaxGhenis Oct 26, 2026
8476dcf
CE1: make every exclusion condition a case (review r2 HIGH-1)
MaxGhenis Oct 26, 2026
a6fa1f0
CE1: exclude pre-ruling cash-equivalent farm transfers (review r2 HIG…
MaxGhenis Oct 26, 2026
c0ea2b2
CE1: return verified rules and open only unsettled sub-questions (rev…
MaxGhenis Oct 26, 2026
5bac444
CE1: test every loader guard and separate data, caller and legal erro…
MaxGhenis Oct 26, 2026
01e1e85
CE1: name open readings once and settle vocational years (review r2 l…
MaxGhenis Oct 26, 2026
2dad26e
CE1: keep IRS page extracts and the OCR text of scanned pages (review…
MaxGhenis Oct 26, 2026
38cd196
CE1: state the capture-folder invariants in the conformance module
MaxGhenis Oct 26, 2026
df1dc16
CE1: test the open-reading and operative-reading checkers (review r2 …
MaxGhenis Oct 26, 2026
ea599b9
Merge origin/master 172f690f into CE1
MaxGhenis Oct 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions data/external/income_resources_ce1/assemble_registry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""Assemble CE1 research fragments; verify source hashes before writing JSON.

Run with the clone's virtual-environment Python from the repository root.
The fragments retain the research work split; coverage_rules.json is the
single runtime input. This script fetches nothing.
"""

import json
from pathlib import Path

from populace_dynamics.income_resources.coverage_rules import (
CAPTURE_DIRECTORY,
SCHEMA_VERSION,
CoverageRegistry,
)


def build(root: Path | None = None) -> str:
"""Validate fragments and return the complete canonical registry text."""
root = Path(root) if root is not None else Path(__file__).resolve().parent

def read(name):
return json.loads((root / name).read_text())

rules = []
for name in (
"government_rules.json",
"se_rules.json",
"other_rules.json",
"se_modifier_rules.json",
):
rules.extend(read(name))
thresholds = []
for name in (
"thresholds_government.json",
"thresholds_se.json",
"thresholds_other.json",
):
thresholds.extend(read(name))
ret = read("earnings_test_root.json")
ret["self_employment_guidance"] = read("earnings_test_se.json")
ret["historical_research"] = read("ret_history_government.json")
ret["definition_modifier_research"] = read("ret_history_modifiers.json")
raw = {
"schema_version": SCHEMA_VERSION,
"income_years": [1968, 2026],
"rules": rules,
"thresholds": thresholds,
"earnings_test": ret,
"table_definitions": read("table_definitions_root.json"),
"scope_status": "partial_statutory_registry_open_histories_refuse",
"design": "docs/design/covered_earnings_v2.md",
"rare_exclusion_ruling": "open_no_reading_selected",
"open_questions": [
{"rule_id": rule["rule_id"], "reason": rule["open_reason"]}
for rule in sorted(rules, key=lambda row: row["rule_id"])
if rule["open_reason"]
],
}
return CoverageRegistry.from_dict(
raw, capture_root=CAPTURE_DIRECTORY
).to_json()


def main():
root = Path(__file__).resolve().parent
(root / "coverage_rules.json").write_text(build(), encoding="utf-8")


if __name__ == "__main__":
main()
25,069 changes: 25,069 additions & 0 deletions data/external/income_resources_ce1/coverage_rules.json

Large diffs are not rendered by default.

153 changes: 153 additions & 0 deletions data/external/income_resources_ce1/earnings_test_root.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"status": "current_text_verified_historical_effective_dates_open",
"citations": [
{
"capture": "lii_42usc403.html",
"sha256": "089ec01fbef104c50892cc9097a12a5a259d3b58c0f335a16f6d67f0021df41a",
"authority": "42 U.S.C.403(f)(5), assignment-pinned current text and amendment notes",
"location": "(f)(5)(A)\u2013(E); amendment notes 1965, 1980, 1983, 1989, 1990"
},
{
"capture": "lii_42_409.html",
"sha256": "d37ce452924c0d10f48af5b2c8cbb96d6692c529dc633a927092af90db69107b",
"authority": "42 U.S.C. 409(a), text captured 2026-10-24",
"location": "(a)(1),(6)(B),(6)(C),(7)(B),(8)"
}
],
"income_year_support": [
1968,
2026
],
"historical_refusal": "Current concept is documented; historical \u00a7403(f)(5) effective-date reconstruction is incomplete. Do not apply current text to earlier income years by assumption.",
"earnings_equation": "wages_for_services_in_year + net_earnings_from_self_employment - net_loss_from_self_employment",
"self_employment": {
"reference": "42 U.S.C.411",
"disregarded_trade_or_business_exclusions": [
"411(c)(1)",
"411(c)(4)",
"411(c)(5)"
],
"thresholds_apply": false,
"reason": "411(b)(2) and(i)(2) define self-employment income;403(f)(5)(B) uses net earnings/net loss.",
"church_employee_income": "411(i)(1) includes gross church employee income with no deductions and excludes it and associated deductions from the other unit. \u00a7411(a)(11) remains applicable after that separation (\u00a7411(i)(3)); RET factor exceptions in POMS are recorded separately."
},
"disregarded_wage_limits": [
{
"paragraph": "409(a)(1)",
"concept": "annual contribution and benefit maximum",
"component_threshold": false,
"aggregation": "person_year"
},
{
"paragraph": "409(a)(6)(B)",
"concept": "domestic cash remuneration threshold",
"component_threshold": true,
"aggregation": "employer_employee_year"
},
{
"paragraph": "409(a)(6)(C)",
"concept": "casual nonbusiness cash remuneration threshold",
"component_threshold": true,
"aggregation": "employer_employee_year"
},
{
"paragraph": "409(a)(7)(B)",
"concept": "agricultural cash remuneration gates",
"component_threshold": true,
"aggregation": "employer_employee_year_or_employer_year"
},
{
"paragraph": "409(a)(8)",
"concept": "statutory homeworker cash remuneration threshold",
"component_threshold": true,
"aggregation": "employer_employee_year"
}
],
"deeming_rule": {
"required_conditions": [
{
"condition_id": "service_location_and_employee_status",
"fact_names": [
"employee_self_or_mixed",
"place_of_work",
"active_us_military_service"
],
"test": "Employee service within the United States, or service outside the United States in active United States military or naval service."
},
{
"condition_id": "no_self_employment_double_count",
"fact_names": [
"remuneration_in_self_employment"
],
"test": "Remuneration is not includible in net earnings or net loss from self-employment."
}
],
"connective": "both",
"citation": {
"capture": "lii_42usc403.html",
"sha256": "089ec01fbef104c50892cc9097a12a5a259d3b58c0f335a16f6d67f0021df41a",
"authority": "42 U.S.C.403(f)(5)(C)",
"location": "(f)(5)(C), first sentence",
"quote": "shall be deemed to be employment as so defined if the remuneration for such services is not includible"
}
},
"retirement_exclusions": [
"403(f)(5)(C)(i): payment on account of retirement, including employer insurance,annuity or fund payments to employee/dependents",
"403(f)(5)(C)(ii): employer payments on/after termination because of retirement after plan-specified age"
],
"gross_income_exclusions_D": [
{
"clause": "403(f)(5)(D)(i)",
"conditions": [
"attained statutory retirement age by last day of taxable year",
"royalties from copyright/patent obtained before taxable year of attaining that age",
"property created by own personal effort",
"facts shown to satisfaction of Commissioner"
],
"excluded": "such royalties"
},
{
"clause": "403(f)(5)(D)(ii)",
"conditions": [
"entitled to title II benefits other than disability insurance or disabled-child benefits",
"receipt in year after initial entitlement year",
"income not attributable to services after initial entitlement month",
"facts shown to satisfaction of Commissioner"
],
"excluded": "such other income"
}
],
"timing_E": "Corporate-director net earnings are deemed derived/received when services performed, regardless of later receipt; exception where paid and received before that service year.",
"history_locators": [
{
"year": 1965,
"act": "P.L.89-97\u00a7325(a)",
"change": "added(D) royalty exclusion"
},
{
"year": 1980,
"act": "P.L.96-473\u00a73(a)",
"change": "expanded(D) to other deferred income"
},
{
"year": 1983,
"act": "P.L.98-21\u00a7324(c)(4)",
"change": "added special retirement wage exclusions"
},
{
"year": 1989,
"act": "P.L.101-239\u00a710208(d)(2)",
"change": "renumbered 409 cross references"
},
{
"year": 1990,
"act": "P.L.101-508\u00a75123(a)",
"change": "moved director timing sentence from 411(a) to 403(f)(5)(E)"
}
],
"refusal_reasons": [
"RET_WAGE_ELIGIBILITY_UNRESOLVED",
"RET_REMUNERATION_TYPE_UNRESOLVED",
"RET_SE_FACTS_UNRESOLVED"
]
}
172 changes: 172 additions & 0 deletions data/external/income_resources_ce1/earnings_test_se.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{
"church_employee_income": {
"cap_applied_for_RET": false,
"church_100_floor_applied_for_RET": false,
"eligible_concept": "gross church employee income under 411(i), unreduced by business expenses; then 411(a)(11) deduction where applicable",
"ordinary_losses_offset_church_unit": false,
"other_400_floor_applied_for_RET": false,
"threshold_reason": "403(f)(5)(B) uses net earnings/net loss, not 411(b) self-employment income",
"historical_1984_1985": {
"rule_id": "se_units_1984_1985",
"ordinary_losses_may_offset_qualifying_church_remuneration": true,
"coverage_floor_cases_not_RET_floors": true,
"RET_dependency_status": "historical 403(f)(5) reconstruction remains subject to the registry concept accessor refusals"
}
},
"citations": [
{
"authority": "42 USC 403(f)(5)",
"capture": "lii_42usc403.html",
"location": "403(f)(5)(A), (B), (D)",
"sha256": "089ec01fbef104c50892cc9097a12a5a259d3b58c0f335a16f6d67f0021df41a"
},
{
"authority": "42 USC 411",
"capture": "lii_42_411.html",
"location": "411(a)(11), (b)(2), (i)",
"sha256": "2c46b53b2037a825ef51fb20d189049d852165eecc0d116e6d1fd852c8803984"
},
{
"authority": "SSA POMS RS 02505.055",
"capture": "poms_rs_02505055.html",
"location": "B.1 How to Count NESE; B.4 How to Count Net Loss",
"sha256": "46ca096b43003f1ec3c6c999276e8018feac633dd6b9caba16644cbe3523fb89"
}
],
"concept_id": "ret_self_employment_earnings",
"factor_history": [
{
"citation": {
"authority": "Public Law 98-21",
"capture": "govinfo_statute97_pg65_extract.pdf",
"location": "124(c)(3), (d)(2):411(a)(11) deduction begins taxable years after 1989",
"sha256": "82029ba2e3610684e05e6b31f4a96586db4b723713ef3ed09741e68e9401dfad"
},
"effective_end": "1989-12-31",
"effective_start": "1968-01-01",
"negative_net_loss_factor": {
"denominator": 1,
"numerator": 1
},
"positive_profit_factor": {
"denominator": 1,
"numerator": 1
}
},
{
"citation": {
"authority": "SSA POMS RS 02505.055",
"capture": "poms_rs_02505055.html",
"location": "B.1, B.4",
"sha256": "46ca096b43003f1ec3c6c999276e8018feac633dd6b9caba16644cbe3523fb89"
},
"effective_end": "2026-12-31",
"effective_start": "1990-01-01",
"negative_net_loss_factor": {
"denominator": 1,
"numerator": 1
},
"positive_profit_factor": {
"denominator": 10000,
"numerator": 9235
},
"below_400_named_options": [
{
"citation": {
"authority": "42 USC 411",
"capture": "lii_42_411.html",
"location": "411(a)(11), 411(b)(2)",
"sha256": "2c46b53b2037a825ef51fb20d189049d852165eecc0d116e6d1fd852c8803984"
},
"description": "Read 411(a)(11) deduction as applying to positive net earnings regardless of the separate 411(b)(2) self-employment-income floor; design 2.3 states the 400 floor does not apply to RET.",
"name": "411_a_11_uniform_positive_profit_factor"
},
{
"citation": {
"authority": "SSA POMS RS 02505.055",
"capture": "poms_rs_02505055.html",
"location": "B.1",
"sha256": "46ca096b43003f1ec3c6c999276e8018feac633dd6b9caba16644cbe3523fb89"
},
"description": "POMS says deduction is not applied when resulting amount is less than 400; actual net profit is earnings for deduction purposes.",
"name": "poms_below_400_unreduced_profit",
"quote": "However, the deduction is not applied to net profit when the resulting amount is less than $400. In this case the actual new profit is the earnings for deduction purposes."
}
]
}
],
"ministerial_service": {
"1402_e_exempt_earnings_still_RET_net_earnings": true,
"ignore_trade_or_business_exclusions": [
"411(c)(1)",
"411(c)(4)",
"411(c)(5)"
],
"religious_sect_411_c_6_exclusion": "not among exceptions waived by 403(f)(5)(B)(i); establish underlying facts"
},
"reference_years": "income/taxable years, never interview years",
"rounding": {
"RET_deduction_rounding": "POMS B.1 says round SEI to next lowest dollar when applying deductions under earnings test; do not infer intermediate component rounding",
"coverage_base_factor_rounding": "none prescribed in 411(a)(11); exact rational arithmetic",
"earnings_record_posting_rounding": {
"citation": {
"authority": "SSA POMS RM03846.035",
"capture": "poms_rm_03846035.html",
"location": "introductory paragraphs and A-B",
"sha256": "746364a9dbe3c128bca49c52fef1badb5a747ab8b823576e6cd04184a4d4681f"
},
"processing_effective_date": "1969-08-01",
"rule": "Calendar-year SEI established/adjusted is increased to next higher dollar except maximum; an earnings-record posting convention, not automatically coverage-base arithmetic"
}
},
"source_disagreements": [
{
"named_options": [
"411_a_11_uniform_positive_profit_factor",
"poms_below_400_unreduced_profit"
],
"question": "RET_FACTOR_BELOW_400",
"status": "open_no_choice"
},
{
"named_options": [
{
"name": "Social_Security_Amendments_of_1983",
"status": "operational_primary_source",
"citation": {
"capture": "govinfo_statute97_pg65_extract.pdf",
"sha256": "82029ba2e3610684e05e6b31f4a96586db4b723713ef3ed09741e68e9401dfad",
"authority": "Public Law 98-21, Social Security Amendments of 1983",
"location": "section 124(c)(3), 97 Stat 90; section 124(d)(2), 97 Stat 91"
}
},
{
"name": "POMS_OBRA_1989_label",
"status": "incorrect_guidance_label_retained",
"citation": {
"authority": "SSA POMS RS 01803.001",
"capture": "poms_rs_01803001.html",
"location": "policy paragraph",
"sha256": "cf33240a5532ef036077fffd9c3933dbd5b68d59f7a1525fb89e88e069d07ccb"
}
}
],
"question": "POMS_RS01803001_ACT_LABEL",
"status": "resolved_by_primary_amending_act",
"citation": {
"authority": "SSA POMS RS 01803.001",
"capture": "poms_rs_01803001.html",
"location": "policy paragraph",
"sha256": "cf33240a5532ef036077fffd9c3933dbd5b68d59f7a1525fb89e88e069d07ccb"
},
"description": "POMS RS 01803.001 calls the deduction legislation OBRA 1989 but prints Public Law 98-21; actual Public Law 98-21 section 124(c)(3), (d)(2) amended 411 and made deduction effective 1990. Keep primary statutory citation.",
"operational_option": "Social_Security_Amendments_of_1983",
"resolution_citation": {
"capture": "govinfo_statute97_pg65_extract.pdf",
"sha256": "82029ba2e3610684e05e6b31f4a96586db4b723713ef3ed09741e68e9401dfad",
"authority": "Public Law 98-21, Social Security Amendments of 1983",
"location": "section 124(c)(3), 97 Stat 90; section 124(d)(2), 97 Stat 91"
}
}
]
}
Loading
Loading