FA-59461 / Subscription proration billing / Open access
Paused days extending the billing period: overlap merge extent · case 01
A short pause nested inside a longer one shortens the extension.
ROOT CAUSE
Merging replaces the merged end with the new end even when it is earlier.
THE FAILURE
Merging replaces the merged end with the new end even when it is earlier.
Unsuccessful approach: The attempt appends the tail from the previous end, which has negative length for nested pauses.
Case contract
Input {start, end (exclusive) day numbers, pauses: [[from, to)]}. Pause intervals are clipped to the period, empty ones dropped, then overlapping ones merged. The period end moves out by the number of distinct paused days. Return [new_end, paused_days].
Why this case matters
Pausing a subscription should extend paid service exactly by the paused time, no more and no less.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
s, e = x['start'], x['end']
iv = sorted([max(a, s), min(b, e)] for a, b in x['pauses'])
iv = [p for p in iv if p[0] < p[1]]
merged = []
for a, b in iv:
if merged and a <= merged[-1][1]:
merged[-1][1] = b
else:
merged.append([a, b])
paused = sum(b - a for a, b in merged)
return [e + paused, paused]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 73, 'end': 101, 'pauses': [[82, 97], [85, 93], [79, 80], [82, 85]]}, [117, 16]), ('regression', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('partial-repair probe', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('partial-repair probe', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('normal control', {'start': 34, 'end': 65, 'pauses': [[30, 33], [31, 34]]}, [65, 0]), ('normal control', {'start': 20, 'end': 48, 'pauses': [[28, 28], [16, 30], [23, 23]]}, [58, 10]), ('normal control', {'start': 15, 'end': 45, 'pauses': [[20, 34], [22, 25], [25, 35]]}, [60, 15]), ('normal control', {'start': 28, 'end': 56, 'pauses': [[45, 57], [44, 58], [33, 35], [48, 63]]}, [70, 14])], [('regression', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('regression', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('partial-repair probe', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('partial-repair probe', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('normal control', {'start': 12, 'end': 40, 'pauses': []}, [40, 0]), ('normal control', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('normal control', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('normal control', {'start': 92, 'end': 122, 'pauses': [[121, 121]]}, [122, 0])], [('regression', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('regression', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('partial-repair probe', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('partial-repair probe', {'start': 62, 'end': 93, 'pauses': [[66, 73], [84, 88], [83, 90]]}, [107, 14]), ('normal control', {'start': 100, 'end': 131, 'pauses': [[127, 128], [119, 120], [97, 98], [120, 128]]}, [140, 9]), ('normal control', {'start': 26, 'end': 56, 'pauses': []}, [56, 0]), ('normal control', {'start': 44, 'end': 72, 'pauses': [[58, 64], [45, 58], [59, 70], [41, 49]]}, [98, 26]), ('normal control', {'start': 92, 'end': 120, 'pauses': [[82, 91]]}, [120, 0])], [('regression', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('regression', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('partial-repair probe', {'start': 48, 'end': 78, 'pauses': [[52, 63], [70, 85], [39, 54], [71, 77]]}, [101, 23]), ('partial-repair probe', {'start': 66, 'end': 94, 'pauses': [[63, 73], [69, 72]]}, [101, 7]), ('normal control', {'start': 84, 'end': 115, 'pauses': []}, [115, 0]), ('normal control', {'start': 86, 'end': 114, 'pauses': [[113, 121]]}, [115, 1]), ('normal control', {'start': 0, 'end': 31, 'pauses': [[31, 46], [24, 33], [-7, -3], [-8, 6]]}, [44, 13]), ('normal control', {'start': 96, 'end': 124, 'pauses': [[120, 128], [90, 105], [99, 105], [116, 125]]}, [141, 17])], [('regression', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('regression', {'start': 62, 'end': 93, 'pauses': [[66, 73], [84, 88], [83, 90]]}, [107, 14]), ('partial-repair probe', {'start': 16, 'end': 46, 'pauses': [[36, 37], [37, 38], [39, 54], [36, 43]]}, [56, 10]), ('partial-repair probe', {'start': 1, 'end': 32, 'pauses': [[-9, 3], [9, 19], [7, 18], [10, 13]]}, [46, 14]), ('normal control', {'start': 28, 'end': 56, 'pauses': [[35, 37], [21, 36]]}, [65, 9]), ('normal control', {'start': 14, 'end': 42, 'pauses': []}, [42, 0]), ('normal control', {'start': 56, 'end': 86, 'pauses': []}, [86, 0]), ('normal control', {'start': 94, 'end': 125, 'pauses': [[103, 112], [94, 95], [111, 118], [87, 100]]}, [146, 21])]]
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 | [113, 12] | [117, 16] | Failed |
| regression 1 | [130, 4] | [131, 5] | Failed |
| partial-repair probe 2 | [129, 13] | [131, 15] | Failed |
| partial-repair probe 3 | [114, 11] | [116, 13] | Failed |
| normal control 4 | [65, 0] | [65, 0] | Passed |
| normal control 5 | [58, 10] | [58, 10] | Passed |
| normal control 6 | [60, 15] | [60, 15] | Passed |
| normal control 7 | [70, 14] | [70, 14] | Passed |
SHA-256 / bd816f6335659673b61ebc2770b552a0af9b148a0eba1dde43fd43f9938d8811
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
s, e = x['start'], x['end']
iv = sorted([max(a, s), min(b, e)] for a, b in x['pauses'])
iv = [p for p in iv if p[0] < p[1]]
merged = []
for a, b in iv:
if merged and a <= merged[-1][1]:
merged.append([merged[-1][1], b])
else:
merged.append([a, b])
paused = sum(b - a for a, b in merged)
return [e + paused, paused]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 73, 'end': 101, 'pauses': [[82, 97], [85, 93], [79, 80], [82, 85]]}, [117, 16]), ('regression', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('partial-repair probe', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('partial-repair probe', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('normal control', {'start': 34, 'end': 65, 'pauses': [[30, 33], [31, 34]]}, [65, 0]), ('normal control', {'start': 20, 'end': 48, 'pauses': [[28, 28], [16, 30], [23, 23]]}, [58, 10]), ('normal control', {'start': 15, 'end': 45, 'pauses': [[20, 34], [22, 25], [25, 35]]}, [60, 15]), ('normal control', {'start': 28, 'end': 56, 'pauses': [[45, 57], [44, 58], [33, 35], [48, 63]]}, [70, 14])], [('regression', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('regression', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('partial-repair probe', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('partial-repair probe', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('normal control', {'start': 12, 'end': 40, 'pauses': []}, [40, 0]), ('normal control', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('normal control', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('normal control', {'start': 92, 'end': 122, 'pauses': [[121, 121]]}, [122, 0])], [('regression', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('regression', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('partial-repair probe', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('partial-repair probe', {'start': 62, 'end': 93, 'pauses': [[66, 73], [84, 88], [83, 90]]}, [107, 14]), ('normal control', {'start': 100, 'end': 131, 'pauses': [[127, 128], [119, 120], [97, 98], [120, 128]]}, [140, 9]), ('normal control', {'start': 26, 'end': 56, 'pauses': []}, [56, 0]), ('normal control', {'start': 44, 'end': 72, 'pauses': [[58, 64], [45, 58], [59, 70], [41, 49]]}, [98, 26]), ('normal control', {'start': 92, 'end': 120, 'pauses': [[82, 91]]}, [120, 0])], [('regression', {'start': 73, 'end': 103, 'pauses': [[70, 72], [68, 79], [74, 86], [77, 84]]}, [116, 13]), ('regression', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('partial-repair probe', {'start': 48, 'end': 78, 'pauses': [[52, 63], [70, 85], [39, 54], [71, 77]]}, [101, 23]), ('partial-repair probe', {'start': 66, 'end': 94, 'pauses': [[63, 73], [69, 72]]}, [101, 7]), ('normal control', {'start': 84, 'end': 115, 'pauses': []}, [115, 0]), ('normal control', {'start': 86, 'end': 114, 'pauses': [[113, 121]]}, [115, 1]), ('normal control', {'start': 0, 'end': 31, 'pauses': [[31, 46], [24, 33], [-7, -3], [-8, 6]]}, [44, 13]), ('normal control', {'start': 96, 'end': 124, 'pauses': [[120, 128], [90, 105], [99, 105], [116, 125]]}, [141, 17])], [('regression', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('regression', {'start': 62, 'end': 93, 'pauses': [[66, 73], [84, 88], [83, 90]]}, [107, 14]), ('partial-repair probe', {'start': 16, 'end': 46, 'pauses': [[36, 37], [37, 38], [39, 54], [36, 43]]}, [56, 10]), ('partial-repair probe', {'start': 1, 'end': 32, 'pauses': [[-9, 3], [9, 19], [7, 18], [10, 13]]}, [46, 14]), ('normal control', {'start': 28, 'end': 56, 'pauses': [[35, 37], [21, 36]]}, [65, 9]), ('normal control', {'start': 14, 'end': 42, 'pauses': []}, [42, 0]), ('normal control', {'start': 56, 'end': 86, 'pauses': []}, [86, 0]), ('normal control', {'start': 94, 'end': 125, 'pauses': [[103, 112], [94, 95], [111, 118], [87, 100]]}, [146, 21])]]
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 | [113, 12] | [117, 16] | Failed |
| regression 1 | [130, 4] | [131, 5] | Failed |
| partial-repair probe 2 | [129, 13] | [131, 15] | Failed |
| partial-repair probe 3 | [114, 11] | [116, 13] | Failed |
| normal control 4 | [65, 0] | [65, 0] | Passed |
| normal control 5 | [58, 10] | [58, 10] | Passed |
| normal control 6 | [60, 15] | [60, 15] | Passed |
| normal control 7 | [70, 14] | [70, 14] | Passed |
SHA-256 / f58418b79e3cd8cb6034337647952de70c05b704c734dc41c2fc92b9f5cb4487
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:36.563363+00:00.
Case digest / 01110b532312fa3a8ed924b1f7c61ef1d46b2c18d4b12d5e714b511723e93522