Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0e7a770
Let refusal exception notes be deleted again; register guard enums be…
MaxGhenis Oct 23, 2026
57756aa
G part 2 and R2 part (b): deduction before reduction; SSA's operation…
MaxGhenis Oct 23, 2026
f3b9a71
Regenerate the G conformance report with the deduction denominator; r…
MaxGhenis Oct 23, 2026
0ccf66f
Merge master 9967dfd6 into the G part 2 / R2 part (b) branch
MaxGhenis Oct 25, 2026
2f88f07
Refuse uncovered G2 and R2 part (b) paths (#563 fix round 2, part 1)
MaxGhenis Oct 31, 2026
4493e58
Merge master 1ec57a5d into the G part 2 / R2 part (b) branch
MaxGhenis Oct 31, 2026
1a9c8b7
Finish and verify #563 fix round 2 (part 2)
MaxGhenis Oct 31, 2026
bbcdf7f
Merge master a747bafa into the G part 2 / R2 part (b) branch
MaxGhenis Oct 31, 2026
7fa124e
Refresh the G conformance report's registry hash (#563)
MaxGhenis Oct 31, 2026
872cebc
Record the conformance hash refresh in the verification ledger (#563)
MaxGhenis Oct 31, 2026
1ce508e
Check FRA facts, the OB bound and as-if-absent membership (#563 round 3)
MaxGhenis Oct 31, 2026
e3315ba
Keep outside events out of governed decisions and check declared fact…
MaxGhenis Oct 31, 2026
a135519
Check only settled G facts before RET coverage refusals (#563 round 5)
MaxGhenis Nov 1, 2026
3212f82
Track B R2: keep the direction a hold leaves settled
MaxGhenis Nov 1, 2026
fbe491d
Track B R2: read each hold's reach before comparing a rate
MaxGhenis Nov 1, 2026
aa86a4d
Track B R2: rule out rates no filling can reach
MaxGhenis Nov 1, 2026
440be37
Merge master 6413d842 into the G part 2 branch
MaxGhenis Nov 1, 2026
40f2c17
Track B R2: read the child-in-care minimum under the month's deductions
MaxGhenis Nov 1, 2026
11b2ab1
Merge master 18082859 into the G part 2 branch
MaxGhenis Nov 1, 2026
bc460e3
Take CI's tier count for round 9
MaxGhenis Nov 2, 2026
434a39c
Track B R2: keep another caregiver's care facts in each comparison
MaxGhenis Nov 2, 2026
03530e8
Merge master 89d064b5 into the G part 2 branch
MaxGhenis Nov 2, 2026
f5a18c8
Record round 10's cloud mutation run (#563, docs only)
MaxGhenis Nov 2, 2026
dbdceac
Merge master dd9c7be2 into the G part 2 branch
MaxGhenis Nov 2, 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
14,069 changes: 14,069 additions & 0 deletions docs/design/track_b_g2_r2b_mutations.json

Large diffs are not rendered by default.

13,379 changes: 13,379 additions & 0 deletions docs/design/track_b_g2_r2b_verification.json

Large diffs are not rendered by default.

279 changes: 261 additions & 18 deletions docs/design/track_b_g_conformance_report.json

Large diffs are not rendered by default.

800 changes: 793 additions & 7 deletions docs/design/track_b_g_gross_benefits.md

Large diffs are not rendered by default.

1,277 changes: 1,180 additions & 97 deletions docs/design/track_b_r2_ret_ledger.md

Large diffs are not rendered by default.

231 changes: 230 additions & 1 deletion scripts/track_b_g_conformance_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ def classify_configuration(case: Configuration) -> tuple[str, str | None]:
def _savings_witness(*, unknown=False):
month = g.YearMonth(2025, 11)
children = [g.Beneficiary(c, g.Role.CHILD) for c in ("c1", "c2")]
guard = g.SavingsClauseGuard(month, earlier_months_unknown=unknown)
guard = g.SavingsClauseGuard(
month,
earlier_months_unknown=unknown,
reading=g.SavingsClauseReading.LITERAL_REFUSAL,
)
guard.admit(_family(_retired(), children, month))
guard.admit(
_family(
Expand All @@ -257,6 +261,121 @@ def _savings_witness(*, unknown=False):
)


def _deduction_witness(reason, *, age_worker=False):
members = [
g.Beneficiary("c1", g.Role.CHILD),
g.Beneficiary("c2", g.Role.CHILD),
]
if age_worker:
members[0] = g.Beneficiary(
"c1", g.Role.SPOUSE, reduction_months=36, birth_year=1960
)
return g.family_benefits_after_deductions(
_retired(),
members,
payment_month=NOW,
params=PARAMS,
deductions={"c1": g.BenefitDeduction(reason)},
households={"c1": "home", "c2": "home"},
worker_deductions={"c2": F(1)} if age_worker else None,
standalone=True,
)


def _care_minimum_partial_witness():
"""A partial deduction leaves the 402(q)(5)(D) comparison open."""
return g.family_benefits_after_deductions(
_survivor(),
(
g.Beneficiary(
"w",
g.Role.WIDOW,
reduction_months=60,
reduction_period_months=60,
child_in_care="c1",
),
g.Beneficiary("c1", g.Role.CHILD),
g.Beneficiary("c2", g.Role.CHILD),
),
payment_month=NOW,
params=PARAMS,
deductions={
"c2": g.BenefitDeduction(
g.DeductionReason.OWN_EARNINGS_TEST, F(100), True
)
},
households={"w": "h", "c1": "h", "c2": "h"},
standalone=True,
)


def _zero_dual_composition_witness():
"""GN 02603.050 A.1/A.2 disagree on C's $175 versus $200 rate."""
return g.family_benefits_after_deductions(
_retired(pia=400, maximum=600),
(
g.Beneficiary(
"b", g.Role.SPOUSE, birth_year=1960, reduction_months=36
),
g.Beneficiary("c", g.Role.CHILD),
g.Beneficiary(
"z",
g.Role.CHILD,
own_benefit=g.OwnBenefit(g.OwnBenefitKind.DISABILITY, F(400)),
),
),
payment_month=NOW,
params=PARAMS,
deductions={
"b": g.BenefitDeduction(g.DeductionReason.OWN_EARNINGS_TEST)
},
households={},
standalone=True,
)


def _operational_savings_witness(*, membership):
month = g.YearMonth(2026, 1)
guard = g.SavingsClauseGuard(month, earlier_months_unknown=False)
members = (
[g.Beneficiary("c1", g.Role.CHILD), g.Beneficiary("c2", g.Role.CHILD)]
if membership
else [
g.Beneficiary(
"s", g.Role.SPOUSE, reduction_months=60, birth_year=1960
)
]
)

def state(pia, maximum):
return g.RecordState(
g.FamilyKind.RETIREMENT,
F(pia),
F(maximum),
worker=g.OwnBenefit(
g.OwnBenefitKind.OLD_AGE,
F(pia),
reduction_months=60,
birth_year=1960,
),
)

guard.admit(
_family(state(1000, 1500 if membership else 1400), members, month)
)
guard.admit(
_family(
state(1010, 1500 if membership else 1300),
members,
g.YearMonth(2026, 2),
)
)
if membership:
guard.admit(
_family(state(1010, 1500), members[:1], g.YearMonth(2026, 3))
)


def refusal_witnesses() -> dict[g.UnsupportedReason, tuple[str, Callable]]:
"""One independently constructed witness for every retained reason."""
rib, dib = g.OwnBenefitKind.OLD_AGE, g.OwnBenefitKind.DISABILITY
Expand Down Expand Up @@ -485,6 +604,55 @@ def multiple_records(child):
"Governed month begins with unknown prior entitlement months",
lambda: _savings_witness(unknown=True),
),
reasons.SAVINGS_CLAUSE_MEMBERSHIP_CHANGE: (
"One child leaves while operational protection is active",
lambda: _operational_savings_witness(membership=True),
),
reasons.SAVINGS_CLAUSE_RATE_PROCEDURE: (
"A reduced spouse alone has no captured allocation procedure",
lambda: _operational_savings_witness(membership=False),
),
**{
refusal: (
"GN 02603.040 event requires an unimplemented deduction procedure: "
+ event.value,
lambda event=event: _deduction_witness(event),
)
for refusal, event in (
(
reasons.PRISONER_SUSPENSION,
g.DeductionReason.PRISONER_SUSPENSION,
),
(
reasons.DRUG_ADDICTION_SUSPENSION,
g.DeductionReason.DRUG_ADDICTION_SUSPENSION,
),
(
reasons.FOREIGN_WORK_DEDUCTION,
g.DeductionReason.FOREIGN_WORK,
),
(reasons.PENALTY_DEDUCTION, g.DeductionReason.PENALTY),
(reasons.MARITIME_DEDUCTION, g.DeductionReason.MARITIME),
(
reasons.ELECTION_CERTIFICATE_SUSPENSION,
g.DeductionReason.ELECTION_CERTIFICATE_SUSPENSION,
),
)
},
reasons.DEDUCTION_AGE_WORK_INTERACTION: (
"Concurrent number-holder reservations and age reduction need a captured allocation",
lambda: _deduction_witness(
g.DeductionReason.OWN_EARNINGS_TEST, age_worker=True
),
),
reasons.SOLE_FULL_DEDUCTION_ZERO_DUAL_COMPOSITION: (
"GN 02603.050 A.1 and A.2 compose differently: child 175 versus 200",
_zero_dual_composition_witness,
),
reasons.CARE_MINIMUM_PARTIAL_DEDUCTION: (
"No source carries a partial deduction to a child-in-care comparison",
_care_minimum_partial_witness,
),
reasons.WIDOW_DRC_SAVINGS_CLAUSE: (
"May 1978 survivor protected from widow deceased-worker DRCs",
lambda: _family(_survivor(widow_drc_savings_clause=True)),
Expand Down Expand Up @@ -658,6 +826,66 @@ def _registry_summary(path: Path) -> dict:
}


def deduction_conformance() -> dict:
"""Separate invented monthly cases; the original lattice is unchanged."""
rows = []
for kind, permanent, partial, separate in itertools.product(
(g.FamilyKind.RETIREMENT, g.FamilyKind.SURVIVOR),
(False, True),
(False, True),
(False, True),
):
state = _retired() if kind is g.FamilyKind.RETIREMENT else _survivor()
members = [g.Beneficiary(key, g.Role.CHILD) for key in ("a", "b", "c")]
key = f"{kind.value}-{'permanent' if permanent else 'estimated'}-{'partial' if partial else 'full'}-{'separate' if separate else 'same'}"
outcome = g.evaluate_family(
key,
1,
lambda state=state, members=members, partial=partial, permanent=permanent, separate=separate: g.family_benefits_after_deductions(
state,
members,
payment_month=NOW,
params=PARAMS,
deductions={
"a": g.BenefitDeduction(
g.DeductionReason.OWN_EARNINGS_TEST,
F(50) if partial else F(0),
permanent,
)
},
households={
"a": "home",
"b": "home",
"c": "other" if separate else "home",
},
standalone=True,
),
)
row = {
"id": key,
"status": "supported" if outcome.supported else "refused",
}
if outcome.supported:
row["payables"] = {
member.beneficiary_id: str(member.auxiliary_payable)
for member in outcome.benefits.beneficiaries
}
else:
row["reason"] = outcome.unsupported.reason.value
rows.append(row)
counts = Counter(row["status"] for row in rows)
return {
"scope": "Separate invented monthly deduction denominator. G v2 had no deduction entry point; no historical lattice row is reclassified.",
"denominator": {
"rows": len(rows),
"supported": counts["supported"],
"refused": counts["refused"],
"invalid": 0,
},
"rows": rows,
}


def build_report(registry_path: Path = DEFAULT_REGISTRY) -> dict:
"""Exhaustively classify each cell once, preserving every denominator."""
statuses = Counter()
Expand All @@ -683,6 +911,7 @@ def build_report(registry_path: Path = DEFAULT_REGISTRY) -> dict:
"admitted_scope": "Gross benefits for supported invented configurations only; no population, behavioral, payment-timing or forecast claim.",
"denominator_kind": "finite invented configuration lattice; no population data or population weights",
"gross_benefits_version": g.GROSS_BENEFITS_VERSION,
"deduction_conformance": deduction_conformance(),
"lattice": {
"definition": {
"record_kinds": [kind.value for kind in g.FamilyKind],
Expand Down
Loading
Loading