Skip to content

Track B insured status: quarters of coverage; fully, currently and disability insured - #562

Draft
MaxGhenis wants to merge 9 commits into
masterfrom
trackb-insured-status-20261023
Draft

MaxGhenis wants to merge 9 commits into
masterfrom
trackb-insured-status-20261023

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds Track B's insured-status rule: quarters of coverage, and fully, currently and disability insured status, decided per person-month (Act 213, 214, 216(i) and 223(c); 20 CFR 404 subpart B; POMS RS 00301). Max ruled d1802 that the rules lane builds it. B6a, the baseline claiming hazard on an insured, unclaimed person-month risk set, needs it, and the open-population lane's OP8(d) will call it for entrants. Nothing in the repository decided insured status before (docs/parity-ledger.md). The work is statutory conformance on invented cases and published examples only, with no population claim.

Status: draft, round-2 review in progress (GPT-6 Astra, at 3fd1d225). Round 1 (at f865bb54) asked for changes. Master 9967dfd6 is merged in at 1e205464, and the round-2 fixes are 74da853b plus a tier recount.

What it does

  • Quarters of coverage.
    • Quarterly wages before 1978, with the $50 rule and the self-employment and agricultural rules.
    • Gift QCs for maximum earnings.
    • Annual increments for 1978–2027: the RS 00301.250 chart, plus OACT's 2027 determination of $1,970.
    • Favourable assignment to quarters (RS 00301.230), and the exclusions (no QC after death, before a quarter begins, or inside a prior period of disability except its first and last quarters).
  • Fully insured. One QC per elapsed year, at least 6 and at most 40. Elapsed years are counted from birth (after 1950, or after the year of attaining 21), never from projection entry. This includes the pre-1913 male cohorts and the exclusion of disability years.
  • Currently insured. 6 QCs in the 13 quarters ending with the quarter of death, of DIB entitlement or of RIB entitlement.
  • Disability insured. 20 of 40 quarters with fully insured status, special status before 31, subsequent periods, statutory blindness, and the date last insured.
  • Per-year earnings provenance (for OP8(d) and its entrants).
    • Each year is observed, convention-filled (with a convention id) or unknown, and an undeclared year is an input error.
    • Unknown years are bounded at their lowest and highest QC counts. A status is returned only when both bounds agree; otherwise the rule refuses by name (unknown_earnings_years_decide_status), and the row stays in the shared denominator.
    • Results report which convention-filled years and conventions they relied on.
  • OP8(d) and OP12 interface needs (Open population design: births, migration, alignment and the long horizon #557, §6.1):
    • QCs as a direct input: a count of 0–4 after 1977, quarter flags before 1978.
    • Evaluation at a stated month.
    • An optional totalization input, empty by default and refused when non-empty until totalization is built.
    • No pre-entry convention inside the rule.
    • A coverage-end month for emigrants, with the statutory clocks still running.
  • The shared Track B contract. Exact schemas, canonical enums, sealed results and refusals, one reason enum, the shared count_family_outcomes denominator, and validation once per call.
  • Named refusals. Each stays in denominators. They cover deemed fully insured status, transitional status, the SSPA 211 alien-worker rule, railroad and military credits, Medicare government employment, earned-basis wages, the pre-1956 alternative test, fiscal and short taxable years, simplified pre-1951 aggregates, raw 1937 earnings, separate pre-1955 agricultural wages, pre-1951 self-employment, increments after 2027, and queries before 1968. The design note has the full table.

Invariants

Each is a Hypothesis property, alongside the example tests:

  • QCs per year are between 0 and 4, and monotone in earnings.
  • The indexed QC amount is monotone in NAWI and never below the prior year's.
  • Assignment is unique, deterministic, order independent and window-optimal.
  • Excluding a period of disability never adds a QC.
  • Adding a QC never removes any status and never moves the date last insured earlier.
  • Disability insured implies fully insured.
  • The windows are exactly 13 and 40 quarters, and the fully insured requirement is between 6 and 40.
  • Unknown-year bounds contain every concrete filling, or the rule refuses.
  • Convention-filled years equal to observed ones give identical status.
  • Input errors never become refusals, and refusal rows and weights are conserved.

Worked examples and differentials

  • Worked examples. The registry (tests/data/track_b/insured_status_examples.yaml) inventories 47 cases, each figure checked against its pinned capture:
    • 26 computed exactly, from RS 00301.120, .140, .147, .148, .150, .220, .230, .320, .325, .340 and .345, the CFR examples, and OACT's 2027 determination;
    • 3 table differentials (below);
    • 3 computed where a POMS example's printed figure diverges from the CFR (both pinned);
    • 1 source ambiguity, 12 named refusals and 2 administrative inventories.
  • Differentials.
    • The 213(d) formula, in exact rational arithmetic on the pinned NAWI, against every published increment from 1979 to 2026.
    • POMS RS 00301.250 against OACT for all 49 shared years.
    • The fully insured requirement against every row of the CFR 404.115 cohort chart.
    • The same requirement against all 38 rows of the RS 00301.800 exhibit, by birth cohort, by its January 1 footnote and by year of death. The exhibit's text comes from its PDF, and the PDF and both GIF renderings are pinned by hash. The PDF's footnote misprints the male age-65 cohort as "1/2/31"; the GIF, the table and 20 CFR 404.132(b) say 1913, and a test pins it.
  • Mutation checks. The lane's twelve mutations were all caught and reverted (tests/data/track_b/insured_status_mutation_checks.json). The exhibit differential also catches moving the 1975 cap and moving the 1913 male cutoff.

Source readings

Four places where the sources disagree are pinned with both sides, and none needs a ruling from Max:

  • Two POMS examples are inconsistent with 20 CFR 404.130(f): the favourable-disregard rule and the endpoint quarters. The rule follows the regulation, per principle P2 ("regulations are law"). Each is logged in ~/reviews/us-hub/source-conflicts/RULINGS.md and marked at its decision line (us:oasdi-insured-prior-disability-favorable-disregard, us:oasdi-insured-disability-period-endpoint-quarters).
  • RS 00301.340's short-year allocation stays refused, with both readings pinned. They differ by $100 in allocated earnings and not at all in status.
  • How direct annual counts behave in an exit year is an interface choice, documented in the design note.

Effort

The coordinator estimated 5–10 engineer-days for a person. This build took about an hour of automated lane time, plus orchestration and review. That isn't a human-effort measurement and shouldn't be read as one. B6a still needs its empirical risk set, observed histories, claim timing and estimation; this PR supplies only the statutory predicate.

Round 2 (after the first review)

  • Medical onset vs an established period. A declared onset no longer removes fully insured elapsed years. A period of disability needs an application and five months (42 U.S.C. 416(i)(2)(A)–(B); 20 CFR 404.320(b)), so the caller declares whether the current one is established. Its start is derived: the onset day if insured then, else the first day of the first later qualifying quarter (416(i)(2)(C); 404.321(a)).
  • Later qualification. The disability test scans from the onset quarter to the query and uses each candidate year's fully insured endpoint (404.131(a), 404.132). A worker uninsured at onset can qualify later. A property checks it against a brute-force scan of every quarter.
  • Currently insured now excludes every established period that intersects the 13-quarter window, including the event's own (404.120(b); RS 00301.110). The old contract assertion pinned the misreading and is corrected.
  • Count bounds. Where the witness can switch, the unknown-year count bounds are a conservative envelope. A property checks that it contains every concrete filling.
  • Open-population rev 10. Prior periods, the current period and section 214(c) applicability each carry OBSERVED / CONVENTION_FILLED / UNKNOWN provenance, with UNKNOWN as the default.
    • Unknown facts are bounded where the answer is the same either way. The no-periods lower bound rests on 404.320(a) and 404.130(f).
    • Otherwise they are refused by name: unknown_prior_disability_periods_decide_status, unknown_current_disability_period_decides_status, sspa211_applicability_unknown.
    • RS 00301.102 B.3 says SSPA 211 applies to a worker with no SSN based on their true identity, so having no SSN yet is not an exemption.
  • Sources. New captures: 20 CFR 404.315, 404.320 and 404.321. The mutation report moved to docs/design/track_b_insured_status_mutations.json.
  • Registry. 48 entries: 27 computed, 12 refused, 3 source-rule divergences, 1 ambiguity, 3 table differentials, 2 inventories.
  • Tiers. unit 19,629 / artifact 4,271 / integration_psid 1,450 / reproduction_legacy 520 / oracle_policyengine 308 (26,178).
  • Local checks at 3fd1d225. 2,717 tests pass across the insured-status files, the shared schema file and two G fix-round fixtures, plus 3,000 in the G receivers file. Birth evidence, tier policy, black and ruff all pass.

Round 1 checks (local, at f865bb54)

  • 540 insured-status tests pass. At b85c1e35, the 11,230 shared tests passed (G, R2, R3, the schema and audit suites, birth-evidence); the later commits touch only the insured-status files.
  • Black and ruff are clean, and the tier policy passes.
  • The tiers are unit 19,324 / artifact 4,253 / integration_psid 1,450 / reproduction_legacy 520 / oracle_policyengine 308 (25,855).
  • Protected files are untouched.

axiom: n/a: Axiom (rulespec-us) encodes 42 U.S.C. 402, 415, 416(l) and 426 but not 413, 414 or 423(c), so there is no differential yet. A dispatch-ready rulespec-us issue (docs/design/track_b_insured_status_rulespec_issue.md) will be filed.

🤖 Generated with Claude Code

MaxGhenis and others added 3 commits October 23, 2026 10:17
… disability insured status

Max ruled d1802: the rules lane builds insured status for B6a's monthly
claiming hazard, and the open-population lane's OP8(d) will call it for
entrants. Nothing in the repository decided insured status before.

The new reference implements Act 213, 214, 216(i) and 223(c) as a sealed,
person-month API:
- Quarters of coverage: quarterly wages before 1978, the self-employment
  and agricultural rules, gift QCs for maximum earnings, annual increments
  1978-2027, favourable assignment, and exclusions.
- Fully insured (6 to 40 elapsed years, counted from birth, with the
  pre-1913 male cohorts), currently insured (6 of 13 quarters), and
  disability insured (20/40, special status before 31, subsequent
  periods, blindness), with the date last insured.
- Every earnings year declares its provenance: observed, convention-filled
  (with an id) or unknown. Unknown years are bounded at their lowest and
  highest QC counts. A status is returned only if both bounds agree;
  otherwise it is refused by name and stays in the shared denominator.
- Direct QC input (a 0-4 count after 1977, quarter flags before),
  evaluation at a stated month, an optional totalization input (refused
  until built), and a coverage-end month for emigrants.

Specialist paths (deemed status, the SSPA alien-worker rule, railroad
and military credits, Medicare government employment, fiscal and short
taxable years, simplified pre-1951 methods) are named refusals. The tests
reproduce the RS 00301 and CFR worked examples, compare the 213(d) formula
on the pinned NAWI with the published chart, compare POMS with OACT, and
compare the CFR 404.115 cohort chart. Hypothesis properties cover
monotonicity in QCs and the date last insured, the soundness of the
unknown-year bounds, and the shared input and seal contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The design note gives B6a and OP8(d) a citable interface: inputs, the
earnings-provenance enum, the decided-despite-unknowns flag, refusal
reasons and signatures. The rulespec issue draft covers 42 U.S.C. 413,
414 and 423(c)(1), which Axiom does not encode yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
social-security-model Ready Ready Preview Oct 25, 2026 12:45pm UTC

Request Review

MaxGhenis and others added 2 commits October 23, 2026 10:24
…lict lines

The exhibit linked from RS 00301.800 (a PDF and two GIF renderings of the
quarters-of-coverage table) was not captured, so its differential was
recorded as unavailable. Its text is now captured as pdf_text
(pdftotext, -layout), with the PDF and both GIFs pinned by hash. A test
checks all 38 rows against fully_insured_requirement: by birth cohort (men
before January 2, 1913 at age 65, women at 62), by footnote 1's January 1
rule, and by year of death. Moving the 1975 cap or the 1913 cutoff fails it.

The PDF's footnote misprints the male cohort as "born before 1/2/31"; the
GIF, the table itself and 20 CFR 404.132(b) say 1913. A test pins that.

The decision lines for the two readings taken from 20 CFR 404.130(f) over
inconsistent POMS examples are marked with their source-conflict ids:
us:oasdi-insured-prior-disability-favorable-disregard and
us:oasdi-insured-disability-period-endpoint-quarters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master added the holdout registry and an ARF change. Only the tier
files conflicted; they take master's version and are recounted
(unit 19,575; total 26,124).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis and others added 2 commits October 25, 2026 05:55
Round 1 of the independent review found that a declared disability
onset froze the fully insured elapsed-year count and anchored the
disability test to the onset quarter. A period of disability exists
only after an application and five months (42 U.S.C. 416(i)(2)(A)-(B);
20 CFR 404.320(b)), and it begins on the onset day only if the worker
is insured then, otherwise on the first day of the first later
qualifying quarter (416(i)(2)(C); 404.321(a)). So:

- Onset alone no longer removes elapsed years (404.110). The current
  period's establishment is declared, with provenance.
- The disability test scans the quarters from onset to the query and
  uses each candidate year's fully insured endpoint (404.131(a),
  404.132). A later qualifying quarter now counts.
- Currently insured excludes every established period intersecting
  the 13-quarter window, including the event's own (404.120(b),
  RS 00301.110). The old contract assertion pinned the misreading.
- Count bounds with a switching witness use a sound envelope.

It also takes the open-population lane's rev 10 needs. Prior
periods, the current period and section 214(c) applicability carry
OBSERVED / CONVENTION_FILLED / UNKNOWN provenance, with UNKNOWN as the
default. Unknown facts are bounded, or refused by name:
unknown_prior_disability_periods_decide_status,
unknown_current_disability_period_decides_status and
sspa211_applicability_unknown. The no-periods lower bound rests on
404.320(a) and 404.130(f).

Adds 20 CFR 404.315, 404.320 and 404.321 captures. Moves the mutation
report to docs/design/track_b_insured_status_mutations.json, next to
its design note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Master added the P2 forward-earnings work. Only the tier files
conflicted; they take master's version and are recounted (unit
19,723; total 26,293).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview — d21ece2d Deployed Oct 25, 2026 by vercel[bot]
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.

1 participant