FAILURE MAP
← Case archive

FA-59656 / Subscription proration billing / Open access

Flat fee proration with metered usage: usage not prorated · case 01

Late joiners are billed for only a fraction of the usage they consumed.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Metered usage is prorated like the flat fee.

VERIFIED REPAIR

Restore the contract rule at the usage not prorated step: use `usage = sum(q for d, q in x['events'] if x['from'] <= d < end) * x['unit']`.

Unsuccessful approach: The attempt stops prorating but also stops windowing usage to the active period.

Case contract

Input {flat, period_days, from, cancel|None, unit, events: [[day, qty]]}. Active window is [from, end) with end = min(cancel, period_days) or period_days. The flat fee is prorated by active days half-up; usage is not prorated: every event inside the window is billed qty*unit. Return [flat_charge, usage_charge].

Why this case matters

Only the recurring fee is prorated; metered usage is billed exactly for the active window.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    end = x['period_days'] if x['cancel'] is None else min(x['cancel'], x['period_days'])
    active = max(0, end - x['from'])
    flat = (x['flat'] * active * 2 + x['period_days']) // (2 * x['period_days'])
    usage = sum(q for d, q in x['events'] if x['from'] <= d < end) * x['unit'] * active // x['period_days']
    return [flat, usage]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'flat': 2900, 'period_days': 30, 'from': 15, 'cancel': None, 'unit': 5, 'events': [[26, 260], [12, 213]]}, [1450, 1300]), ('regression', {'flat': 12170, 'period_days': 30, 'from': 3, 'cancel': None, 'unit': 12, 'events': [[23, 155], [28, 348], [21, 236]]}, [10953, 8868]), ('partial-repair probe', {'flat': 2900, 'period_days': 31, 'from': 23, 'cancel': None, 'unit': 12, 'events': [[13, 491]]}, [748, 0]), ('partial-repair probe', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('normal control', {'flat': 8044, 'period_days': 31, 'from': 14, 'cancel': None, 'unit': 5, 'events': []}, [4411, 0]), ('normal control', {'flat': 2900, 'period_days': 31, 'from': 0, 'cancel': None, 'unit': 5, 'events': [[10, 43], [0, 320]]}, [2900, 1815]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 10, 'cancel': None, 'unit': 5, 'events': []}, [1933, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 26, 'cancel': 17, 'unit': 1, 'events': []}, [0, 0])], [('regression', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('regression', {'flat': 12170, 'period_days': 30, 'from': 3, 'cancel': None, 'unit': 12, 'events': [[23, 155], [28, 348], [21, 236]]}, [10953, 8868]), ('partial-repair probe', {'flat': 6972, 'period_days': 31, 'from': 29, 'cancel': 18, 'unit': 12, 'events': [[29, 170]]}, [0, 0]), ('partial-repair probe', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 7, 'cancel': 17, 'unit': 12, 'events': []}, [967, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 29, 'cancel': 2, 'unit': 5, 'events': []}, [0, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 11, 'cancel': None, 'unit': 1, 'events': []}, [6270, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 9, 'cancel': None, 'unit': 1, 'events': []}, [7026, 0])], [('regression', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('regression', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 2, 'cancel': 7, 'unit': 12, 'events': [[8, 9], [1, 189]]}, [1597, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 7, 'cancel': 9, 'unit': 12, 'events': []}, [639, 0]), ('normal control', {'flat': 11296, 'period_days': 30, 'from': 23, 'cancel': None, 'unit': 1, 'events': []}, [2636, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 25, 'cancel': 29, 'unit': 12, 'events': []}, [1320, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 9, 'cancel': None, 'unit': 5, 'events': []}, [7026, 0])], [('regression', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('regression', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 2, 'cancel': 7, 'unit': 12, 'events': [[8, 9], [1, 189]]}, [1597, 0]), ('partial-repair probe', {'flat': 11245, 'period_days': 30, 'from': 4, 'cancel': None, 'unit': 5, 'events': [[15, 26], [32, 318], [2, 320], [5, 358]]}, [9746, 1920]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 29, 'cancel': 16, 'unit': 12, 'events': []}, [0, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 26, 'cancel': None, 'unit': 12, 'events': []}, [387, 0]), ('normal control', {'flat': 8533, 'period_days': 30, 'from': 5, 'cancel': 4, 'unit': 12, 'events': []}, [0, 0]), ('normal control', {'flat': 3099, 'period_days': 30, 'from': 5, 'cancel': None, 'unit': 1, 'events': []}, [2583, 0])], [('regression', {'flat': 11245, 'period_days': 30, 'from': 4, 'cancel': None, 'unit': 5, 'events': [[15, 26], [32, 318], [2, 320], [5, 358]]}, [9746, 1920]), ('regression', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('partial-repair probe', {'flat': 6064, 'period_days': 30, 'from': 12, 'cancel': 13, 'unit': 12, 'events': [[26, 133], [7, 193]]}, [202, 0]), ('partial-repair probe', {'flat': 2900, 'period_days': 30, 'from': 26, 'cancel': None, 'unit': 5, 'events': [[15, 372], [6, 377], [28, 0]]}, [387, 0]), ('normal control', {'flat': 19748, 'period_days': 30, 'from': 10, 'cancel': None, 'unit': 5, 'events': []}, [13165, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 28, 'cancel': None, 'unit': 12, 'events': []}, [958, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 22, 'cancel': None, 'unit': 5, 'events': []}, [773, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 8, 'cancel': None, 'unit': 1, 'events': []}, [2127, 0])]]
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 fixtureActualExpectedOutcome
regression 0[1450, 650][1450, 1300]Failed
regression 1[10953, 7981][10953, 8868]Failed
partial-repair probe 2[748, 0][748, 0]Passed
partial-repair probe 3[240, 1][240, 60]Failed
normal control 4[4411, 0][4411, 0]Passed
normal control 5[2900, 1815][2900, 1815]Passed
normal control 6[1933, 0][1933, 0]Passed
normal control 7[0, 0][0, 0]Passed

