FA-59641 / Subscription proration billing / Open access
Minimum threshold for invoicing prorations: carried amount inclusion · case 01
Small deferred prorations from earlier cycles are never billed.
ROOT CAUSE
The carried amount is dropped when computing pending prorations.
THE FAILURE
The carried amount is dropped when computing pending prorations.
Unsuccessful approach: The attempt includes carry but ignores new credit lines.
Case contract
Input {lines, threshold, carried}. Pending = carried + sum(lines). Pending >= threshold is invoiced now; pending <= -threshold is credited to the balance now; anything in between is carried to the next cycle. Return [invoiced, credited, carry].
Why this case matters
Tiny proration amounts are deferred to avoid micro-charges, but must not be lost.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
pending = sum(x['lines'])
if pending >= x['threshold']:
return [pending, 0, 0]
if pending <= -x['threshold']:
return [0, -pending, 0]
return [0, 0, pending]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression (boundary)', {'lines': [-60], 'threshold': 50, 'carried': 10}, [0, 50, 0]), ('regression (boundary)', {'lines': [30], 'threshold': 50, 'carried': 20}, [50, 0, 0]), ('partial-repair probe (boundary)', {'lines': [-50, 150], 'threshold': 100, 'carried': 0}, [100, 0, 0]), ('partial-repair probe (boundary)', {'lines': [-100], 'threshold': 100, 'carried': 0}, [0, 100, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [481], 'threshold': 100, 'carried': 0}, [481, 0, 0]), ('normal control', {'lines': [207], 'threshold': 500, 'carried': 0}, [0, 0, 207]), ('normal control', {'lines': [429], 'threshold': 100, 'carried': 0}, [429, 0, 0]), ('normal control', {'lines': [97], 'threshold': 50, 'carried': 0}, [97, 0, 0])], [('regression', {'lines': [518, -386], 'threshold': 500, 'carried': 499}, [631, 0, 0]), ('regression (boundary)', {'lines': [], 'threshold': 100, 'carried': 100}, [100, 0, 0]), ('partial-repair probe (boundary)', {'lines': [-60], 'threshold': 50, 'carried': 10}, [0, 50, 0]), ('partial-repair probe', {'lines': [61, 426, -138, 400], 'threshold': 50, 'carried': 0}, [749, 0, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [344], 'threshold': 100, 'carried': 0}, [344, 0, 0]), ('normal control', {'lines': [], 'threshold': 50, 'carried': 0}, [0, 0, 0]), ('normal control', {'lines': [326, 112, 108, 591], 'threshold': 50, 'carried': 0}, [1137, 0, 0]), ('normal control', {'lines': [127], 'threshold': 100, 'carried': 0}, [127, 0, 0])], [('regression', {'lines': [340, -379, -241], 'threshold': 50, 'carried': -6}, [0, 286, 0]), ('regression (boundary)', {'lines': [-60], 'threshold': 50, 'carried': 10}, [0, 50, 0]), ('partial-repair probe', {'lines': [518, -386], 'threshold': 500, 'carried': 499}, [631, 0, 0]), ('partial-repair probe', {'lines': [-381, 116], 'threshold': 500, 'carried': 0}, [0, 0, -265]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [341], 'threshold': 500, 'carried': 0}, [0, 0, 341]), ('normal control', {'lines': [], 'threshold': 500, 'carried': 0}, [0, 0, 0]), ('normal control', {'lines': [], 'threshold': 100, 'carried': 0}, [0, 0, 0]), ('normal control', {'lines': [225], 'threshold': 500, 'carried': 0}, [0, 0, 225])], [('regression', {'lines': [-497, -497, -32, -352], 'threshold': 50, 'carried': -49}, [0, 1427, 0]), ('regression', {'lines': [], 'threshold': 500, 'carried': 499}, [0, 0, 499]), ('partial-repair probe', {'lines': [340, -379, -241], 'threshold': 50, 'carried': -6}, [0, 286, 0]), ('partial-repair probe', {'lines': [-95, 305], 'threshold': 100, 'carried': 0}, [210, 0, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [120, 341, 183, 393], 'threshold': 500, 'carried': 0}, [1037, 0, 0]), ('normal control', {'lines': [376], 'threshold': 500, 'carried': 0}, [0, 0, 376]), ('normal control', {'lines': [458], 'threshold': 100, 'carried': 0}, [458, 0, 0]), ('normal control', {'lines': [239], 'threshold': 100, 'carried': 0}, [239, 0, 0])], [('regression', {'lines': [382, -579, 100], 'threshold': 500, 'carried': 299}, [0, 0, 202]), ('regression', {'lines': [518, -386], 'threshold': 500, 'carried': 499}, [631, 0, 0]), ('partial-repair probe', {'lines': [-95, 305], 'threshold': 100, 'carried': 0}, [210, 0, 0]), ('partial-repair probe', {'lines': [145, -201, 592, 509], 'threshold': 500, 'carried': 0}, [1045, 0, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [336], 'threshold': 100, 'carried': 0}, [336, 0, 0]), ('normal control', {'lines': [41], 'threshold': 500, 'carried': 0}, [0, 0, 41]), ('normal control', {'lines': [360], 'threshold': 500, 'carried': 0}, [0, 0, 360]), ('normal control', {'lines': [263, 589], 'threshold': 100, 'carried': 0}, [852, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression (boundary) 0 | [0, 60, 0] | [0, 50, 0] | Failed |
| regression (boundary) 1 | [0, 0, 30] | [50, 0, 0] | Failed |
| partial-repair probe (boundary) 2 | [100, 0, 0] | [100, 0, 0] | Passed |
| partial-repair probe (boundary) 3 | [0, 100, 0] | [0, 100, 0] | Passed |
| boundary control 4 | [500, 0, 0] | [500, 0, 0] | Passed |
| boundary control 5 | [50, 0, 0] | [50, 0, 0] | Passed |
| normal control 6 | [481, 0, 0] | [481, 0, 0] | Passed |
| normal control 7 | [0, 0, 207] | [0, 0, 207] | Passed |
| normal control 8 | [429, 0, 0] | [429, 0, 0] | Passed |
| normal control 9 | [97, 0, 0] | [97, 0, 0] | Passed |
SHA-256 / 37656c965a5608125d46d584e34564292d68eb07df70f640c79e902df177825e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
pending = x['carried'] + sum(l for l in x['lines'] if l > 0)
if pending >= x['threshold']:
return [pending, 0, 0]
if pending <= -x['threshold']:
return [0, -pending, 0]
return [0, 0, pending]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression (boundary)', {'lines': [-60], 'threshold': 50, 'carried': 10}, [0, 50, 0]), ('regression (boundary)', {'lines': [30], 'threshold': 50, 'carried': 20}, [50, 0, 0]), ('partial-repair probe (boundary)', {'lines': [-50, 150], 'threshold': 100, 'carried': 0}, [100, 0, 0]), ('partial-repair probe (boundary)', {'lines': [-100], 'threshold': 100, 'carried': 0}, [0, 100, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [481], 'threshold': 100, 'carried': 0}, [481, 0, 0]), ('normal control', {'lines': [207], 'threshold': 500, 'carried': 0}, [0, 0, 207]), ('normal control', {'lines': [429], 'threshold': 100, 'carried': 0}, [429, 0, 0]), ('normal control', {'lines': [97], 'threshold': 50, 'carried': 0}, [97, 0, 0])], [('regression', {'lines': [518, -386], 'threshold': 500, 'carried': 499}, [631, 0, 0]), ('regression (boundary)', {'lines': [], 'threshold': 100, 'carried': 100}, [100, 0, 0]), ('partial-repair probe (boundary)', {'lines': [-60], 'threshold': 50, 'carried': 10}, [0, 50, 0]), ('partial-repair probe', {'lines': [61, 426, -138, 400], 'threshold': 50, 'carried': 0}, [749, 0, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [344], 'threshold': 100, 'carried': 0}, [344, 0, 0]), ('normal control', {'lines': [], 'threshold': 50, 'carried': 0}, [0, 0, 0]), ('normal control', {'lines': [326, 112, 108, 591], 'threshold': 50, 'carried': 0}, [1137, 0, 0]), ('normal control', {'lines': [127], 'threshold': 100, 'carried': 0}, [127, 0, 0])], [('regression', {'lines': [340, -379, -241], 'threshold': 50, 'carried': -6}, [0, 286, 0]), ('regression (boundary)', {'lines': [-60], 'threshold': 50, 'carried': 10}, [0, 50, 0]), ('partial-repair probe', {'lines': [518, -386], 'threshold': 500, 'carried': 499}, [631, 0, 0]), ('partial-repair probe', {'lines': [-381, 116], 'threshold': 500, 'carried': 0}, [0, 0, -265]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [341], 'threshold': 500, 'carried': 0}, [0, 0, 341]), ('normal control', {'lines': [], 'threshold': 500, 'carried': 0}, [0, 0, 0]), ('normal control', {'lines': [], 'threshold': 100, 'carried': 0}, [0, 0, 0]), ('normal control', {'lines': [225], 'threshold': 500, 'carried': 0}, [0, 0, 225])], [('regression', {'lines': [-497, -497, -32, -352], 'threshold': 50, 'carried': -49}, [0, 1427, 0]), ('regression', {'lines': [], 'threshold': 500, 'carried': 499}, [0, 0, 499]), ('partial-repair probe', {'lines': [340, -379, -241], 'threshold': 50, 'carried': -6}, [0, 286, 0]), ('partial-repair probe', {'lines': [-95, 305], 'threshold': 100, 'carried': 0}, [210, 0, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [120, 341, 183, 393], 'threshold': 500, 'carried': 0}, [1037, 0, 0]), ('normal control', {'lines': [376], 'threshold': 500, 'carried': 0}, [0, 0, 376]), ('normal control', {'lines': [458], 'threshold': 100, 'carried': 0}, [458, 0, 0]), ('normal control', {'lines': [239], 'threshold': 100, 'carried': 0}, [239, 0, 0])], [('regression', {'lines': [382, -579, 100], 'threshold': 500, 'carried': 299}, [0, 0, 202]), ('regression', {'lines': [518, -386], 'threshold': 500, 'carried': 499}, [631, 0, 0]), ('partial-repair probe', {'lines': [-95, 305], 'threshold': 100, 'carried': 0}, [210, 0, 0]), ('partial-repair probe', {'lines': [145, -201, 592, 509], 'threshold': 500, 'carried': 0}, [1045, 0, 0]), ('boundary control', {'lines': [250, 250], 'threshold': 500, 'carried': 0}, [500, 0, 0]), ('boundary control', {'lines': [40, 10], 'threshold': 50, 'carried': 0}, [50, 0, 0]), ('normal control', {'lines': [336], 'threshold': 100, 'carried': 0}, [336, 0, 0]), ('normal control', {'lines': [41], 'threshold': 500, 'carried': 0}, [0, 0, 41]), ('normal control', {'lines': [360], 'threshold': 500, 'carried': 0}, [0, 0, 360]), ('normal control', {'lines': [263, 589], 'threshold': 100, 'carried': 0}, [852, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression (boundary) 0 | [0, 0, 10] | [0, 50, 0] | Failed |
| regression (boundary) 1 | [50, 0, 0] | [50, 0, 0] | Passed |
| partial-repair probe (boundary) 2 | [150, 0, 0] | [100, 0, 0] | Failed |
| partial-repair probe (boundary) 3 | [0, 0, 0] | [0, 100, 0] | Failed |
| boundary control 4 | [500, 0, 0] | [500, 0, 0] | Passed |
| boundary control 5 | [50, 0, 0] | [50, 0, 0] | Passed |
| normal control 6 | [481, 0, 0] | [481, 0, 0] | Passed |
| normal control 7 | [0, 0, 207] | [0, 0, 207] | Passed |
| normal control 8 | [429, 0, 0] | [429, 0, 0] | Passed |
| normal control 9 | [97, 0, 0] | [97, 0, 0] | Passed |
SHA-256 / b6cf441e27fe9c3cc1734eb359991209eaeebbe01875bdfe8f2a32d809c409a0
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 10 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:38.174494+00:00.
Case digest / b9f26d520b3a0a0b96d399f7390704c550df57ba5ed2e976809681e9b36943af