{"abstract":"The full carry credit is carried forward even after it reduced this year's tax.","category":"Tax bracket computation","checks":6,"contract":"solve(tax, credits): tax is integer cents >= 0; credits is a list of [kind, cents] with kind 'nonref' (nonrefundable, unused part lost), 'carry' (nonrefundable, unused part carried forward) or 'ref' (refundable). Unknown kinds return 'ERR:kind'. Apply all nonref credits first (limited to the remaining tax), then carry credits (limited to what remains), then refundable credits in full (a negative result is a refund). Return [final_tax, carryforward].","contract_signature":"tax, credits","evaluation_group":"w2-tax_bracket_computation-credit-ordering","failed_approach":"Computing the carryforward from the tax remaining after the credit mixes up credit and tax balances.","family":"w2-tax_bracket_computation-credit-ordering-carryforward-amount","id":"FA-62476","implementations":{"attempt":{"sha256":"eef937f5d26c8dff0035f711bafe4f0bd8c56c79bcc325ac67d61b5638d5f704","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tax, credits):\n    tot = {'nonref': 0, 'carry': 0, 'ref': 0}\n    for kind, amount in credits:\n        if kind not in tot: return 'ERR:kind'\n        tot[kind] += amount\n    n, c, r = tot['nonref'], tot['carry'], tot['ref']\n    t = tax\n    use_n = min(n, t)\n    t -= use_n\n    use_c = min(c, t)\n    t -= use_c\n    cf = max(0, c - t)\n    t -= r\n    return [t, cf]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression carryforward-amount 1', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),\n  ('regression carryforward-amount 2', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),\n  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),\n  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),\n  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0])],\n [('regression carryforward-amount 1', (500, [['carry', 50], ['carry', 1626], ['carry', 2439], ['carry', 2757]]),\n   [0, 6372]),\n  ('regression carryforward-amount 2', (1000, [['carry', 300], ['nonref', 100], ['nonref', 100], ['nonref', 765]]),\n   [0, 265]),\n  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),\n  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),\n  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),\n  ('control: empty', (1234, []), [1234, 0])],\n [('regression carryforward-amount 1', (2284, [['carry', 50], ['ref', 300]]), [1934, 0]),\n  ('regression carryforward-amount 2', (1112, [['carry', 300]]), [812, 0]),\n  ('partial repair guard 1', (500, [['carry', 300]]), [200, 0]),\n  ('partial repair guard 2', (100, [['ref', 931], ['carry', 300], ['ref', 50]]), [-981, 200]),\n  ('control: empty', (1234, []), [1234, 0]),\n  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),\n  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50])],\n [('regression carryforward-amount 1', (500, [['carry', 300]]), [200, 0]),\n  ('regression carryforward-amount 2', (100, [['ref', 931], ['carry', 300], ['ref', 50]]), [-981, 200]),\n  ('partial repair guard 1', (500, [['carry', 2501], ['carry', 0], ['nonref', 300], ['ref', 0]]), [0, 2301]),\n  ('partial repair guard 2', (1000, [['ref', 50], ['carry', 0], ['carry', 483], ['nonref', 50]]), [417, 0]),\n  ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),\n  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),\n  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),\n  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200])],\n [('regression carryforward-amount 1', (500, [['carry', 100]]), [400, 0]),\n  ('regression carryforward-amount 2', (500, [['carry', 2501], ['carry', 0], ['nonref', 300], ['ref', 0]]), [0, 2301]),\n  ('partial repair guard 1', (100, [['carry', 100], ['carry', 0]]), [0, 0]),\n  ('partial repair guard 2', (500, [['ref', 300], ['carry', 2443]]), [-300, 1943]),\n  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),\n  ('control: empty', (1234, []), [1234, 0]),\n  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),\n  ('control: refund', (500, [['ref', 700]]), [-200, 0])]]\nfor label, args, expected in cases[N - 1]:\n    check(label, 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":"d9a4a22d0c7ba63cebc47cb77835815c72d90bde95153cfceecfbf3062ae7ed9","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(tax, credits):\n    tot = {'nonref': 0, 'carry': 0, 'ref': 0}\n    for kind, amount in credits:\n        if kind not in tot: return 'ERR:kind'\n        tot[kind] += amount\n    n, c, r = tot['nonref'], tot['carry'], tot['ref']\n    t = tax\n    use_n = min(n, t)\n    t -= use_n\n    use_c = min(c, t)\n    t -= use_c\n    cf = c\n    t -= r\n    return [t, cf]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression carryforward-amount 1', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),\n  ('regression carryforward-amount 2', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),\n  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),\n  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),\n  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0])],\n [('regression carryforward-amount 1', (500, [['carry', 50], ['carry', 1626], ['carry', 2439], ['carry', 2757]]),\n   [0, 6372]),\n  ('regression carryforward-amount 2', (1000, [['carry', 300], ['nonref', 100], ['nonref', 100], ['nonref', 765]]),\n   [0, 265]),\n  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),\n  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),\n  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),\n  ('control: empty', (1234, []), [1234, 0])],\n [('regression carryforward-amount 1', (2284, [['carry', 50], ['ref', 300]]), [1934, 0]),\n  ('regression carryforward-amount 2', (1112, [['carry', 300]]), [812, 0]),\n  ('partial repair guard 1', (500, [['carry', 300]]), [200, 0]),\n  ('partial repair guard 2', (100, [['ref', 931], ['carry', 300], ['ref', 50]]), [-981, 200]),\n  ('control: empty', (1234, []), [1234, 0]),\n  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),\n  ('control: refund', (500, [['ref', 700]]), [-200, 0]), ('control: no tax carry', (0, [['carry', 50]]), [0, 50])],\n [('regression carryforward-amount 1', (500, [['carry', 300]]), [200, 0]),\n  ('regression carryforward-amount 2', (100, [['ref', 931], ['carry', 300], ['ref', 50]]), [-981, 200]),\n  ('partial repair guard 1', (500, [['carry', 2501], ['carry', 0], ['nonref', 300], ['ref', 0]]), [0, 2301]),\n  ('partial repair guard 2', (1000, [['ref', 50], ['carry', 0], ['carry', 483], ['nonref', 50]]), [417, 0]),\n  ('control: no tax carry', (0, [['carry', 50]]), [0, 50]),\n  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind'),\n  ('control: nonref exceeds tax', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),\n  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200])],\n [('regression carryforward-amount 1', (500, [['carry', 100]]), [400, 0]),\n  ('regression carryforward-amount 2', (500, [['carry', 2501], ['carry', 0], ['nonref', 300], ['ref', 0]]), [0, 2301]),\n  ('partial repair guard 1', (100, [['carry', 100], ['carry', 0]]), [0, 0]),\n  ('partial repair guard 2', (500, [['ref', 300], ['carry', 2443]]), [-300, 1943]),\n  ('control: split carries', (900, [['carry', 400], ['nonref', 600], ['carry', 100]]), [0, 200]),\n  ('control: empty', (1234, []), [1234, 0]),\n  ('control: all kinds', (1000, [['nonref', 400], ['carry', 800], ['ref', 300]]), [-300, 200]),\n  ('control: refund', (500, [['ref', 700]]), [-200, 0])]]\nfor label, args, expected in cases[N - 1]:\n    check(label, 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, bounded teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's rules. 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-tax_bracket_computation-credit-ordering-carryforward-amount","generated_at":"2026-09-29T14:47:05.016107+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Tax computations hinge on which slice, threshold, ordering and rounding rule applies at each step; a misplaced boundary silently misstates liabilities.","root_cause":"cf is set to the full carry credit instead of the unused portion.","sha256":"0d628f4c3a18a19be9d008c7a21f0b421221100700cabda912d0c303dc3cbfad","title":"The credit carryforward ignores the part that was used · 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":38.329,"exit_code":1,"observations":[{"actual":[-300,800],"check":"regression carryforward-amount 1","expected":[-300,200],"passed":false},{"actual":[0,500],"check":"regression carryforward-amount 2","expected":[0,200],"passed":false},{"actual":[-200,0],"check":"control: refund","expected":[-200,0],"passed":true},{"actual":[0,50],"check":"control: no tax carry","expected":[0,50],"passed":true},{"actual":"ERR:kind","check":"control: unknown kind","expected":"ERR:kind","passed":true},{"actual":[-100,0],"check":"control: nonref exceeds tax","expected":[-100,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression carryforward-amount 1\", \"actual\": [-300, 800], \"expected\": [-300, 200], \"passed\": false}, {\"check\": \"regression carryforward-amount 2\", \"actual\": [0, 500], \"expected\": [0, 200], \"passed\": false}, {\"check\": \"control: refund\", \"actual\": [-200, 0], \"expected\": [-200, 0], \"passed\": true}, {\"check\": \"control: no tax carry\", \"actual\": [0, 50], \"expected\": [0, 50], \"passed\": true}, {\"check\": \"control: unknown kind\", \"actual\": \"ERR:kind\", \"expected\": \"ERR:kind\", \"passed\": true}, {\"check\": \"control: nonref exceeds tax\", \"actual\": [-100, 0], \"expected\": [-100, 0], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.981,"exit_code":1,"observations":[{"actual":[-300,800],"check":"regression carryforward-amount 1","expected":[-300,200],"passed":false},{"actual":[0,500],"check":"regression carryforward-amount 2","expected":[0,200],"passed":false},{"actual":[-200,0],"check":"control: refund","expected":[-200,0],"passed":true},{"actual":[0,50],"check":"control: no tax carry","expected":[0,50],"passed":true},{"actual":"ERR:kind","check":"control: unknown kind","expected":"ERR:kind","passed":true},{"actual":[-100,0],"check":"control: nonref exceeds tax","expected":[-100,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression carryforward-amount 1\", \"actual\": [-300, 800], \"expected\": [-300, 200], \"passed\": false}, {\"check\": \"regression carryforward-amount 2\", \"actual\": [0, 500], \"expected\": [0, 200], \"passed\": false}, {\"check\": \"control: refund\", \"actual\": [-200, 0], \"expected\": [-200, 0], \"passed\": true}, {\"check\": \"control: no tax carry\", \"actual\": [0, 50], \"expected\": [0, 50], \"passed\": true}, {\"check\": \"control: unknown kind\", \"actual\": \"ERR:kind\", \"expected\": \"ERR:kind\", \"passed\": true}, {\"check\": \"control: nonref exceeds tax\", \"actual\": [-100, 0], \"expected\": [-100, 0], \"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."}}