SHA-256 / e8363874f15b5a677e4679feb50cce3b874cf14c15ef36243d5466d79764a3dd

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    end = x['period_days'] if x['cancel'] is None else min(x['cancel'], x['period_days'])
    active = max(0, end - x['from'])
    flat = (x['flat'] * active * 2 + x['period_days']) // (2 * x['period_days'])
    usage = sum(q for d, q in x['events']) * x['unit']
    return [flat, usage]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'flat': 2900, 'period_days': 30, 'from': 15, 'cancel': None, 'unit': 5, 'events': [[26, 260], [12, 213]]}, [1450, 1300]), ('regression', {'flat': 12170, 'period_days': 30, 'from': 3, 'cancel': None, 'unit': 12, 'events': [[23, 155], [28, 348], [21, 236]]}, [10953, 8868]), ('partial-repair probe', {'flat': 2900, 'period_days': 31, 'from': 23, 'cancel': None, 'unit': 12, 'events': [[13, 491]]}, [748, 0]), ('partial-repair probe', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('normal control', {'flat': 8044, 'period_days': 31, 'from': 14, 'cancel': None, 'unit': 5, 'events': []}, [4411, 0]), ('normal control', {'flat': 2900, 'period_days': 31, 'from': 0, 'cancel': None, 'unit': 5, 'events': [[10, 43], [0, 320]]}, [2900, 1815]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 10, 'cancel': None, 'unit': 5, 'events': []}, [1933, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 26, 'cancel': 17, 'unit': 1, 'events': []}, [0, 0])], [('regression', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('regression', {'flat': 12170, 'period_days': 30, 'from': 3, 'cancel': None, 'unit': 12, 'events': [[23, 155], [28, 348], [21, 236]]}, [10953, 8868]), ('partial-repair probe', {'flat': 6972, 'period_days': 31, 'from': 29, 'cancel': 18, 'unit': 12, 'events': [[29, 170]]}, [0, 0]), ('partial-repair probe', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 7, 'cancel': 17, 'unit': 12, 'events': []}, [967, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 29, 'cancel': 2, 'unit': 5, 'events': []}, [0, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 11, 'cancel': None, 'unit': 1, 'events': []}, [6270, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 9, 'cancel': None, 'unit': 1, 'events': []}, [7026, 0])], [('regression', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('regression', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 2, 'cancel': 7, 'unit': 12, 'events': [[8, 9], [1, 189]]}, [1597, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 7, 'cancel': 9, 'unit': 12, 'events': []}, [639, 0]), ('normal control', {'flat': 11296, 'period_days': 30, 'from': 23, 'cancel': None, 'unit': 1, 'events': []}, [2636, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 25, 'cancel': 29, 'unit': 12, 'events': []}, [1320, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 9, 'cancel': None, 'unit': 5, 'events': []}, [7026, 0])], [('regression', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('regression', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 2, 'cancel': 7, 'unit': 12, 'events': [[8, 9], [1, 189]]}, [1597, 0]), ('partial-repair probe', {'flat': 11245, 'period_days': 30, 'from': 4, 'cancel': None, 'unit': 5, 'events': [[15, 26], [32, 318], [2, 320], [5, 358]]}, [9746, 1920]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 29, 'cancel': 16, 'unit': 12, 'events': []}, [0, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 26, 'cancel': None, 'unit': 12, 'events': []}, [387, 0]), ('normal control', {'flat': 8533, 'period_days': 30, 'from': 5, 'cancel': 4, 'unit': 12, 'events': []}, [0, 0]), ('normal control', {'flat': 3099, 'period_days': 30, 'from': 5, 'cancel': None, 'unit': 1, 'events': []}, [2583, 0])], [('regression', {'flat': 11245, 'period_days': 30, 'from': 4, 'cancel': None, 'unit': 5, 'events': [[15, 26], [32, 318], [2, 320], [5, 358]]}, [9746, 1920]), ('regression', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('partial-repair probe', {'flat': 6064, 'period_days': 30, 'from': 12, 'cancel': 13, 'unit': 12, 'events': [[26, 133], [7, 193]]}, [202, 0]), ('partial-repair probe', {'flat': 2900, 'period_days': 30, 'from': 26, 'cancel': None, 'unit': 5, 'events': [[15, 372], [6, 377], [28, 0]]}, [387, 0]), ('normal control', {'flat': 19748, 'period_days': 30, 'from': 10, 'cancel': None, 'unit': 5, 'events': []}, [13165, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 28, 'cancel': None, 'unit': 12, 'events': []}, [958, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 22, 'cancel': None, 'unit': 5, 'events': []}, [773, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 8, 'cancel': None, 'unit': 1, 'events': []}, [2127, 0])]]
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 fixtureActualExpectedOutcome
regression 0[1450, 2365][1450, 1300]Failed
regression 1[10953, 8868][10953, 8868]Passed
partial-repair probe 2[748, 5892][748, 0]Failed
partial-repair probe 3[240, 10668][240, 60]Failed
normal control 4[4411, 0][4411, 0]Passed
normal control 5[2900, 1815][2900, 1815]Passed
normal control 6[1933, 0][1933, 0]Passed
normal control 7[0, 0][0, 0]Passed

