FA-59616 / Subscription proration billing / Open access
Sequential plan changes within one cycle: no-op change skip · case 01
Switching to the same plan emits a pair of offsetting lines.
ROOT CAUSE
Changes to the current price are not skipped.
VERIFIED REPAIR
Restore the contract rule at the no-op change skip step: use `or p == cur:`.
Unsuccessful approach: The attempt skips changes back to the initial price even when a different plan is current.
Case contract
Input {start, end, initial price, changes: [[t, price]]}. Changes are ordered by time; at equal times only the last applies. A change outside [start, end) or to the current price is ignored. Each effective change emits a credit line -(current*(end-t)/span) and a debit line new*(end-t)/span, magnitudes half-up, and the new price becomes current. Return the list of line amounts.
Why this case matters
Customers who change plans several times in a cycle must be credited for the plan they actually had at each change.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
span = x['end'] - x['start']
ch = sorted(x['changes'], key=lambda c: c[0])
dedup = []
for t, p in ch:
if dedup and dedup[-1][0] == t:
dedup[-1] = [t, p]
else:
dedup.append([t, p])
cur = x['initial']
lines = []
for t, p in dedup:
if t < x['start'] or t >= x['end']:
continue
left = x['end'] - t
lines.append(-((cur * left * 2 + span) // (2 * span)))
lines.append((p * left * 2 + span) // (2 * span))
cur = p
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[846, 2000], [857, 2000], [872, 1000]]}, [-4194, 1677]), ('regression', {'start': 925, 'end': 955, 'initial': 1000, 'changes': [[940, 1000], [922, 5000]]}, []), ('partial-repair probe', {'start': 796, 'end': 827, 'initial': 2000, 'changes': [[819, 2000], [827, 2383], [799, 1000], [827, 1000]]}, [-1806, 903, -258, 516]), ('partial-repair probe', {'start': 918, 'end': 948, 'initial': 1000, 'changes': [[920, 4137], [928, 1000], [948, 1000], [948, 7000]]}, [-933, 3861, -2758, 667]), ('normal control', {'start': 984, 'end': 1015, 'initial': 2000, 'changes': [[1001, 5000], [1014, 3956], [981, 1000]]}, [-903, 2258, -161, 128]), ('normal control', {'start': 446, 'end': 811, 'initial': 2000, 'changes': [[443, 5000]]}, []), ('normal control', {'start': 526, 'end': 557, 'initial': 5000, 'changes': []}, []), ('normal control', {'start': 534, 'end': 565, 'initial': 5000, 'changes': [[565, 1007], [565, 1000], [539, 1000], [537, 2000]]}, [-4516, 1806, -1677, 839])], [('regression', {'start': 927, 'end': 957, 'initial': 2000, 'changes': [[940, 5000], [941, 2000], [939, 2000], [924, 2000]]}, [-1133, 2833, -2667, 1067]), ('regression', {'start': 605, 'end': 636, 'initial': 1000, 'changes': [[610, 1000], [625, 5000], [602, 1000], [602, 2000]]}, [-355, 1774]), ('partial-repair probe', {'start': 358, 'end': 388, 'initial': 5000, 'changes': [[355, 4064], [386, 5000], [373, 2000]]}, [-2500, 1000, -133, 333]), ('partial-repair probe', {'start': 3, 'end': 34, 'initial': 5000, 'changes': [[34, 2000], [14, 5000], [14, 2000], [16, 5000]]}, [-3226, 1290, -1161, 2903]), ('normal control', {'start': 670, 'end': 700, 'initial': 2000, 'changes': [[678, 520], [700, 1000], [691, 5000]]}, [-1467, 381, -156, 1500]), ('normal control', {'start': 968, 'end': 1333, 'initial': 1000, 'changes': [[1333, 1000], [965, 5000], [1171, 2000]]}, [-444, 888]), ('normal control', {'start': 198, 'end': 563, 'initial': 1000, 'changes': [[263, 5000], [461, 2011], [195, 5000], [493, 1242]]}, [-822, 4110, -1397, 562, -386, 238]), ('normal control', {'start': 597, 'end': 627, 'initial': 2000, 'changes': [[594, 4502], [594, 7000]]}, [])], [('regression', {'start': 417, 'end': 447, 'initial': 5000, 'changes': [[447, 2000], [437, 1000], [426, 1000], [436, 1000], [436, 1000]]}, [-3500, 700]), ('regression', {'start': 946, 'end': 1311, 'initial': 1000, 'changes': [[1254, 1000], [943, 5000]]}, []), ('partial-repair probe', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[846, 2000], [857, 2000], [872, 1000]]}, [-4194, 1677]), ('partial-repair probe', {'start': 927, 'end': 957, 'initial': 2000, 'changes': [[940, 5000], [941, 2000], [939, 2000], [924, 2000]]}, [-1133, 2833, -2667, 1067]), ('normal control', {'start': 903, 'end': 1268, 'initial': 1000, 'changes': [[900, 3996]]}, []), ('normal control', {'start': 925, 'end': 956, 'initial': 2000, 'changes': [[935, 95], [925, 5000], [956, 1000], [956, 1000]]}, [-2000, 5000, -3387, 64]), ('normal control', {'start': 382, 'end': 747, 'initial': 2000, 'changes': [[508, 5000]]}, [-1310, 3274]), ('normal control', {'start': 414, 'end': 445, 'initial': 2000, 'changes': [[445, 1000], [434, 1000], [431, 8555]]}, [-903, 3864, -3036, 355])], [('regression', {'start': 960, 'end': 1325, 'initial': 1000, 'changes': [[1020, 1000], [1144, 2000], [1215, 1000], [957, 1000], [957, 7000]]}, [-496, 992, -603, 301]), ('regression', {'start': 74, 'end': 439, 'initial': 5000, 'changes': [[185, 5000]]}, []), ('partial-repair probe', {'start': 417, 'end': 447, 'initial': 5000, 'changes': [[447, 2000], [437, 1000], [426, 1000], [436, 1000], [436, 1000]]}, [-3500, 700]), ('partial-repair probe', {'start': 64, 'end': 95, 'initial': 5000, 'changes': [[64, 940], [71, 5000], [70, 250], [61, 1000], [61, 7000]]}, [-5000, 940, -758, 202, -194, 3871]), ('normal control', {'start': 398, 'end': 429, 'initial': 5000, 'changes': [[429, 4572], [429, 1000]]}, []), ('normal control', {'start': 677, 'end': 1042, 'initial': 5000, 'changes': [[1042, 5000], [1042, 5000]]}, []), ('normal control', {'start': 849, 'end': 879, 'initial': 5000, 'changes': [[879, 7238], [846, 4596], [846, 5000], [863, 2000]]}, [-2667, 1067]), ('normal control', {'start': 201, 'end': 232, 'initial': 2000, 'changes': [[219, 5000], [221, 899]]}, [-839, 2097, -1774, 319])], [('regression', {'start': 140, 'end': 170, 'initial': 2000, 'changes': [[137, 5000], [158, 1000], [157, 2000], [157, 1000]]}, [-867, 433]), ('regression', {'start': 90, 'end': 120, 'initial': 2000, 'changes': [[87, 3032], [104, 2000], [120, 2000]]}, []), ('partial-repair probe', {'start': 960, 'end': 1325, 'initial': 1000, 'changes': [[1020, 1000], [1144, 2000], [1215, 1000], [957, 1000], [957, 7000]]}, [-496, 992, -603, 301]), ('partial-repair probe', {'start': 354, 'end': 385, 'initial': 2000, 'changes': [[360, 8455], [373, 2000], [351, 4202], [351, 8189]]}, [-1613, 6819, -3273, 774]), ('normal control', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[872, 2000], [872, 2000]]}, []), ('normal control', {'start': 690, 'end': 1055, 'initial': 5000, 'changes': [[702, 2000]]}, [-4836, 1934]), ('normal control', {'start': 347, 'end': 712, 'initial': 5000, 'changes': [[355, 1000], [367, 2000], [712, 1000], [712, 2000]]}, [-4890, 978, -945, 1890]), ('normal control', {'start': 239, 'end': 270, 'initial': 5000, 'changes': []}, [])]]
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 | [-4194, 1677, -968, 968] | [-4194, 1677] | Failed |
| regression 1 | [-500, 500] | [] | Failed |
| partial-repair probe 2 | [-1806, 903, -258, 516] | [-1806, 903, -258, 516] | Passed |
| partial-repair probe 3 | [-933, 3861, -2758, 667] | [-933, 3861, -2758, 667] | Passed |
| normal control 4 | [-903, 2258, -161, 128] | [-903, 2258, -161, 128] | Passed |
| normal control 5 | [] | [] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [-4516, 1806, -1677, 839] | [-4516, 1806, -1677, 839] | Passed |
SHA-256 / 5ae87102e5554d8d63f203e333ce26ded11c89911bc51cc3821460ecdaa9d382
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
span = x['end'] - x['start']
ch = sorted(x['changes'], key=lambda c: c[0])
dedup = []
for t, p in ch:
if dedup and dedup[-1][0] == t:
dedup[-1] = [t, p]
else:
dedup.append([t, p])
cur = x['initial']
lines = []
for t, p in dedup:
if t < x['start'] or t >= x['end'] or p == x['initial']:
continue
left = x['end'] - t
lines.append(-((cur * left * 2 + span) // (2 * span)))
lines.append((p * left * 2 + span) // (2 * span))
cur = p
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[846, 2000], [857, 2000], [872, 1000]]}, [-4194, 1677]), ('regression', {'start': 925, 'end': 955, 'initial': 1000, 'changes': [[940, 1000], [922, 5000]]}, []), ('partial-repair probe', {'start': 796, 'end': 827, 'initial': 2000, 'changes': [[819, 2000], [827, 2383], [799, 1000], [827, 1000]]}, [-1806, 903, -258, 516]), ('partial-repair probe', {'start': 918, 'end': 948, 'initial': 1000, 'changes': [[920, 4137], [928, 1000], [948, 1000], [948, 7000]]}, [-933, 3861, -2758, 667]), ('normal control', {'start': 984, 'end': 1015, 'initial': 2000, 'changes': [[1001, 5000], [1014, 3956], [981, 1000]]}, [-903, 2258, -161, 128]), ('normal control', {'start': 446, 'end': 811, 'initial': 2000, 'changes': [[443, 5000]]}, []), ('normal control', {'start': 526, 'end': 557, 'initial': 5000, 'changes': []}, []), ('normal control', {'start': 534, 'end': 565, 'initial': 5000, 'changes': [[565, 1007], [565, 1000], [539, 1000], [537, 2000]]}, [-4516, 1806, -1677, 839])], [('regression', {'start': 927, 'end': 957, 'initial': 2000, 'changes': [[940, 5000], [941, 2000], [939, 2000], [924, 2000]]}, [-1133, 2833, -2667, 1067]), ('regression', {'start': 605, 'end': 636, 'initial': 1000, 'changes': [[610, 1000], [625, 5000], [602, 1000], [602, 2000]]}, [-355, 1774]), ('partial-repair probe', {'start': 358, 'end': 388, 'initial': 5000, 'changes': [[355, 4064], [386, 5000], [373, 2000]]}, [-2500, 1000, -133, 333]), ('partial-repair probe', {'start': 3, 'end': 34, 'initial': 5000, 'changes': [[34, 2000], [14, 5000], [14, 2000], [16, 5000]]}, [-3226, 1290, -1161, 2903]), ('normal control', {'start': 670, 'end': 700, 'initial': 2000, 'changes': [[678, 520], [700, 1000], [691, 5000]]}, [-1467, 381, -156, 1500]), ('normal control', {'start': 968, 'end': 1333, 'initial': 1000, 'changes': [[1333, 1000], [965, 5000], [1171, 2000]]}, [-444, 888]), ('normal control', {'start': 198, 'end': 563, 'initial': 1000, 'changes': [[263, 5000], [461, 2011], [195, 5000], [493, 1242]]}, [-822, 4110, -1397, 562, -386, 238]), ('normal control', {'start': 597, 'end': 627, 'initial': 2000, 'changes': [[594, 4502], [594, 7000]]}, [])], [('regression', {'start': 417, 'end': 447, 'initial': 5000, 'changes': [[447, 2000], [437, 1000], [426, 1000], [436, 1000], [436, 1000]]}, [-3500, 700]), ('regression', {'start': 946, 'end': 1311, 'initial': 1000, 'changes': [[1254, 1000], [943, 5000]]}, []), ('partial-repair probe', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[846, 2000], [857, 2000], [872, 1000]]}, [-4194, 1677]), ('partial-repair probe', {'start': 927, 'end': 957, 'initial': 2000, 'changes': [[940, 5000], [941, 2000], [939, 2000], [924, 2000]]}, [-1133, 2833, -2667, 1067]), ('normal control', {'start': 903, 'end': 1268, 'initial': 1000, 'changes': [[900, 3996]]}, []), ('normal control', {'start': 925, 'end': 956, 'initial': 2000, 'changes': [[935, 95], [925, 5000], [956, 1000], [956, 1000]]}, [-2000, 5000, -3387, 64]), ('normal control', {'start': 382, 'end': 747, 'initial': 2000, 'changes': [[508, 5000]]}, [-1310, 3274]), ('normal control', {'start': 414, 'end': 445, 'initial': 2000, 'changes': [[445, 1000], [434, 1000], [431, 8555]]}, [-903, 3864, -3036, 355])], [('regression', {'start': 960, 'end': 1325, 'initial': 1000, 'changes': [[1020, 1000], [1144, 2000], [1215, 1000], [957, 1000], [957, 7000]]}, [-496, 992, -603, 301]), ('regression', {'start': 74, 'end': 439, 'initial': 5000, 'changes': [[185, 5000]]}, []), ('partial-repair probe', {'start': 417, 'end': 447, 'initial': 5000, 'changes': [[447, 2000], [437, 1000], [426, 1000], [436, 1000], [436, 1000]]}, [-3500, 700]), ('partial-repair probe', {'start': 64, 'end': 95, 'initial': 5000, 'changes': [[64, 940], [71, 5000], [70, 250], [61, 1000], [61, 7000]]}, [-5000, 940, -758, 202, -194, 3871]), ('normal control', {'start': 398, 'end': 429, 'initial': 5000, 'changes': [[429, 4572], [429, 1000]]}, []), ('normal control', {'start': 677, 'end': 1042, 'initial': 5000, 'changes': [[1042, 5000], [1042, 5000]]}, []), ('normal control', {'start': 849, 'end': 879, 'initial': 5000, 'changes': [[879, 7238], [846, 4596], [846, 5000], [863, 2000]]}, [-2667, 1067]), ('normal control', {'start': 201, 'end': 232, 'initial': 2000, 'changes': [[219, 5000], [221, 899]]}, [-839, 2097, -1774, 319])], [('regression', {'start': 140, 'end': 170, 'initial': 2000, 'changes': [[137, 5000], [158, 1000], [157, 2000], [157, 1000]]}, [-867, 433]), ('regression', {'start': 90, 'end': 120, 'initial': 2000, 'changes': [[87, 3032], [104, 2000], [120, 2000]]}, []), ('partial-repair probe', {'start': 960, 'end': 1325, 'initial': 1000, 'changes': [[1020, 1000], [1144, 2000], [1215, 1000], [957, 1000], [957, 7000]]}, [-496, 992, -603, 301]), ('partial-repair probe', {'start': 354, 'end': 385, 'initial': 2000, 'changes': [[360, 8455], [373, 2000], [351, 4202], [351, 8189]]}, [-1613, 6819, -3273, 774]), ('normal control', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[872, 2000], [872, 2000]]}, []), ('normal control', {'start': 690, 'end': 1055, 'initial': 5000, 'changes': [[702, 2000]]}, [-4836, 1934]), ('normal control', {'start': 347, 'end': 712, 'initial': 5000, 'changes': [[355, 1000], [367, 2000], [712, 1000], [712, 2000]]}, [-4890, 978, -945, 1890]), ('normal control', {'start': 239, 'end': 270, 'initial': 5000, 'changes': []}, [])]]
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 | [-4194, 1677, -968, 968] | [-4194, 1677] | Failed |
| regression 1 | [] | [] | Passed |
| partial-repair probe 2 | [-1806, 903] | [-1806, 903, -258, 516] | Failed |
| partial-repair probe 3 | [-933, 3861] | [-933, 3861, -2758, 667] | Failed |
| normal control 4 | [-903, 2258, -161, 128] | [-903, 2258, -161, 128] | Passed |
| normal control 5 | [] | [] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [-4516, 1806, -1677, 839] | [-4516, 1806, -1677, 839] | Passed |
SHA-256 / 612499e368ac5f1ae6dc4aa15a1a1efa8b916236d79b65cf898c9c83b6c96102
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
span = x['end'] - x['start']
ch = sorted(x['changes'], key=lambda c: c[0])
dedup = []
for t, p in ch:
if dedup and dedup[-1][0] == t:
dedup[-1] = [t, p]
else:
dedup.append([t, p])
cur = x['initial']
lines = []
for t, p in dedup:
if t < x['start'] or t >= x['end'] or p == cur:
continue
left = x['end'] - t
lines.append(-((cur * left * 2 + span) // (2 * span)))
lines.append((p * left * 2 + span) // (2 * span))
cur = p
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[846, 2000], [857, 2000], [872, 1000]]}, [-4194, 1677]), ('regression', {'start': 925, 'end': 955, 'initial': 1000, 'changes': [[940, 1000], [922, 5000]]}, []), ('partial-repair probe', {'start': 796, 'end': 827, 'initial': 2000, 'changes': [[819, 2000], [827, 2383], [799, 1000], [827, 1000]]}, [-1806, 903, -258, 516]), ('partial-repair probe', {'start': 918, 'end': 948, 'initial': 1000, 'changes': [[920, 4137], [928, 1000], [948, 1000], [948, 7000]]}, [-933, 3861, -2758, 667]), ('normal control', {'start': 984, 'end': 1015, 'initial': 2000, 'changes': [[1001, 5000], [1014, 3956], [981, 1000]]}, [-903, 2258, -161, 128]), ('normal control', {'start': 446, 'end': 811, 'initial': 2000, 'changes': [[443, 5000]]}, []), ('normal control', {'start': 526, 'end': 557, 'initial': 5000, 'changes': []}, []), ('normal control', {'start': 534, 'end': 565, 'initial': 5000, 'changes': [[565, 1007], [565, 1000], [539, 1000], [537, 2000]]}, [-4516, 1806, -1677, 839])], [('regression', {'start': 927, 'end': 957, 'initial': 2000, 'changes': [[940, 5000], [941, 2000], [939, 2000], [924, 2000]]}, [-1133, 2833, -2667, 1067]), ('regression', {'start': 605, 'end': 636, 'initial': 1000, 'changes': [[610, 1000], [625, 5000], [602, 1000], [602, 2000]]}, [-355, 1774]), ('partial-repair probe', {'start': 358, 'end': 388, 'initial': 5000, 'changes': [[355, 4064], [386, 5000], [373, 2000]]}, [-2500, 1000, -133, 333]), ('partial-repair probe', {'start': 3, 'end': 34, 'initial': 5000, 'changes': [[34, 2000], [14, 5000], [14, 2000], [16, 5000]]}, [-3226, 1290, -1161, 2903]), ('normal control', {'start': 670, 'end': 700, 'initial': 2000, 'changes': [[678, 520], [700, 1000], [691, 5000]]}, [-1467, 381, -156, 1500]), ('normal control', {'start': 968, 'end': 1333, 'initial': 1000, 'changes': [[1333, 1000], [965, 5000], [1171, 2000]]}, [-444, 888]), ('normal control', {'start': 198, 'end': 563, 'initial': 1000, 'changes': [[263, 5000], [461, 2011], [195, 5000], [493, 1242]]}, [-822, 4110, -1397, 562, -386, 238]), ('normal control', {'start': 597, 'end': 627, 'initial': 2000, 'changes': [[594, 4502], [594, 7000]]}, [])], [('regression', {'start': 417, 'end': 447, 'initial': 5000, 'changes': [[447, 2000], [437, 1000], [426, 1000], [436, 1000], [436, 1000]]}, [-3500, 700]), ('regression', {'start': 946, 'end': 1311, 'initial': 1000, 'changes': [[1254, 1000], [943, 5000]]}, []), ('partial-repair probe', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[846, 2000], [857, 2000], [872, 1000]]}, [-4194, 1677]), ('partial-repair probe', {'start': 927, 'end': 957, 'initial': 2000, 'changes': [[940, 5000], [941, 2000], [939, 2000], [924, 2000]]}, [-1133, 2833, -2667, 1067]), ('normal control', {'start': 903, 'end': 1268, 'initial': 1000, 'changes': [[900, 3996]]}, []), ('normal control', {'start': 925, 'end': 956, 'initial': 2000, 'changes': [[935, 95], [925, 5000], [956, 1000], [956, 1000]]}, [-2000, 5000, -3387, 64]), ('normal control', {'start': 382, 'end': 747, 'initial': 2000, 'changes': [[508, 5000]]}, [-1310, 3274]), ('normal control', {'start': 414, 'end': 445, 'initial': 2000, 'changes': [[445, 1000], [434, 1000], [431, 8555]]}, [-903, 3864, -3036, 355])], [('regression', {'start': 960, 'end': 1325, 'initial': 1000, 'changes': [[1020, 1000], [1144, 2000], [1215, 1000], [957, 1000], [957, 7000]]}, [-496, 992, -603, 301]), ('regression', {'start': 74, 'end': 439, 'initial': 5000, 'changes': [[185, 5000]]}, []), ('partial-repair probe', {'start': 417, 'end': 447, 'initial': 5000, 'changes': [[447, 2000], [437, 1000], [426, 1000], [436, 1000], [436, 1000]]}, [-3500, 700]), ('partial-repair probe', {'start': 64, 'end': 95, 'initial': 5000, 'changes': [[64, 940], [71, 5000], [70, 250], [61, 1000], [61, 7000]]}, [-5000, 940, -758, 202, -194, 3871]), ('normal control', {'start': 398, 'end': 429, 'initial': 5000, 'changes': [[429, 4572], [429, 1000]]}, []), ('normal control', {'start': 677, 'end': 1042, 'initial': 5000, 'changes': [[1042, 5000], [1042, 5000]]}, []), ('normal control', {'start': 849, 'end': 879, 'initial': 5000, 'changes': [[879, 7238], [846, 4596], [846, 5000], [863, 2000]]}, [-2667, 1067]), ('normal control', {'start': 201, 'end': 232, 'initial': 2000, 'changes': [[219, 5000], [221, 899]]}, [-839, 2097, -1774, 319])], [('regression', {'start': 140, 'end': 170, 'initial': 2000, 'changes': [[137, 5000], [158, 1000], [157, 2000], [157, 1000]]}, [-867, 433]), ('regression', {'start': 90, 'end': 120, 'initial': 2000, 'changes': [[87, 3032], [104, 2000], [120, 2000]]}, []), ('partial-repair probe', {'start': 960, 'end': 1325, 'initial': 1000, 'changes': [[1020, 1000], [1144, 2000], [1215, 1000], [957, 1000], [957, 7000]]}, [-496, 992, -603, 301]), ('partial-repair probe', {'start': 354, 'end': 385, 'initial': 2000, 'changes': [[360, 8455], [373, 2000], [351, 4202], [351, 8189]]}, [-1613, 6819, -3273, 774]), ('normal control', {'start': 841, 'end': 872, 'initial': 5000, 'changes': [[872, 2000], [872, 2000]]}, []), ('normal control', {'start': 690, 'end': 1055, 'initial': 5000, 'changes': [[702, 2000]]}, [-4836, 1934]), ('normal control', {'start': 347, 'end': 712, 'initial': 5000, 'changes': [[355, 1000], [367, 2000], [712, 1000], [712, 2000]]}, [-4890, 978, -945, 1890]), ('normal control', {'start': 239, 'end': 270, 'initial': 5000, 'changes': []}, [])]]
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 | [-4194, 1677] | [-4194, 1677] | Passed |
| regression 1 | [] | [] | Passed |
| partial-repair probe 2 | [-1806, 903, -258, 516] | [-1806, 903, -258, 516] | Passed |
| partial-repair probe 3 | [-933, 3861, -2758, 667] | [-933, 3861, -2758, 667] | Passed |
| normal control 4 | [-903, 2258, -161, 128] | [-903, 2258, -161, 128] | Passed |
| normal control 5 | [] | [] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [-4516, 1806, -1677, 839] | [-4516, 1806, -1677, 839] | Passed |
SHA-256 / 13d3d7fd825c1a1851b74d6cce64e95c917ec115eb0323b1f5c4db2b7b6a63da
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.013949+00:00.
Case digest / 23e5e5ad8387ce421c6ff3575996395862a133a2f7ec545012484852e054443a