{"abstract":"Seat upgrades are charged for a single seat on the new plan.","category":"Subscription proration billing","checks":10,"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]].","evaluation_group":"w2-subscription-proration-second-granular-lines","failed_approach":"The attempt multiplies by the old quantity, so quantity changes are billed at the wrong count.","family":"w2-subscription-proration-second-granular-lines-new-quantity-scaling","id":"FA-59366","implementations":{"attempt":{"sha256":"59eb5acd82bb0b441aa5cda40d43efa36b63396e135239cfdff0d7a21d853f6f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if x['change'] >= x['end'] or x['change'] < x['start']:\n        return []\n    span = x['end'] - x['start']\n    left = x['end'] - x['change']\n    def hu(n):\n        return (n * 2 + span) // (2 * span)\n    lines = []\n    if x['old'] * x['qold']:\n        lines.append(['unused', -hu(x['old'] * x['qold'] * left)])\n    if x['new'] * x['qnew']:\n        lines.append(['remaining', hu(x['new'] * x['qold'] * left)])\n    return lines\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'start': 1759524018, 'end': 1763871464, 'change': 1759976835, 'old': 0, 'qold': 0, 'new': 1500, 'qnew': 5}, [['remaining', 6719]]), ('regression', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('partial-repair probe', {'start': 1718898066, 'end': 1722579184, 'change': 1721183532, 'old': 87270, 'qold': 0, 'new': 4900, 'qnew': 1}, [['remaining', 1858]]), ('partial-repair probe', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('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': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('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]])], [('regression', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('regression', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('partial-repair probe', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('partial-repair probe', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('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': 1749969117, 'end': 1752647517, 'change': 1751393656, 'old': 63152, 'qold': 13, 'new': 0, 'qnew': 0}, [['unused', -384330]]), ('normal control', {'start': 1728579559, 'end': 1760115559, 'change': 1760115559, 'old': 0, 'qold': 0, 'new': 51264, 'qnew': 1}, []), ('normal control', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1721814513, 'end': 1722419313, 'change': 1722419313, 'old': 0, 'qold': 3, 'new': 0, 'qnew': 5}, [])], [('regression', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('regression', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('partial-repair probe', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('partial-repair probe', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('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': 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}, []), ('normal control', {'start': 1759898518, 'end': 1762576918, 'change': 1760952409, 'old': 0, 'qold': 3, 'new': 37669, 'qnew': 0}, []), ('normal control', {'start': 1724743049, 'end': 1756279049, 'change': 1724743049, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 1}, [['unused', -2500], ['remaining', 1500]])], [('regression', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('regression', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('partial-repair probe', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('partial-repair probe', {'start': 1742790755, 'end': 1743897100, 'change': 1742790755, 'old': 1000, 'qold': 20, 'new': 4900, 'qnew': 1}, [['unused', -20000], ['remaining', 4900]]), ('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': 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}, []), ('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}, [])], [('regression', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('regression', {'start': 1716615435, 'end': 1718469212, 'change': 1718430872, 'old': 0, 'qold': 0, 'new': 4900, 'qnew': 5}, [['remaining', 507]]), ('partial-repair probe', {'start': 1744261612, 'end': 1748589217, 'change': 1744261612, 'old': 1000, 'qold': 4, 'new': 2084, 'qnew': 18}, [['unused', -4000], ['remaining', 37512]]), ('partial-repair probe', {'start': 1733908199, 'end': 1736586599, 'change': 1733908199, 'old': 32045, 'qold': 0, 'new': 4900, 'qnew': 19}, [['remaining', 93100]]), ('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': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('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}, [])]]\nfor i, (label, args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (label, i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"c24a8914d25d8e521f3a60afc164d635b820b0123739e7cc0d4122d58c5aaccf","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if x['change'] >= x['end'] or x['change'] < x['start']:\n        return []\n    span = x['end'] - x['start']\n    left = x['end'] - x['change']\n    def hu(n):\n        return (n * 2 + span) // (2 * span)\n    lines = []\n    if x['old'] * x['qold']:\n        lines.append(['unused', -hu(x['old'] * x['qold'] * left)])\n    if x['new'] * x['qnew']:\n        lines.append(['remaining', hu(x['new'] * left)])\n    return lines\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'start': 1759524018, 'end': 1763871464, 'change': 1759976835, 'old': 0, 'qold': 0, 'new': 1500, 'qnew': 5}, [['remaining', 6719]]), ('regression', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('partial-repair probe', {'start': 1718898066, 'end': 1722579184, 'change': 1721183532, 'old': 87270, 'qold': 0, 'new': 4900, 'qnew': 1}, [['remaining', 1858]]), ('partial-repair probe', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('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': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('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]])], [('regression', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('regression', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('partial-repair probe', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('partial-repair probe', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('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': 1749969117, 'end': 1752647517, 'change': 1751393656, 'old': 63152, 'qold': 13, 'new': 0, 'qnew': 0}, [['unused', -384330]]), ('normal control', {'start': 1728579559, 'end': 1760115559, 'change': 1760115559, 'old': 0, 'qold': 0, 'new': 51264, 'qnew': 1}, []), ('normal control', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1721814513, 'end': 1722419313, 'change': 1722419313, 'old': 0, 'qold': 3, 'new': 0, 'qnew': 5}, [])], [('regression', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('regression', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('partial-repair probe', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('partial-repair probe', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('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': 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}, []), ('normal control', {'start': 1759898518, 'end': 1762576918, 'change': 1760952409, 'old': 0, 'qold': 3, 'new': 37669, 'qnew': 0}, []), ('normal control', {'start': 1724743049, 'end': 1756279049, 'change': 1724743049, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 1}, [['unused', -2500], ['remaining', 1500]])], [('regression', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('regression', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('partial-repair probe', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('partial-repair probe', {'start': 1742790755, 'end': 1743897100, 'change': 1742790755, 'old': 1000, 'qold': 20, 'new': 4900, 'qnew': 1}, [['unused', -20000], ['remaining', 4900]]), ('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': 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}, []), ('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}, [])], [('regression', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('regression', {'start': 1716615435, 'end': 1718469212, 'change': 1718430872, 'old': 0, 'qold': 0, 'new': 4900, 'qnew': 5}, [['remaining', 507]]), ('partial-repair probe', {'start': 1744261612, 'end': 1748589217, 'change': 1744261612, 'old': 1000, 'qold': 4, 'new': 2084, 'qnew': 18}, [['unused', -4000], ['remaining', 37512]]), ('partial-repair probe', {'start': 1733908199, 'end': 1736586599, 'change': 1733908199, 'old': 32045, 'qold': 0, 'new': 4900, 'qnew': 19}, [['remaining', 93100]]), ('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': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('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}, [])]]\nfor i, (label, args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (label, i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"7b1fce293d87e01a1df4957cc9330935dfaab5bfbe2e27f287d2379f844727c4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if x['change'] >= x['end'] or x['change'] < x['start']:\n        return []\n    span = x['end'] - x['start']\n    left = x['end'] - x['change']\n    def hu(n):\n        return (n * 2 + span) // (2 * span)\n    lines = []\n    if x['old'] * x['qold']:\n        lines.append(['unused', -hu(x['old'] * x['qold'] * left)])\n    if x['new'] * x['qnew']:\n        lines.append(['remaining', hu(x['new'] * x['qnew'] * left)])\n    return lines\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'start': 1759524018, 'end': 1763871464, 'change': 1759976835, 'old': 0, 'qold': 0, 'new': 1500, 'qnew': 5}, [['remaining', 6719]]), ('regression', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('partial-repair probe', {'start': 1718898066, 'end': 1722579184, 'change': 1721183532, 'old': 87270, 'qold': 0, 'new': 4900, 'qnew': 1}, [['remaining', 1858]]), ('partial-repair probe', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('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': 1726549577, 'end': 1727154377, 'change': 1726962866, 'old': 2500, 'qold': 0, 'new': 0, 'qnew': 0}, []), ('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]])], [('regression', {'start': 1726496239, 'end': 1729174639, 'change': 1726496239, 'old': 73990, 'qold': 3, 'new': 47429, 'qnew': 5}, [['unused', -221970], ['remaining', 237145]]), ('regression', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('partial-repair probe', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('partial-repair probe', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('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': 1749969117, 'end': 1752647517, 'change': 1751393656, 'old': 63152, 'qold': 13, 'new': 0, 'qnew': 0}, [['unused', -384330]]), ('normal control', {'start': 1728579559, 'end': 1760115559, 'change': 1760115559, 'old': 0, 'qold': 0, 'new': 51264, 'qnew': 1}, []), ('normal control', {'start': 1700089359, 'end': 1702545450, 'change': 1702420392, 'old': 79079, 'qold': 0, 'new': 0, 'qnew': 5}, []), ('normal control', {'start': 1721814513, 'end': 1722419313, 'change': 1722419313, 'old': 0, 'qold': 3, 'new': 0, 'qnew': 5}, [])], [('regression', {'start': 1739142581, 'end': 1739747381, 'change': 1739142581, 'old': 26706, 'qold': 3, 'new': 1500, 'qnew': 5}, [['unused', -80118], ['remaining', 7500]]), ('regression', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('partial-repair probe', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('partial-repair probe', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('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': 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}, []), ('normal control', {'start': 1759898518, 'end': 1762576918, 'change': 1760952409, 'old': 0, 'qold': 3, 'new': 37669, 'qnew': 0}, []), ('normal control', {'start': 1724743049, 'end': 1756279049, 'change': 1724743049, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 1}, [['unused', -2500], ['remaining', 1500]])], [('regression', {'start': 1733742690, 'end': 1736421090, 'change': 1733742690, 'old': 0, 'qold': 3, 'new': 4900, 'qnew': 14}, [['remaining', 68600]]), ('regression', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('partial-repair probe', {'start': 1702270224, 'end': 1702644112, 'change': 1702432315, 'old': 1000, 'qold': 0, 'new': 97578, 'qnew': 1}, [['remaining', 55275]]), ('partial-repair probe', {'start': 1742790755, 'end': 1743897100, 'change': 1742790755, 'old': 1000, 'qold': 20, 'new': 4900, 'qnew': 1}, [['unused', -20000], ['remaining', 4900]]), ('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': 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}, []), ('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}, [])], [('regression', {'start': 1742110108, 'end': 1745693685, 'change': 1744431348, 'old': 2500, 'qold': 1, 'new': 1500, 'qnew': 5}, [['unused', -881], ['remaining', 2642]]), ('regression', {'start': 1716615435, 'end': 1718469212, 'change': 1718430872, 'old': 0, 'qold': 0, 'new': 4900, 'qnew': 5}, [['remaining', 507]]), ('partial-repair probe', {'start': 1744261612, 'end': 1748589217, 'change': 1744261612, 'old': 1000, 'qold': 4, 'new': 2084, 'qnew': 18}, [['unused', -4000], ['remaining', 37512]]), ('partial-repair probe', {'start': 1733908199, 'end': 1736586599, 'change': 1733908199, 'old': 32045, 'qold': 0, 'new': 4900, 'qnew': 19}, [['remaining', 93100]]), ('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': 1753105090, 'end': 1753709890, 'change': 1753105090, 'old': 1000, 'qold': 0, 'new': 0, 'qnew': 1}, []), ('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}, [])]]\nfor i, (label, args, expected) in enumerate(fixtures[N-1]):\n    check(\"%s %d\" % (label, i), solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-subscription-proration-second-granular-lines-new-quantity-scaling","generated_at":"2026-09-29T14:46:35.608022+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Timestamp-based proration produces separate credit and debit lines whose rounding and emission rules show on the invoice.","repair":"Restore the contract rule at the new quantity scaling step: use `hu(x['new'] * x['qnew'] * left)`.","root_cause":"The remaining-time line ignores the new quantity.","sha256":"26421b6c457c87668b46749a892eabf678f374395ad63ed2acbd1aa980f053a7","title":"Second-granular proration line items: new quantity scaling · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.033,"exit_code":1,"observations":[{"actual":[["remaining",0]],"check":"regression 0","expected":[["remaining",6719]],"passed":false},{"actual":[["unused",-221970],["remaining",142287]],"check":"regression 1","expected":[["unused",-221970],["remaining",237145]],"passed":false},{"actual":[["remaining",0]],"check":"partial-repair probe 2","expected":[["remaining",1858]],"passed":false},{"actual":[["unused",-80118],["remaining",4500]],"check":"partial-repair probe 3","expected":[["unused",-80118],["remaining",7500]],"passed":false},{"actual":[["unused",-2],["remaining",3]],"check":"boundary control 4","expected":[["unused",-2],["remaining",3]],"passed":true},{"actual":[["unused",-3],["remaining",4]],"check":"boundary control 5","expected":[["unused",-3],["remaining",4]],"passed":true},{"actual":[],"check":"normal control 6","expected":[],"passed":true},{"actual":[],"check":"normal control 7","expected":[],"passed":true},{"actual":[],"check":"normal control 8","expected":[],"passed":true},{"actual":[["unused",-2000]],"check":"normal control 9","expected":[["unused",-2000]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [[\"remaining\", 0]], \"expected\": [[\"remaining\", 6719]], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [[\"unused\", -221970], [\"remaining\", 142287]], \"expected\": [[\"unused\", -221970], [\"remaining\", 237145]], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [[\"remaining\", 0]], \"expected\": [[\"remaining\", 1858]], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [[\"unused\", -80118], [\"remaining\", 4500]], \"expected\": [[\"unused\", -80118], [\"remaining\", 7500]], \"passed\": false}, {\"check\": \"boundary control 4\", \"actual\": [[\"unused\", -2], [\"remaining\", 3]], \"expected\": [[\"unused\", -2], [\"remaining\", 3]], \"passed\": true}, {\"check\": \"boundary control 5\", \"actual\": [[\"unused\", -3], [\"remaining\", 4]], \"expected\": [[\"unused\", -3], [\"remaining\", 4]], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 8\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 9\", \"actual\": [[\"unused\", -2000]], \"expected\": [[\"unused\", -2000]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.993,"exit_code":1,"observations":[{"actual":[["remaining",1344]],"check":"regression 0","expected":[["remaining",6719]],"passed":false},{"actual":[["unused",-221970],["remaining",47429]],"check":"regression 1","expected":[["unused",-221970],["remaining",237145]],"passed":false},{"actual":[["remaining",1858]],"check":"partial-repair probe 2","expected":[["remaining",1858]],"passed":true},{"actual":[["unused",-80118],["remaining",1500]],"check":"partial-repair probe 3","expected":[["unused",-80118],["remaining",7500]],"passed":false},{"actual":[["unused",-2],["remaining",3]],"check":"boundary control 4","expected":[["unused",-2],["remaining",3]],"passed":true},{"actual":[["unused",-3],["remaining",4]],"check":"boundary control 5","expected":[["unused",-3],["remaining",4]],"passed":true},{"actual":[],"check":"normal control 6","expected":[],"passed":true},{"actual":[],"check":"normal control 7","expected":[],"passed":true},{"actual":[],"check":"normal control 8","expected":[],"passed":true},{"actual":[["unused",-2000]],"check":"normal control 9","expected":[["unused",-2000]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [[\"remaining\", 1344]], \"expected\": [[\"remaining\", 6719]], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [[\"unused\", -221970], [\"remaining\", 47429]], \"expected\": [[\"unused\", -221970], [\"remaining\", 237145]], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [[\"remaining\", 1858]], \"expected\": [[\"remaining\", 1858]], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [[\"unused\", -80118], [\"remaining\", 1500]], \"expected\": [[\"unused\", -80118], [\"remaining\", 7500]], \"passed\": false}, {\"check\": \"boundary control 4\", \"actual\": [[\"unused\", -2], [\"remaining\", 3]], \"expected\": [[\"unused\", -2], [\"remaining\", 3]], \"passed\": true}, {\"check\": \"boundary control 5\", \"actual\": [[\"unused\", -3], [\"remaining\", 4]], \"expected\": [[\"unused\", -3], [\"remaining\", 4]], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 8\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 9\", \"actual\": [[\"unused\", -2000]], \"expected\": [[\"unused\", -2000]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":45.939,"exit_code":0,"observations":[{"actual":[["remaining",6719]],"check":"regression 0","expected":[["remaining",6719]],"passed":true},{"actual":[["unused",-221970],["remaining",237145]],"check":"regression 1","expected":[["unused",-221970],["remaining",237145]],"passed":true},{"actual":[["remaining",1858]],"check":"partial-repair probe 2","expected":[["remaining",1858]],"passed":true},{"actual":[["unused",-80118],["remaining",7500]],"check":"partial-repair probe 3","expected":[["unused",-80118],["remaining",7500]],"passed":true},{"actual":[["unused",-2],["remaining",3]],"check":"boundary control 4","expected":[["unused",-2],["remaining",3]],"passed":true},{"actual":[["unused",-3],["remaining",4]],"check":"boundary control 5","expected":[["unused",-3],["remaining",4]],"passed":true},{"actual":[],"check":"normal control 6","expected":[],"passed":true},{"actual":[],"check":"normal control 7","expected":[],"passed":true},{"actual":[],"check":"normal control 8","expected":[],"passed":true},{"actual":[["unused",-2000]],"check":"normal control 9","expected":[["unused",-2000]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [[\"remaining\", 6719]], \"expected\": [[\"remaining\", 6719]], \"passed\": true}, {\"check\": \"regression 1\", \"actual\": [[\"unused\", -221970], [\"remaining\", 237145]], \"expected\": [[\"unused\", -221970], [\"remaining\", 237145]], \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": [[\"remaining\", 1858]], \"expected\": [[\"remaining\", 1858]], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [[\"unused\", -80118], [\"remaining\", 7500]], \"expected\": [[\"unused\", -80118], [\"remaining\", 7500]], \"passed\": true}, {\"check\": \"boundary control 4\", \"actual\": [[\"unused\", -2], [\"remaining\", 3]], \"expected\": [[\"unused\", -2], [\"remaining\", 3]], \"passed\": true}, {\"check\": \"boundary control 5\", \"actual\": [[\"unused\", -3], [\"remaining\", 4]], \"expected\": [[\"unused\", -3], [\"remaining\", 4]], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 8\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"normal control 9\", \"actual\": [[\"unused\", -2000]], \"expected\": [[\"unused\", -2000]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}