SHA-256 / dc3aceb19bd3a4e36b0df914ce8bd9e19246c240b97c829c44b94cd78782d5bc

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    end = x['period_days'] if x['cancel'] is None else min(x['cancel'], x['period_days'])
    active = max(0, end - x['from'])
    flat = (x['flat'] * active * 2 + x['period_days']) // (2 * x['period_days'])
    usage = sum(q for d, q in x['events'] if x['from'] <= d < end) * x['unit']
    return [flat, usage]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'flat': 2900, 'period_days': 30, 'from': 15, 'cancel': None, 'unit': 5, 'events': [[26, 260], [12, 213]]}, [1450, 1300]), ('regression', {'flat': 12170, 'period_days': 30, 'from': 3, 'cancel': None, 'unit': 12, 'events': [[23, 155], [28, 348], [21, 236]]}, [10953, 8868]), ('partial-repair probe', {'flat': 2900, 'period_days': 31, 'from': 23, 'cancel': None, 'unit': 12, 'events': [[13, 491]]}, [748, 0]), ('partial-repair probe', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('normal control', {'flat': 8044, 'period_days': 31, 'from': 14, 'cancel': None, 'unit': 5, 'events': []}, [4411, 0]), ('normal control', {'flat': 2900, 'period_days': 31, 'from': 0, 'cancel': None, 'unit': 5, 'events': [[10, 43], [0, 320]]}, [2900, 1815]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 10, 'cancel': None, 'unit': 5, 'events': []}, [1933, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 26, 'cancel': 17, 'unit': 1, 'events': []}, [0, 0])], [('regression', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('regression', {'flat': 12170, 'period_days': 30, 'from': 3, 'cancel': None, 'unit': 12, 'events': [[23, 155], [28, 348], [21, 236]]}, [10953, 8868]), ('partial-repair probe', {'flat': 6972, 'period_days': 31, 'from': 29, 'cancel': 18, 'unit': 12, 'events': [[29, 170]]}, [0, 0]), ('partial-repair probe', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 7, 'cancel': 17, 'unit': 12, 'events': []}, [967, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 29, 'cancel': 2, 'unit': 5, 'events': []}, [0, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 11, 'cancel': None, 'unit': 1, 'events': []}, [6270, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 9, 'cancel': None, 'unit': 1, 'events': []}, [7026, 0])], [('regression', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('regression', {'flat': 7431, 'period_days': 31, 'from': 30, 'cancel': None, 'unit': 12, 'events': [[6, 380], [30, 5], [32, 257], [4, 247]]}, [240, 60]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 2, 'cancel': 7, 'unit': 12, 'events': [[8, 9], [1, 189]]}, [1597, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 7, 'cancel': 9, 'unit': 12, 'events': []}, [639, 0]), ('normal control', {'flat': 11296, 'period_days': 30, 'from': 23, 'cancel': None, 'unit': 1, 'events': []}, [2636, 0]), ('normal control', {'flat': 9900, 'period_days': 30, 'from': 25, 'cancel': 29, 'unit': 12, 'events': []}, [1320, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 9, 'cancel': None, 'unit': 5, 'events': []}, [7026, 0])], [('regression', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('regression', {'flat': 2900, 'period_days': 31, 'from': 7, 'cancel': None, 'unit': 5, 'events': [[19, 421], [6, 32], [33, 481]]}, [2245, 2105]), ('partial-repair probe', {'flat': 9900, 'period_days': 31, 'from': 2, 'cancel': 7, 'unit': 12, 'events': [[8, 9], [1, 189]]}, [1597, 0]), ('partial-repair probe', {'flat': 11245, 'period_days': 30, 'from': 4, 'cancel': None, 'unit': 5, 'events': [[15, 26], [32, 318], [2, 320], [5, 358]]}, [9746, 1920]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 29, 'cancel': 16, 'unit': 12, 'events': []}, [0, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 26, 'cancel': None, 'unit': 12, 'events': []}, [387, 0]), ('normal control', {'flat': 8533, 'period_days': 30, 'from': 5, 'cancel': 4, 'unit': 12, 'events': []}, [0, 0]), ('normal control', {'flat': 3099, 'period_days': 30, 'from': 5, 'cancel': None, 'unit': 1, 'events': []}, [2583, 0])], [('regression', {'flat': 11245, 'period_days': 30, 'from': 4, 'cancel': None, 'unit': 5, 'events': [[15, 26], [32, 318], [2, 320], [5, 358]]}, [9746, 1920]), ('regression', {'flat': 9900, 'period_days': 31, 'from': 22, 'cancel': None, 'unit': 12, 'events': [[18, 186], [30, 275], [20, 173], [26, 168]]}, [2874, 5316]), ('partial-repair probe', {'flat': 6064, 'period_days': 30, 'from': 12, 'cancel': 13, 'unit': 12, 'events': [[26, 133], [7, 193]]}, [202, 0]), ('partial-repair probe', {'flat': 2900, 'period_days': 30, 'from': 26, 'cancel': None, 'unit': 5, 'events': [[15, 372], [6, 377], [28, 0]]}, [387, 0]), ('normal control', {'flat': 19748, 'period_days': 30, 'from': 10, 'cancel': None, 'unit': 5, 'events': []}, [13165, 0]), ('normal control', {'flat': 9900, 'period_days': 31, 'from': 28, 'cancel': None, 'unit': 12, 'events': []}, [958, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 22, 'cancel': None, 'unit': 5, 'events': []}, [773, 0]), ('normal control', {'flat': 2900, 'period_days': 30, 'from': 8, 'cancel': None, 'unit': 1, 'events': []}, [2127, 0])]]
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 fixtureActualExpectedOutcome
regression 0[1450, 1300][1450, 1300]Passed
regression 1[10953, 8868][10953, 8868]Passed
partial-repair probe 2[748, 0][748, 0]Passed
partial-repair probe 3[240, 60][240, 60]Passed
normal control 4[4411, 0][4411, 0]Passed
normal control 5[2900, 1815][2900, 1815]Passed
normal control 6[1933, 0][1933, 0]Passed
normal control 7[0, 0][0, 0]Passed

SHA-256 / 34c76cbe67801816d2448513fcdde39ff5e53a771fc3822d3d06c626f4ff84ec

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:38.318171+00:00.

Case digest / c618869b4e6fc440be5fff84f9530ebe40e134167bfb6100a12b21e0fb95fcd2