{"abstract":"Workers at the cap keep accrual they should have forfeited because leave was deducted first.","category":"Shift rostering labor rules","checks":8,"contract":"Per pay period [worked minutes, leave minutes requested]. Accrual is worked * rate_bp / 10000 minutes with the fractional remainder (in 1/10000 minutes) carried to later periods. After accrual the balance is capped (excess forfeited), then the request is approved up to the balance; unapproved minutes accumulate. Return [balance, forfeited, unapproved].","contract_signature":"periods, rate_bp, cap","evaluation_group":"w2-shift-rostering-labor-rules-leave-accrual-ledger","failed_approach":"Netting the request into the cap test still forfeits the wrong amount.","family":"w2-shift-rostering-labor-rules-leave-accrual-ledger-cap-before-usage","id":"FA-94136","implementations":{"attempt":{"sha256":"c58211feb4fc0c7fcb44508edf91aae96b7120f4d24fc2f1713d1a3d2d8777fb","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(periods, rate_bp, cap):\n    bal = carry = forfeit = unappr = 0\n    for worked, used in periods:\n        num = worked * rate_bp + carry\n        bal += num // 10000\n        carry = num % 10000\n        if bal - used > cap:\n            forfeit += bal - cap\n            bal = cap\n        take = min(used, bal)\n        unappr += used - take\n        bal -= take\n    return [bal, forfeit, unappr]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: cap before usage 1', [[[2400, 0], [2400, 500]], 1207, 400], [0, 179, 100]),\n  ('regression variant: cap before usage 2',\n   [[[0, 480], [0, 0], [2280, 240], [2400, 0], [2280, 0], [2700, 900]], 833, 400], [0, 215, 1031]),\n  ('partial repair guard 3',\n   [[[1200, 0], [2280, 0], [1200, 240], [2400, 0], [2700, 0], [2700, 2000]], 1207, 600], [0, 666, 1400]),\n  ('boundary control 4', [[[99, 0], [99, 0], [2, 0]], 5000, 100], [100, 0, 0]),\n  ('boundary control 5', [[[2400, 0], [2400, 0], [2400, 0]], 1207, 11200], [869, 0, 0]),\n  ('normal control 6',\n   [[[2700, 240], [2298, 0], [2400, 240], [2700, 0], [2280, 0], [319, 0], [1200, 0]], 1207, 1200],\n   [1197, 0, 0]),\n  ('normal control 7', [[[2400, 900], [2400, 480], [419, 240], [2400, 900], [0, 0]], 833, 1200],\n   [0, 0, 1886]),\n  ('normal control 8',\n   [[[2280, 0], [1990, 0], [1908, 480], [2700, 240], [1835, 2000], [2700, 240]], 833, 11200], [0, 0, 1843])],\n [('regression: cap before usage 1', [[[0, 2000], [0, 0], [2597, 0], [2280, 2000], [2400, 0]], 1207, 400],\n   [290, 188, 3600]),\n  ('regression variant: cap before usage 2',\n   [[[2700, 0], [0, 0], [2280, 480], [2019, 900], [2400, 480], [2700, 900], [2055, 0], [2169, 2000]], 1207,\n    400],\n   [0, 311, 3101]),\n  ('partial repair guard 3',\n   [[[2700, 0], [2280, 2000], [1200, 0], [2700, 240], [0, 240], [2700, 0]], 1207, 400], [326, 271, 1680]),\n  ('boundary control 4', [[[2400, 400], [0, 400]], 1207, 11200], [0, 0, 511]),\n  ('boundary control 5', [[[99, 0], [99, 0], [2, 0]], 5000, 100], [100, 0, 0]),\n  ('normal control 6', [[[0, 0], [1200, 0]], 769, 600], [92, 0, 0]),\n  ('normal control 7',\n   [[[0, 480], [2280, 0], [0, 480], [2280, 240], [1200, 0], [1200, 0], [2700, 240]], 1207, 11200],\n   [410, 0, 685]),\n  ('normal control 8', [[[2094, 0], [2400, 2000]], 769, 1200], [0, 0, 1655])],\n [('regression: cap before usage 1',\n   [[[0, 0], [2400, 900], [2700, 0], [2280, 900], [2700, 2000], [1200, 0], [1200, 0], [2280, 0]], 1207, 600],\n   [565, 1, 2585]),\n  ('regression variant: cap before usage 2',\n   [[[2280, 900], [2700, 0], [2400, 0], [1034, 2000], [2700, 2000], [1200, 0]], 1207, 400],\n   [145, 340, 3899]),\n  ('partial repair guard 3',\n   [[[2700, 0], [0, 0], [2280, 480], [2019, 900], [2400, 480], [2700, 900], [2055, 0], [2169, 2000]], 1207,\n    400],\n   [0, 311, 3101]),\n  ('boundary control 4', [[[2400, 0], [2400, 500]], 1207, 400], [0, 179, 100]),\n  ('boundary control 5', [[[2400, 400], [0, 400]], 1207, 11200], [0, 0, 511]),\n  ('normal control 6', [[[1200, 2000], [2700, 0], [2280, 240], [0, 0], [2700, 0]], 833, 600], [400, 0, 1901]),\n  ('normal control 7', [[[2400, 0], [1200, 0], [0, 0], [0, 900], [1200, 0]], 1000, 600], [120, 0, 540]),\n  ('normal control 8', [[[2400, 2000], [0, 900], [2700, 480]], 769, 1200], [0, 0, 2988])],\n [('regression: cap before usage 1',\n   [[[2400, 240], [2280, 0], [1200, 0], [2700, 0], [2400, 0], [887, 900]], 769, 600], [0, 128, 356]),\n  ('regression variant: cap before usage 2',\n   [[[1200, 0], [1754, 0], [2700, 0], [1200, 0], [1200, 0], [2280, 480], [2400, 240], [2700, 0]], 1000, 600],\n   [390, 433, 0]),\n  ('partial repair guard 3', [[[2280, 0], [2700, 0], [1200, 240], [2400, 240]], 1000, 600], [360, 18, 0]),\n  ('boundary control 4', [[[2400, 0], [2400, 0], [2400, 0]], 1207, 11200], [869, 0, 0]),\n  ('boundary control 5', [[[2400, 0], [2400, 500]], 1207, 400], [0, 179, 100]),\n  ('normal control 6', [[[2400, 0], [1200, 0], [0, 0], [0, 900], [1200, 0]], 1000, 600], [120, 0, 540]),\n  ('normal control 7', [[[0, 240], [2280, 2000], [2400, 900], [2700, 480]], 1207, 400], [0, 0, 2730]),\n  ('normal control 8', [[[1200, 900], [2700, 2000], [2700, 900]], 769, 11200], [0, 0, 3293])],\n [('regression: cap before usage 1',\n   [[[2479, 2000], [2700, 0], [1200, 0], [1200, 0], [2400, 480], [2400, 0]], 1000, 400], [240, 350, 1833]),\n  ('regression variant: cap before usage 2',\n   [[[2400, 480], [1434, 2000], [1200, 480], [0, 900], [2400, 0], [0, 0], [2400, 0], [2400, 480]], 1207, 400],\n   [0, 469, 3333]),\n  ('partial repair guard 3',\n   [[[0, 0], [2400, 480], [2400, 240], [2400, 0], [1200, 240], [0, 480], [2280, 2000], [1200, 900]], 1207,\n    400],\n   [0, 84, 2991]),\n  ('boundary control 4', [[[99, 0], [99, 0], [2, 0]], 5000, 100], [100, 0, 0]),\n  ('boundary control 5', [[[2400, 0], [2400, 0], [2400, 0]], 1207, 11200], [869, 0, 0]),\n  ('normal control 6', [[[2280, 240], [2400, 900], [2928, 240]], 769, 600], [0, 0, 795]),\n  ('normal control 7', [[[2700, 240], [2280, 240], [2700, 900], [2400, 480], [2400, 2000]], 1000, 600],\n   [0, 0, 2612]),\n  ('normal control 8', [[[0, 480], [2400, 0], [0, 0], [2700, 0], [0, 240], [1200, 0]], 769, 600],\n   [244, 0, 480])]]\nfor label, args, expected in fixtures[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":"8c956cca19b9f474bedf438663060bc815defa24b03d8ff754694e51d475ef0c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(periods, rate_bp, cap):\n    bal = carry = forfeit = unappr = 0\n    for worked, used in periods:\n        num = worked * rate_bp + carry\n        bal += num // 10000\n        carry = num % 10000\n        take = min(used, bal)\n        unappr += used - take\n        bal -= take\n        if bal > cap:\n            forfeit += bal - cap\n            bal = cap\n    return [bal, forfeit, unappr]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: cap before usage 1', [[[2400, 0], [2400, 500]], 1207, 400], [0, 179, 100]),\n  ('regression variant: cap before usage 2',\n   [[[0, 480], [0, 0], [2280, 240], [2400, 0], [2280, 0], [2700, 900]], 833, 400], [0, 215, 1031]),\n  ('partial repair guard 3',\n   [[[1200, 0], [2280, 0], [1200, 240], [2400, 0], [2700, 0], [2700, 2000]], 1207, 600], [0, 666, 1400]),\n  ('boundary control 4', [[[99, 0], [99, 0], [2, 0]], 5000, 100], [100, 0, 0]),\n  ('boundary control 5', [[[2400, 0], [2400, 0], [2400, 0]], 1207, 11200], [869, 0, 0]),\n  ('normal control 6',\n   [[[2700, 240], [2298, 0], [2400, 240], [2700, 0], [2280, 0], [319, 0], [1200, 0]], 1207, 1200],\n   [1197, 0, 0]),\n  ('normal control 7', [[[2400, 900], [2400, 480], [419, 240], [2400, 900], [0, 0]], 833, 1200],\n   [0, 0, 1886]),\n  ('normal control 8',\n   [[[2280, 0], [1990, 0], [1908, 480], [2700, 240], [1835, 2000], [2700, 240]], 833, 11200], [0, 0, 1843])],\n [('regression: cap before usage 1', [[[0, 2000], [0, 0], [2597, 0], [2280, 2000], [2400, 0]], 1207, 400],\n   [290, 188, 3600]),\n  ('regression variant: cap before usage 2',\n   [[[2700, 0], [0, 0], [2280, 480], [2019, 900], [2400, 480], [2700, 900], [2055, 0], [2169, 2000]], 1207,\n    400],\n   [0, 311, 3101]),\n  ('partial repair guard 3',\n   [[[2700, 0], [2280, 2000], [1200, 0], [2700, 240], [0, 240], [2700, 0]], 1207, 400], [326, 271, 1680]),\n  ('boundary control 4', [[[2400, 400], [0, 400]], 1207, 11200], [0, 0, 511]),\n  ('boundary control 5', [[[99, 0], [99, 0], [2, 0]], 5000, 100], [100, 0, 0]),\n  ('normal control 6', [[[0, 0], [1200, 0]], 769, 600], [92, 0, 0]),\n  ('normal control 7',\n   [[[0, 480], [2280, 0], [0, 480], [2280, 240], [1200, 0], [1200, 0], [2700, 240]], 1207, 11200],\n   [410, 0, 685]),\n  ('normal control 8', [[[2094, 0], [2400, 2000]], 769, 1200], [0, 0, 1655])],\n [('regression: cap before usage 1',\n   [[[0, 0], [2400, 900], [2700, 0], [2280, 900], [2700, 2000], [1200, 0], [1200, 0], [2280, 0]], 1207, 600],\n   [565, 1, 2585]),\n  ('regression variant: cap before usage 2',\n   [[[2280, 900], [2700, 0], [2400, 0], [1034, 2000], [2700, 2000], [1200, 0]], 1207, 400],\n   [145, 340, 3899]),\n  ('partial repair guard 3',\n   [[[2700, 0], [0, 0], [2280, 480], [2019, 900], [2400, 480], [2700, 900], [2055, 0], [2169, 2000]], 1207,\n    400],\n   [0, 311, 3101]),\n  ('boundary control 4', [[[2400, 0], [2400, 500]], 1207, 400], [0, 179, 100]),\n  ('boundary control 5', [[[2400, 400], [0, 400]], 1207, 11200], [0, 0, 511]),\n  ('normal control 6', [[[1200, 2000], [2700, 0], [2280, 240], [0, 0], [2700, 0]], 833, 600], [400, 0, 1901]),\n  ('normal control 7', [[[2400, 0], [1200, 0], [0, 0], [0, 900], [1200, 0]], 1000, 600], [120, 0, 540]),\n  ('normal control 8', [[[2400, 2000], [0, 900], [2700, 480]], 769, 1200], [0, 0, 2988])],\n [('regression: cap before usage 1',\n   [[[2400, 240], [2280, 0], [1200, 0], [2700, 0], [2400, 0], [887, 900]], 769, 600], [0, 128, 356]),\n  ('regression variant: cap before usage 2',\n   [[[1200, 0], [1754, 0], [2700, 0], [1200, 0], [1200, 0], [2280, 480], [2400, 240], [2700, 0]], 1000, 600],\n   [390, 433, 0]),\n  ('partial repair guard 3', [[[2280, 0], [2700, 0], [1200, 240], [2400, 240]], 1000, 600], [360, 18, 0]),\n  ('boundary control 4', [[[2400, 0], [2400, 0], [2400, 0]], 1207, 11200], [869, 0, 0]),\n  ('boundary control 5', [[[2400, 0], [2400, 500]], 1207, 400], [0, 179, 100]),\n  ('normal control 6', [[[2400, 0], [1200, 0], [0, 0], [0, 900], [1200, 0]], 1000, 600], [120, 0, 540]),\n  ('normal control 7', [[[0, 240], [2280, 2000], [2400, 900], [2700, 480]], 1207, 400], [0, 0, 2730]),\n  ('normal control 8', [[[1200, 900], [2700, 2000], [2700, 900]], 769, 11200], [0, 0, 3293])],\n [('regression: cap before usage 1',\n   [[[2479, 2000], [2700, 0], [1200, 0], [1200, 0], [2400, 480], [2400, 0]], 1000, 400], [240, 350, 1833]),\n  ('regression variant: cap before usage 2',\n   [[[2400, 480], [1434, 2000], [1200, 480], [0, 900], [2400, 0], [0, 0], [2400, 0], [2400, 480]], 1207, 400],\n   [0, 469, 3333]),\n  ('partial repair guard 3',\n   [[[0, 0], [2400, 480], [2400, 240], [2400, 0], [1200, 240], [0, 480], [2280, 2000], [1200, 900]], 1207,\n    400],\n   [0, 84, 2991]),\n  ('boundary control 4', [[[99, 0], [99, 0], [2, 0]], 5000, 100], [100, 0, 0]),\n  ('boundary control 5', [[[2400, 0], [2400, 0], [2400, 0]], 1207, 11200], [869, 0, 0]),\n  ('normal control 6', [[[2280, 240], [2400, 900], [2928, 240]], 769, 600], [0, 0, 795]),\n  ('normal control 7', [[[2700, 240], [2280, 240], [2700, 900], [2400, 480], [2400, 2000]], 1000, 600],\n   [0, 0, 2612]),\n  ('normal control 8', [[[0, 480], [2400, 0], [0, 0], [2700, 0], [0, 240], [1200, 0]], 769, 600],\n   [244, 0, 480])]]\nfor label, args, expected in fixtures[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":"Stipulated toy labor rule for a bounded roster model; it is not legal advice and does not claim conformance with any jurisdiction, award, or collective agreement. 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-shift-rostering-labor-rules-leave-accrual-ledger-cap-before-usage","generated_at":"2026-09-29T14:52:01.494990+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Leave accrual ledgers attached to rosters must carry fractions and apply caps in the right order.","root_cause":"Usage is deducted before the balance is capped.","sha256":"1c75cbc100f5370f10c47f6b56daf18a4fd3d3d23601daadf178c53247d0b7dc","title":"Leave taken before the accrual cap is enforced · 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":41.839,"exit_code":1,"observations":[{"actual":[79,0,0],"check":"regression: cap before usage 1","expected":[0,179,100],"passed":false},{"actual":[0,0,816],"check":"regression variant: cap before usage 2","expected":[0,215,1031],"passed":false},{"actual":[0,340,1074],"check":"partial repair guard 3","expected":[0,666,1400],"passed":false},{"actual":[100,0,0],"check":"boundary control 4","expected":[100,0,0],"passed":true},{"actual":[869,0,0],"check":"boundary control 5","expected":[869,0,0],"passed":true},{"actual":[1197,0,0],"check":"normal control 6","expected":[1197,0,0],"passed":true},{"actual":[0,0,1886],"check":"normal control 7","expected":[0,0,1886],"passed":true},{"actual":[0,0,1843],"check":"normal control 8","expected":[0,0,1843],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: cap before usage 1\", \"actual\": [79, 0, 0], \"expected\": [0, 179, 100], \"passed\": false}, {\"check\": \"regression variant: cap before usage 2\", \"actual\": [0, 0, 816], \"expected\": [0, 215, 1031], \"passed\": false}, {\"check\": \"partial repair guard 3\", \"actual\": [0, 340, 1074], \"expected\": [0, 666, 1400], \"passed\": false}, {\"check\": \"boundary control 4\", \"actual\": [100, 0, 0], \"expected\": [100, 0, 0], \"passed\": true}, {\"check\": \"boundary control 5\", \"actual\": [869, 0, 0], \"expected\": [869, 0, 0], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [1197, 0, 0], \"expected\": [1197, 0, 0], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [0, 0, 1886], \"expected\": [0, 0, 1886], \"passed\": true}, {\"check\": \"normal control 8\", \"actual\": [0, 0, 1843], \"expected\": [0, 0, 1843], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.29,"exit_code":1,"observations":[{"actual":[79,0,0],"check":"regression: cap before usage 1","expected":[0,179,100],"passed":false},{"actual":[0,0,816],"check":"regression variant: cap before usage 2","expected":[0,215,1031],"passed":false},{"actual":[0,340,1074],"check":"partial repair guard 3","expected":[0,666,1400],"passed":false},{"actual":[100,0,0],"check":"boundary control 4","expected":[100,0,0],"passed":true},{"actual":[869,0,0],"check":"boundary control 5","expected":[869,0,0],"passed":true},{"actual":[1197,0,0],"check":"normal control 6","expected":[1197,0,0],"passed":true},{"actual":[0,0,1886],"check":"normal control 7","expected":[0,0,1886],"passed":true},{"actual":[0,0,1843],"check":"normal control 8","expected":[0,0,1843],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: cap before usage 1\", \"actual\": [79, 0, 0], \"expected\": [0, 179, 100], \"passed\": false}, {\"check\": \"regression variant: cap before usage 2\", \"actual\": [0, 0, 816], \"expected\": [0, 215, 1031], \"passed\": false}, {\"check\": \"partial repair guard 3\", \"actual\": [0, 340, 1074], \"expected\": [0, 666, 1400], \"passed\": false}, {\"check\": \"boundary control 4\", \"actual\": [100, 0, 0], \"expected\": [100, 0, 0], \"passed\": true}, {\"check\": \"boundary control 5\", \"actual\": [869, 0, 0], \"expected\": [869, 0, 0], \"passed\": true}, {\"check\": \"normal control 6\", \"actual\": [1197, 0, 0], \"expected\": [1197, 0, 0], \"passed\": true}, {\"check\": \"normal control 7\", \"actual\": [0, 0, 1886], \"expected\": [0, 0, 1886], \"passed\": true}, {\"check\": \"normal control 8\", \"actual\": [0, 0, 1843], \"expected\": [0, 0, 1843], \"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."}}