FAILURE MAP
← Case archive

FA-59256 / Payroll withholding rules / Open access

Daily, weekly and seventh-day overtime split: seventh-day trigger · case 01

Anyone working the last day of the week gets seventh-day premium pay.

Verified by executionVariant 1 · 10 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The seventh-day rule checks only the last day instead of all seven consecutive days.

VERIFIED REPAIR

Restore the contract rule at the seventh-day trigger step: use `worked_all = all(h > 0 for h in hours)`.

Unsuccessful approach: The attempt accepts six worked days, still paying the premium without a full seven-day streak.

Case contract

Input seven daily hour counts (workweek order). If all seven days are worked, day 7 hours are 1.5x up to 8 and double beyond 8. Other days: first 8 regular, 8-12 at 1.5x, over 12 double; regular hours beyond a weekly total of 40 regular hours become 1.5x. Return [regular, overtime, double].

Why this case matters

Stacked daily and weekly overtime rules must not double count hours or miss the seventh consecutive day.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    hours = x
    reg = ot = dt = 0
    worked_all = hours[6] > 0
    for i, h in enumerate(hours):
        if i == 6 and worked_all:
            ot += min(h, 8)
            dt += max(0, h - 8)
            continue
        d_reg = min(h, 8)
        d_ot = max(0, min(h, 12) - 8)
        d_dt = max(0, h - 12)
        room = max(0, 40 - reg)
        if d_reg > room:
            d_ot += d_reg - room
            d_reg = room
        reg += d_reg
        ot += d_ot
        dt += d_dt
    return [reg, ot, dt]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('regression (boundary)', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('partial-repair probe', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('partial-repair probe', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [12, 12, 8, 7, 0, 8, 0], [39, 8, 0]), ('normal control', [0, 12, 10, 8, 8, 12, 0], [40, 10, 0]), ('normal control', [10, 8, 6, 12, 9, 10, 0], [40, 15, 0]), ('normal control', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2])], [('regression', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('partial-repair probe', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('partial-repair probe', [9, 8, 8, 0, 12, 8, 12], [40, 17, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 0, 0, 7, 10, 8, 0], [23, 2, 0]), ('normal control', [8, 8, 5, 0, 0, 10, 0], [29, 2, 0]), ('normal control', [0, 7, 12, 8, 0, 7, 0], [30, 4, 0]), ('normal control', [0, 4, 4, 9, 8, 8, 0], [32, 1, 0])], [('regression', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('partial-repair probe', [0, 10, 12, 8, 10, 12, 9], [40, 21, 0]), ('partial-repair probe', [9, 12, 8, 0, 1, 8, 8], [40, 6, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 12, 0, 0, 10, 8, 0], [24, 6, 0]), ('normal control', [12, 7, 12, 0, 8, 8, 0], [39, 8, 0]), ('normal control', [8, 8, 10, 8, 8, 8, 6], [40, 16, 0]), ('normal control', [14, 10, 12, 6, 12, 0, 0], [38, 14, 2])], [('regression', [9, 8, 8, 0, 12, 8, 12], [40, 17, 0]), ('regression', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('partial-repair probe', [7, 8, 8, 0, 9, 8, 8], [40, 8, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 2, 8, 8, 12, 12, 0], [34, 8, 0]), ('normal control', [8, 8, 0, 12, 12, 0, 0], [32, 8, 0]), ('normal control', [7, 0, 8, 0, 8, 12, 0], [31, 4, 0]), ('normal control', [12, 4, 12, 12, 2, 9, 14], [38, 21, 6])], [('regression', [0, 10, 12, 8, 10, 12, 9], [40, 21, 0]), ('regression', [0, 0, 0, 8, 0, 0, 8], [16, 0, 0]), ('partial-repair probe', [8, 8, 0, 12, 8, 12, 12], [40, 20, 0]), ('partial-repair probe', [8, 12, 0, 12, 9, 8, 10], [40, 19, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [9, 9, 6, 8, 0, 12, 0], [38, 6, 0]), ('normal control', [0, 12, 3, 6, 12, 12, 0], [33, 12, 0]), ('normal control', [0, 0, 0, 9, 0, 8, 0], [16, 1, 0]), ('normal control', [0, 8, 6, 8, 6, 12, 0], [36, 4, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression 0[33, 9, 0][40, 2, 0]Failed
regression (boundary) 1[0, 8, 5][8, 4, 1]Failed
partial-repair probe 2[31, 16, 4][39, 12, 0]Failed
partial-repair probe 3[34, 12, 0][40, 6, 0]Failed
boundary control 4[40, 16, 0][40, 16, 0]Passed
boundary control 5[40, 10, 0][40, 10, 0]Passed
normal control 6[39, 8, 0][39, 8, 0]Passed
normal control 7[40, 10, 0][40, 10, 0]Passed
normal control 8[40, 15, 0][40, 15, 0]Passed
normal control 9[39, 9, 2][39, 9, 2]Passed

SHA-256 / 5ec97c7f7ddbf1fbbeb346fa42a55664f50d69ca8ad1daa995b423f9cb715401

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    hours = x
    reg = ot = dt = 0
    worked_all = sum(1 for h in hours if h > 0) >= 6
    for i, h in enumerate(hours):
        if i == 6 and worked_all:
            ot += min(h, 8)
            dt += max(0, h - 8)
            continue
        d_reg = min(h, 8)
        d_ot = max(0, min(h, 12) - 8)
        d_dt = max(0, h - 12)
        room = max(0, 40 - reg)
        if d_reg > room:
            d_ot += d_reg - room
            d_reg = room
        reg += d_reg
        ot += d_ot
        dt += d_dt
    return [reg, ot, dt]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('regression (boundary)', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('partial-repair probe', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('partial-repair probe', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [12, 12, 8, 7, 0, 8, 0], [39, 8, 0]), ('normal control', [0, 12, 10, 8, 8, 12, 0], [40, 10, 0]), ('normal control', [10, 8, 6, 12, 9, 10, 0], [40, 15, 0]), ('normal control', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2])], [('regression', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('partial-repair probe', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('partial-repair probe', [9, 8, 8, 0, 12, 8, 12], [40, 17, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 0, 0, 7, 10, 8, 0], [23, 2, 0]), ('normal control', [8, 8, 5, 0, 0, 10, 0], [29, 2, 0]), ('normal control', [0, 7, 12, 8, 0, 7, 0], [30, 4, 0]), ('normal control', [0, 4, 4, 9, 8, 8, 0], [32, 1, 0])], [('regression', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('partial-repair probe', [0, 10, 12, 8, 10, 12, 9], [40, 21, 0]), ('partial-repair probe', [9, 12, 8, 0, 1, 8, 8], [40, 6, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 12, 0, 0, 10, 8, 0], [24, 6, 0]), ('normal control', [12, 7, 12, 0, 8, 8, 0], [39, 8, 0]), ('normal control', [8, 8, 10, 8, 8, 8, 6], [40, 16, 0]), ('normal control', [14, 10, 12, 6, 12, 0, 0], [38, 14, 2])], [('regression', [9, 8, 8, 0, 12, 8, 12], [40, 17, 0]), ('regression', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('partial-repair probe', [7, 8, 8, 0, 9, 8, 8], [40, 8, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 2, 8, 8, 12, 12, 0], [34, 8, 0]), ('normal control', [8, 8, 0, 12, 12, 0, 0], [32, 8, 0]), ('normal control', [7, 0, 8, 0, 8, 12, 0], [31, 4, 0]), ('normal control', [12, 4, 12, 12, 2, 9, 14], [38, 21, 6])], [('regression', [0, 10, 12, 8, 10, 12, 9], [40, 21, 0]), ('regression', [0, 0, 0, 8, 0, 0, 8], [16, 0, 0]), ('partial-repair probe', [8, 8, 0, 12, 8, 12, 12], [40, 20, 0]), ('partial-repair probe', [8, 12, 0, 12, 9, 8, 10], [40, 19, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [9, 9, 6, 8, 0, 12, 0], [38, 6, 0]), ('normal control', [0, 12, 3, 6, 12, 12, 0], [33, 12, 0]), ('normal control', [0, 0, 0, 9, 0, 8, 0], [16, 1, 0]), ('normal control', [0, 8, 6, 8, 6, 12, 0], [36, 4, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression 0[33, 9, 0][40, 2, 0]Failed
regression (boundary) 1[8, 4, 1][8, 4, 1]Passed
partial-repair probe 2[31, 16, 4][39, 12, 0]Failed
partial-repair probe 3[34, 12, 0][40, 6, 0]Failed
boundary control 4[40, 16, 0][40, 16, 0]Passed
boundary control 5[40, 10, 0][40, 10, 0]Passed
normal control 6[39, 8, 0][39, 8, 0]Passed
normal control 7[40, 10, 0][40, 10, 0]Passed
normal control 8[40, 15, 0][40, 15, 0]Passed
normal control 9[39, 9, 2][39, 9, 2]Passed

SHA-256 / 21d88e680fa505f24487b6c6ba3e0abcb226a4d42cc076b2992a2cab76a4c976

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    hours = x
    reg = ot = dt = 0
    worked_all = all(h > 0 for h in hours)
    for i, h in enumerate(hours):
        if i == 6 and worked_all:
            ot += min(h, 8)
            dt += max(0, h - 8)
            continue
        d_reg = min(h, 8)
        d_ot = max(0, min(h, 12) - 8)
        d_dt = max(0, h - 12)
        room = max(0, 40 - reg)
        if d_reg > room:
            d_ot += d_reg - room
            d_reg = room
        reg += d_reg
        ot += d_ot
        dt += d_dt
    return [reg, ot, dt]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('regression (boundary)', [0, 0, 0, 0, 0, 0, 13], [8, 4, 1]), ('partial-repair probe', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('partial-repair probe', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [12, 12, 8, 7, 0, 8, 0], [39, 8, 0]), ('normal control', [0, 12, 10, 8, 8, 12, 0], [40, 10, 0]), ('normal control', [10, 8, 6, 12, 9, 10, 0], [40, 15, 0]), ('normal control', [14, 9, 8, 7, 0, 12, 0], [39, 9, 2])], [('regression', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('regression', [6, 8, 9, 0, 8, 3, 8], [40, 2, 0]), ('partial-repair probe', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('partial-repair probe', [9, 8, 8, 0, 12, 8, 12], [40, 17, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 0, 0, 7, 10, 8, 0], [23, 2, 0]), ('normal control', [8, 8, 5, 0, 0, 10, 0], [29, 2, 0]), ('normal control', [0, 7, 12, 8, 0, 7, 0], [30, 4, 0]), ('normal control', [0, 4, 4, 9, 8, 8, 0], [32, 1, 0])], [('regression', [8, 2, 8, 0, 12, 9, 7], [40, 6, 0]), ('regression', [8, 7, 14, 0, 12, 0, 8], [39, 8, 2]), ('partial-repair probe', [0, 10, 12, 8, 10, 12, 9], [40, 21, 0]), ('partial-repair probe', [9, 12, 8, 0, 1, 8, 8], [40, 6, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 12, 0, 0, 10, 8, 0], [24, 6, 0]), ('normal control', [12, 7, 12, 0, 8, 8, 0], [39, 8, 0]), ('normal control', [8, 8, 10, 8, 8, 8, 6], [40, 16, 0]), ('normal control', [14, 10, 12, 6, 12, 0, 0], [38, 14, 2])], [('regression', [9, 8, 8, 0, 12, 8, 12], [40, 17, 0]), ('regression', [12, 8, 3, 0, 12, 4, 12], [39, 12, 0]), ('partial-repair probe', [8, 8, 7, 8, 0, 14, 6], [40, 9, 2]), ('partial-repair probe', [7, 8, 8, 0, 9, 8, 8], [40, 8, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [0, 2, 8, 8, 12, 12, 0], [34, 8, 0]), ('normal control', [8, 8, 0, 12, 12, 0, 0], [32, 8, 0]), ('normal control', [7, 0, 8, 0, 8, 12, 0], [31, 4, 0]), ('normal control', [12, 4, 12, 12, 2, 9, 14], [38, 21, 6])], [('regression', [0, 10, 12, 8, 10, 12, 9], [40, 21, 0]), ('regression', [0, 0, 0, 8, 0, 0, 8], [16, 0, 0]), ('partial-repair probe', [8, 8, 0, 12, 8, 12, 12], [40, 20, 0]), ('partial-repair probe', [8, 12, 0, 12, 9, 8, 10], [40, 19, 0]), ('boundary control', [8, 8, 8, 8, 8, 8, 8], [40, 16, 0]), ('boundary control', [10, 10, 10, 10, 10, 0, 0], [40, 10, 0]), ('normal control', [9, 9, 6, 8, 0, 12, 0], [38, 6, 0]), ('normal control', [0, 12, 3, 6, 12, 12, 0], [33, 12, 0]), ('normal control', [0, 0, 0, 9, 0, 8, 0], [16, 1, 0]), ('normal control', [0, 8, 6, 8, 6, 12, 0], [36, 4, 0])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression 0[40, 2, 0][40, 2, 0]Passed
regression (boundary) 1[8, 4, 1][8, 4, 1]Passed
partial-repair probe 2[39, 12, 0][39, 12, 0]Passed
partial-repair probe 3[40, 6, 0][40, 6, 0]Passed
boundary control 4[40, 16, 0][40, 16, 0]Passed
boundary control 5[40, 10, 0][40, 10, 0]Passed
normal control 6[39, 8, 0][39, 8, 0]Passed
normal control 7[40, 10, 0][40, 10, 0]Passed
normal control 8[40, 15, 0][40, 15, 0]Passed
normal control 9[39, 9, 2][39, 9, 2]Passed

SHA-256 / b0d6a07017775345a5d5137691054ef330a453db32e215516e220414c4a747e0

Verification & scope

A deterministic teaching model of a stipulated payroll rule with toy thresholds and rates. It makes no claim of conformance to any tax authority, statute or jurisdiction and is not payroll 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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:46:34.505379+00:00.

Case digest / ee81574f4b4d5cbfe9a04c8b8d7a2e84c5dfd90325be8dbcbbfcd50173446131