FA-59351 / Subscription proration billing / Open access
Daily plan-change proration: net rounding composition · case 01
The amount due differs by a cent from the printed charge minus the printed credit.
ROOT CAUSE
The net is recomputed from the price difference with its own rounding instead of from the rounded line items.
VERIFIED REPAIR
Restore the contract rule at the net rounding composition step: use `net = charge - credit`.
Unsuccessful approach: The attempt still derives the net from the price difference and floors it, drifting further on downgrades.
Case contract
Input {old, new prices per period, start, end (exclusive), change} dates with start <= change < end. Remaining days = end - change; period days = end - start. Credit = old*remaining/period and charge = new*remaining/period, each rounded half-up. Net = charge - credit; a positive net is due now, a negative net becomes a credit balance. Return [credit, charge, amount_due, credit_balance].
Why this case matters
Mid-cycle plan changes must credit unused time on the old plan and charge the new plan for the same days.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import calendar
N = 1
observations = []
def solve(x):
s = datetime.date(*x['start'])
e = datetime.date(*x['end'])
c = datetime.date(*x['change'])
total = (e - s).days
remaining = (e - c).days
def pr(p):
return (p * remaining * 2 + total) // (2 * total)
credit = pr(x['old'])
charge = pr(x['new'])
net = ((x['new'] - x['old']) * remaining * 2 + total) // (2 * total)
return [credit, charge, max(0, net), max(0, -net)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'old': 6384, 'new': 4900, 'start': [2023, 3, 23], 'end': [2023, 4, 23], 'change': [2023, 4, 13]}, [2059, 1581, 0, 478]), ('regression', {'old': 12063, 'new': 1999, 'start': [2024, 10, 16], 'end': [2024, 11, 14], 'change': [2024, 11, 2]}, [4992, 827, 0, 4165]), ('partial-repair probe', {'old': 999, 'new': 1999, 'start': [2023, 10, 16], 'end': [2023, 11, 13], 'change': [2023, 11, 8]}, [178, 357, 179, 0]), ('partial-repair probe', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('normal control', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('normal control', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0])], [('regression', {'old': 23223, 'new': 4900, 'start': [2025, 2, 5], 'end': [2025, 3, 8], 'change': [2025, 2, 9]}, [20226, 4268, 0, 15958]), ('regression', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('partial-repair probe', {'old': 4900, 'new': 14973, 'start': [2025, 4, 11], 'end': [2025, 5, 10], 'change': [2025, 4, 17]}, [3886, 11875, 7989, 0]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 11, 22], 'end': [2024, 12, 21], 'change': [2024, 12, 19]}, [338, 683, 345, 0]), ('normal control', {'old': 1999, 'new': 4900, 'start': [2023, 10, 12], 'end': [2024, 10, 11], 'change': [2024, 2, 28]}, [1238, 3034, 1796, 0]), ('normal control', {'old': 999, 'new': 9900, 'start': [2025, 5, 5], 'end': [2025, 6, 3], 'change': [2025, 5, 20]}, [482, 4779, 4297, 0]), ('normal control', {'old': 33928, 'new': 9900, 'start': [2025, 3, 24], 'end': [2025, 4, 24], 'change': [2025, 4, 16]}, [8756, 2555, 0, 6201]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2024, 4, 24], 'end': [2024, 5, 25], 'change': [2024, 5, 23]}, [129, 129, 0, 0])], [('regression', {'old': 1999, 'new': 4900, 'start': [2023, 2, 4], 'end': [2024, 2, 5], 'change': [2023, 8, 2]}, [1021, 2504, 1483, 0]), ('regression', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0]), ('partial-repair probe', {'old': 27165, 'new': 30410, 'start': [2023, 10, 29], 'end': [2024, 1, 27], 'change': [2023, 12, 28]}, [9055, 10137, 1082, 0]), ('partial-repair probe', {'old': 1999, 'new': 9900, 'start': [2024, 7, 18], 'end': [2024, 8, 18], 'change': [2024, 8, 1]}, [1096, 5429, 4333, 0]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2025, 5, 29], 'end': [2025, 6, 28], 'change': [2025, 6, 7]}, [1399, 1399, 0, 0]), ('normal control', {'old': 999, 'new': 4900, 'start': [2025, 5, 24], 'end': [2025, 6, 24], 'change': [2025, 5, 24]}, [999, 4900, 3901, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 11, 23], 'end': [2025, 11, 24], 'change': [2025, 7, 22]}, [1673, 1673, 0, 0]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2025, 3, 22], 'end': [2025, 6, 20], 'change': [2025, 5, 23]}, [622, 622, 0, 0])], [('regression', {'old': 999, 'new': 1999, 'start': [2023, 12, 29], 'end': [2024, 1, 26], 'change': [2024, 1, 17]}, [321, 643, 322, 0]), ('regression', {'old': 7276, 'new': 43371, 'start': [2024, 5, 21], 'end': [2024, 8, 19], 'change': [2024, 6, 13]}, [5417, 32287, 26870, 0]), ('partial-repair probe', {'old': 6384, 'new': 4900, 'start': [2023, 3, 23], 'end': [2023, 4, 23], 'change': [2023, 4, 13]}, [2059, 1581, 0, 478]), ('partial-repair probe', {'old': 999, 'new': 9900, 'start': [2023, 10, 10], 'end': [2024, 10, 9], 'change': [2024, 4, 29]}, [446, 4421, 3975, 0]), ('normal control', {'old': 4900, 'new': 29832, 'start': [2023, 6, 23], 'end': [2023, 7, 21], 'change': [2023, 7, 16]}, [875, 5327, 4452, 0]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2023, 11, 13], 'end': [2023, 12, 14], 'change': [2023, 11, 26]}, [2845, 5748, 2903, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 5, 8], 'end': [2024, 6, 6], 'change': [2024, 6, 4]}, [338, 338, 0, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 10, 23]}, [2886, 2886, 0, 0])], [('regression', {'old': 1999, 'new': 10802, 'start': [2025, 1, 26], 'end': [2025, 2, 24], 'change': [2025, 1, 31]}, [1654, 8940, 7286, 0]), ('regression', {'old': 4900, 'new': 46132, 'start': [2024, 4, 13], 'end': [2024, 5, 12], 'change': [2024, 4, 30]}, [2028, 19089, 17061, 0]), ('partial-repair probe', {'old': 23223, 'new': 4900, 'start': [2025, 2, 5], 'end': [2025, 3, 8], 'change': [2025, 2, 9]}, [20226, 4268, 0, 15958]), ('partial-repair probe', {'old': 17701, 'new': 4900, 'start': [2024, 7, 1], 'end': [2024, 8, 1], 'change': [2024, 7, 6]}, [14846, 4110, 0, 10736]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2023, 8, 19], 'end': [2023, 9, 18], 'change': [2023, 9, 4]}, [2287, 4620, 2333, 0]), ('normal control', {'old': 1999, 'new': 9900, 'start': [2024, 9, 13], 'end': [2024, 12, 12], 'change': [2024, 11, 10]}, [711, 3520, 2809, 0]), ('normal control', {'old': 4900, 'new': 1999, 'start': [2023, 7, 16], 'end': [2023, 10, 14], 'change': [2023, 9, 2]}, [2287, 933, 0, 1354]), ('normal control', {'old': 41031, 'new': 1999, 'start': [2023, 6, 12], 'end': [2023, 7, 13], 'change': [2023, 7, 6]}, [9265, 451, 0, 8814])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [2059, 1581, 0, 479] | [2059, 1581, 0, 478] | Failed |
| regression 1 | [4992, 827, 0, 4164] | [4992, 827, 0, 4165] | Failed |
| partial-repair probe 2 | [178, 357, 179, 0] | [178, 357, 179, 0] | Passed |
| partial-repair probe 3 | [1288, 1222, 0, 66] | [1288, 1222, 0, 66] | Passed |
| normal control 4 | [3430, 5942, 2512, 0] | [3430, 5942, 2512, 0] | Passed |
| normal control 5 | [1797, 3630, 1833, 0] | [1797, 3630, 1833, 0] | Passed |
| normal control 6 | [6761, 948, 0, 5813] | [6761, 948, 0, 5813] | Passed |
| normal control 7 | [4410, 8910, 4500, 0] | [4410, 8910, 4500, 0] | Passed |
SHA-256 / 0904942f0a84815a3b0727b64d76f33474db8c68d0c0986d8c3e11c4bb6e7bc3
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import calendar
N = 1
observations = []
def solve(x):
s = datetime.date(*x['start'])
e = datetime.date(*x['end'])
c = datetime.date(*x['change'])
total = (e - s).days
remaining = (e - c).days
def pr(p):
return (p * remaining * 2 + total) // (2 * total)
credit = pr(x['old'])
charge = pr(x['new'])
net = (x['new'] - x['old']) * remaining // total
return [credit, charge, max(0, net), max(0, -net)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'old': 6384, 'new': 4900, 'start': [2023, 3, 23], 'end': [2023, 4, 23], 'change': [2023, 4, 13]}, [2059, 1581, 0, 478]), ('regression', {'old': 12063, 'new': 1999, 'start': [2024, 10, 16], 'end': [2024, 11, 14], 'change': [2024, 11, 2]}, [4992, 827, 0, 4165]), ('partial-repair probe', {'old': 999, 'new': 1999, 'start': [2023, 10, 16], 'end': [2023, 11, 13], 'change': [2023, 11, 8]}, [178, 357, 179, 0]), ('partial-repair probe', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('normal control', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('normal control', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0])], [('regression', {'old': 23223, 'new': 4900, 'start': [2025, 2, 5], 'end': [2025, 3, 8], 'change': [2025, 2, 9]}, [20226, 4268, 0, 15958]), ('regression', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('partial-repair probe', {'old': 4900, 'new': 14973, 'start': [2025, 4, 11], 'end': [2025, 5, 10], 'change': [2025, 4, 17]}, [3886, 11875, 7989, 0]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 11, 22], 'end': [2024, 12, 21], 'change': [2024, 12, 19]}, [338, 683, 345, 0]), ('normal control', {'old': 1999, 'new': 4900, 'start': [2023, 10, 12], 'end': [2024, 10, 11], 'change': [2024, 2, 28]}, [1238, 3034, 1796, 0]), ('normal control', {'old': 999, 'new': 9900, 'start': [2025, 5, 5], 'end': [2025, 6, 3], 'change': [2025, 5, 20]}, [482, 4779, 4297, 0]), ('normal control', {'old': 33928, 'new': 9900, 'start': [2025, 3, 24], 'end': [2025, 4, 24], 'change': [2025, 4, 16]}, [8756, 2555, 0, 6201]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2024, 4, 24], 'end': [2024, 5, 25], 'change': [2024, 5, 23]}, [129, 129, 0, 0])], [('regression', {'old': 1999, 'new': 4900, 'start': [2023, 2, 4], 'end': [2024, 2, 5], 'change': [2023, 8, 2]}, [1021, 2504, 1483, 0]), ('regression', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0]), ('partial-repair probe', {'old': 27165, 'new': 30410, 'start': [2023, 10, 29], 'end': [2024, 1, 27], 'change': [2023, 12, 28]}, [9055, 10137, 1082, 0]), ('partial-repair probe', {'old': 1999, 'new': 9900, 'start': [2024, 7, 18], 'end': [2024, 8, 18], 'change': [2024, 8, 1]}, [1096, 5429, 4333, 0]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2025, 5, 29], 'end': [2025, 6, 28], 'change': [2025, 6, 7]}, [1399, 1399, 0, 0]), ('normal control', {'old': 999, 'new': 4900, 'start': [2025, 5, 24], 'end': [2025, 6, 24], 'change': [2025, 5, 24]}, [999, 4900, 3901, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 11, 23], 'end': [2025, 11, 24], 'change': [2025, 7, 22]}, [1673, 1673, 0, 0]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2025, 3, 22], 'end': [2025, 6, 20], 'change': [2025, 5, 23]}, [622, 622, 0, 0])], [('regression', {'old': 999, 'new': 1999, 'start': [2023, 12, 29], 'end': [2024, 1, 26], 'change': [2024, 1, 17]}, [321, 643, 322, 0]), ('regression', {'old': 7276, 'new': 43371, 'start': [2024, 5, 21], 'end': [2024, 8, 19], 'change': [2024, 6, 13]}, [5417, 32287, 26870, 0]), ('partial-repair probe', {'old': 6384, 'new': 4900, 'start': [2023, 3, 23], 'end': [2023, 4, 23], 'change': [2023, 4, 13]}, [2059, 1581, 0, 478]), ('partial-repair probe', {'old': 999, 'new': 9900, 'start': [2023, 10, 10], 'end': [2024, 10, 9], 'change': [2024, 4, 29]}, [446, 4421, 3975, 0]), ('normal control', {'old': 4900, 'new': 29832, 'start': [2023, 6, 23], 'end': [2023, 7, 21], 'change': [2023, 7, 16]}, [875, 5327, 4452, 0]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2023, 11, 13], 'end': [2023, 12, 14], 'change': [2023, 11, 26]}, [2845, 5748, 2903, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 5, 8], 'end': [2024, 6, 6], 'change': [2024, 6, 4]}, [338, 338, 0, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 10, 23]}, [2886, 2886, 0, 0])], [('regression', {'old': 1999, 'new': 10802, 'start': [2025, 1, 26], 'end': [2025, 2, 24], 'change': [2025, 1, 31]}, [1654, 8940, 7286, 0]), ('regression', {'old': 4900, 'new': 46132, 'start': [2024, 4, 13], 'end': [2024, 5, 12], 'change': [2024, 4, 30]}, [2028, 19089, 17061, 0]), ('partial-repair probe', {'old': 23223, 'new': 4900, 'start': [2025, 2, 5], 'end': [2025, 3, 8], 'change': [2025, 2, 9]}, [20226, 4268, 0, 15958]), ('partial-repair probe', {'old': 17701, 'new': 4900, 'start': [2024, 7, 1], 'end': [2024, 8, 1], 'change': [2024, 7, 6]}, [14846, 4110, 0, 10736]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2023, 8, 19], 'end': [2023, 9, 18], 'change': [2023, 9, 4]}, [2287, 4620, 2333, 0]), ('normal control', {'old': 1999, 'new': 9900, 'start': [2024, 9, 13], 'end': [2024, 12, 12], 'change': [2024, 11, 10]}, [711, 3520, 2809, 0]), ('normal control', {'old': 4900, 'new': 1999, 'start': [2023, 7, 16], 'end': [2023, 10, 14], 'change': [2023, 9, 2]}, [2287, 933, 0, 1354]), ('normal control', {'old': 41031, 'new': 1999, 'start': [2023, 6, 12], 'end': [2023, 7, 13], 'change': [2023, 7, 6]}, [9265, 451, 0, 8814])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [2059, 1581, 0, 479] | [2059, 1581, 0, 478] | Failed |
| regression 1 | [4992, 827, 0, 4165] | [4992, 827, 0, 4165] | Passed |
| partial-repair probe 2 | [178, 357, 178, 0] | [178, 357, 179, 0] | Failed |
| partial-repair probe 3 | [1288, 1222, 0, 67] | [1288, 1222, 0, 66] | Failed |
| normal control 4 | [3430, 5942, 2512, 0] | [3430, 5942, 2512, 0] | Passed |
| normal control 5 | [1797, 3630, 1833, 0] | [1797, 3630, 1833, 0] | Passed |
| normal control 6 | [6761, 948, 0, 5813] | [6761, 948, 0, 5813] | Passed |
| normal control 7 | [4410, 8910, 4500, 0] | [4410, 8910, 4500, 0] | Passed |
SHA-256 / 23644e052b0ac8b4397892746df368d27e03a0dcedd99db1a972100b4c0f1ede
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import datetime
import calendar
N = 1
observations = []
def solve(x):
s = datetime.date(*x['start'])
e = datetime.date(*x['end'])
c = datetime.date(*x['change'])
total = (e - s).days
remaining = (e - c).days
def pr(p):
return (p * remaining * 2 + total) // (2 * total)
credit = pr(x['old'])
charge = pr(x['new'])
net = charge - credit
return [credit, charge, max(0, net), max(0, -net)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'old': 6384, 'new': 4900, 'start': [2023, 3, 23], 'end': [2023, 4, 23], 'change': [2023, 4, 13]}, [2059, 1581, 0, 478]), ('regression', {'old': 12063, 'new': 1999, 'start': [2024, 10, 16], 'end': [2024, 11, 14], 'change': [2024, 11, 2]}, [4992, 827, 0, 4165]), ('partial-repair probe', {'old': 999, 'new': 1999, 'start': [2023, 10, 16], 'end': [2023, 11, 13], 'change': [2023, 11, 8]}, [178, 357, 179, 0]), ('partial-repair probe', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('normal control', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('normal control', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0])], [('regression', {'old': 23223, 'new': 4900, 'start': [2025, 2, 5], 'end': [2025, 3, 8], 'change': [2025, 2, 9]}, [20226, 4268, 0, 15958]), ('regression', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('partial-repair probe', {'old': 4900, 'new': 14973, 'start': [2025, 4, 11], 'end': [2025, 5, 10], 'change': [2025, 4, 17]}, [3886, 11875, 7989, 0]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 11, 22], 'end': [2024, 12, 21], 'change': [2024, 12, 19]}, [338, 683, 345, 0]), ('normal control', {'old': 1999, 'new': 4900, 'start': [2023, 10, 12], 'end': [2024, 10, 11], 'change': [2024, 2, 28]}, [1238, 3034, 1796, 0]), ('normal control', {'old': 999, 'new': 9900, 'start': [2025, 5, 5], 'end': [2025, 6, 3], 'change': [2025, 5, 20]}, [482, 4779, 4297, 0]), ('normal control', {'old': 33928, 'new': 9900, 'start': [2025, 3, 24], 'end': [2025, 4, 24], 'change': [2025, 4, 16]}, [8756, 2555, 0, 6201]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2024, 4, 24], 'end': [2024, 5, 25], 'change': [2024, 5, 23]}, [129, 129, 0, 0])], [('regression', {'old': 1999, 'new': 4900, 'start': [2023, 2, 4], 'end': [2024, 2, 5], 'change': [2023, 8, 2]}, [1021, 2504, 1483, 0]), ('regression', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0]), ('partial-repair probe', {'old': 27165, 'new': 30410, 'start': [2023, 10, 29], 'end': [2024, 1, 27], 'change': [2023, 12, 28]}, [9055, 10137, 1082, 0]), ('partial-repair probe', {'old': 1999, 'new': 9900, 'start': [2024, 7, 18], 'end': [2024, 8, 18], 'change': [2024, 8, 1]}, [1096, 5429, 4333, 0]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2025, 5, 29], 'end': [2025, 6, 28], 'change': [2025, 6, 7]}, [1399, 1399, 0, 0]), ('normal control', {'old': 999, 'new': 4900, 'start': [2025, 5, 24], 'end': [2025, 6, 24], 'change': [2025, 5, 24]}, [999, 4900, 3901, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 11, 23], 'end': [2025, 11, 24], 'change': [2025, 7, 22]}, [1673, 1673, 0, 0]), ('normal control', {'old': 1999, 'new': 1999, 'start': [2025, 3, 22], 'end': [2025, 6, 20], 'change': [2025, 5, 23]}, [622, 622, 0, 0])], [('regression', {'old': 999, 'new': 1999, 'start': [2023, 12, 29], 'end': [2024, 1, 26], 'change': [2024, 1, 17]}, [321, 643, 322, 0]), ('regression', {'old': 7276, 'new': 43371, 'start': [2024, 5, 21], 'end': [2024, 8, 19], 'change': [2024, 6, 13]}, [5417, 32287, 26870, 0]), ('partial-repair probe', {'old': 6384, 'new': 4900, 'start': [2023, 3, 23], 'end': [2023, 4, 23], 'change': [2023, 4, 13]}, [2059, 1581, 0, 478]), ('partial-repair probe', {'old': 999, 'new': 9900, 'start': [2023, 10, 10], 'end': [2024, 10, 9], 'change': [2024, 4, 29]}, [446, 4421, 3975, 0]), ('normal control', {'old': 4900, 'new': 29832, 'start': [2023, 6, 23], 'end': [2023, 7, 21], 'change': [2023, 7, 16]}, [875, 5327, 4452, 0]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2023, 11, 13], 'end': [2023, 12, 14], 'change': [2023, 11, 26]}, [2845, 5748, 2903, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 5, 8], 'end': [2024, 6, 6], 'change': [2024, 6, 4]}, [338, 338, 0, 0]), ('normal control', {'old': 4900, 'new': 4900, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 10, 23]}, [2886, 2886, 0, 0])], [('regression', {'old': 1999, 'new': 10802, 'start': [2025, 1, 26], 'end': [2025, 2, 24], 'change': [2025, 1, 31]}, [1654, 8940, 7286, 0]), ('regression', {'old': 4900, 'new': 46132, 'start': [2024, 4, 13], 'end': [2024, 5, 12], 'change': [2024, 4, 30]}, [2028, 19089, 17061, 0]), ('partial-repair probe', {'old': 23223, 'new': 4900, 'start': [2025, 2, 5], 'end': [2025, 3, 8], 'change': [2025, 2, 9]}, [20226, 4268, 0, 15958]), ('partial-repair probe', {'old': 17701, 'new': 4900, 'start': [2024, 7, 1], 'end': [2024, 8, 1], 'change': [2024, 7, 6]}, [14846, 4110, 0, 10736]), ('normal control', {'old': 4900, 'new': 9900, 'start': [2023, 8, 19], 'end': [2023, 9, 18], 'change': [2023, 9, 4]}, [2287, 4620, 2333, 0]), ('normal control', {'old': 1999, 'new': 9900, 'start': [2024, 9, 13], 'end': [2024, 12, 12], 'change': [2024, 11, 10]}, [711, 3520, 2809, 0]), ('normal control', {'old': 4900, 'new': 1999, 'start': [2023, 7, 16], 'end': [2023, 10, 14], 'change': [2023, 9, 2]}, [2287, 933, 0, 1354]), ('normal control', {'old': 41031, 'new': 1999, 'start': [2023, 6, 12], 'end': [2023, 7, 13], 'change': [2023, 7, 6]}, [9265, 451, 0, 8814])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [2059, 1581, 0, 478] | [2059, 1581, 0, 478] | Passed |
| regression 1 | [4992, 827, 0, 4165] | [4992, 827, 0, 4165] | Passed |
| partial-repair probe 2 | [178, 357, 179, 0] | [178, 357, 179, 0] | Passed |
| partial-repair probe 3 | [1288, 1222, 0, 66] | [1288, 1222, 0, 66] | Passed |
| normal control 4 | [3430, 5942, 2512, 0] | [3430, 5942, 2512, 0] | Passed |
| normal control 5 | [1797, 3630, 1833, 0] | [1797, 3630, 1833, 0] | Passed |
| normal control 6 | [6761, 948, 0, 5813] | [6761, 948, 0, 5813] | Passed |
| normal control 7 | [4410, 8910, 4500, 0] | [4410, 8910, 4500, 0] | Passed |
SHA-256 / bea707d9976e4216adeac9f9d04c9e6931361e5f3fb9c7dc93ccd32ffde9f1ea
Verification & scope
A deterministic teaching model of a stipulated billing rule. It makes no claim to reproduce any billing provider's exact behaviour and is not billing software. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:46:35.484851+00:00.
Case digest / 4f1aa86b39d5fb729c7bf6ac535c98873160cda49ac076bdc3c438c0fd3bd47e