{"abstract":"A nonrefundable credit larger than the tax pays out cash.","category":"Tax bracket computation","checks":7,"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":"Letting refundable credits raise the nonrefundable limit still converts part of the credit into a refund.","family":"w2-tax_bracket_computation-credit-ordering-nonref-limit","id":"FA-62471","implementations":{"attempt":{"sha256":"2ba35fa3c97c3bc565852c7f8c52b6d5f331b7362737183d465557c1cc856d76","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 + r)\n    t -= use_n\n    use_c = min(c, t)\n    t -= use_c\n    cf = c - use_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 nonref-limit 1', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),\n  ('regression nonref-limit 2', (300, [['nonref', 500]]), [0, 0]),\n  ('partial repair guard 2', (0, [['nonref', 100], ['ref', 0], ['ref', 50], ['carry', 300]]), [-50, 300]),\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  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind')],\n [('regression nonref-limit 1', (0, [['nonref', 1308]]), [0, 0]),\n  ('regression nonref-limit 2', (1467, [['nonref', 0], ['carry', 50], ['nonref', 2387]]), [0, 50]),\n  ('partial repair guard 1', (444, [['nonref', 806], ['ref', 2], ['nonref', 464], ['ref', 0]]), [-2, 0]),\n  ('partial repair guard 2', (100, [['ref', 50], ['nonref', 2064]]), [-50, 0]),\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 nonref-limit 1', (0, [['nonref', 100], ['carry', 0], ['ref', 0], ['nonref', 50]]), [0, 0]),\n  ('regression nonref-limit 2', (0, [['nonref', 100], ['ref', 0], ['ref', 50], ['carry', 300]]), [-50, 300]),\n  ('partial repair guard 1', (100, [['ref', 50], ['nonref', 300], ['ref', 380]]), [-430, 0]),\n  ('partial repair guard 2', (0, [['ref', 100], ['nonref', 50], ['carry', 100], ['ref', 130]]), [-230, 100]),\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 nonref-limit 1', (444, [['nonref', 806], ['ref', 2], ['nonref', 464], ['ref', 0]]), [-2, 0]),\n  ('regression nonref-limit 2', (0, [['nonref', 889]]), [0, 0]),\n  ('partial repair guard 1', (0, [['nonref', 100], ['carry', 100], ['ref', 1667]]), [-1667, 100]),\n  ('partial repair guard 2', (100, [['nonref', 2372], ['carry', 100], ['carry', 50], ['ref', 300]]), [-300, 150]),\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 nonref-limit 1', (100, [['carry', 300], ['nonref', 300], ['carry', 50], ['nonref', 2635]]), [0, 350]),\n  ('regression nonref-limit 2', (100, [['ref', 50], ['nonref', 2064]]), [-50, 0]),\n  ('partial repair guard 1', (100, [['nonref', 100], ['ref', 50], ['nonref', 300], ['ref', 1614]]), [-1664, 0]),\n  ('partial repair guard 2', (100, [['carry', 0], ['nonref', 1027], ['ref', 2757]]), [-2757, 0]),\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":"ff6c9b28e74ab6b91fc4ddfadfc8c62404ecbb5ed6825d56b3989d8948a7d3ce","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 = n\n    t -= use_n\n    use_c = min(c, t)\n    t -= use_c\n    cf = c - use_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 nonref-limit 1', (300, [['nonref', 500], ['ref', 100]]), [-100, 0]),\n  ('regression nonref-limit 2', (300, [['nonref', 500]]), [0, 0]),\n  ('partial repair guard 2', (0, [['nonref', 100], ['ref', 0], ['ref', 50], ['carry', 300]]), [-50, 300]),\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  ('control: unknown kind', (100, [['bonus', 5]]), 'ERR:kind')],\n [('regression nonref-limit 1', (0, [['nonref', 1308]]), [0, 0]),\n  ('regression nonref-limit 2', (1467, [['nonref', 0], ['carry', 50], ['nonref', 2387]]), [0, 50]),\n  ('partial repair guard 1', (444, [['nonref', 806], ['ref', 2], ['nonref', 464], ['ref', 0]]), [-2, 0]),\n  ('partial repair guard 2', (100, [['ref', 50], ['nonref', 2064]]), [-50, 0]),\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 nonref-limit 1', (0, [['nonref', 100], ['carry', 0], ['ref', 0], ['nonref', 50]]), [0, 0]),\n  ('regression nonref-limit 2', (0, [['nonref', 100], ['ref', 0], ['ref', 50], ['carry', 300]]), [-50, 300]),\n  ('partial repair guard 1', (100, [['ref', 50], ['nonref', 300], ['ref', 380]]), [-430, 0]),\n  ('partial repair guard 2', (0, [['ref', 100], ['nonref', 50], ['carry', 100], ['ref', 130]]), [-230, 100]),\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 nonref-limit 1', (444, [['nonref', 806], ['ref', 2], ['nonref', 464], ['ref', 0]]), [-2, 0]),\n  ('regression nonref-limit 2', (0, [['nonref', 889]]), [0, 0]),\n  ('partial repair guard 1', (0, [['nonref', 100], ['carry', 100], ['ref', 1667]]), [-1667, 100]),\n  ('partial repair guard 2', (100, [['nonref', 2372], ['carry', 100], ['carry', 50], ['ref', 300]]), [-300, 150]),\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 nonref-limit 1', (100, [['carry', 300], ['nonref', 300], ['carry', 50], ['nonref', 2635]]), [0, 350]),\n  ('regression nonref-limit 2', (100, [['ref', 50], ['nonref', 2064]]), [-50, 0]),\n  ('partial repair guard 1', (100, [['nonref', 100], ['ref', 50], ['nonref', 300], ['ref', 1614]]), [-1664, 0]),\n  ('partial repair guard 2', (100, [['carry', 0], ['nonref', 1027], ['ref', 2757]]), [-2757, 0]),\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-nonref-limit","generated_at":"2026-09-29T14:47:04.968341+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":"The nonrefundable credit is applied in full instead of being limited to the remaining tax.","sha256":"08093ddc9c19664b46d00347d3acc8796ac44f5669cbdfd5af09fe36642580aa","title":"Nonrefundable credits are allowed to produce a refund · 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.708,"exit_code":1,"observations":[{"actual":[-100,100],"check":"regression nonref-limit 1","expected":[-100,0],"passed":false},{"actual":[0,0],"check":"regression nonref-limit 2","expected":[0,0],"passed":true},{"actual":[-50,350],"check":"partial repair guard 2","expected":[-50,300],"passed":false},{"actual":[-300,200],"check":"control: all kinds","expected":[-300,200],"passed":true},{"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}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression nonref-limit 1\", \"actual\": [-100, 100], \"expected\": [-100, 0], \"passed\": false}, {\"check\": \"regression nonref-limit 2\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"partial repair guard 2\", \"actual\": [-50, 350], \"expected\": [-50, 300], \"passed\": false}, {\"check\": \"control: all kinds\", \"actual\": [-300, 200], \"expected\": [-300, 200], \"passed\": true}, {\"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}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.222,"exit_code":1,"observations":[{"actual":[-100,200],"check":"regression nonref-limit 1","expected":[-100,0],"passed":false},{"actual":[0,200],"check":"regression nonref-limit 2","expected":[0,0],"passed":false},{"actual":[-50,400],"check":"partial repair guard 2","expected":[-50,300],"passed":false},{"actual":[-300,200],"check":"control: all kinds","expected":[-300,200],"passed":true},{"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}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression nonref-limit 1\", \"actual\": [-100, 200], \"expected\": [-100, 0], \"passed\": false}, {\"check\": \"regression nonref-limit 2\", \"actual\": [0, 200], \"expected\": [0, 0], \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": [-50, 400], \"expected\": [-50, 300], \"passed\": false}, {\"check\": \"control: all kinds\", \"actual\": [-300, 200], \"expected\": [-300, 200], \"passed\": true}, {\"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}], \"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."}}