{"abstract":"Stub invoices for trials ending early in the month use a 30-day cycle regardless of the real anchor cycle.","category":"Subscription proration billing","checks":8,"contract":"Input {trial_end date, anchor_day 1..28, price}. If trial_end.day equals anchor_day, charge the full price and the next anchor is one month later. Otherwise charge price*days/cycle half-up, where days runs from trial_end to the next anchor date strictly after it and cycle is the length of the anchor-to-anchor month containing trial_end. Return [amount, next anchor ISO].","contract_signature":"x","evaluation_group":"w2-subscription-proration-trial-conversion-stub","failed_approach":"The attempt uses the first of the month as the previous anchor, shrinking the cycle to a partial month.","family":"w2-subscription-proration-trial-conversion-stub-previous-anchor-date","id":"FA-59426","implementations":{"attempt":{"sha256":"1a2f1c904bec40bc88623295e623169947b4a1024a616f300038b56591639cb2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nimport calendar\nN = 1\nobservations = []\ndef solve(x):\n    t = datetime.date(*x['trial_end'])\n    a = x['anchor_day']\n    if t.day == a:\n        ny, nm = (t.year + 1, 1) if t.month == 12 else (t.year, t.month + 1)\n        return [x['price'], datetime.date(ny, nm, a).isoformat()]\n    if t.day < a:\n        nxt = datetime.date(t.year, t.month, a)\n        py, pm = (t.year - 1, 12) if t.month == 1 else (t.year, t.month - 1)\n        prev = datetime.date(t.year, t.month, 1)\n    else:\n        ey, em = (t.year + 1, 1) if t.month == 12 else (t.year, t.month + 1)\n        nxt = datetime.date(ey, em, a)\n        prev = datetime.date(t.year, t.month, a)\n    days = (nxt - t).days\n    cycle = (nxt - prev).days\n    return [(x['price'] * days * 2 + cycle) // (2 * cycle), nxt.isoformat()]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'trial_end': [2024, 4, 27], 'anchor_day': 28, 'price': 999}, [32, '2024-04-28']), ('regression', {'trial_end': [2024, 4, 1], 'anchor_day': 28, 'price': 78891}, [68712, '2024-04-28']), ('partial-repair probe', {'trial_end': [2024, 12, 16], 'anchor_day': 28, 'price': 2900}, [1160, '2024-12-28']), ('partial-repair probe', {'trial_end': [2025, 2, 6], 'anchor_day': 15, 'price': 2900}, [842, '2025-02-15']), ('normal control', {'trial_end': [2024, 12, 25], 'anchor_day': 1, 'price': 12600}, [2845, '2025-01-01']), ('normal control', {'trial_end': [2023, 4, 14], 'anchor_day': 1, 'price': 999}, [566, '2023-05-01']), ('normal control', {'trial_end': [2023, 6, 15], 'anchor_day': 15, 'price': 999}, [999, '2023-07-15']), ('normal control', {'trial_end': [2023, 12, 16], 'anchor_day': 15, 'price': 2900}, [2806, '2024-01-15'])], [('regression', {'trial_end': [2024, 4, 1], 'anchor_day': 28, 'price': 78891}, [68712, '2024-04-28']), ('regression', {'trial_end': [2025, 2, 6], 'anchor_day': 15, 'price': 2900}, [842, '2025-02-15']), ('partial-repair probe', {'trial_end': [2024, 6, 4], 'anchor_day': 28, 'price': 999}, [773, '2024-06-28']), ('partial-repair probe', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('normal control', {'trial_end': [2025, 3, 15], 'anchor_day': 15, 'price': 2900}, [2900, '2025-04-15']), ('normal control', {'trial_end': [2023, 12, 15], 'anchor_day': 1, 'price': 47732}, [26176, '2024-01-01']), ('normal control', {'trial_end': [2024, 2, 8], 'anchor_day': 8, 'price': 999}, [999, '2024-03-08']), ('normal control', {'trial_end': [2024, 6, 25], 'anchor_day': 1, 'price': 2900}, [580, '2024-07-01'])], [('regression', {'trial_end': [2025, 2, 6], 'anchor_day': 15, 'price': 2900}, [842, '2025-02-15']), ('regression', {'trial_end': [2024, 6, 4], 'anchor_day': 28, 'price': 999}, [773, '2024-06-28']), ('partial-repair probe', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('partial-repair probe', {'trial_end': [2023, 10, 3], 'anchor_day': 16, 'price': 999}, [433, '2023-10-16']), ('normal control', {'trial_end': [2023, 12, 26], 'anchor_day': 21, 'price': 999}, [838, '2024-01-21']), ('normal control', {'trial_end': [2023, 5, 26], 'anchor_day': 1, 'price': 62316}, [12061, '2023-06-01']), ('normal control', {'trial_end': [2023, 4, 30], 'anchor_day': 15, 'price': 44760}, [22380, '2023-05-15']), ('normal control', {'trial_end': [2025, 5, 3], 'anchor_day': 1, 'price': 2900}, [2713, '2025-06-01'])], [('regression', {'trial_end': [2024, 6, 4], 'anchor_day': 28, 'price': 999}, [773, '2024-06-28']), ('regression', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('partial-repair probe', {'trial_end': [2023, 10, 3], 'anchor_day': 16, 'price': 999}, [433, '2023-10-16']), ('partial-repair probe', {'trial_end': [2023, 6, 18], 'anchor_day': 28, 'price': 2900}, [935, '2023-06-28']), ('normal control', {'trial_end': [2024, 6, 14], 'anchor_day': 1, 'price': 999}, [566, '2024-07-01']), ('normal control', {'trial_end': [2023, 5, 23], 'anchor_day': 15, 'price': 2900}, [2152, '2023-06-15']), ('normal control', {'trial_end': [2023, 5, 31], 'anchor_day': 4, 'price': 999}, [129, '2023-06-04']), ('normal control', {'trial_end': [2023, 3, 16], 'anchor_day': 15, 'price': 9250}, [8952, '2023-04-15'])], [('regression', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('regression', {'trial_end': [2023, 6, 18], 'anchor_day': 28, 'price': 2900}, [935, '2023-06-28']), ('partial-repair probe', {'trial_end': [2025, 3, 22], 'anchor_day': 28, 'price': 58121}, [12455, '2025-03-28']), ('partial-repair probe', {'trial_end': [2024, 3, 15], 'anchor_day': 28, 'price': 999}, [448, '2024-03-28']), ('normal control', {'trial_end': [2025, 2, 28], 'anchor_day': 1, 'price': 999}, [36, '2025-03-01']), ('normal control', {'trial_end': [2023, 8, 18], 'anchor_day': 1, 'price': 2900}, [1310, '2023-09-01']), ('normal control', {'trial_end': [2025, 1, 4], 'anchor_day': 1, 'price': 39775}, [35926, '2025-02-01']), ('normal control', {'trial_end': [2024, 7, 15], 'anchor_day': 15, 'price': 999}, [999, '2024-08-15'])]]\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":"f520a4d155d1d46eb0f64f14bac737b3d1e94bd44e69ef600cb8bf43b1e2fc5c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport datetime\nimport calendar\nN = 1\nobservations = []\ndef solve(x):\n    t = datetime.date(*x['trial_end'])\n    a = x['anchor_day']\n    if t.day == a:\n        ny, nm = (t.year + 1, 1) if t.month == 12 else (t.year, t.month + 1)\n        return [x['price'], datetime.date(ny, nm, a).isoformat()]\n    if t.day < a:\n        nxt = datetime.date(t.year, t.month, a)\n        py, pm = (t.year - 1, 12) if t.month == 1 else (t.year, t.month - 1)\n        prev = nxt - datetime.timedelta(days=30)\n    else:\n        ey, em = (t.year + 1, 1) if t.month == 12 else (t.year, t.month + 1)\n        nxt = datetime.date(ey, em, a)\n        prev = datetime.date(t.year, t.month, a)\n    days = (nxt - t).days\n    cycle = (nxt - prev).days\n    return [(x['price'] * days * 2 + cycle) // (2 * cycle), nxt.isoformat()]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression', {'trial_end': [2024, 4, 27], 'anchor_day': 28, 'price': 999}, [32, '2024-04-28']), ('regression', {'trial_end': [2024, 4, 1], 'anchor_day': 28, 'price': 78891}, [68712, '2024-04-28']), ('partial-repair probe', {'trial_end': [2024, 12, 16], 'anchor_day': 28, 'price': 2900}, [1160, '2024-12-28']), ('partial-repair probe', {'trial_end': [2025, 2, 6], 'anchor_day': 15, 'price': 2900}, [842, '2025-02-15']), ('normal control', {'trial_end': [2024, 12, 25], 'anchor_day': 1, 'price': 12600}, [2845, '2025-01-01']), ('normal control', {'trial_end': [2023, 4, 14], 'anchor_day': 1, 'price': 999}, [566, '2023-05-01']), ('normal control', {'trial_end': [2023, 6, 15], 'anchor_day': 15, 'price': 999}, [999, '2023-07-15']), ('normal control', {'trial_end': [2023, 12, 16], 'anchor_day': 15, 'price': 2900}, [2806, '2024-01-15'])], [('regression', {'trial_end': [2024, 4, 1], 'anchor_day': 28, 'price': 78891}, [68712, '2024-04-28']), ('regression', {'trial_end': [2025, 2, 6], 'anchor_day': 15, 'price': 2900}, [842, '2025-02-15']), ('partial-repair probe', {'trial_end': [2024, 6, 4], 'anchor_day': 28, 'price': 999}, [773, '2024-06-28']), ('partial-repair probe', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('normal control', {'trial_end': [2025, 3, 15], 'anchor_day': 15, 'price': 2900}, [2900, '2025-04-15']), ('normal control', {'trial_end': [2023, 12, 15], 'anchor_day': 1, 'price': 47732}, [26176, '2024-01-01']), ('normal control', {'trial_end': [2024, 2, 8], 'anchor_day': 8, 'price': 999}, [999, '2024-03-08']), ('normal control', {'trial_end': [2024, 6, 25], 'anchor_day': 1, 'price': 2900}, [580, '2024-07-01'])], [('regression', {'trial_end': [2025, 2, 6], 'anchor_day': 15, 'price': 2900}, [842, '2025-02-15']), ('regression', {'trial_end': [2024, 6, 4], 'anchor_day': 28, 'price': 999}, [773, '2024-06-28']), ('partial-repair probe', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('partial-repair probe', {'trial_end': [2023, 10, 3], 'anchor_day': 16, 'price': 999}, [433, '2023-10-16']), ('normal control', {'trial_end': [2023, 12, 26], 'anchor_day': 21, 'price': 999}, [838, '2024-01-21']), ('normal control', {'trial_end': [2023, 5, 26], 'anchor_day': 1, 'price': 62316}, [12061, '2023-06-01']), ('normal control', {'trial_end': [2023, 4, 30], 'anchor_day': 15, 'price': 44760}, [22380, '2023-05-15']), ('normal control', {'trial_end': [2025, 5, 3], 'anchor_day': 1, 'price': 2900}, [2713, '2025-06-01'])], [('regression', {'trial_end': [2024, 6, 4], 'anchor_day': 28, 'price': 999}, [773, '2024-06-28']), ('regression', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('partial-repair probe', {'trial_end': [2023, 10, 3], 'anchor_day': 16, 'price': 999}, [433, '2023-10-16']), ('partial-repair probe', {'trial_end': [2023, 6, 18], 'anchor_day': 28, 'price': 2900}, [935, '2023-06-28']), ('normal control', {'trial_end': [2024, 6, 14], 'anchor_day': 1, 'price': 999}, [566, '2024-07-01']), ('normal control', {'trial_end': [2023, 5, 23], 'anchor_day': 15, 'price': 2900}, [2152, '2023-06-15']), ('normal control', {'trial_end': [2023, 5, 31], 'anchor_day': 4, 'price': 999}, [129, '2023-06-04']), ('normal control', {'trial_end': [2023, 3, 16], 'anchor_day': 15, 'price': 9250}, [8952, '2023-04-15'])], [('regression', {'trial_end': [2024, 4, 10], 'anchor_day': 15, 'price': 2900}, [468, '2024-04-15']), ('regression', {'trial_end': [2023, 6, 18], 'anchor_day': 28, 'price': 2900}, [935, '2023-06-28']), ('partial-repair probe', {'trial_end': [2025, 3, 22], 'anchor_day': 28, 'price': 58121}, [12455, '2025-03-28']), ('partial-repair probe', {'trial_end': [2024, 3, 15], 'anchor_day': 28, 'price': 999}, [448, '2024-03-28']), ('normal control', {'trial_end': [2025, 2, 28], 'anchor_day': 1, 'price': 999}, [36, '2025-03-01']), ('normal control', {'trial_end': [2023, 8, 18], 'anchor_day': 1, 'price': 2900}, [1310, '2023-09-01']), ('normal control', {'trial_end': [2025, 1, 4], 'anchor_day': 1, 'price': 39775}, [35926, '2025-02-01']), ('normal control', {'trial_end': [2024, 7, 15], 'anchor_day': 15, 'price': 999}, [999, '2024-08-15'])]]\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-trial-conversion-stub-previous-anchor-date","generated_at":"2026-09-29T14:46:36.200844+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Converting a trial onto a fixed billing anchor produces a stub invoice whose length depends on real month boundaries.","root_cause":"The previous anchor is approximated as 30 days before the next anchor instead of the same day one month earlier.","sha256":"c4bea06c1e7221f5e06754bd0add41c62f0fda586bbf4f85fd22cb7b4965ff2e","title":"Trial conversion stub period: previous anchor date · 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":42.86,"exit_code":1,"observations":[{"actual":[37,"2024-04-28"],"check":"regression 0","expected":[32,"2024-04-28"],"passed":false},{"actual":[78891,"2024-04-28"],"check":"regression 1","expected":[68712,"2024-04-28"],"passed":false},{"actual":[1289,"2024-12-28"],"check":"partial-repair probe 2","expected":[1160,"2024-12-28"],"passed":false},{"actual":[1864,"2025-02-15"],"check":"partial-repair probe 3","expected":[842,"2025-02-15"],"passed":false},{"actual":[2845,"2025-01-01"],"check":"normal control 4","expected":[2845,"2025-01-01"],"passed":true},{"actual":[566,"2023-05-01"],"check":"normal control 5","expected":[566,"2023-05-01"],"passed":true},{"actual":[999,"2023-07-15"],"check":"normal control 6","expected":[999,"2023-07-15"],"passed":true},{"actual":[2806,"2024-01-15"],"check":"normal control 7","expected":[2806,"2024-01-15"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [37, \"2024-04-28\"], \"expected\": [32, \"2024-04-28\"], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [78891, \"2024-04-28\"], \"expected\": [68712, \"2024-04-28\"], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [1289, \"2024-12-28\"], \"expected\": [1160, \"2024-12-28\"], \"passed\": false}, {\"check\": \"partial-repair probe 3\", \"actual\": [1864, \"2025-02-15\"], \"expected\": [842, \"2025-02-15\"], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [2845, \"2025-01-01\"], \"expected\": [2845, \"2025-01-01\"], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [566, \"2023-05-01\"], \"expected\": [566, \"2023-05-01\"], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [999, \"2023-07-15\"], \"expected\": [999, \"2023-07-15\"], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [2806, \"2024-01-15\"], \"expected\": [2806, \"2024-01-15\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.409,"exit_code":1,"observations":[{"actual":[33,"2024-04-28"],"check":"regression 0","expected":[32,"2024-04-28"],"passed":false},{"actual":[71002,"2024-04-28"],"check":"regression 1","expected":[68712,"2024-04-28"],"passed":false},{"actual":[1160,"2024-12-28"],"check":"partial-repair probe 2","expected":[1160,"2024-12-28"],"passed":true},{"actual":[870,"2025-02-15"],"check":"partial-repair probe 3","expected":[842,"2025-02-15"],"passed":false},{"actual":[2845,"2025-01-01"],"check":"normal control 4","expected":[2845,"2025-01-01"],"passed":true},{"actual":[566,"2023-05-01"],"check":"normal control 5","expected":[566,"2023-05-01"],"passed":true},{"actual":[999,"2023-07-15"],"check":"normal control 6","expected":[999,"2023-07-15"],"passed":true},{"actual":[2806,"2024-01-15"],"check":"normal control 7","expected":[2806,"2024-01-15"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression 0\", \"actual\": [33, \"2024-04-28\"], \"expected\": [32, \"2024-04-28\"], \"passed\": false}, {\"check\": \"regression 1\", \"actual\": [71002, \"2024-04-28\"], \"expected\": [68712, \"2024-04-28\"], \"passed\": false}, {\"check\": \"partial-repair probe 2\", \"actual\": [1160, \"2024-12-28\"], \"expected\": [1160, \"2024-12-28\"], \"passed\": true}, {\"check\": \"partial-repair probe 3\", \"actual\": [870, \"2025-02-15\"], \"expected\": [842, \"2025-02-15\"], \"passed\": false}, {\"check\": \"normal control 4\", \"actual\": [2845, \"2025-01-01\"], \"expected\": [2845, \"2025-01-01\"], \"passed\": true}, {\"check\": \"normal control 5\", \"actual\": [566, \"2023-05-01\"], \"expected\": [566, \"2023-05-01\"], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [999, \"2023-07-15\"], \"expected\": [999, \"2023-07-15\"], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [2806, \"2024-01-15\"], \"expected\": [2806, \"2024-01-15\"], \"passed\": true}], \"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."}}