{"abstract":"Last-value meters report whichever event arrived last rather than the latest reading.","category":"Subscription proration billing","checks":8,"contract":"Input {events: [[day, qty]], change day, old_unit, new_unit, agg sum|max|last}. Events are ordered by day (stable). Events before the change day are aggregated and priced at old_unit; events on or after it at new_unit. Empty segments aggregate to 0; last means the chronologically last quantity. Return [old_charge, new_charge].","evaluation_group":"w2-subscription-proration-usage-split-at-price-change","failed_approach":"The attempt sorts by quantity, so last returns the maximum.","family":"w2-subscription-proration-usage-split-at-price-change-chronological-order-for-last","id":"FA-59741","implementations":{"attempt":{"sha256":"bd421fe653232161aec5dfab1f780343dfc80eb188560ea7bbd083755889cde0","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    ev = sorted(x['events'], key=lambda e: e[1])\n    before = [q for t, q in ev if t < x['change']]\n    after = [q for t, q in ev if t >= x['change']]\n    def agg(v):\n        if not v:\n            return 0\n        if x['agg'] == 'sum':\n            return sum(v)\n        if x['agg'] == 'max':\n            return max(v)\n        return v[-1]\n    return [agg(before) * x['old_unit'], agg(after) * x['new_unit']]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'events': [[21, 57], [28, 66], [4, 55], [23, 20], [14, 65], [14, 74]], 'change': 4, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 2640]), ('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('partial-repair probe', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('normal control', {'events': [[7, 80], [27, 92], [3, 28], [21, 43], [0, 29]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [725, 1380]), ('normal control', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('normal control', {'events': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('normal control', {'events': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425])], [('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[28, 51], [11, 74], [16, 43], [3, 28]], 'change': 16, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [1850, 2040]), ('partial-repair probe', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('normal control', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('normal control', {'events': [[10, 54], [8, 78]], 'change': 23, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [780, 0]), ('normal control', {'events': [], 'change': 27, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('regression', {'events': [[28, 51], [11, 74], [16, 43], [3, 28]], 'change': 16, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [1850, 2040]), ('partial-repair probe', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('partial-repair probe', {'events': [[11, 1], [27, 17], [27, 80], [23, 84], [14, 2]], 'change': 23, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [20, 1200]), ('normal control', {'events': [[19, 78], [29, 77], [0, 53]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1950, 3080]), ('normal control', {'events': [[30, 18], [0, 63], [28, 43]], 'change': 28, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1575, 1720]), ('normal control', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('regression', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[2, 40], [17, 1], [30, 39]], 'change': 2, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1560]), ('partial-repair probe', {'events': [[30, 20], [23, 26], [11, 52], [19, 96]], 'change': 11, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 300]), ('normal control', {'events': [[28, 32], [5, 0], [19, 71], [20, 79]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 2730]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[15, 59]], 'change': 15, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 885]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[11, 1], [27, 17], [27, 80], [23, 84], [14, 2]], 'change': 23, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [20, 1200]), ('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('partial-repair probe', {'events': [[28, 38], [8, 87], [26, 15], [29, 47], [16, 71]], 'change': 16, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [870, 1880]), ('partial-repair probe', {'events': [[5, 62], [5, 57], [21, 12]], 'change': 21, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [570, 480]), ('normal control', {'events': [[9, 7]], 'change': 9, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 280]), ('normal control', {'events': [[14, 36]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1440]), ('normal control', {'events': [], 'change': 13, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[0, 49], [11, 65], [3, 41]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [1225, 975])]]\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":"f157226bb1bf0bba43879936738fcbc366f23480add3615e812b9d6fb01f4f0c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    ev = x['events']\n    before = [q for t, q in ev if t < x['change']]\n    after = [q for t, q in ev if t >= x['change']]\n    def agg(v):\n        if not v:\n            return 0\n        if x['agg'] == 'sum':\n            return sum(v)\n        if x['agg'] == 'max':\n            return max(v)\n        return v[-1]\n    return [agg(before) * x['old_unit'], agg(after) * x['new_unit']]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'events': [[21, 57], [28, 66], [4, 55], [23, 20], [14, 65], [14, 74]], 'change': 4, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 2640]), ('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('partial-repair probe', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('normal control', {'events': [[7, 80], [27, 92], [3, 28], [21, 43], [0, 29]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [725, 1380]), ('normal control', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('normal control', {'events': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('normal control', {'events': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425])], [('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[28, 51], [11, 74], [16, 43], [3, 28]], 'change': 16, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [1850, 2040]), ('partial-repair probe', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('normal control', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('normal control', {'events': [[10, 54], [8, 78]], 'change': 23, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [780, 0]), ('normal control', {'events': [], 'change': 27, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('regression', {'events': [[28, 51], [11, 74], [16, 43], [3, 28]], 'change': 16, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [1850, 2040]), ('partial-repair probe', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('partial-repair probe', {'events': [[11, 1], [27, 17], [27, 80], [23, 84], [14, 2]], 'change': 23, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [20, 1200]), ('normal control', {'events': [[19, 78], [29, 77], [0, 53]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1950, 3080]), ('normal control', {'events': [[30, 18], [0, 63], [28, 43]], 'change': 28, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1575, 1720]), ('normal control', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('regression', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[2, 40], [17, 1], [30, 39]], 'change': 2, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1560]), ('partial-repair probe', {'events': [[30, 20], [23, 26], [11, 52], [19, 96]], 'change': 11, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 300]), ('normal control', {'events': [[28, 32], [5, 0], [19, 71], [20, 79]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 2730]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[15, 59]], 'change': 15, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 885]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[11, 1], [27, 17], [27, 80], [23, 84], [14, 2]], 'change': 23, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [20, 1200]), ('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('partial-repair probe', {'events': [[28, 38], [8, 87], [26, 15], [29, 47], [16, 71]], 'change': 16, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [870, 1880]), ('partial-repair probe', {'events': [[5, 62], [5, 57], [21, 12]], 'change': 21, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [570, 480]), ('normal control', {'events': [[9, 7]], 'change': 9, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 280]), ('normal control', {'events': [[14, 36]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1440]), ('normal control', {'events': [], 'change': 13, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[0, 49], [11, 65], [3, 41]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [1225, 975])]]\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":"2325ca8d82431455e2b68b15239076f8a955c52adf49de7bb45067ad43379362","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    ev = sorted(x['events'], key=lambda e: e[0])\n    before = [q for t, q in ev if t < x['change']]\n    after = [q for t, q in ev if t >= x['change']]\n    def agg(v):\n        if not v:\n            return 0\n        if x['agg'] == 'sum':\n            return sum(v)\n        if x['agg'] == 'max':\n            return max(v)\n        return v[-1]\n    return [agg(before) * x['old_unit'], agg(after) * x['new_unit']]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'events': [[21, 57], [28, 66], [4, 55], [23, 20], [14, 65], [14, 74]], 'change': 4, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 2640]), ('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('partial-repair probe', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('normal control', {'events': [[7, 80], [27, 92], [3, 28], [21, 43], [0, 29]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [725, 1380]), ('normal control', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('normal control', {'events': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('normal control', {'events': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425])], [('regression', {'events': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[28, 51], [11, 74], [16, 43], [3, 28]], 'change': 16, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [1850, 2040]), ('partial-repair probe', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('normal control', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('normal control', {'events': [[10, 54], [8, 78]], 'change': 23, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [780, 0]), ('normal control', {'events': [], 'change': 27, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('regression', {'events': [[28, 51], [11, 74], [16, 43], [3, 28]], 'change': 16, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [1850, 2040]), ('partial-repair probe', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('partial-repair probe', {'events': [[11, 1], [27, 17], [27, 80], [23, 84], [14, 2]], 'change': 23, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [20, 1200]), ('normal control', {'events': [[19, 78], [29, 77], [0, 53]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1950, 3080]), ('normal control', {'events': [[30, 18], [0, 63], [28, 43]], 'change': 28, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [1575, 1720]), ('normal control', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('regression', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('partial-repair probe', {'events': [[2, 40], [17, 1], [30, 39]], 'change': 2, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1560]), ('partial-repair probe', {'events': [[30, 20], [23, 26], [11, 52], [19, 96]], 'change': 11, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 300]), ('normal control', {'events': [[28, 32], [5, 0], [19, 71], [20, 79]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 2730]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[15, 59]], 'change': 15, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 885]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[11, 1], [27, 17], [27, 80], [23, 84], [14, 2]], 'change': 23, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [20, 1200]), ('regression', {'events': [[10, 22], [11, 92], [13, 32], [10, 16], [9, 90]], 'change': 10, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [900, 1280]), ('partial-repair probe', {'events': [[28, 38], [8, 87], [26, 15], [29, 47], [16, 71]], 'change': 16, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [870, 1880]), ('partial-repair probe', {'events': [[5, 62], [5, 57], [21, 12]], 'change': 21, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [570, 480]), ('normal control', {'events': [[9, 7]], 'change': 9, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 280]), ('normal control', {'events': [[14, 36]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [0, 1440]), ('normal control', {'events': [], 'change': 13, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[0, 49], [11, 65], [3, 41]], 'change': 3, 'old_unit': 25, 'new_unit': 15, 'agg': 'max'}, [1225, 975])]]\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-usage-split-at-price-change-chronological-order-for-last","generated_at":"2026-09-29T14:46:39.125184+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Metered usage must be attributed to the price in effect when it occurred, with the aggregation mode applied per segment.","repair":"Restore the contract rule at the chronological order for last step: use `ev = sorted(x['events'], key=lambda e: e[0])`.","root_cause":"Events are used in arrival order.","sha256":"142dcaeac8c0e576e793358fc1b53563207efb21729dbab224494543cc43441c","title":"Metered usage split at a mid-period price change: chronological order for last · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.181,"exit_code":1,"observations":[{"actual":[0,2960],"check":"regression 0","expected":[0,2640],"passed":false},{"actual":[1575,675],"check":"regression 1","expected":[1550,675],"passed":false},{"actual":[820,1350],"check":"partial-repair probe 2","expected":[810,1350],"passed":false},{"actual":[900,3680],"check":"partial-repair probe 3","expected":[900,1280],"passed":false},{"actual":[725,1380],"check":"normal control 4","expected":[725,1380],"passed":true},{"actual":[0,3520],"check":"normal control 5","expected":[0,3520],"passed":true},{"actual":[900,1440],"check":"normal control 6","expected":[900,1440],"passed":true},{"actual":[900,1425],"check":"normal control 7","expected":[900,1425],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [0, 2960], \"expected\": [0, 2640], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [1575, 675], \"expected\": [1550, 675], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [820, 1350], \"expected\": [810, 1350], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [900, 3680], \"expected\": [900, 1280], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [725, 1380], \"expected\": [725, 1380], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [0, 3520], \"expected\": [0, 3520], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [900, 1440], \"expected\": [900, 1440], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [900, 1425], \"expected\": [900, 1425], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.388,"exit_code":1,"observations":[{"actual":[0,2960],"check":"regression 0","expected":[0,2640],"passed":false},{"actual":[1575,675],"check":"regression 1","expected":[1550,675],"passed":false},{"actual":[820,1350],"check":"partial-repair probe 2","expected":[810,1350],"passed":false},{"actual":[900,640],"check":"partial-repair probe 3","expected":[900,1280],"passed":false},{"actual":[725,1380],"check":"normal control 4","expected":[725,1380],"passed":true},{"actual":[0,3520],"check":"normal control 5","expected":[0,3520],"passed":true},{"actual":[900,1440],"check":"normal control 6","expected":[900,1440],"passed":true},{"actual":[900,1425],"check":"normal control 7","expected":[900,1425],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [0, 2960], \"expected\": [0, 2640], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [1575, 675], \"expected\": [1550, 675], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [820, 1350], \"expected\": [810, 1350], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [900, 640], \"expected\": [900, 1280], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [725, 1380], \"expected\": [725, 1380], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [0, 3520], \"expected\": [0, 3520], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [900, 1440], \"expected\": [900, 1440], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [900, 1425], \"expected\": [900, 1425], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.115,"exit_code":0,"observations":[{"actual":[0,2640],"check":"regression 0","expected":[0,2640],"passed":true},{"actual":[1550,675],"check":"regression 1","expected":[1550,675],"passed":true},{"actual":[810,1350],"check":"partial-repair probe 2","expected":[810,1350],"passed":true},{"actual":[900,1280],"check":"partial-repair probe 3","expected":[900,1280],"passed":true},{"actual":[725,1380],"check":"normal control 4","expected":[725,1380],"passed":true},{"actual":[0,3520],"check":"normal control 5","expected":[0,3520],"passed":true},{"actual":[900,1440],"check":"normal control 6","expected":[900,1440],"passed":true},{"actual":[900,1425],"check":"normal control 7","expected":[900,1425],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [0, 2640], \"expected\": [0, 2640], \"passed\": true}, {\"check\": \"regression 1\", \"actual\": [1550, 675], \"expected\": [1550, 675], \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": [810, 1350], \"expected\": [810, 1350], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [900, 1280], \"expected\": [900, 1280], \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": [725, 1380], \"expected\": [725, 1380], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [0, 3520], \"expected\": [0, 3520], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [900, 1440], \"expected\": [900, 1440], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [900, 1425], \"expected\": [900, 1425], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}