{"abstract":"Usage recorded on the change day is billed at both prices.","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 drops the day before the change from the old segment entirely.","family":"w2-subscription-proration-usage-split-at-price-change-change-day-ownership","id":"FA-59736","implementations":{"attempt":{"sha256":"a4d53d88c6d076f57cbdb3c152475b228616fda8a5a6ed6b09a29058d4094c34","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'] - 1]\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': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('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]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('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': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425]), ('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])], [('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': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('partial-repair probe', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('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': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('regression', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('partial-repair probe', {'events': [[21, 60], [30, 96], [16, 57], [5, 93], [30, 96]], 'change': 22, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [600, 3840]), ('partial-repair probe', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('normal control', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('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]), ('partial-repair probe', {'events': [[25, 50], [26, 27], [26, 6], [28, 92], [21, 23], [5, 66]], 'change': 26, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [500, 3680]), ('partial-repair probe', {'events': [[2, 41], [3, 45], [30, 93]], 'change': 3, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [410, 2070]), ('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]), ('normal control', {'events': [[22, 54], [5, 92], [13, 67], [15, 87], [19, 0]], 'change': 19, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [920, 2160])], [('regression', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('regression', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('partial-repair probe', {'events': [[13, 87], [30, 41], [0, 12], [5, 55], [6, 92], [1, 78]], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [120, 1380]), ('partial-repair probe', {'events': [[3, 68], [1, 51], [0, 25], [2, 68]], 'change': 3, 'old_unit': 25, 'new_unit': 40, 'agg': 'sum'}, [3600, 2720]), ('normal control', {'events': [], 'change': 8, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[10, 87], [0, 71], [24, 27], [26, 7]], 'change': 21, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [2175, 1080]), ('normal control', {'events': [[20, 35]], 'change': 24, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [875, 0]), ('normal control', {'events': [], 'change': 26, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 0])]]\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":"dfd2301df1f1ba8f5260e823c8bcdcf760206a5cb6f4d539cfff8bf32345827b","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': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('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]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('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': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425]), ('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])], [('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': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('partial-repair probe', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('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': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('regression', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('partial-repair probe', {'events': [[21, 60], [30, 96], [16, 57], [5, 93], [30, 96]], 'change': 22, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [600, 3840]), ('partial-repair probe', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('normal control', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('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]), ('partial-repair probe', {'events': [[25, 50], [26, 27], [26, 6], [28, 92], [21, 23], [5, 66]], 'change': 26, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [500, 3680]), ('partial-repair probe', {'events': [[2, 41], [3, 45], [30, 93]], 'change': 3, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [410, 2070]), ('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]), ('normal control', {'events': [[22, 54], [5, 92], [13, 67], [15, 87], [19, 0]], 'change': 19, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [920, 2160])], [('regression', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('regression', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('partial-repair probe', {'events': [[13, 87], [30, 41], [0, 12], [5, 55], [6, 92], [1, 78]], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [120, 1380]), ('partial-repair probe', {'events': [[3, 68], [1, 51], [0, 25], [2, 68]], 'change': 3, 'old_unit': 25, 'new_unit': 40, 'agg': 'sum'}, [3600, 2720]), ('normal control', {'events': [], 'change': 8, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[10, 87], [0, 71], [24, 27], [26, 7]], 'change': 21, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [2175, 1080]), ('normal control', {'events': [[20, 35]], 'change': 24, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [875, 0]), ('normal control', {'events': [], 'change': 26, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 0])]]\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":"1b6beb2ebfdfe639a041f7b0ef895f81697cead6183070655d24fea1294e4561","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': [[0, 58], [18, 62], [19, 45], [13, 16], [4, 63]], 'change': 19, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [1550, 675]), ('regression', {'events': [[15, 86], [15, 88]], 'change': 15, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3520]), ('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]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('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': [[14, 21], [12, 35], [4, 90], [22, 95], [25, 43], [7, 60]], 'change': 12, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1425]), ('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])], [('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': [[27, 13], [19, 6], [5, 44], [27, 90], [30, 96]], 'change': 30, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [900, 1440]), ('partial-repair probe', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('partial-repair probe', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('normal control', {'events': [], 'change': 6, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0]), ('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': [], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [0, 0])], [('regression', {'events': [[26, 90], [27, 37], [29, 38]], 'change': 27, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [900, 1125]), ('regression', {'events': [[21, 53], [25, 86], [26, 43], [1, 19], [13, 55]], 'change': 13, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [475, 3440]), ('partial-repair probe', {'events': [[21, 60], [30, 96], [16, 57], [5, 93], [30, 96]], 'change': 22, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [600, 3840]), ('partial-repair probe', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('normal control', {'events': [], 'change': 1, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [0, 0]), ('normal control', {'events': [[28, 90], [11, 81], [2, 82]], 'change': 16, 'old_unit': 10, 'new_unit': 15, 'agg': 'last'}, [810, 1350]), ('normal control', {'events': [[7, 73], [11, 66], [21, 17]], 'change': 29, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [425, 0]), ('normal control', {'events': [[18, 32], [15, 45], [18, 6]], 'change': 18, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [450, 1280])], [('regression', {'events': [[0, 23], [4, 89], [5, 3]], 'change': 5, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [2225, 45]), ('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]), ('partial-repair probe', {'events': [[25, 50], [26, 27], [26, 6], [28, 92], [21, 23], [5, 66]], 'change': 26, 'old_unit': 10, 'new_unit': 40, 'agg': 'last'}, [500, 3680]), ('partial-repair probe', {'events': [[2, 41], [3, 45], [30, 93]], 'change': 3, 'old_unit': 10, 'new_unit': 15, 'agg': 'sum'}, [410, 2070]), ('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]), ('normal control', {'events': [[22, 54], [5, 92], [13, 67], [15, 87], [19, 0]], 'change': 19, 'old_unit': 10, 'new_unit': 40, 'agg': 'max'}, [920, 2160])], [('regression', {'events': [[9, 69], [8, 24], [20, 22], [10, 85]], 'change': 9, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [600, 3400]), ('regression', {'events': [[19, 13], [29, 81], [12, 31], [12, 74]], 'change': 12, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [0, 3240]), ('partial-repair probe', {'events': [[13, 87], [30, 41], [0, 12], [5, 55], [6, 92], [1, 78]], 'change': 1, 'old_unit': 10, 'new_unit': 15, 'agg': 'max'}, [120, 1380]), ('partial-repair probe', {'events': [[3, 68], [1, 51], [0, 25], [2, 68]], 'change': 3, 'old_unit': 25, 'new_unit': 40, 'agg': 'sum'}, [3600, 2720]), ('normal control', {'events': [], 'change': 8, 'old_unit': 25, 'new_unit': 15, 'agg': 'sum'}, [0, 0]), ('normal control', {'events': [[10, 87], [0, 71], [24, 27], [26, 7]], 'change': 21, 'old_unit': 25, 'new_unit': 40, 'agg': 'max'}, [2175, 1080]), ('normal control', {'events': [[20, 35]], 'change': 24, 'old_unit': 25, 'new_unit': 40, 'agg': 'last'}, [875, 0]), ('normal control', {'events': [], 'change': 26, 'old_unit': 25, 'new_unit': 15, 'agg': 'last'}, [0, 0])]]\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-change-day-ownership","generated_at":"2026-09-29T14:46:39.125447+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 change day ownership step: use `before = [q for t, q in ev if t < x['change']]`.","root_cause":"The old-price segment includes the change day.","sha256":"e5973b885b5d70d05783ca89723ec905994aa0e5551733d95de3179034715439","title":"Metered usage split at a mid-period price change: change day ownership · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.006,"exit_code":1,"observations":[{"actual":[400,675],"check":"regression 0","expected":[1550,675],"passed":false},{"actual":[0,3520],"check":"regression 1","expected":[0,3520],"passed":true},{"actual":[0,1280],"check":"partial-repair probe 2","expected":[900,1280],"passed":false},{"actual":[0,1125],"check":"partial-repair probe 3","expected":[900,1125],"passed":false},{"actual":[725,1380],"check":"normal control 4","expected":[725,1380],"passed":true},{"actual":[900,1425],"check":"normal control 5","expected":[900,1425],"passed":true},{"actual":[780,0],"check":"normal control 6","expected":[780,0],"passed":true},{"actual":[0,0],"check":"normal control 7","expected":[0,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [400, 675], \"expected\": [1550, 675], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [0, 3520], \"expected\": [0, 3520], \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": [0, 1280], \"expected\": [900, 1280], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [0, 1125], \"expected\": [900, 1125], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [725, 1380], \"expected\": [725, 1380], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [900, 1425], \"expected\": [900, 1425], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [780, 0], \"expected\": [780, 0], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.146,"exit_code":1,"observations":[{"actual":[1125,675],"check":"regression 0","expected":[1550,675],"passed":false},{"actual":[2200,3520],"check":"regression 1","expected":[0,3520],"passed":false},{"actual":[160,1280],"check":"partial-repair probe 2","expected":[900,1280],"passed":false},{"actual":[1270,1125],"check":"partial-repair probe 3","expected":[900,1125],"passed":false},{"actual":[725,1380],"check":"normal control 4","expected":[725,1380],"passed":true},{"actual":[900,1425],"check":"normal control 5","expected":[900,1425],"passed":true},{"actual":[780,0],"check":"normal control 6","expected":[780,0],"passed":true},{"actual":[0,0],"check":"normal control 7","expected":[0,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [1125, 675], \"expected\": [1550, 675], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [2200, 3520], \"expected\": [0, 3520], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [160, 1280], \"expected\": [900, 1280], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [1270, 1125], \"expected\": [900, 1125], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [725, 1380], \"expected\": [725, 1380], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [900, 1425], \"expected\": [900, 1425], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [780, 0], \"expected\": [780, 0], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.143,"exit_code":0,"observations":[{"actual":[1550,675],"check":"regression 0","expected":[1550,675],"passed":true},{"actual":[0,3520],"check":"regression 1","expected":[0,3520],"passed":true},{"actual":[900,1280],"check":"partial-repair probe 2","expected":[900,1280],"passed":true},{"actual":[900,1125],"check":"partial-repair probe 3","expected":[900,1125],"passed":true},{"actual":[725,1380],"check":"normal control 4","expected":[725,1380],"passed":true},{"actual":[900,1425],"check":"normal control 5","expected":[900,1425],"passed":true},{"actual":[780,0],"check":"normal control 6","expected":[780,0],"passed":true},{"actual":[0,0],"check":"normal control 7","expected":[0,0],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [1550, 675], \"expected\": [1550, 675], \"passed\": true}, {\"check\": \"regression 1\", \"actual\": [0, 3520], \"expected\": [0, 3520], \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": [900, 1280], \"expected\": [900, 1280], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [900, 1125], \"expected\": [900, 1125], \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": [725, 1380], \"expected\": [725, 1380], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [900, 1425], \"expected\": [900, 1425], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [780, 0], \"expected\": [780, 0], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}