FA-59736 / Subscription proration billing / Open access
Metered usage split at a mid-period price change: change day ownership · case 01
Usage recorded on the change day is billed at both prices.
ROOT CAUSE
The old-price segment includes the change day.
VERIFIED REPAIR
Restore the contract rule at the change day ownership step: use `before = [q for t, q in ev if t < x['change']]`.
Unsuccessful approach: The attempt drops the day before the change from the old segment entirely.
Case contract
Input {events: [[day, qty]], change day, old_unit, new_unit, agg sum|max|last}. Events are ordered by day (stable). Events before the change day are aggregated and priced at old_unit; events on or after it at new_unit. Empty segments aggregate to 0; last means the chronologically last quantity. Return [old_charge, new_charge].
Why this case matters
Metered usage must be attributed to the price in effect when it occurred, with the aggregation mode applied per segment.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
ev = sorted(x['events'], key=lambda e: e[0])
before = [q for t, q in ev if t <= x['change']]
after = [q for t, q in ev if t >= x['change']]
def agg(v):
if not v:
return 0
if x['agg'] == 'sum':
return sum(v)
if x['agg'] == 'max':
return max(v)
return v[-1]
return [agg(before) * x['old_unit'], agg(after) * x['new_unit']]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('normal control', {'events': [[7, 80], [27, 92], [3, 28], [21, 43], [0, 29]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [725, 1380]), ('normal control', {'events': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425]), ('normal control', {'events': [[10, 54], [8, 78]], 'change': 23, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [780, 0]), ('normal control', {'events': [], 'change': 27, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('regression', {'events': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('partial-repair probe', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('normal control', {'events': [[19, 78], [29, 77], [0, 53]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1950, 3080]), ('normal control', {'events': [[30, 18], [0, 63], [28, 43]], 'change': 28, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1575, 1720]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('regression', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('partial-repair probe', {'events': [[21, 60], [30, 96], [16, 57], [5, 93], [30, 96]], 'change': 22, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [600, 3840]), ('partial-repair probe', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('normal control', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('regression', {'events': [[21, 57], [28, 66], [4, 55], [23, 20], [14, 65], [14, 74]], 'change': 4, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 2640]), ('partial-repair probe', {'events': [[25, 50], [26, 27], [26, 6], [28, 92], [21, 23], [5, 66]], 'change': 26, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [500, 3680]), ('partial-repair probe', {'events': [[2, 41], [3, 45], [30, 93]], 'change': 3, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [410, 2070]), ('normal control', {'events': [[14, 36]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1440]), ('normal control', {'events': [], 'change': 13, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[0, 49], [11, 65], [3, 41]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [1225, 975]), ('normal control', {'events': [[22, 54], [5, 92], [13, 67], [15, 87], [19, 0]], 'change': 19, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [920, 2160])], [('regression', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('regression', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('partial-repair probe', {'events': [[13, 87], [30, 41], [0, 12], [5, 55], [6, 92], [1, 78]], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [120, 1380]), ('partial-repair probe', {'events': [[3, 68], [1, 51], [0, 25], [2, 68]], 'change': 3, 'old_unit': 25, 'new_unit': 40, 'agg': 'sum'}, [3600, 2720]), ('normal control', {'events': [], 'change': 8, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[10, 87], [0, 71], [24, 27], [26, 7]], 'change': 21, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [2175, 1080]), ('normal control', {'events': [[20, 35]], 'change': 24, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [875, 0]), ('normal control', {'events': [], 'change': 26, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [1125, 675] | [1550, 675] | Failed |
| regression 1 | [2200, 3520] | [0, 3520] | Failed |
| partial-repair probe 2 | [160, 1280] | [900, 1280] | Failed |
| partial-repair probe 3 | [1270, 1125] | [900, 1125] | Failed |
| normal control 4 | [725, 1380] | [725, 1380] | Passed |
| normal control 5 | [900, 1425] | [900, 1425] | Passed |
| normal control 6 | [780, 0] | [780, 0] | Passed |
| normal control 7 | [0, 0] | [0, 0] | Passed |
SHA-256 / dfd2301df1f1ba8f5260e823c8bcdcf760206a5cb6f4d539cfff8bf32345827b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
ev = sorted(x['events'], key=lambda e: e[0])
before = [q for t, q in ev if t < x['change'] - 1]
after = [q for t, q in ev if t >= x['change']]
def agg(v):
if not v:
return 0
if x['agg'] == 'sum':
return sum(v)
if x['agg'] == 'max':
return max(v)
return v[-1]
return [agg(before) * x['old_unit'], agg(after) * x['new_unit']]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('normal control', {'events': [[7, 80], [27, 92], [3, 28], [21, 43], [0, 29]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [725, 1380]), ('normal control', {'events': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425]), ('normal control', {'events': [[10, 54], [8, 78]], 'change': 23, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [780, 0]), ('normal control', {'events': [], 'change': 27, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('regression', {'events': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('partial-repair probe', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('normal control', {'events': [[19, 78], [29, 77], [0, 53]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1950, 3080]), ('normal control', {'events': [[30, 18], [0, 63], [28, 43]], 'change': 28, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1575, 1720]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('regression', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('partial-repair probe', {'events': [[21, 60], [30, 96], [16, 57], [5, 93], [30, 96]], 'change': 22, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [600, 3840]), ('partial-repair probe', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('normal control', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('regression', {'events': [[21, 57], [28, 66], [4, 55], [23, 20], [14, 65], [14, 74]], 'change': 4, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 2640]), ('partial-repair probe', {'events': [[25, 50], [26, 27], [26, 6], [28, 92], [21, 23], [5, 66]], 'change': 26, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [500, 3680]), ('partial-repair probe', {'events': [[2, 41], [3, 45], [30, 93]], 'change': 3, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [410, 2070]), ('normal control', {'events': [[14, 36]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1440]), ('normal control', {'events': [], 'change': 13, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[0, 49], [11, 65], [3, 41]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [1225, 975]), ('normal control', {'events': [[22, 54], [5, 92], [13, 67], [15, 87], [19, 0]], 'change': 19, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [920, 2160])], [('regression', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('regression', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('partial-repair probe', {'events': [[13, 87], [30, 41], [0, 12], [5, 55], [6, 92], [1, 78]], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [120, 1380]), ('partial-repair probe', {'events': [[3, 68], [1, 51], [0, 25], [2, 68]], 'change': 3, 'old_unit': 25, 'new_unit': 40, 'agg': 'sum'}, [3600, 2720]), ('normal control', {'events': [], 'change': 8, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[10, 87], [0, 71], [24, 27], [26, 7]], 'change': 21, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [2175, 1080]), ('normal control', {'events': [[20, 35]], 'change': 24, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [875, 0]), ('normal control', {'events': [], 'change': 26, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [400, 675] | [1550, 675] | Failed |
| regression 1 | [0, 3520] | [0, 3520] | Passed |
| partial-repair probe 2 | [0, 1280] | [900, 1280] | Failed |
| partial-repair probe 3 | [0, 1125] | [900, 1125] | Failed |
| normal control 4 | [725, 1380] | [725, 1380] | Passed |
| normal control 5 | [900, 1425] | [900, 1425] | Passed |
| normal control 6 | [780, 0] | [780, 0] | Passed |
| normal control 7 | [0, 0] | [0, 0] | Passed |
SHA-256 / a4d53d88c6d076f57cbdb3c152475b228616fda8a5a6ed6b09a29058d4094c34
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
ev = sorted(x['events'], key=lambda e: e[0])
before = [q for t, q in ev if t < x['change']]
after = [q for t, q in ev if t >= x['change']]
def agg(v):
if not v:
return 0
if x['agg'] == 'sum':
return sum(v)
if x['agg'] == 'max':
return max(v)
return v[-1]
return [agg(before) * x['old_unit'], agg(after) * x['new_unit']]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('normal control', {'events': [[7, 80], [27, 92], [3, 28], [21, 43], [0, 29]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [725, 1380]), ('normal control', {'events': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425]), ('normal control', {'events': [[10, 54], [8, 78]], 'change': 23, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [780, 0]), ('normal control', {'events': [], 'change': 27, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('regression', {'events': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('partial-repair probe', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('normal control', {'events': [[19, 78], [29, 77], [0, 53]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1950, 3080]), ('normal control', {'events': [[30, 18], [0, 63], [28, 43]], 'change': 28, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1575, 1720]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('regression', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('partial-repair probe', {'events': [[21, 60], [30, 96], [16, 57], [5, 93], [30, 96]], 'change': 22, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [600, 3840]), ('partial-repair probe', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('normal control', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('regression', {'events': [[21, 57], [28, 66], [4, 55], [23, 20], [14, 65], [14, 74]], 'change': 4, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 2640]), ('partial-repair probe', {'events': [[25, 50], [26, 27], [26, 6], [28, 92], [21, 23], [5, 66]], 'change': 26, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [500, 3680]), ('partial-repair probe', {'events': [[2, 41], [3, 45], [30, 93]], 'change': 3, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [410, 2070]), ('normal control', {'events': [[14, 36]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1440]), ('normal control', {'events': [], 'change': 13, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[0, 49], [11, 65], [3, 41]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [1225, 975]), ('normal control', {'events': [[22, 54], [5, 92], [13, 67], [15, 87], [19, 0]], 'change': 19, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [920, 2160])], [('regression', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('regression', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('partial-repair probe', {'events': [[13, 87], [30, 41], [0, 12], [5, 55], [6, 92], [1, 78]], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [120, 1380]), ('partial-repair probe', {'events': [[3, 68], [1, 51], [0, 25], [2, 68]], 'change': 3, 'old_unit': 25, 'new_unit': 40, 'agg': 'sum'}, [3600, 2720]), ('normal control', {'events': [], 'change': 8, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[10, 87], [0, 71], [24, 27], [26, 7]], 'change': 21, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [2175, 1080]), ('normal control', {'events': [[20, 35]], 'change': 24, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [875, 0]), ('normal control', {'events': [], 'change': 26, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [1550, 675] | [1550, 675] | Passed |
| regression 1 | [0, 3520] | [0, 3520] | Passed |
| partial-repair probe 2 | [900, 1280] | [900, 1280] | Passed |
| partial-repair probe 3 | [900, 1125] | [900, 1125] | Passed |
| normal control 4 | [725, 1380] | [725, 1380] | Passed |
| normal control 5 | [900, 1425] | [900, 1425] | Passed |
| normal control 6 | [780, 0] | [780, 0] | Passed |
| normal control 7 | [0, 0] | [0, 0] | Passed |
SHA-256 / 1b6beb2ebfdfe639a041f7b0ef895f81697cead6183070655d24fea1294e4561
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.125447+00:00.
Case digest / e5973b885b5d70d05783ca89723ec905994aa0e5551733d95de3179034715439