FA-59456 / Subscription proration billing / Open access
Paused days extending the billing period: clip pauses to period · case 01
Pauses that straddle the renewal extend the period by days that belong to the next period.
ROOT CAUSE
Pause intervals are not clipped to the current billing period.
THE FAILURE
Pause intervals are not clipped to the current billing period.
Unsuccessful approach: The attempt clips the start but not the end of each pause.
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([a, b] 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] = max(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': 28, 'end': 56, 'pauses': [[45, 57], [44, 58], [33, 35], [48, 63]]}, [70, 14]), ('regression', {'start': 34, 'end': 65, 'pauses': [[30, 33], [31, 34]]}, [65, 0]), ('partial-repair probe', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('partial-repair probe', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('normal control', {'start': 15, 'end': 45, 'pauses': [[20, 34], [22, 25], [25, 35]]}, [60, 15]), ('normal control', {'start': 12, 'end': 40, 'pauses': []}, [40, 0]), ('normal control', {'start': 73, 'end': 101, 'pauses': [[82, 97], [85, 93], [79, 80], [82, 85]]}, [117, 16]), ('normal control', {'start': 92, 'end': 122, 'pauses': [[121, 121]]}, [122, 0])], [('regression', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('regression', {'start': 20, 'end': 48, 'pauses': [[28, 28], [16, 30], [23, 23]]}, [58, 10]), ('partial-repair probe', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('partial-repair probe', {'start': 86, 'end': 114, 'pauses': [[113, 121]]}, [115, 1]), ('normal control', {'start': 26, 'end': 56, 'pauses': []}, [56, 0]), ('normal control', {'start': 84, 'end': 115, 'pauses': []}, [115, 0]), ('normal control', {'start': 14, 'end': 42, 'pauses': []}, [42, 0]), ('normal control', {'start': 56, 'end': 86, 'pauses': []}, [86, 0])], [('regression', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('regression', {'start': 28, 'end': 56, 'pauses': [[45, 57], [44, 58], [33, 35], [48, 63]]}, [70, 14]), ('partial-repair probe', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('partial-repair probe', {'start': 0, 'end': 31, 'pauses': [[31, 46], [24, 33], [-7, -3], [-8, 6]]}, [44, 13]), ('normal control', {'start': 65, 'end': 93, 'pauses': []}, [93, 0]), ('normal control', {'start': 89, 'end': 119, 'pauses': [[109, 109]]}, [119, 0]), ('normal control', {'start': 99, 'end': 127, 'pauses': [[115, 120]]}, [132, 5]), ('normal control', {'start': 88, 'end': 118, 'pauses': [[105, 110], [103, 103], [95, 110], [104, 108]]}, [133, 15])], [('regression', {'start': 86, 'end': 114, 'pauses': [[113, 121]]}, [115, 1]), ('regression', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('partial-repair probe', {'start': 96, 'end': 124, 'pauses': [[120, 128], [90, 105], [99, 105], [116, 125]]}, [141, 17]), ('partial-repair probe', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('normal control', {'start': 9, 'end': 37, 'pauses': [[26, 26]]}, [37, 0]), ('normal control', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('normal control', {'start': 95, 'end': 126, 'pauses': [[89, 89]]}, [126, 0]), ('normal control', {'start': 74, 'end': 105, 'pauses': [[77, 77], [87, 92]]}, [110, 5])], [('regression', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('regression', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('partial-repair probe', {'start': 60, 'end': 88, 'pauses': [[92, 102], [57, 65], [85, 100]]}, [96, 8]), ('partial-repair probe', {'start': 94, 'end': 124, 'pauses': [[96, 99], [128, 143], [115, 130]]}, [136, 12]), ('normal control', {'start': 54, 'end': 84, 'pauses': [[76, 80], [66, 79]]}, [98, 14]), ('normal control', {'start': 66, 'end': 97, 'pauses': [[87, 97], [71, 85]]}, [121, 24]), ('normal control', {'start': 62, 'end': 93, 'pauses': [[66, 73], [84, 88], [83, 90]]}, [107, 14]), ('normal control', {'start': 81, 'end': 111, 'pauses': []}, [111, 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 | [77, 21] | [70, 14] | Failed |
| regression 1 | [69, 4] | [65, 0] | Failed |
| partial-repair probe 2 | [142, 30] | [139, 27] | Failed |
| partial-repair probe 3 | [85, 9] | [80, 4] | Failed |
| normal control 4 | [60, 15] | [60, 15] | Passed |
| normal control 5 | [40, 0] | [40, 0] | Passed |
| normal control 6 | [117, 16] | [117, 16] | Passed |
| normal control 7 | [122, 0] | [122, 0] | Passed |
SHA-256 / ad1949442785c1de65f8be6886fe55943cc9af34fbbc20be5016d68dc52d6511
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), b] 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] = max(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': 28, 'end': 56, 'pauses': [[45, 57], [44, 58], [33, 35], [48, 63]]}, [70, 14]), ('regression', {'start': 34, 'end': 65, 'pauses': [[30, 33], [31, 34]]}, [65, 0]), ('partial-repair probe', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('partial-repair probe', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('normal control', {'start': 15, 'end': 45, 'pauses': [[20, 34], [22, 25], [25, 35]]}, [60, 15]), ('normal control', {'start': 12, 'end': 40, 'pauses': []}, [40, 0]), ('normal control', {'start': 73, 'end': 101, 'pauses': [[82, 97], [85, 93], [79, 80], [82, 85]]}, [117, 16]), ('normal control', {'start': 92, 'end': 122, 'pauses': [[121, 121]]}, [122, 0])], [('regression', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('regression', {'start': 20, 'end': 48, 'pauses': [[28, 28], [16, 30], [23, 23]]}, [58, 10]), ('partial-repair probe', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('partial-repair probe', {'start': 86, 'end': 114, 'pauses': [[113, 121]]}, [115, 1]), ('normal control', {'start': 26, 'end': 56, 'pauses': []}, [56, 0]), ('normal control', {'start': 84, 'end': 115, 'pauses': []}, [115, 0]), ('normal control', {'start': 14, 'end': 42, 'pauses': []}, [42, 0]), ('normal control', {'start': 56, 'end': 86, 'pauses': []}, [86, 0])], [('regression', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('regression', {'start': 28, 'end': 56, 'pauses': [[45, 57], [44, 58], [33, 35], [48, 63]]}, [70, 14]), ('partial-repair probe', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('partial-repair probe', {'start': 0, 'end': 31, 'pauses': [[31, 46], [24, 33], [-7, -3], [-8, 6]]}, [44, 13]), ('normal control', {'start': 65, 'end': 93, 'pauses': []}, [93, 0]), ('normal control', {'start': 89, 'end': 119, 'pauses': [[109, 109]]}, [119, 0]), ('normal control', {'start': 99, 'end': 127, 'pauses': [[115, 120]]}, [132, 5]), ('normal control', {'start': 88, 'end': 118, 'pauses': [[105, 110], [103, 103], [95, 110], [104, 108]]}, [133, 15])], [('regression', {'start': 86, 'end': 114, 'pauses': [[113, 121]]}, [115, 1]), ('regression', {'start': 82, 'end': 112, 'pauses': [[76, 78], [84, 98], [94, 101], [102, 113]]}, [139, 27]), ('partial-repair probe', {'start': 96, 'end': 124, 'pauses': [[120, 128], [90, 105], [99, 105], [116, 125]]}, [141, 17]), ('partial-repair probe', {'start': 86, 'end': 116, 'pauses': [[89, 104], [117, 132], [97, 102]]}, [131, 15]), ('normal control', {'start': 9, 'end': 37, 'pauses': [[26, 26]]}, [37, 0]), ('normal control', {'start': 91, 'end': 121, 'pauses': [[114, 118], [100, 102], [115, 116]]}, [127, 6]), ('normal control', {'start': 95, 'end': 126, 'pauses': [[89, 89]]}, [126, 0]), ('normal control', {'start': 74, 'end': 105, 'pauses': [[77, 77], [87, 92]]}, [110, 5])], [('regression', {'start': 98, 'end': 126, 'pauses': [[121, 127], [123, 125]]}, [131, 5]), ('regression', {'start': 46, 'end': 76, 'pauses': [[72, 81]]}, [80, 4]), ('partial-repair probe', {'start': 60, 'end': 88, 'pauses': [[92, 102], [57, 65], [85, 100]]}, [96, 8]), ('partial-repair probe', {'start': 94, 'end': 124, 'pauses': [[96, 99], [128, 143], [115, 130]]}, [136, 12]), ('normal control', {'start': 54, 'end': 84, 'pauses': [[76, 80], [66, 79]]}, [98, 14]), ('normal control', {'start': 66, 'end': 97, 'pauses': [[87, 97], [71, 85]]}, [121, 24]), ('normal control', {'start': 62, 'end': 93, 'pauses': [[66, 73], [84, 88], [83, 90]]}, [107, 14]), ('normal control', {'start': 81, 'end': 111, 'pauses': []}, [111, 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 | [77, 21] | [70, 14] | Failed |
| regression 1 | [65, 0] | [65, 0] | Passed |
| partial-repair probe 2 | [140, 28] | [139, 27] | Failed |
| partial-repair probe 3 | [85, 9] | [80, 4] | Failed |
| normal control 4 | [60, 15] | [60, 15] | Passed |
| normal control 5 | [40, 0] | [40, 0] | Passed |
| normal control 6 | [117, 16] | [117, 16] | Passed |
| normal control 7 | [122, 0] | [122, 0] | Passed |
SHA-256 / da43528157d59104267286f0f2dbd2a7428c1f6f0555361bf66aa33b3ce304ff
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.548080+00:00.
Case digest / 7c92eee2cab9bd8f4b067b310e4a7a7b75b8bbdd722d690a61cea77bfb38df9c