FAILURE MAP
← Case archive

FA-59786 / Subscription proration billing / Open access

Proration behavior modes and pending items: none keeps pending · case 01

Changes made without prorations erase previously pending items.

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

ROOT CAUSE

The none branch clears pending items.

VERIFIED REPAIR

Restore the contract rule at the none keeps pending step: use `return [0, x['pending'], 0]`.

Unsuccessful approach: The attempt keeps pending but also adds the new proration, as if prorations were created.

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, 0, 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': 'none', 'amount': 3140, 'pending': 2478}, [0, 2478, 0]), ('regression', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 418, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2033, 'pending': -1935}, [0, -3968, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3806, 'pending': 0}, [3806, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0])], [('regression', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('regression', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 557, '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': 'always_invoice', 'amount': 3888, 'pending': 0}, [3888, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0])], [('regression', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0]), ('regression', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 557, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -4898, 'pending': -2365}, [0, 0, 7263]), ('normal control', {'behavior': 'create_prorations', 'amount': -1700, 'pending': 0}, [0, -1700, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 603, 'pending': -721}, [0, 0, 118])], [('regression', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('regression', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2824, 'pending': 2220}, [0, -604, 0]), ('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': 'create_prorations', 'amount': 3999, 'pending': 3774}, [0, 7773, 0])], [('regression', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('regression', {'behavior': 'none', 'amount': 5967, 'pending': -212}, [0, -212, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2152, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5861, 'pending': 2640}, [0, 8501, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 6428, 'pending': 2242}, [8670, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 490, 'pending': 0}, [0, 490, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -4222, 'pending': 288}, [0, -3934, 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, 0, 0][0, 2478, 0]Failed
regression 1[0, 0, 0][0, 1574, 0]Failed
partial-repair probe 2[0, 0, 0][0, 0, 0]Passed
partial-repair probe 3[0, 0, 0][0, 0, 0]Passed
normal control 4[0, -3968, 0][0, -3968, 0]Passed
normal control 5[3806, 0, 0][3806, 0, 0]Passed
normal control 6[0, -4586, 0][0, -4586, 0]Passed
normal control 7[0, 6174, 0][0, 6174, 0]Passed

SHA-256 / 659da1d18d7f5271bfe302518be441f4381c34a10c296a0930df215f1908c83f

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'] + amt, 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': 'none', 'amount': 3140, 'pending': 2478}, [0, 2478, 0]), ('regression', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 418, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2033, 'pending': -1935}, [0, -3968, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3806, 'pending': 0}, [3806, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0])], [('regression', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('regression', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 557, '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': 'always_invoice', 'amount': 3888, 'pending': 0}, [3888, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0])], [('regression', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0]), ('regression', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 557, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -4898, 'pending': -2365}, [0, 0, 7263]), ('normal control', {'behavior': 'create_prorations', 'amount': -1700, 'pending': 0}, [0, -1700, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 603, 'pending': -721}, [0, 0, 118])], [('regression', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('regression', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2824, 'pending': 2220}, [0, -604, 0]), ('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': 'create_prorations', 'amount': 3999, 'pending': 3774}, [0, 7773, 0])], [('regression', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('regression', {'behavior': 'none', 'amount': 5967, 'pending': -212}, [0, -212, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2152, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5861, 'pending': 2640}, [0, 8501, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 6428, 'pending': 2242}, [8670, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 490, 'pending': 0}, [0, 490, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -4222, 'pending': 288}, [0, -3934, 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, 5618, 0][0, 2478, 0]Failed
regression 1[0, 387, 0][0, 1574, 0]Failed
partial-repair probe 2[0, 418, 0][0, 0, 0]Failed
partial-repair probe 3[0, -2844, 0][0, 0, 0]Failed
normal control 4[0, -3968, 0][0, -3968, 0]Passed
normal control 5[3806, 0, 0][3806, 0, 0]Passed
normal control 6[0, -4586, 0][0, -4586, 0]Passed
normal control 7[0, 6174, 0][0, 6174, 0]Passed

SHA-256 / 6adc45fe40c66dc50afe9a9b0c8fb33459ae5d681ac8b1d577a9520e8bd2daf3

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': 'none', 'amount': 3140, 'pending': 2478}, [0, 2478, 0]), ('regression', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 418, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2033, 'pending': -1935}, [0, -3968, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 3806, 'pending': 0}, [3806, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2749, 'pending': -1837}, [0, -4586, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 7165, 'pending': -991}, [0, 6174, 0])], [('regression', {'behavior': 'none', 'amount': -1187, 'pending': 1574}, [0, 1574, 0]), ('regression', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2844, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 557, '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': 'always_invoice', 'amount': 3888, 'pending': 0}, [3888, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5304, 'pending': -1989}, [0, 3315, 0])], [('regression', {'behavior': 'none', 'amount': -2370, 'pending': -876}, [0, -876, 0]), ('regression', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': 557, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5860, 'pending': -2357}, [0, 3503, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': -4898, 'pending': -2365}, [0, 0, 7263]), ('normal control', {'behavior': 'create_prorations', 'amount': -1700, 'pending': 0}, [0, -1700, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 603, 'pending': -721}, [0, 0, 118])], [('regression', {'behavior': 'none', 'amount': -2879, 'pending': -1049}, [0, -1049, 0]), ('regression', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2062, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -2824, 'pending': 2220}, [0, -604, 0]), ('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': 'create_prorations', 'amount': 3999, 'pending': 3774}, [0, 7773, 0])], [('regression', {'behavior': 'none', 'amount': 5845, 'pending': -1589}, [0, -1589, 0]), ('regression', {'behavior': 'none', 'amount': 5967, 'pending': -212}, [0, -212, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -4490, 'pending': 0}, [0, 0, 0]), ('partial-repair probe', {'behavior': 'none', 'amount': -2152, 'pending': 0}, [0, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 5861, 'pending': 2640}, [0, 8501, 0]), ('normal control', {'behavior': 'always_invoice', 'amount': 6428, 'pending': 2242}, [8670, 0, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': 490, 'pending': 0}, [0, 490, 0]), ('normal control', {'behavior': 'create_prorations', 'amount': -4222, 'pending': 288}, [0, -3934, 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, 2478, 0][0, 2478, 0]Passed
regression 1[0, 1574, 0][0, 1574, 0]Passed
partial-repair probe 2[0, 0, 0][0, 0, 0]Passed
partial-repair probe 3[0, 0, 0][0, 0, 0]Passed
normal control 4[0, -3968, 0][0, -3968, 0]Passed
normal control 5[3806, 0, 0][3806, 0, 0]Passed
normal control 6[0, -4586, 0][0, -4586, 0]Passed
normal control 7[0, 6174, 0][0, 6174, 0]Passed

SHA-256 / 966ccf055fd94fcec151349b8a46e664096471f08808c5fca35050a166969592

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

Case digest / 2a80d010853228df222d9f875c9ac472380a7da0cc33fa4788f1dd9f336eed2f