{"abstract":"Customers who upgrade are charged and credited for one day fewer than remain in the period.","category":"Subscription proration billing","checks":7,"contract":"Input {old, new prices per period, start, end (exclusive), change} dates with start <= change < end. Remaining days = end - change; period days = end - start. Credit = old*remaining/period and charge = new*remaining/period, each rounded half-up. Net = charge - credit; a positive net is due now, a negative net becomes a credit balance. Return [credit, charge, amount_due, credit_balance].","contract_signature":"x","evaluation_group":"w2-subscription-proration-daily-plan-change","failed_approach":"The attempt counts the exclusive period end as a service day, prorating one day too many.","family":"w2-subscription-proration-daily-plan-change-remaining-day-count","id":"FA-59341","implementations":{"attempt":{"sha256":"91b668170d2bbc58a18120364cd07df73be6e792cbafe2345b48e36549987402","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nimport calendar\nN = 1\nobservations = []\ndef solve(x):\n    s = datetime.date(*x['start'])\n    e = datetime.date(*x['end'])\n    c = datetime.date(*x['change'])\n    total = (e - s).days\n    remaining = (e - c).days + 1\n    def pr(p):\n        return (p * remaining * 2 + total) // (2 * total)\n    credit = pr(x['old'])\n    charge = pr(x['new'])\n    net = charge - credit\n    return [credit, charge, max(0, net), max(0, -net)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'old': 999, 'new': 1999, 'start': [2023, 10, 16], 'end': [2023, 11, 13], 'change': [2023, 11, 8]}, [178, 357, 179, 0]), ('regression', {'old': 12063, 'new': 1999, 'start': [2024, 10, 16], 'end': [2024, 11, 14], 'change': [2024, 11, 2]}, [4992, 827, 0, 4165]), ('partial-repair probe', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('partial-repair probe', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('additional oracle', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66])], [('regression', {'old': 12063, 'new': 1999, 'start': [2024, 10, 16], 'end': [2024, 11, 14], 'change': [2024, 11, 2]}, [4992, 827, 0, 4165]), ('regression', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('partial-repair probe', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('additional oracle', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0])], [('regression', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('regression', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('partial-repair probe', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0]), ('additional oracle', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0])], [('regression', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('regression', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('partial-repair probe', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0]), ('additional oracle', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0]), ('additional oracle', {'old': 7276, 'new': 43371, 'start': [2024, 5, 21], 'end': [2024, 8, 19], 'change': [2024, 6, 13]}, [5417, 32287, 26870, 0])], [('regression', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('regression', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('partial-repair probe', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0]), ('partial-repair probe', {'old': 7276, 'new': 43371, 'start': [2024, 5, 21], 'end': [2024, 8, 19], 'change': [2024, 6, 13]}, [5417, 32287, 26870, 0]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0]), ('additional oracle', {'old': 4900, 'new': 14973, 'start': [2025, 4, 11], 'end': [2025, 5, 10], 'change': [2025, 4, 17]}, [3886, 11875, 7989, 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":"1c7c2d49171d25e851a1d32175b65f7943c14ccdcac0710caba50f9b3ac6e694","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nimport calendar\nN = 1\nobservations = []\ndef solve(x):\n    s = datetime.date(*x['start'])\n    e = datetime.date(*x['end'])\n    c = datetime.date(*x['change'])\n    total = (e - s).days\n    remaining = (e - c).days - 1\n    def pr(p):\n        return (p * remaining * 2 + total) // (2 * total)\n    credit = pr(x['old'])\n    charge = pr(x['new'])\n    net = charge - credit\n    return [credit, charge, max(0, net), max(0, -net)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'old': 999, 'new': 1999, 'start': [2023, 10, 16], 'end': [2023, 11, 13], 'change': [2023, 11, 8]}, [178, 357, 179, 0]), ('regression', {'old': 12063, 'new': 1999, 'start': [2024, 10, 16], 'end': [2024, 11, 14], 'change': [2024, 11, 2]}, [4992, 827, 0, 4165]), ('partial-repair probe', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('partial-repair probe', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('additional oracle', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66])], [('regression', {'old': 12063, 'new': 1999, 'start': [2024, 10, 16], 'end': [2024, 11, 14], 'change': [2024, 11, 2]}, [4992, 827, 0, 4165]), ('regression', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('partial-repair probe', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('additional oracle', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0])], [('regression', {'old': 999, 'new': 1999, 'start': [2024, 9, 16], 'end': [2024, 12, 15], 'change': [2024, 12, 10]}, [56, 111, 55, 0]), ('regression', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('partial-repair probe', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0]), ('additional oracle', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0])], [('regression', {'old': 4900, 'new': 8489, 'start': [2024, 3, 22], 'end': [2024, 6, 20], 'change': [2024, 4, 18]}, [3430, 5942, 2512, 0]), ('regression', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('partial-repair probe', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('partial-repair probe', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0]), ('additional oracle', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('additional oracle', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0]), ('additional oracle', {'old': 7276, 'new': 43371, 'start': [2024, 5, 21], 'end': [2024, 8, 19], 'change': [2024, 6, 13]}, [5417, 32287, 26870, 0])], [('regression', {'old': 4900, 'new': 9900, 'start': [2024, 1, 10], 'end': [2024, 4, 9], 'change': [2024, 3, 7]}, [1797, 3630, 1833, 0]), ('regression', {'old': 34933, 'new': 4900, 'start': [2024, 12, 28], 'end': [2025, 1, 28], 'change': [2025, 1, 22]}, [6761, 948, 0, 5813]), ('partial-repair probe', {'old': 999, 'new': 4900, 'start': [2025, 1, 22], 'end': [2025, 4, 22], 'change': [2025, 3, 8]}, [500, 2450, 1950, 0]), ('partial-repair probe', {'old': 7276, 'new': 43371, 'start': [2024, 5, 21], 'end': [2024, 8, 19], 'change': [2024, 6, 13]}, [5417, 32287, 26870, 0]), ('additional oracle', {'old': 38640, 'new': 36658, 'start': [2024, 12, 23], 'end': [2025, 1, 22], 'change': [2025, 1, 21]}, [1288, 1222, 0, 66]), ('additional oracle', {'old': 4900, 'new': 9900, 'start': [2024, 6, 18], 'end': [2024, 7, 18], 'change': [2024, 6, 21]}, [4410, 8910, 4500, 0]), ('additional oracle', {'old': 4900, 'new': 14973, 'start': [2025, 4, 11], 'end': [2025, 5, 10], 'change': [2025, 4, 17]}, [3886, 11875, 7989, 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-daily-plan-change-remaining-day-count","generated_at":"2026-09-29T14:46:35.484850+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Mid-cycle plan changes must credit unused time on the old plan and charge the new plan for the same days.","root_cause":"The change day itself is excluded from the remaining days although service on the new plan starts that day.","sha256":"b10824947722b634041141c26b29753162c38cdf4d9a264352d39f8a5df9aaa1","title":"Daily plan-change proration: remaining day count · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":47.571,"exit_code":1,"observations":[{"actual":[214,428,214,0],"check":"regression 0","expected":[178,357,179,0],"passed":false},{"actual":[5408,896,0,4512],"check":"regression 1","expected":[4992,827,0,4165],"passed":false},{"actual":[67,133,66,0],"check":"partial-repair probe 2","expected":[56,111,55,0],"passed":false},{"actual":[3484,6037,2553,0],"check":"partial-repair probe 3","expected":[3430,5942,2512,0],"passed":false},{"actual":[1851,3740,1889,0],"check":"additional oracle 4","expected":[1797,3630,1833,0],"passed":false},{"actual":[7888,1106,0,6782],"check":"additional oracle 5","expected":[6761,948,0,5813],"passed":false},{"actual":[2576,2444,0,132],"check":"additional oracle 6","expected":[1288,1222,0,66],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [214, 428, 214, 0], \"expected\": [178, 357, 179, 0], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [5408, 896, 0, 4512], \"expected\": [4992, 827, 0, 4165], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [67, 133, 66, 0], \"expected\": [56, 111, 55, 0], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [3484, 6037, 2553, 0], \"expected\": [3430, 5942, 2512, 0], \"passed\": false}, {\"check\": \"additional oracle 4\", \"actual\": [1851, 3740, 1889, 0], \"expected\": [1797, 3630, 1833, 0], \"passed\": false}, {\"check\": \"additional oracle 5\", \"actual\": [7888, 1106, 0, 6782], \"expected\": [6761, 948, 0, 5813], \"passed\": false}, {\"check\": \"additional oracle 6\", \"actual\": [2576, 2444, 0, 132], \"expected\": [1288, 1222, 0, 66], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":46.918,"exit_code":1,"observations":[{"actual":[143,286,143,0],"check":"regression 0","expected":[178,357,179,0],"passed":false},{"actual":[4576,758,0,3818],"check":"regression 1","expected":[4992,827,0,4165],"passed":false},{"actual":[44,89,45,0],"check":"partial-repair probe 2","expected":[56,111,55,0],"passed":false},{"actual":[3376,5848,2472,0],"check":"partial-repair probe 3","expected":[3430,5942,2512,0],"passed":false},{"actual":[1742,3520,1778,0],"check":"additional oracle 4","expected":[1797,3630,1833,0],"passed":false},{"actual":[5634,790,0,4844],"check":"additional oracle 5","expected":[6761,948,0,5813],"passed":false},{"actual":[0,0,0,0],"check":"additional oracle 6","expected":[1288,1222,0,66],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [143, 286, 143, 0], \"expected\": [178, 357, 179, 0], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [4576, 758, 0, 3818], \"expected\": [4992, 827, 0, 4165], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [44, 89, 45, 0], \"expected\": [56, 111, 55, 0], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [3376, 5848, 2472, 0], \"expected\": [3430, 5942, 2512, 0], \"passed\": false}, {\"check\": \"additional oracle 4\", \"actual\": [1742, 3520, 1778, 0], \"expected\": [1797, 3630, 1833, 0], \"passed\": false}, {\"check\": \"additional oracle 5\", \"actual\": [5634, 790, 0, 4844], \"expected\": [6761, 948, 0, 5813], \"passed\": false}, {\"check\": \"additional oracle 6\", \"actual\": [0, 0, 0, 0], \"expected\": [1288, 1222, 0, 66], \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}