FAILURE MAP
← Case archive

FA-59791 / Subscription proration billing / Open access

Proration behavior modes and pending items: create defers to renewal · case 01

Default prorations are charged immediately instead of on the next renewal invoice.

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

ROOT CAUSE

The create branch invoices the new amount now.

VERIFIED REPAIR

Restore the contract rule at the create defers to renewal step: use `return [0, x['pending'] + amt, 0]`.

Unsuccessful approach: The attempt defers but overwrites existing pending items.

Case contract

Input {behavior create_prorations|none|always_invoice, amount (net new proration), pending (existing pending items)}. none: nothing is created and pending is untouched. create_prorations: amount joins pending for the next renewal invoice. always_invoice: pending plus amount are invoiced now; a negative total becomes a credit. Return [invoiced_now, pending_after, credited].

Why this case matters

Whether prorations are invoiced now, deferred, or skipped decides when the customer pays and what stays pending.

1 / The failure

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

N = 1
observations = []
def solve(x):
    amt = x['amount']
    b = x['behavior']
    if b == 'none':
        return [0, x['pending'], 0]
    if b == 'always_invoice':
        due = x['pending'] + amt
        return [max(0, due), 0, max(0, -due)]
    return [amt, x['pending'], 0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'behavior': 'create_prorations', 'amount': -2033, 'pending': -1935}, [0, -3968, 0]), ('regression', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('normal control', {'behavior': 'none', 'amount': 418, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 3140, 'pending': 2478}, [0, 2478, 0]), ('normal control', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3806, 'pending': 0}, [3806, 0, 0])], [('regression', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('normal control', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 883, 'pending': 0}, [883, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 758, 'pending': 0}, [758, 0, 0]), ('normal control', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0])], [('regression', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -2824, 'pending': 2220}, [0, -604, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3888, 'pending': 0}, [3888, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 557, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -4898, 'pending': -2365}, [0, 0, 7263])], [('regression', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 3999, 'pending': 3774}, [0, 7773, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5861, 'pending': 2640}, [0, 8501, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 603, 'pending': -721}, [0, 0, 118]), ('normal control', {'behavior': 'always_invoice', 'amount': 5024, 'pending': 409}, [5433, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -1436, 'pending': -1622}, [0, 0, 3058]), ('normal control', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0])], [('regression', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('regression', {'behavior': 'create_prorations', 'amount': -1700, 'pending': 0}, [0, -1700, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -4222, 'pending': 288}, [0, -3934, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -3788, 'pending': 3777}, [0, -11, 0]), ('normal control', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 6428, 'pending': 2242}, [8670, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('normal control', {'behavior': 'none', 'amount': -2152, 'pending': 0}, [0, 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 fixtureActualExpectedOutcome
regression 0[-2033, -1935, 0][0, -3968, 0]Failed
regression 1[-2749, -1837, 0][0, -4586, 0]Failed
partial-repair probe 2[7165, -991, 0][0, 6174, 0]Failed
partial-repair probe 3[5304, -1989, 0][0, 3315, 0]Failed
normal control 4[0, 0, 0][0, 0, 0]Passed
normal control 5[0, 2478, 0][0, 2478, 0]Passed
normal control 6[0, 1574, 0][0, 1574, 0]Passed
normal control 7[3806, 0, 0][3806, 0, 0]Passed

SHA-256 / db3e1f85a4dca763c8bb8a8bc367554205d0d7db3c59e27fbcdec69eceeadf91

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    amt = x['amount']
    b = x['behavior']
    if b == 'none':
        return [0, x['pending'], 0]
    if b == 'always_invoice':
        due = x['pending'] + amt
        return [max(0, due), 0, max(0, -due)]
    return [0, amt, 0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'behavior': 'create_prorations', 'amount': -2033, 'pending': -1935}, [0, -3968, 0]), ('regression', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('normal control', {'behavior': 'none', 'amount': 418, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 3140, 'pending': 2478}, [0, 2478, 0]), ('normal control', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3806, 'pending': 0}, [3806, 0, 0])], [('regression', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('normal control', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 883, 'pending': 0}, [883, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 758, 'pending': 0}, [758, 0, 0]), ('normal control', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0])], [('regression', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -2824, 'pending': 2220}, [0, -604, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3888, 'pending': 0}, [3888, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 557, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -4898, 'pending': -2365}, [0, 0, 7263])], [('regression', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 3999, 'pending': 3774}, [0, 7773, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5861, 'pending': 2640}, [0, 8501, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 603, 'pending': -721}, [0, 0, 118]), ('normal control', {'behavior': 'always_invoice', 'amount': 5024, 'pending': 409}, [5433, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -1436, 'pending': -1622}, [0, 0, 3058]), ('normal control', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0])], [('regression', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('regression', {'behavior': 'create_prorations', 'amount': -1700, 'pending': 0}, [0, -1700, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -4222, 'pending': 288}, [0, -3934, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -3788, 'pending': 3777}, [0, -11, 0]), ('normal control', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 6428, 'pending': 2242}, [8670, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('normal control', {'behavior': 'none', 'amount': -2152, 'pending': 0}, [0, 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 fixtureActualExpectedOutcome
regression 0[0, -2033, 0][0, -3968, 0]Failed
regression 1[0, -2749, 0][0, -4586, 0]Failed
partial-repair probe 2[0, 7165, 0][0, 6174, 0]Failed
partial-repair probe 3[0, 5304, 0][0, 3315, 0]Failed
normal control 4[0, 0, 0][0, 0, 0]Passed
normal control 5[0, 2478, 0][0, 2478, 0]Passed
normal control 6[0, 1574, 0][0, 1574, 0]Passed
normal control 7[3806, 0, 0][3806, 0, 0]Passed

SHA-256 / 70f538ccf3c8099813d5612550b73f2b04afddcec0a067a6f64767ecf26aad7a

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    amt = x['amount']
    b = x['behavior']
    if b == 'none':
        return [0, x['pending'], 0]
    if b == 'always_invoice':
        due = x['pending'] + amt
        return [max(0, due), 0, max(0, -due)]
    return [0, x['pending'] + amt, 0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'behavior': 'create_prorations', 'amount': -2033, 'pending': -1935}, [0, -3968, 0]), ('regression', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('normal control', {'behavior': 'none', 'amount': 418, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 3140, 'pending': 2478}, [0, 2478, 0]), ('normal control', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3806, 'pending': 0}, [3806, 0, 0])], [('regression', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('normal control', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 883, 'pending': 0}, [883, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 758, 'pending': 0}, [758, 0, 0]), ('normal control', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0])], [('regression', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -2824, 'pending': 2220}, [0, -604, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3888, 'pending': 0}, [3888, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 557, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -4898, 'pending': -2365}, [0, 0, 7263])], [('regression', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0]), ('regression', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 3999, 'pending': 3774}, [0, 7773, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': 5861, 'pending': 2640}, [0, 8501, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 603, 'pending': -721}, [0, 0, 118]), ('normal control', {'behavior': 'always_invoice', 'amount': 5024, 'pending': 409}, [5433, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -1436, 'pending': -1622}, [0, 0, 3058]), ('normal control', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0])], [('regression', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('regression', {'behavior': 'create_prorations', 'amount': -1700, 'pending': 0}, [0, -1700, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -4222, 'pending': 288}, [0, -3934, 0]), ('partial-repair probe', {'behavior': 'create_prorations', 'amount': -3788, 'pending': 3777}, [0, -11, 0]), ('normal control', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 6428, 'pending': 2242}, [8670, 0, 0]), ('normal control', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('normal control', {'behavior': 'none', 'amount': -2152, 'pending': 0}, [0, 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 fixtureActualExpectedOutcome
regression 0[0, -3968, 0][0, -3968, 0]Passed
regression 1[0, -4586, 0][0, -4586, 0]Passed
partial-repair probe 2[0, 6174, 0][0, 6174, 0]Passed
partial-repair probe 3[0, 3315, 0][0, 3315, 0]Passed
normal control 4[0, 0, 0][0, 0, 0]Passed
normal control 5[0, 2478, 0][0, 2478, 0]Passed
normal control 6[0, 1574, 0][0, 1574, 0]Passed
normal control 7[3806, 0, 0][3806, 0, 0]Passed

SHA-256 / 52469defc63c7150e3a652aad2d7f8ab0e2c0013601d0f8a6b1d377d20161663

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

Case digest / f3854a3c5b8c31a08b4d38d5e219a8d29a87a9d375f7dac2cbed6aefa9b5a041