FA-59376 / Subscription proration billing / Open access
Second-granular proration line items: zero-value line suppression · case 01
Moving from zero seats produces an empty zero-cent credit line.
ROOT CAUSE
The credit line is emitted whenever the old price is nonzero, even with zero quantity.
VERIFIED REPAIR
Restore the contract rule at the zero-value line suppression step: use `if x['old'] * x['qold']:`.
Unsuccessful approach: The attempt tests quantity alone, emitting zero lines for free plans.
Case contract
Input unix-second {start, end, change} and {old, qold, new, qnew}. If change < start or change >= end return []. Otherwise left = end - change, span = end - start. An "unused" credit line of -(old*qold*left/span) and a "remaining" line of new*qnew*left/span are emitted, each magnitude rounded half-up (half away from zero), omitting a line whose price*quantity is 0. Return [[kind, amount]].
Why this case matters
Timestamp-based proration produces separate credit and debit lines whose rounding and emission rules show on the invoice.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if x['change'] >= x['end'] or x['change'] < x['start']:
return []
span = x['end'] - x['start']
left = x['end'] - x['change']
def hu(n):
return (n * 2 + span) // (2 * span)
lines = []
if x['old']:
lines.append(['unused', -hu(x['old'] * x['qold'] * left)])
if x['new'] * x['qnew']:
lines.append(['remaining', hu(x['new'] * x['qnew'] * left)])
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 1718898066, 'end': 1722579184, 'change': 1721183532, 'old': 87270, 'qold': 0, 'new': 4900, 'qnew': 1}, [['remaining', 1858]]), ('regression', {'start': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('partial-repair probe', {'start': 1759898518, 'end': 1762576918, 'change': 1760952409, 'old': 0, 'qold': 3, 'new': 37669, 'qnew': 0}, []), ('partial-repair probe', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 3, 'qold': 1, 'new': 5, 'qnew': 1}, [['unused', -2], ['remaining', 3]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 5, 'qold': 1, 'new': 7, 'qnew': 1}, [['unused', -3], ['remaining', 4]]), ('normal control', {'start': 1704011568, 'end': 1706689968, 'change': 1706689968, 'old': 1000, 'qold': 3, 'new': 1500, 'qnew': 3}, []), ('normal control', {'start': 1737228310, 'end': 1739499785, 'change': 1739499795, 'old': 178, 'qold': 1, 'new': 1500, 'qnew': 1}, []), ('normal control', {'start': 1732894162, 'end': 1735486162, 'change': 1732894162, 'old': 1000, 'qold': 2, 'new': 91004, 'qnew': 0}, [['unused', -2000]]), ('normal control', {'start': 1749969117, 'end': 1752647517, 'change': 1751393656, 'old': 63152, 'qold': 13, 'new': 0, 'qnew': 0}, [['unused', -384330]])], [('regression', {'start': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('regression', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('partial-repair probe', {'start': 1703542570, 'end': 1706134570, 'change': 1705592728, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 7}, [['remaining', 7170]]), ('partial-repair probe', {'start': 1720582304, 'end': 1723174304, 'change': 1723103614, 'old': 0, 'qold': 1, 'new': 27595, 'qnew': 5}, [['remaining', 3763]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 7, 'qold': 1, 'new': 9, 'qnew': 1}, [['unused', -4], ['remaining', 5]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 9, 'qold': 1, 'new': 11, 'qnew': 1}, [['unused', -5], ['remaining', 6]]), ('normal control', {'start': 1728579559, 'end': 1760115559, 'change': 1760115559, 'old': 0, 'qold': 0, 'new': 51264, 'qnew': 1}, []), ('normal control', {'start': 1721814513, 'end': 1722419313, 'change': 1722419313, 'old': 0, 'qold': 3, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1720297909, 'end': 1720623118, 'change': 1720623118, 'old': 1000, 'qold': 17, 'new': 0, 'qnew': 0}, []), ('normal control', {'start': 1734629848, 'end': 1766165848, 'change': 1766165848, 'old': 1000, 'qold': 1, 'new': 4900, 'qnew': 1}, [])], [('regression', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('regression', {'start': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('partial-repair probe', {'start': 1708667964, 'end': 1709272764, 'change': 1708667964, 'old': 0, 'qold': 14, 'new': 0, 'qnew': 1}, []), ('partial-repair probe', {'start': 1757422189, 'end': 1758026989, 'change': 1757422189, 'old': 0, 'qold': 1, 'new': 0, 'qnew': 5}, []), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 11, 'qold': 1, 'new': 13, 'qnew': 1}, [['unused', -6], ['remaining', 7]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 13, 'qold': 1, 'new': 15, 'qnew': 1}, [['unused', -7], ['remaining', 8]]), ('normal control', {'start': 1759524018, 'end': 1763871464, 'change': 1759976835, 'old': 0, 'qold': 0, 'new': 1500, 'qnew': 5}, [['remaining', 6719]]), ('normal control', {'start': 1724743049, 'end': 1756279049, 'change': 1724743049, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 1}, [['unused', -2500], ['remaining', 1500]]), ('normal control', {'start': 1742436208, 'end': 1773972208, 'change': 1773972218, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 1}, []), ('normal control', {'start': 1757847857, 'end': 1760439857, 'change': 1757847852, 'old': 92286, 'qold': 0, 'new': 0, 'qnew': 4}, [])], [('regression', {'start': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('regression', {'start': 1726598960, 'end': 1727203760, 'change': 1726783107, 'old': 2500, 'qold': 0, 'new': 4900, 'qnew': 0}, []), ('partial-repair probe', {'start': 1741666940, 'end': 1742271740, 'change': 1742262231, 'old': 0, 'qold': 3, 'new': 51773, 'qnew': 5}, [['remaining', 4070]]), ('partial-repair probe', {'start': 1726326778, 'end': 1757862778, 'change': 1743535077, 'old': 0, 'qold': 3, 'new': 67019, 'qnew': 5}, [['remaining', 152243]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 3, 'qold': 1, 'new': 5, 'qnew': 1}, [['unused', -2], ['remaining', 3]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 5, 'qold': 1, 'new': 7, 'qnew': 1}, [['unused', -3], ['remaining', 4]]), ('normal control', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('normal control', {'start': 1739738740, 'end': 1771274740, 'change': 1771274740, 'old': 2500, 'qold': 3, 'new': 1500, 'qnew': 5}, []), ('normal control', {'start': 1725551908, 'end': 1757087908, 'change': 1757087918, 'old': 67119, 'qold': 3, 'new': 4900, 'qnew': 13}, []), ('normal control', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]])], [('regression', {'start': 1726598960, 'end': 1727203760, 'change': 1726783107, 'old': 2500, 'qold': 0, 'new': 4900, 'qnew': 0}, []), ('regression', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('partial-repair probe', {'start': 1759684109, 'end': 1761679609, 'change': 1759972940, 'old': 0, 'qold': 19, 'new': 23288, 'qnew': 1}, [['remaining', 19917]]), ('partial-repair probe', {'start': 1726548056, 'end': 1729226456, 'change': 1726548056, 'old': 0, 'qold': 1, 'new': 4900, 'qnew': 10}, [['remaining', 49000]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 7, 'qold': 1, 'new': 9, 'qnew': 1}, [['unused', -4], ['remaining', 5]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 9, 'qold': 1, 'new': 11, 'qnew': 1}, [['unused', -5], ['remaining', 6]]), ('normal control', {'start': 1742150000, 'end': 1745617539, 'change': 1744739339, 'old': 2500, 'qold': 3, 'new': 0, 'qnew': 1}, [['unused', -1899]]), ('normal control', {'start': 1734436882, 'end': 1765972882, 'change': 1756322121, 'old': 10374, 'qold': 1, 'new': 4900, 'qnew': 1}, [['unused', -3175], ['remaining', 1500]]), ('normal control', {'start': 1716957129, 'end': 1717561929, 'change': 1716957124, 'old': 1000, 'qold': 7, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1724685898, 'end': 1728923706, 'change': 1728923716, 'old': 2500, 'qold': 3, 'new': 1500, 'qnew': 1}, [])]]
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 | [['unused', 0], ['remaining', 1858]] | [['remaining', 1858]] | Failed |
| regression 1 | [['unused', 0]] | [] | Failed |
| partial-repair probe 2 | [] | [] | Passed |
| partial-repair probe 3 | [['remaining', 68600]] | [['remaining', 68600]] | Passed |
| boundary control 4 | [['unused', -2], ['remaining', 3]] | [['unused', -2], ['remaining', 3]] | Passed |
| boundary control 5 | [['unused', -3], ['remaining', 4]] | [['unused', -3], ['remaining', 4]] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [] | [] | Passed |
| normal control 8 | [['unused', -2000]] | [['unused', -2000]] | Passed |
| normal control 9 | [['unused', -384330]] | [['unused', -384330]] | Passed |
SHA-256 / 0ecf8470f650cdfcbb8390020a53c6cc43678e770b22522c2b223195aa764948
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if x['change'] >= x['end'] or x['change'] < x['start']:
return []
span = x['end'] - x['start']
left = x['end'] - x['change']
def hu(n):
return (n * 2 + span) // (2 * span)
lines = []
if x['qold']:
lines.append(['unused', -hu(x['old'] * x['qold'] * left)])
if x['new'] * x['qnew']:
lines.append(['remaining', hu(x['new'] * x['qnew'] * left)])
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 1718898066, 'end': 1722579184, 'change': 1721183532, 'old': 87270, 'qold': 0, 'new': 4900, 'qnew': 1}, [['remaining', 1858]]), ('regression', {'start': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('partial-repair probe', {'start': 1759898518, 'end': 1762576918, 'change': 1760952409, 'old': 0, 'qold': 3, 'new': 37669, 'qnew': 0}, []), ('partial-repair probe', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 3, 'qold': 1, 'new': 5, 'qnew': 1}, [['unused', -2], ['remaining', 3]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 5, 'qold': 1, 'new': 7, 'qnew': 1}, [['unused', -3], ['remaining', 4]]), ('normal control', {'start': 1704011568, 'end': 1706689968, 'change': 1706689968, 'old': 1000, 'qold': 3, 'new': 1500, 'qnew': 3}, []), ('normal control', {'start': 1737228310, 'end': 1739499785, 'change': 1739499795, 'old': 178, 'qold': 1, 'new': 1500, 'qnew': 1}, []), ('normal control', {'start': 1732894162, 'end': 1735486162, 'change': 1732894162, 'old': 1000, 'qold': 2, 'new': 91004, 'qnew': 0}, [['unused', -2000]]), ('normal control', {'start': 1749969117, 'end': 1752647517, 'change': 1751393656, 'old': 63152, 'qold': 13, 'new': 0, 'qnew': 0}, [['unused', -384330]])], [('regression', {'start': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('regression', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('partial-repair probe', {'start': 1703542570, 'end': 1706134570, 'change': 1705592728, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 7}, [['remaining', 7170]]), ('partial-repair probe', {'start': 1720582304, 'end': 1723174304, 'change': 1723103614, 'old': 0, 'qold': 1, 'new': 27595, 'qnew': 5}, [['remaining', 3763]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 7, 'qold': 1, 'new': 9, 'qnew': 1}, [['unused', -4], ['remaining', 5]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 9, 'qold': 1, 'new': 11, 'qnew': 1}, [['unused', -5], ['remaining', 6]]), ('normal control', {'start': 1728579559, 'end': 1760115559, 'change': 1760115559, 'old': 0, 'qold': 0, 'new': 51264, 'qnew': 1}, []), ('normal control', {'start': 1721814513, 'end': 1722419313, 'change': 1722419313, 'old': 0, 'qold': 3, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1720297909, 'end': 1720623118, 'change': 1720623118, 'old': 1000, 'qold': 17, 'new': 0, 'qnew': 0}, []), ('normal control', {'start': 1734629848, 'end': 1766165848, 'change': 1766165848, 'old': 1000, 'qold': 1, 'new': 4900, 'qnew': 1}, [])], [('regression', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('regression', {'start': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('partial-repair probe', {'start': 1708667964, 'end': 1709272764, 'change': 1708667964, 'old': 0, 'qold': 14, 'new': 0, 'qnew': 1}, []), ('partial-repair probe', {'start': 1757422189, 'end': 1758026989, 'change': 1757422189, 'old': 0, 'qold': 1, 'new': 0, 'qnew': 5}, []), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 11, 'qold': 1, 'new': 13, 'qnew': 1}, [['unused', -6], ['remaining', 7]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 13, 'qold': 1, 'new': 15, 'qnew': 1}, [['unused', -7], ['remaining', 8]]), ('normal control', {'start': 1759524018, 'end': 1763871464, 'change': 1759976835, 'old': 0, 'qold': 0, 'new': 1500, 'qnew': 5}, [['remaining', 6719]]), ('normal control', {'start': 1724743049, 'end': 1756279049, 'change': 1724743049, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 1}, [['unused', -2500], ['remaining', 1500]]), ('normal control', {'start': 1742436208, 'end': 1773972208, 'change': 1773972218, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 1}, []), ('normal control', {'start': 1757847857, 'end': 1760439857, 'change': 1757847852, 'old': 92286, 'qold': 0, 'new': 0, 'qnew': 4}, [])], [('regression', {'start': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('regression', {'start': 1726598960, 'end': 1727203760, 'change': 1726783107, 'old': 2500, 'qold': 0, 'new': 4900, 'qnew': 0}, []), ('partial-repair probe', {'start': 1741666940, 'end': 1742271740, 'change': 1742262231, 'old': 0, 'qold': 3, 'new': 51773, 'qnew': 5}, [['remaining', 4070]]), ('partial-repair probe', {'start': 1726326778, 'end': 1757862778, 'change': 1743535077, 'old': 0, 'qold': 3, 'new': 67019, 'qnew': 5}, [['remaining', 152243]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 3, 'qold': 1, 'new': 5, 'qnew': 1}, [['unused', -2], ['remaining', 3]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 5, 'qold': 1, 'new': 7, 'qnew': 1}, [['unused', -3], ['remaining', 4]]), ('normal control', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('normal control', {'start': 1739738740, 'end': 1771274740, 'change': 1771274740, 'old': 2500, 'qold': 3, 'new': 1500, 'qnew': 5}, []), ('normal control', {'start': 1725551908, 'end': 1757087908, 'change': 1757087918, 'old': 67119, 'qold': 3, 'new': 4900, 'qnew': 13}, []), ('normal control', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]])], [('regression', {'start': 1726598960, 'end': 1727203760, 'change': 1726783107, 'old': 2500, 'qold': 0, 'new': 4900, 'qnew': 0}, []), ('regression', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('partial-repair probe', {'start': 1759684109, 'end': 1761679609, 'change': 1759972940, 'old': 0, 'qold': 19, 'new': 23288, 'qnew': 1}, [['remaining', 19917]]), ('partial-repair probe', {'start': 1726548056, 'end': 1729226456, 'change': 1726548056, 'old': 0, 'qold': 1, 'new': 4900, 'qnew': 10}, [['remaining', 49000]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 7, 'qold': 1, 'new': 9, 'qnew': 1}, [['unused', -4], ['remaining', 5]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 9, 'qold': 1, 'new': 11, 'qnew': 1}, [['unused', -5], ['remaining', 6]]), ('normal control', {'start': 1742150000, 'end': 1745617539, 'change': 1744739339, 'old': 2500, 'qold': 3, 'new': 0, 'qnew': 1}, [['unused', -1899]]), ('normal control', {'start': 1734436882, 'end': 1765972882, 'change': 1756322121, 'old': 10374, 'qold': 1, 'new': 4900, 'qnew': 1}, [['unused', -3175], ['remaining', 1500]]), ('normal control', {'start': 1716957129, 'end': 1717561929, 'change': 1716957124, 'old': 1000, 'qold': 7, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1724685898, 'end': 1728923706, 'change': 1728923716, 'old': 2500, 'qold': 3, 'new': 1500, 'qnew': 1}, [])]]
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 | [['remaining', 1858]] | [['remaining', 1858]] | Passed |
| regression 1 | [] | [] | Passed |
| partial-repair probe 2 | [['unused', 0]] | [] | Failed |
| partial-repair probe 3 | [['unused', 0], ['remaining', 68600]] | [['remaining', 68600]] | Failed |
| boundary control 4 | [['unused', -2], ['remaining', 3]] | [['unused', -2], ['remaining', 3]] | Passed |
| boundary control 5 | [['unused', -3], ['remaining', 4]] | [['unused', -3], ['remaining', 4]] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [] | [] | Passed |
| normal control 8 | [['unused', -2000]] | [['unused', -2000]] | Passed |
| normal control 9 | [['unused', -384330]] | [['unused', -384330]] | Passed |
SHA-256 / 201325967ffd8703df9a810707c8d9f1e4bc247e97178cf9ef44054afcceb301
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if x['change'] >= x['end'] or x['change'] < x['start']:
return []
span = x['end'] - x['start']
left = x['end'] - x['change']
def hu(n):
return (n * 2 + span) // (2 * span)
lines = []
if x['old'] * x['qold']:
lines.append(['unused', -hu(x['old'] * x['qold'] * left)])
if x['new'] * x['qnew']:
lines.append(['remaining', hu(x['new'] * x['qnew'] * left)])
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'start': 1718898066, 'end': 1722579184, 'change': 1721183532, 'old': 87270, 'qold': 0, 'new': 4900, 'qnew': 1}, [['remaining', 1858]]), ('regression', {'start': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('partial-repair probe', {'start': 1759898518, 'end': 1762576918, 'change': 1760952409, 'old': 0, 'qold': 3, 'new': 37669, 'qnew': 0}, []), ('partial-repair probe', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 3, 'qold': 1, 'new': 5, 'qnew': 1}, [['unused', -2], ['remaining', 3]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 5, 'qold': 1, 'new': 7, 'qnew': 1}, [['unused', -3], ['remaining', 4]]), ('normal control', {'start': 1704011568, 'end': 1706689968, 'change': 1706689968, 'old': 1000, 'qold': 3, 'new': 1500, 'qnew': 3}, []), ('normal control', {'start': 1737228310, 'end': 1739499785, 'change': 1739499795, 'old': 178, 'qold': 1, 'new': 1500, 'qnew': 1}, []), ('normal control', {'start': 1732894162, 'end': 1735486162, 'change': 1732894162, 'old': 1000, 'qold': 2, 'new': 91004, 'qnew': 0}, [['unused', -2000]]), ('normal control', {'start': 1749969117, 'end': 1752647517, 'change': 1751393656, 'old': 63152, 'qold': 13, 'new': 0, 'qnew': 0}, [['unused', -384330]])], [('regression', {'start': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('regression', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('partial-repair probe', {'start': 1703542570, 'end': 1706134570, 'change': 1705592728, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 7}, [['remaining', 7170]]), ('partial-repair probe', {'start': 1720582304, 'end': 1723174304, 'change': 1723103614, 'old': 0, 'qold': 1, 'new': 27595, 'qnew': 5}, [['remaining', 3763]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 7, 'qold': 1, 'new': 9, 'qnew': 1}, [['unused', -4], ['remaining', 5]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 9, 'qold': 1, 'new': 11, 'qnew': 1}, [['unused', -5], ['remaining', 6]]), ('normal control', {'start': 1728579559, 'end': 1760115559, 'change': 1760115559, 'old': 0, 'qold': 0, 'new': 51264, 'qnew': 1}, []), ('normal control', {'start': 1721814513, 'end': 1722419313, 'change': 1722419313, 'old': 0, 'qold': 3, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1720297909, 'end': 1720623118, 'change': 1720623118, 'old': 1000, 'qold': 17, 'new': 0, 'qnew': 0}, []), ('normal control', {'start': 1734629848, 'end': 1766165848, 'change': 1766165848, 'old': 1000, 'qold': 1, 'new': 4900, 'qnew': 1}, [])], [('regression', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('regression', {'start': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('partial-repair probe', {'start': 1708667964, 'end': 1709272764, 'change': 1708667964, 'old': 0, 'qold': 14, 'new': 0, 'qnew': 1}, []), ('partial-repair probe', {'start': 1757422189, 'end': 1758026989, 'change': 1757422189, 'old': 0, 'qold': 1, 'new': 0, 'qnew': 5}, []), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 11, 'qold': 1, 'new': 13, 'qnew': 1}, [['unused', -6], ['remaining', 7]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 13, 'qold': 1, 'new': 15, 'qnew': 1}, [['unused', -7], ['remaining', 8]]), ('normal control', {'start': 1759524018, 'end': 1763871464, 'change': 1759976835, 'old': 0, 'qold': 0, 'new': 1500, 'qnew': 5}, [['remaining', 6719]]), ('normal control', {'start': 1724743049, 'end': 1756279049, 'change': 1724743049, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 1}, [['unused', -2500], ['remaining', 1500]]), ('normal control', {'start': 1742436208, 'end': 1773972208, 'change': 1773972218, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 1}, []), ('normal control', {'start': 1757847857, 'end': 1760439857, 'change': 1757847852, 'old': 92286, 'qold': 0, 'new': 0, 'qnew': 4}, [])], [('regression', {'start': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('regression', {'start': 1726598960, 'end': 1727203760, 'change': 1726783107, 'old': 2500, 'qold': 0, 'new': 4900, 'qnew': 0}, []), ('partial-repair probe', {'start': 1741666940, 'end': 1742271740, 'change': 1742262231, 'old': 0, 'qold': 3, 'new': 51773, 'qnew': 5}, [['remaining', 4070]]), ('partial-repair probe', {'start': 1726326778, 'end': 1757862778, 'change': 1743535077, 'old': 0, 'qold': 3, 'new': 67019, 'qnew': 5}, [['remaining', 152243]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 3, 'qold': 1, 'new': 5, 'qnew': 1}, [['unused', -2], ['remaining', 3]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 5, 'qold': 1, 'new': 7, 'qnew': 1}, [['unused', -3], ['remaining', 4]]), ('normal control', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('normal control', {'start': 1739738740, 'end': 1771274740, 'change': 1771274740, 'old': 2500, 'qold': 3, 'new': 1500, 'qnew': 5}, []), ('normal control', {'start': 1725551908, 'end': 1757087908, 'change': 1757087918, 'old': 67119, 'qold': 3, 'new': 4900, 'qnew': 13}, []), ('normal control', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]])], [('regression', {'start': 1726598960, 'end': 1727203760, 'change': 1726783107, 'old': 2500, 'qold': 0, 'new': 4900, 'qnew': 0}, []), ('regression', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('partial-repair probe', {'start': 1759684109, 'end': 1761679609, 'change': 1759972940, 'old': 0, 'qold': 19, 'new': 23288, 'qnew': 1}, [['remaining', 19917]]), ('partial-repair probe', {'start': 1726548056, 'end': 1729226456, 'change': 1726548056, 'old': 0, 'qold': 1, 'new': 4900, 'qnew': 10}, [['remaining', 49000]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 7, 'qold': 1, 'new': 9, 'qnew': 1}, [['unused', -4], ['remaining', 5]]), ('boundary control', {'start': 1000, 'end': 2000, 'change': 1500, 'old': 9, 'qold': 1, 'new': 11, 'qnew': 1}, [['unused', -5], ['remaining', 6]]), ('normal control', {'start': 1742150000, 'end': 1745617539, 'change': 1744739339, 'old': 2500, 'qold': 3, 'new': 0, 'qnew': 1}, [['unused', -1899]]), ('normal control', {'start': 1734436882, 'end': 1765972882, 'change': 1756322121, 'old': 10374, 'qold': 1, 'new': 4900, 'qnew': 1}, [['unused', -3175], ['remaining', 1500]]), ('normal control', {'start': 1716957129, 'end': 1717561929, 'change': 1716957124, 'old': 1000, 'qold': 7, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1724685898, 'end': 1728923706, 'change': 1728923716, 'old': 2500, 'qold': 3, 'new': 1500, 'qnew': 1}, [])]]
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 | [['remaining', 1858]] | [['remaining', 1858]] | Passed |
| regression 1 | [] | [] | Passed |
| partial-repair probe 2 | [] | [] | Passed |
| partial-repair probe 3 | [['remaining', 68600]] | [['remaining', 68600]] | Passed |
| boundary control 4 | [['unused', -2], ['remaining', 3]] | [['unused', -2], ['remaining', 3]] | Passed |
| boundary control 5 | [['unused', -3], ['remaining', 4]] | [['unused', -3], ['remaining', 4]] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [] | [] | Passed |
| normal control 8 | [['unused', -2000]] | [['unused', -2000]] | Passed |
| normal control 9 | [['unused', -384330]] | [['unused', -384330]] | Passed |
SHA-256 / ee7f1c3281b46e987ef7cf2c83fcf483522a93f68c5070f11b0eb4a25efc43eb
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:35.706224+00:00.
Case digest / e09f22f08b836a9d82ddd42dadccbfd7a517a3923bc7230999cbcf30213f7fed