{"abstract":"Customers who paid part of an invoice get no credit for unused time.","category":"Subscription proration billing","checks":8,"contract":"Input {list, paid, status paid|partial|open|void|refunded, left, period}. Open, void and refunded invoices earn no unused-time credit. Paid and partially paid invoices earn paid*left/period half-up (the amount actually collected, not the list price). Return cents.","evaluation_group":"w2-subscription-proration-unused-time-credit-basis","failed_approach":"The attempt denies partial invoices while crediting refunded ones.","family":"w2-subscription-proration-unused-time-credit-basis-partially-paid-invoices","id":"FA-59831","implementations":{"attempt":{"sha256":"a281daddbbe51252d5dcd1dba6e0a800cf5b198dddb95d88e101fd56eb6b34e1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if x['status'] in ('open', 'void', 'partial'):\n        return 0\n    return (x['paid'] * x['left'] * 2 + x['period']) // (2 * x['period'])\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'list': 4900, 'paid': 2450, 'status': 'partial', 'left': 24, 'period': 31}, 1897), ('regression', {'list': 4900, 'paid': 935, 'status': 'partial', 'left': 23, 'period': 31}, 694), ('partial-repair probe', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('partial-repair probe', {'list': 1000, 'paid': 461, 'status': 'refunded', 'left': 10, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 4950, 'status': 'void', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'void', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 0, 'status': 'open', 'left': 4, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'open', 'left': 29, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 935, 'status': 'partial', 'left': 23, 'period': 31}, 694), ('regression', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('partial-repair probe', {'list': 1000, 'paid': 461, 'status': 'refunded', 'left': 10, 'period': 31}, 0), ('partial-repair probe', {'list': 4900, 'paid': 2450, 'status': 'refunded', 'left': 20, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'paid', 'left': 19, 'period': 31}, 3003), ('normal control', {'list': 1000, 'paid': 500, 'status': 'open', 'left': 15, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'paid', 'left': 6, 'period': 31}, 474), ('normal control', {'list': 4900, 'paid': 0, 'status': 'refunded', 'left': 1, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('regression', {'list': 4900, 'paid': 311, 'status': 'partial', 'left': 2, 'period': 31}, 20), ('partial-repair probe', {'list': 4900, 'paid': 2450, 'status': 'refunded', 'left': 20, 'period': 31}, 0), ('partial-repair probe', {'list': 9900, 'paid': 4739, 'status': 'refunded', 'left': 24, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'partial', 'left': 13, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 500, 'status': 'open', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'open', 'left': 20, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'void', 'left': 3, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 311, 'status': 'partial', 'left': 2, 'period': 31}, 20), ('regression', {'list': 1000, 'paid': 500, 'status': 'partial', 'left': 13, 'period': 31}, 210), ('partial-repair probe', {'list': 9900, 'paid': 4739, 'status': 'refunded', 'left': 24, 'period': 31}, 0), ('partial-repair probe', {'list': 4900, 'paid': 1142, 'status': 'refunded', 'left': 8, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'open', 'left': 25, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'void', 'left': 29, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 2540, 'status': 'open', 'left': 27, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'refunded', 'left': 6, 'period': 31}, 0)], [('regression', {'list': 1000, 'paid': 500, 'status': 'partial', 'left': 13, 'period': 31}, 210), ('regression', {'list': 9900, 'paid': 9900, 'status': 'partial', 'left': 21, 'period': 31}, 6706), ('partial-repair probe', {'list': 4900, 'paid': 1142, 'status': 'refunded', 'left': 8, 'period': 31}, 0), ('partial-repair probe', {'list': 1000, 'paid': 1000, 'status': 'refunded', 'left': 7, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 4950, 'status': 'paid', 'left': 25, 'period': 31}, 3992), ('normal control', {'list': 4900, 'paid': 786, 'status': 'open', 'left': 21, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'refunded', 'left': 28, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'partial', 'left': 3, 'period': 31}, 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":"47f4209f337ae8c891adc373554d609e665816b0f98e9c0fc82fa18d1d537095","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if x['status'] != 'paid':\n        return 0\n    return (x['paid'] * x['left'] * 2 + x['period']) // (2 * x['period'])\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'list': 4900, 'paid': 2450, 'status': 'partial', 'left': 24, 'period': 31}, 1897), ('regression', {'list': 4900, 'paid': 935, 'status': 'partial', 'left': 23, 'period': 31}, 694), ('partial-repair probe', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('partial-repair probe', {'list': 1000, 'paid': 461, 'status': 'refunded', 'left': 10, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 4950, 'status': 'void', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'void', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 0, 'status': 'open', 'left': 4, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'open', 'left': 29, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 935, 'status': 'partial', 'left': 23, 'period': 31}, 694), ('regression', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('partial-repair probe', {'list': 1000, 'paid': 461, 'status': 'refunded', 'left': 10, 'period': 31}, 0), ('partial-repair probe', {'list': 4900, 'paid': 2450, 'status': 'refunded', 'left': 20, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'paid', 'left': 19, 'period': 31}, 3003), ('normal control', {'list': 1000, 'paid': 500, 'status': 'open', 'left': 15, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'paid', 'left': 6, 'period': 31}, 474), ('normal control', {'list': 4900, 'paid': 0, 'status': 'refunded', 'left': 1, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('regression', {'list': 4900, 'paid': 311, 'status': 'partial', 'left': 2, 'period': 31}, 20), ('partial-repair probe', {'list': 4900, 'paid': 2450, 'status': 'refunded', 'left': 20, 'period': 31}, 0), ('partial-repair probe', {'list': 9900, 'paid': 4739, 'status': 'refunded', 'left': 24, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'partial', 'left': 13, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 500, 'status': 'open', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'open', 'left': 20, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'void', 'left': 3, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 311, 'status': 'partial', 'left': 2, 'period': 31}, 20), ('regression', {'list': 1000, 'paid': 500, 'status': 'partial', 'left': 13, 'period': 31}, 210), ('partial-repair probe', {'list': 9900, 'paid': 4739, 'status': 'refunded', 'left': 24, 'period': 31}, 0), ('partial-repair probe', {'list': 4900, 'paid': 1142, 'status': 'refunded', 'left': 8, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'open', 'left': 25, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'void', 'left': 29, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 2540, 'status': 'open', 'left': 27, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'refunded', 'left': 6, 'period': 31}, 0)], [('regression', {'list': 1000, 'paid': 500, 'status': 'partial', 'left': 13, 'period': 31}, 210), ('regression', {'list': 9900, 'paid': 9900, 'status': 'partial', 'left': 21, 'period': 31}, 6706), ('partial-repair probe', {'list': 4900, 'paid': 1142, 'status': 'refunded', 'left': 8, 'period': 31}, 0), ('partial-repair probe', {'list': 1000, 'paid': 1000, 'status': 'refunded', 'left': 7, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 4950, 'status': 'paid', 'left': 25, 'period': 31}, 3992), ('normal control', {'list': 4900, 'paid': 786, 'status': 'open', 'left': 21, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'refunded', 'left': 28, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'partial', 'left': 3, 'period': 31}, 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":"24fc2515661a55d0f3b928e642374a5a581067e0109e833c096a6ad94b726ecd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    if x['status'] in ('open', 'void', 'refunded'):\n        return 0\n    return (x['paid'] * x['left'] * 2 + x['period']) // (2 * x['period'])\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'list': 4900, 'paid': 2450, 'status': 'partial', 'left': 24, 'period': 31}, 1897), ('regression', {'list': 4900, 'paid': 935, 'status': 'partial', 'left': 23, 'period': 31}, 694), ('partial-repair probe', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('partial-repair probe', {'list': 1000, 'paid': 461, 'status': 'refunded', 'left': 10, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 4950, 'status': 'void', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'void', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 0, 'status': 'open', 'left': 4, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'open', 'left': 29, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 935, 'status': 'partial', 'left': 23, 'period': 31}, 694), ('regression', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('partial-repair probe', {'list': 1000, 'paid': 461, 'status': 'refunded', 'left': 10, 'period': 31}, 0), ('partial-repair probe', {'list': 4900, 'paid': 2450, 'status': 'refunded', 'left': 20, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'paid', 'left': 19, 'period': 31}, 3003), ('normal control', {'list': 1000, 'paid': 500, 'status': 'open', 'left': 15, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'paid', 'left': 6, 'period': 31}, 474), ('normal control', {'list': 4900, 'paid': 0, 'status': 'refunded', 'left': 1, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 3688, 'status': 'partial', 'left': 5, 'period': 31}, 595), ('regression', {'list': 4900, 'paid': 311, 'status': 'partial', 'left': 2, 'period': 31}, 20), ('partial-repair probe', {'list': 4900, 'paid': 2450, 'status': 'refunded', 'left': 20, 'period': 31}, 0), ('partial-repair probe', {'list': 9900, 'paid': 4739, 'status': 'refunded', 'left': 24, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'partial', 'left': 13, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 500, 'status': 'open', 'left': 9, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 2450, 'status': 'open', 'left': 20, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'void', 'left': 3, 'period': 31}, 0)], [('regression', {'list': 4900, 'paid': 311, 'status': 'partial', 'left': 2, 'period': 31}, 20), ('regression', {'list': 1000, 'paid': 500, 'status': 'partial', 'left': 13, 'period': 31}, 210), ('partial-repair probe', {'list': 9900, 'paid': 4739, 'status': 'refunded', 'left': 24, 'period': 31}, 0), ('partial-repair probe', {'list': 4900, 'paid': 1142, 'status': 'refunded', 'left': 8, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 4900, 'status': 'open', 'left': 25, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'void', 'left': 29, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 2540, 'status': 'open', 'left': 27, 'period': 31}, 0), ('normal control', {'list': 4900, 'paid': 0, 'status': 'refunded', 'left': 6, 'period': 31}, 0)], [('regression', {'list': 1000, 'paid': 500, 'status': 'partial', 'left': 13, 'period': 31}, 210), ('regression', {'list': 9900, 'paid': 9900, 'status': 'partial', 'left': 21, 'period': 31}, 6706), ('partial-repair probe', {'list': 4900, 'paid': 1142, 'status': 'refunded', 'left': 8, 'period': 31}, 0), ('partial-repair probe', {'list': 1000, 'paid': 1000, 'status': 'refunded', 'left': 7, 'period': 31}, 0), ('normal control', {'list': 9900, 'paid': 4950, 'status': 'paid', 'left': 25, 'period': 31}, 3992), ('normal control', {'list': 4900, 'paid': 786, 'status': 'open', 'left': 21, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'refunded', 'left': 28, 'period': 31}, 0), ('normal control', {'list': 1000, 'paid': 0, 'status': 'partial', 'left': 3, 'period': 31}, 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-unused-time-credit-basis-partially-paid-invoices","generated_at":"2026-09-29T14:46:40.047360+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Credits for unused time must not exceed what the customer actually paid for the period.","repair":"Restore the contract rule at the partially paid invoices step: use `if x['status'] in ('open', 'void', 'refunded'):`.","root_cause":"Every non-paid status, including partially paid, is denied credit.","sha256":"3be5776208b762687c4562a2e5a5e7da4983ddd376e8f39de2833db6f9a1881e","title":"Unused-time credit based on amount paid: partially paid invoices · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.033,"exit_code":1,"observations":[{"actual":0,"check":"regression 0","expected":1897,"passed":false},{"actual":0,"check":"regression 1","expected":694,"passed":false},{"actual":0,"check":"partial-repair probe 2","expected":595,"passed":false},{"actual":149,"check":"partial-repair probe 3","expected":0,"passed":false},{"actual":0,"check":"normal control 4","expected":0,"passed":true},{"actual":0,"check":"normal control 5","expected":0,"passed":true},{"actual":0,"check":"normal control 6","expected":0,"passed":true},{"actual":0,"check":"normal control 7","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": 0, \"expected\": 1897, \"passed\": false}, {\"check\": \"regression 1\", \"actual\": 0, \"expected\": 694, \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": 0, \"expected\": 595, \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": 149, \"expected\": 0, \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.043,"exit_code":1,"observations":[{"actual":0,"check":"regression 0","expected":1897,"passed":false},{"actual":0,"check":"regression 1","expected":694,"passed":false},{"actual":0,"check":"partial-repair probe 2","expected":595,"passed":false},{"actual":0,"check":"partial-repair probe 3","expected":0,"passed":true},{"actual":0,"check":"normal control 4","expected":0,"passed":true},{"actual":0,"check":"normal control 5","expected":0,"passed":true},{"actual":0,"check":"normal control 6","expected":0,"passed":true},{"actual":0,"check":"normal control 7","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": 0, \"expected\": 1897, \"passed\": false}, {\"check\": \"regression 1\", \"actual\": 0, \"expected\": 694, \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": 0, \"expected\": 595, \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":37.465,"exit_code":0,"observations":[{"actual":1897,"check":"regression 0","expected":1897,"passed":true},{"actual":694,"check":"regression 1","expected":694,"passed":true},{"actual":595,"check":"partial-repair probe 2","expected":595,"passed":true},{"actual":0,"check":"partial-repair probe 3","expected":0,"passed":true},{"actual":0,"check":"normal control 4","expected":0,"passed":true},{"actual":0,"check":"normal control 5","expected":0,"passed":true},{"actual":0,"check":"normal control 6","expected":0,"passed":true},{"actual":0,"check":"normal control 7","expected":0,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": 1897, \"expected\": 1897, \"passed\": true}, {\"check\": \"regression 1\", \"actual\": 694, \"expected\": 694, \"passed\": true}, {\"check\": \"partial-repair probe 2\", \"actual\": 595, \"expected\": 595, \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 4\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}