FA-59776 / Subscription proration billing / Open access
Ratable monthly schedule of a prepaid term: cumulative remainder allocation · case 01
Monthly schedule parts do not add up to the invoiced amount.
ROOT CAUSE
Each month is floored independently instead of taking the increase of the cumulative floor.
VERIFIED REPAIR
Restore the contract rule at the cumulative remainder allocation step: use `part = x['amount'] * acc_days // total - acc`.
Unsuccessful approach: The attempt rounds each month half-up, which can still over- or under-shoot the total.
Case contract
Input {amount, start, end (exclusive)}. The amount is spread by days across calendar months. The cumulative amount through each month is floor(amount*cumulative_days/total_days), and each month gets the increase, so the parts sum exactly to amount. Return [["YYYY-MM", cents]] for each month touched.
Why this case matters
Prepaid subscriptions are recognized day-by-day, and per-month rounding must not leak or create cents.
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'])
total = (e - s).days
out = []
cur = s
acc = 0
acc_days = 0
while cur < e:
nm = datetime.date(cur.year + (cur.month == 12), cur.month % 12 + 1, 1)
seg_end = min(nm, e)
days = (seg_end - cur).days
acc_days += days
part = x['amount'] * days // total
acc += part
out.append([cur.strftime('%Y-%m'), part])
cur = seg_end
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'amount': 99, 'start': [2024, 9, 18], 'end': [2024, 10, 18]}, [['2024-09', 42], ['2024-10', 57]]), ('regression', {'amount': 99, 'start': [2025, 1, 16], 'end': [2025, 6, 7]}, [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]]), ('partial-repair probe', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('normal control', {'amount': 1000, 'start': [2023, 2, 2], 'end': [2023, 3, 4]}, [['2023-02', 900], ['2023-03', 100]]), ('normal control', {'amount': 119900, 'start': [2024, 12, 17], 'end': [2025, 1, 16]}, [['2024-12', 59950], ['2025-01', 59950]]), ('normal control', {'amount': 1000, 'start': [2023, 9, 7], 'end': [2023, 10, 7]}, [['2023-09', 800], ['2023-10', 200]]), ('normal control', {'amount': 119900, 'start': [2023, 12, 11], 'end': [2024, 1, 10]}, [['2023-12', 83930], ['2024-01', 35970]])], [('regression', {'amount': 99, 'start': [2025, 1, 16], 'end': [2025, 6, 7]}, [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]]), ('regression', {'amount': 771300, 'start': [2023, 1, 27], 'end': [2023, 2, 27]}, [['2023-01', 124403], ['2023-02', 646897]]), ('partial-repair probe', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('normal control', {'amount': 119900, 'start': [2023, 10, 25], 'end': [2024, 6, 1]}, [['2023-10', 3815], ['2023-11', 16350], ['2023-12', 16895], ['2024-01', 16895], ['2024-02', 15805], ['2024-03', 16895], ['2024-04', 16350], ['2024-05', 16895]]), ('normal control', {'amount': 119900, 'start': [2023, 10, 2], 'end': [2023, 11, 1]}, [['2023-10', 119900]]), ('normal control', {'amount': 2702, 'start': [2024, 7, 1], 'end': [2024, 8, 1]}, [['2024-07', 2702]]), ('normal control', {'amount': 119900, 'start': [2023, 7, 14], 'end': [2023, 8, 13]}, [['2023-07', 71940], ['2023-08', 47960]])], [('regression', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('regression', {'amount': 771300, 'start': [2023, 1, 27], 'end': [2023, 2, 27]}, [['2023-01', 124403], ['2023-02', 646897]]), ('partial-repair probe', {'amount': 1000, 'start': [2024, 7, 15], 'end': [2025, 7, 16]}, [['2024-07', 46], ['2024-08', 85], ['2024-09', 82], ['2024-10', 84], ['2024-11', 82], ['2024-12', 85], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 85], ['2025-06', 82], ['2025-07', 41]]), ('partial-repair probe', {'amount': 1000, 'start': [2024, 12, 7], 'end': [2025, 12, 8]}, [['2024-12', 68], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 84], ['2025-06', 82], ['2025-07', 85], ['2025-08', 85], ['2025-09', 82], ['2025-10', 84], ['2025-11', 82], ['2025-12', 20]]), ('normal control', {'amount': 1000, 'start': [2025, 2, 8], 'end': [2025, 2, 21]}, [['2025-02', 1000]]), ('normal control', {'amount': 119900, 'start': [2024, 12, 3], 'end': [2024, 12, 27]}, [['2024-12', 119900]]), ('normal control', {'amount': 99, 'start': [2024, 2, 10], 'end': [2024, 3, 11]}, [['2024-02', 66], ['2024-03', 33]]), ('normal control', {'amount': 119900, 'start': [2024, 9, 4], 'end': [2024, 10, 4]}, [['2024-09', 107910], ['2024-10', 11990]])], [('regression', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('regression', {'amount': 99, 'start': [2025, 2, 8], 'end': [2025, 5, 9]}, [['2025-02', 23], ['2025-03', 34], ['2025-04', 33], ['2025-05', 9]]), ('partial-repair probe', {'amount': 119900, 'start': [2024, 11, 19], 'end': [2025, 2, 17]}, [['2024-11', 15986], ['2024-12', 41299], ['2025-01', 41299], ['2025-02', 21316]]), ('partial-repair probe', {'amount': 778345, 'start': [2023, 9, 19], 'end': [2023, 10, 20]}, [['2023-09', 301294], ['2023-10', 477051]]), ('normal control', {'amount': 1000, 'start': [2024, 3, 2], 'end': [2024, 4, 1]}, [['2024-03', 1000]]), ('normal control', {'amount': 851526, 'start': [2024, 8, 2], 'end': [2024, 10, 31]}, [['2024-08', 283842], ['2024-09', 283842], ['2024-10', 283842]]), ('normal control', {'amount': 1000, 'start': [2025, 1, 29], 'end': [2025, 2, 28]}, [['2025-01', 100], ['2025-02', 900]]), ('normal control', {'amount': 1000, 'start': [2023, 11, 28], 'end': [2023, 12, 28]}, [['2023-11', 100], ['2023-12', 900]])], [('regression', {'amount': 1000, 'start': [2024, 7, 15], 'end': [2025, 7, 16]}, [['2024-07', 46], ['2024-08', 85], ['2024-09', 82], ['2024-10', 84], ['2024-11', 82], ['2024-12', 85], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 85], ['2025-06', 82], ['2025-07', 41]]), ('regression', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 119900, 'start': [2024, 6, 19], 'end': [2024, 7, 20]}, [['2024-06', 46412], ['2024-07', 73488]]), ('partial-repair probe', {'amount': 795575, 'start': [2023, 3, 21], 'end': [2023, 11, 20]}, [['2023-03', 35866], ['2023-04', 97816], ['2023-05', 101077], ['2023-06', 97817], ['2023-07', 101077], ['2023-08', 101077], ['2023-09', 97817], ['2023-10', 101077], ['2023-11', 61951]]), ('normal control', {'amount': 1000, 'start': [2023, 2, 26], 'end': [2023, 3, 28]}, [['2023-02', 100], ['2023-03', 900]]), ('normal control', {'amount': 119900, 'start': [2023, 12, 20], 'end': [2024, 1, 19]}, [['2023-12', 47960], ['2024-01', 71940]]), ('normal control', {'amount': 119900, 'start': [2023, 9, 5], 'end': [2023, 9, 6]}, [['2023-09', 119900]]), ('normal control', {'amount': 119900, 'start': [2024, 4, 13], 'end': [2024, 5, 13]}, [['2024-04', 71940], ['2024-05', 47960]])]]
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 | [['2024-09', 42], ['2024-10', 56]] | [['2024-09', 42], ['2024-10', 57]] | Failed |
| regression 1 | [['2025-01', 11], ['2025-02', 19], ['2025-03', 21], ['2025-04', 20], ['2025-05', 21], ['2025-06', 4]] | [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]] | Failed |
| partial-repair probe 2 | [['2023-06', 8], ['2023-07', 27], ['2023-08', 27], ['2023-09', 26], ['2023-10', 8]] | [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]] | Failed |
| partial-repair probe 3 | [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 1]] | [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]] | Failed |
| normal control 4 | [['2023-02', 900], ['2023-03', 100]] | [['2023-02', 900], ['2023-03', 100]] | Passed |
| normal control 5 | [['2024-12', 59950], ['2025-01', 59950]] | [['2024-12', 59950], ['2025-01', 59950]] | Passed |
| normal control 6 | [['2023-09', 800], ['2023-10', 200]] | [['2023-09', 800], ['2023-10', 200]] | Passed |
| normal control 7 | [['2023-12', 83930], ['2024-01', 35970]] | [['2023-12', 83930], ['2024-01', 35970]] | Passed |
SHA-256 / 87beda7e59e0e696271ae0687790f721049d57fe1940b25c6d612a284d46f034
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'])
total = (e - s).days
out = []
cur = s
acc = 0
acc_days = 0
while cur < e:
nm = datetime.date(cur.year + (cur.month == 12), cur.month % 12 + 1, 1)
seg_end = min(nm, e)
days = (seg_end - cur).days
acc_days += days
part = (x['amount'] * days * 2 + total) // (2 * total)
acc += part
out.append([cur.strftime('%Y-%m'), part])
cur = seg_end
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'amount': 99, 'start': [2024, 9, 18], 'end': [2024, 10, 18]}, [['2024-09', 42], ['2024-10', 57]]), ('regression', {'amount': 99, 'start': [2025, 1, 16], 'end': [2025, 6, 7]}, [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]]), ('partial-repair probe', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('normal control', {'amount': 1000, 'start': [2023, 2, 2], 'end': [2023, 3, 4]}, [['2023-02', 900], ['2023-03', 100]]), ('normal control', {'amount': 119900, 'start': [2024, 12, 17], 'end': [2025, 1, 16]}, [['2024-12', 59950], ['2025-01', 59950]]), ('normal control', {'amount': 1000, 'start': [2023, 9, 7], 'end': [2023, 10, 7]}, [['2023-09', 800], ['2023-10', 200]]), ('normal control', {'amount': 119900, 'start': [2023, 12, 11], 'end': [2024, 1, 10]}, [['2023-12', 83930], ['2024-01', 35970]])], [('regression', {'amount': 99, 'start': [2025, 1, 16], 'end': [2025, 6, 7]}, [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]]), ('regression', {'amount': 771300, 'start': [2023, 1, 27], 'end': [2023, 2, 27]}, [['2023-01', 124403], ['2023-02', 646897]]), ('partial-repair probe', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('normal control', {'amount': 119900, 'start': [2023, 10, 25], 'end': [2024, 6, 1]}, [['2023-10', 3815], ['2023-11', 16350], ['2023-12', 16895], ['2024-01', 16895], ['2024-02', 15805], ['2024-03', 16895], ['2024-04', 16350], ['2024-05', 16895]]), ('normal control', {'amount': 119900, 'start': [2023, 10, 2], 'end': [2023, 11, 1]}, [['2023-10', 119900]]), ('normal control', {'amount': 2702, 'start': [2024, 7, 1], 'end': [2024, 8, 1]}, [['2024-07', 2702]]), ('normal control', {'amount': 119900, 'start': [2023, 7, 14], 'end': [2023, 8, 13]}, [['2023-07', 71940], ['2023-08', 47960]])], [('regression', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('regression', {'amount': 771300, 'start': [2023, 1, 27], 'end': [2023, 2, 27]}, [['2023-01', 124403], ['2023-02', 646897]]), ('partial-repair probe', {'amount': 1000, 'start': [2024, 7, 15], 'end': [2025, 7, 16]}, [['2024-07', 46], ['2024-08', 85], ['2024-09', 82], ['2024-10', 84], ['2024-11', 82], ['2024-12', 85], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 85], ['2025-06', 82], ['2025-07', 41]]), ('partial-repair probe', {'amount': 1000, 'start': [2024, 12, 7], 'end': [2025, 12, 8]}, [['2024-12', 68], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 84], ['2025-06', 82], ['2025-07', 85], ['2025-08', 85], ['2025-09', 82], ['2025-10', 84], ['2025-11', 82], ['2025-12', 20]]), ('normal control', {'amount': 1000, 'start': [2025, 2, 8], 'end': [2025, 2, 21]}, [['2025-02', 1000]]), ('normal control', {'amount': 119900, 'start': [2024, 12, 3], 'end': [2024, 12, 27]}, [['2024-12', 119900]]), ('normal control', {'amount': 99, 'start': [2024, 2, 10], 'end': [2024, 3, 11]}, [['2024-02', 66], ['2024-03', 33]]), ('normal control', {'amount': 119900, 'start': [2024, 9, 4], 'end': [2024, 10, 4]}, [['2024-09', 107910], ['2024-10', 11990]])], [('regression', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('regression', {'amount': 99, 'start': [2025, 2, 8], 'end': [2025, 5, 9]}, [['2025-02', 23], ['2025-03', 34], ['2025-04', 33], ['2025-05', 9]]), ('partial-repair probe', {'amount': 119900, 'start': [2024, 11, 19], 'end': [2025, 2, 17]}, [['2024-11', 15986], ['2024-12', 41299], ['2025-01', 41299], ['2025-02', 21316]]), ('partial-repair probe', {'amount': 778345, 'start': [2023, 9, 19], 'end': [2023, 10, 20]}, [['2023-09', 301294], ['2023-10', 477051]]), ('normal control', {'amount': 1000, 'start': [2024, 3, 2], 'end': [2024, 4, 1]}, [['2024-03', 1000]]), ('normal control', {'amount': 851526, 'start': [2024, 8, 2], 'end': [2024, 10, 31]}, [['2024-08', 283842], ['2024-09', 283842], ['2024-10', 283842]]), ('normal control', {'amount': 1000, 'start': [2025, 1, 29], 'end': [2025, 2, 28]}, [['2025-01', 100], ['2025-02', 900]]), ('normal control', {'amount': 1000, 'start': [2023, 11, 28], 'end': [2023, 12, 28]}, [['2023-11', 100], ['2023-12', 900]])], [('regression', {'amount': 1000, 'start': [2024, 7, 15], 'end': [2025, 7, 16]}, [['2024-07', 46], ['2024-08', 85], ['2024-09', 82], ['2024-10', 84], ['2024-11', 82], ['2024-12', 85], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 85], ['2025-06', 82], ['2025-07', 41]]), ('regression', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 119900, 'start': [2024, 6, 19], 'end': [2024, 7, 20]}, [['2024-06', 46412], ['2024-07', 73488]]), ('partial-repair probe', {'amount': 795575, 'start': [2023, 3, 21], 'end': [2023, 11, 20]}, [['2023-03', 35866], ['2023-04', 97816], ['2023-05', 101077], ['2023-06', 97817], ['2023-07', 101077], ['2023-08', 101077], ['2023-09', 97817], ['2023-10', 101077], ['2023-11', 61951]]), ('normal control', {'amount': 1000, 'start': [2023, 2, 26], 'end': [2023, 3, 28]}, [['2023-02', 100], ['2023-03', 900]]), ('normal control', {'amount': 119900, 'start': [2023, 12, 20], 'end': [2024, 1, 19]}, [['2023-12', 47960], ['2024-01', 71940]]), ('normal control', {'amount': 119900, 'start': [2023, 9, 5], 'end': [2023, 9, 6]}, [['2023-09', 119900]]), ('normal control', {'amount': 119900, 'start': [2024, 4, 13], 'end': [2024, 5, 13]}, [['2024-04', 71940], ['2024-05', 47960]])]]
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 | [['2024-09', 43], ['2024-10', 56]] | [['2024-09', 42], ['2024-10', 57]] | Failed |
| regression 1 | [['2025-01', 11], ['2025-02', 20], ['2025-03', 22], ['2025-04', 21], ['2025-05', 22], ['2025-06', 4]] | [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]] | Failed |
| partial-repair probe 2 | [['2023-06', 9], ['2023-07', 28], ['2023-08', 28], ['2023-09', 27], ['2023-10', 8]] | [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]] | Failed |
| partial-repair probe 3 | [['2025-02', 31], ['2025-03', 34], ['2025-04', 33], ['2025-05', 1]] | [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]] | Failed |
| normal control 4 | [['2023-02', 900], ['2023-03', 100]] | [['2023-02', 900], ['2023-03', 100]] | Passed |
| normal control 5 | [['2024-12', 59950], ['2025-01', 59950]] | [['2024-12', 59950], ['2025-01', 59950]] | Passed |
| normal control 6 | [['2023-09', 800], ['2023-10', 200]] | [['2023-09', 800], ['2023-10', 200]] | Passed |
| normal control 7 | [['2023-12', 83930], ['2024-01', 35970]] | [['2023-12', 83930], ['2024-01', 35970]] | Passed |
SHA-256 / 0410dbda8a3b1f527826b18f81b73f531d43264f8ab2b4600cb7de51b730a8fd
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'])
total = (e - s).days
out = []
cur = s
acc = 0
acc_days = 0
while cur < e:
nm = datetime.date(cur.year + (cur.month == 12), cur.month % 12 + 1, 1)
seg_end = min(nm, e)
days = (seg_end - cur).days
acc_days += days
part = x['amount'] * acc_days // total - acc
acc += part
out.append([cur.strftime('%Y-%m'), part])
cur = seg_end
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'amount': 99, 'start': [2024, 9, 18], 'end': [2024, 10, 18]}, [['2024-09', 42], ['2024-10', 57]]), ('regression', {'amount': 99, 'start': [2025, 1, 16], 'end': [2025, 6, 7]}, [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]]), ('partial-repair probe', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('normal control', {'amount': 1000, 'start': [2023, 2, 2], 'end': [2023, 3, 4]}, [['2023-02', 900], ['2023-03', 100]]), ('normal control', {'amount': 119900, 'start': [2024, 12, 17], 'end': [2025, 1, 16]}, [['2024-12', 59950], ['2025-01', 59950]]), ('normal control', {'amount': 1000, 'start': [2023, 9, 7], 'end': [2023, 10, 7]}, [['2023-09', 800], ['2023-10', 200]]), ('normal control', {'amount': 119900, 'start': [2023, 12, 11], 'end': [2024, 1, 10]}, [['2023-12', 83930], ['2024-01', 35970]])], [('regression', {'amount': 99, 'start': [2025, 1, 16], 'end': [2025, 6, 7]}, [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]]), ('regression', {'amount': 771300, 'start': [2023, 1, 27], 'end': [2023, 2, 27]}, [['2023-01', 124403], ['2023-02', 646897]]), ('partial-repair probe', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('normal control', {'amount': 119900, 'start': [2023, 10, 25], 'end': [2024, 6, 1]}, [['2023-10', 3815], ['2023-11', 16350], ['2023-12', 16895], ['2024-01', 16895], ['2024-02', 15805], ['2024-03', 16895], ['2024-04', 16350], ['2024-05', 16895]]), ('normal control', {'amount': 119900, 'start': [2023, 10, 2], 'end': [2023, 11, 1]}, [['2023-10', 119900]]), ('normal control', {'amount': 2702, 'start': [2024, 7, 1], 'end': [2024, 8, 1]}, [['2024-07', 2702]]), ('normal control', {'amount': 119900, 'start': [2023, 7, 14], 'end': [2023, 8, 13]}, [['2023-07', 71940], ['2023-08', 47960]])], [('regression', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('regression', {'amount': 771300, 'start': [2023, 1, 27], 'end': [2023, 2, 27]}, [['2023-01', 124403], ['2023-02', 646897]]), ('partial-repair probe', {'amount': 1000, 'start': [2024, 7, 15], 'end': [2025, 7, 16]}, [['2024-07', 46], ['2024-08', 85], ['2024-09', 82], ['2024-10', 84], ['2024-11', 82], ['2024-12', 85], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 85], ['2025-06', 82], ['2025-07', 41]]), ('partial-repair probe', {'amount': 1000, 'start': [2024, 12, 7], 'end': [2025, 12, 8]}, [['2024-12', 68], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 84], ['2025-06', 82], ['2025-07', 85], ['2025-08', 85], ['2025-09', 82], ['2025-10', 84], ['2025-11', 82], ['2025-12', 20]]), ('normal control', {'amount': 1000, 'start': [2025, 2, 8], 'end': [2025, 2, 21]}, [['2025-02', 1000]]), ('normal control', {'amount': 119900, 'start': [2024, 12, 3], 'end': [2024, 12, 27]}, [['2024-12', 119900]]), ('normal control', {'amount': 99, 'start': [2024, 2, 10], 'end': [2024, 3, 11]}, [['2024-02', 66], ['2024-03', 33]]), ('normal control', {'amount': 119900, 'start': [2024, 9, 4], 'end': [2024, 10, 4]}, [['2024-09', 107910], ['2024-10', 11990]])], [('regression', {'amount': 99, 'start': [2025, 2, 1], 'end': [2025, 5, 2]}, [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]]), ('regression', {'amount': 99, 'start': [2025, 2, 8], 'end': [2025, 5, 9]}, [['2025-02', 23], ['2025-03', 34], ['2025-04', 33], ['2025-05', 9]]), ('partial-repair probe', {'amount': 119900, 'start': [2024, 11, 19], 'end': [2025, 2, 17]}, [['2024-11', 15986], ['2024-12', 41299], ['2025-01', 41299], ['2025-02', 21316]]), ('partial-repair probe', {'amount': 778345, 'start': [2023, 9, 19], 'end': [2023, 10, 20]}, [['2023-09', 301294], ['2023-10', 477051]]), ('normal control', {'amount': 1000, 'start': [2024, 3, 2], 'end': [2024, 4, 1]}, [['2024-03', 1000]]), ('normal control', {'amount': 851526, 'start': [2024, 8, 2], 'end': [2024, 10, 31]}, [['2024-08', 283842], ['2024-09', 283842], ['2024-10', 283842]]), ('normal control', {'amount': 1000, 'start': [2025, 1, 29], 'end': [2025, 2, 28]}, [['2025-01', 100], ['2025-02', 900]]), ('normal control', {'amount': 1000, 'start': [2023, 11, 28], 'end': [2023, 12, 28]}, [['2023-11', 100], ['2023-12', 900]])], [('regression', {'amount': 1000, 'start': [2024, 7, 15], 'end': [2025, 7, 16]}, [['2024-07', 46], ['2024-08', 85], ['2024-09', 82], ['2024-10', 84], ['2024-11', 82], ['2024-12', 85], ['2025-01', 85], ['2025-02', 76], ['2025-03', 85], ['2025-04', 82], ['2025-05', 85], ['2025-06', 82], ['2025-07', 41]]), ('regression', {'amount': 99, 'start': [2023, 6, 21], 'end': [2023, 10, 10]}, [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]]), ('partial-repair probe', {'amount': 119900, 'start': [2024, 6, 19], 'end': [2024, 7, 20]}, [['2024-06', 46412], ['2024-07', 73488]]), ('partial-repair probe', {'amount': 795575, 'start': [2023, 3, 21], 'end': [2023, 11, 20]}, [['2023-03', 35866], ['2023-04', 97816], ['2023-05', 101077], ['2023-06', 97817], ['2023-07', 101077], ['2023-08', 101077], ['2023-09', 97817], ['2023-10', 101077], ['2023-11', 61951]]), ('normal control', {'amount': 1000, 'start': [2023, 2, 26], 'end': [2023, 3, 28]}, [['2023-02', 100], ['2023-03', 900]]), ('normal control', {'amount': 119900, 'start': [2023, 12, 20], 'end': [2024, 1, 19]}, [['2023-12', 47960], ['2024-01', 71940]]), ('normal control', {'amount': 119900, 'start': [2023, 9, 5], 'end': [2023, 9, 6]}, [['2023-09', 119900]]), ('normal control', {'amount': 119900, 'start': [2024, 4, 13], 'end': [2024, 5, 13]}, [['2024-04', 71940], ['2024-05', 47960]])]]
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 | [['2024-09', 42], ['2024-10', 57]] | [['2024-09', 42], ['2024-10', 57]] | Passed |
| regression 1 | [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]] | [['2025-01', 11], ['2025-02', 19], ['2025-03', 22], ['2025-04', 21], ['2025-05', 21], ['2025-06', 5]] | Passed |
| partial-repair probe 2 | [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]] | [['2023-06', 8], ['2023-07', 28], ['2023-08', 28], ['2023-09', 26], ['2023-10', 9]] | Passed |
| partial-repair probe 3 | [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]] | [['2025-02', 30], ['2025-03', 34], ['2025-04', 33], ['2025-05', 2]] | Passed |
| normal control 4 | [['2023-02', 900], ['2023-03', 100]] | [['2023-02', 900], ['2023-03', 100]] | Passed |
| normal control 5 | [['2024-12', 59950], ['2025-01', 59950]] | [['2024-12', 59950], ['2025-01', 59950]] | Passed |
| normal control 6 | [['2023-09', 800], ['2023-10', 200]] | [['2023-09', 800], ['2023-10', 200]] | Passed |
| normal control 7 | [['2023-12', 83930], ['2024-01', 35970]] | [['2023-12', 83930], ['2024-01', 35970]] | Passed |
SHA-256 / 2d37514c687bdbb27d1770442e1bf51f0157e69af50eb0ba011e1cd1fd066bc6
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:39.493219+00:00.
Case digest / 48457c67a4e8e61019c47f7d92a8ffb1ee5be9845af6e1c8514dcf1b2ba8e104