FAILURE MAP
← Case archive

FA-93871 / Shift rostering labor rules / Open access

Seventh-day premium triggered by any Sunday shift · case 01

A worker with a normal Sunday shift after days off receives seventh-consecutive-day premiums.

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

ROOT CAUSE

The seventh-day rule checks only whether day 7 was worked, not whether all seven days were worked.

VERIFIED REPAIR

Apply the seventh-day rates only when every day of the workweek has worked minutes.

Unsuccessful approach: Counting six worked days still triggers the premium when a mid-week day was off.

Case contract

Seven daily worked minutes (Mon..Sun) and an hourly rate in cents. Daily: first 480 minutes regular, next 240 at 1.5x, beyond 720 at 2x. If all seven days are worked, day 7 pays its first 480 minutes at 1.5x and the rest at 2x. Regular minutes above 2400 in the week move to 1.5x (daily overtime minutes never count toward the weekly threshold). Pay is computed exactly and rounded half up to a cent once. Return [regular, ot15, ot2, pay_cents].

Why this case matters

Overtime classification mistakes are a classic payroll-roster defect: pyramiding, seventh-day rules and rounding stage all change what workers are paid.

1 / The failure

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

N = 1
observations = []
def solve(days, rate):
    reg = ot15 = ot2 = 0
    seventh = days[6] > 0
    for d, m in enumerate(days):
        if d == 6 and seventh:
            ot15 += min(m, 480)
            ot2 += max(m - 480, 0)
            continue
        reg += min(m, 480)
        ot15 += min(max(m - 480, 0), 240)
        ot2 += max(m - 720, 0)
    excess = max(reg - 2400, 0)
    reg -= excess
    ot15 += excess
    units = reg * rate * 2 + ot15 * rate * 3 + ot2 * rate * 4
    pay = (units + 60) // 120
    return [reg, ot15, ot2, pay]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: seventh day detection 1', [[0, 450, 480, 480, 540, 481, 540], 2000], [2400, 571, 0, 108550]),
  ('regression variant: seventh day detection 2', [[240, 540, 720, 240, 600, 0, 780], 90],
   [2400, 660, 60, 5265]),
  ('partial repair guard 3', [[720, 720, 900, 0, 780, 240, 780], 1725], [2400, 1440, 300, 148350]),
  ('boundary control 4', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
  ('boundary control 5', [[9, 0, 0, 0, 0, 0, 0], 30], [9, 0, 0, 5]),
  ('normal control 6', [[481, 0, 900, 240, 540, 900, 480], 2250], [2400, 781, 360, 160931]),
  ('normal control 7', [[720, 540, 240, 481, 900, 780, 481], 2000], [2400, 1501, 241, 171117]),
  ('normal control 8', [[510, 510, 510, 480, 510, 510, 300], 2000], [2400, 930, 0, 126500])],
 [('regression: seventh day detection 1', [[600, 481, 0, 540, 0, 450, 720], 2250], [2370, 421, 0, 112556]),
  ('regression variant: seventh day detection 2', [[780, 600, 780, 0, 600, 480, 540], 1725],
   [2400, 1260, 120, 130238]),
  ('partial repair guard 3', [[203, 0, 480, 481, 720, 720, 540], 90], [2400, 744, 0, 5274]),
  ('boundary control 4', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
  ('boundary control 5', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
  ('normal control 6', [[600, 0, 600, 540, 0, 481, 450], 1725], [2370, 301, 0, 81118]),
  ('normal control 7', [[450, 540, 450, 240, 240, 720, 481], 1725], [2340, 780, 1, 100970]),
  ('normal control 8', [[481, 600, 780, 450, 0, 0, 721], 1725], [2370, 601, 61, 97563])],
 [('regression: seventh day detection 1', [[481, 433, 0, 0, 450, 780, 780], 2000], [2323, 481, 120, 109483]),
  ('regression variant: seventh day detection 2', [[0, 0, 540, 481, 450, 540, 450], 1725],
   [2340, 121, 0, 72493]),
  ('partial repair guard 3', [[737, 951, 39, 0, 720, 600, 240], 1500], [2199, 840, 248, 98875]),
  ('boundary control 4', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
  ('boundary control 5', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
  ('normal control 6', [[780, 600, 721, 240, 780, 721, 780], 90], [2400, 1800, 422, 8916]),
  ('normal control 7', [[450, 0, 540, 900, 780, 0, 600], 1500], [2370, 660, 240, 96000]),
  ('normal control 8', [[300, 600, 300, 480, 600, 480, 600], 30], [2400, 840, 120, 1950])],
 [('regression: seventh day detection 1', [[540, 176, 0, 780, 450, 0, 481], 2250], [2066, 301, 60, 98906]),
  ('regression variant: seventh day detection 2', [[900, 0, 720, 540, 480, 450, 780], 2250],
   [2400, 1230, 240, 177188]),
  ('partial repair guard 3', [[450, 0, 586, 480, 900, 450, 720], 90], [2400, 1006, 180, 6404]),
  ('boundary control 4', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
  ('boundary control 5', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
  ('normal control 6', [[540, 540, 780, 240, 480, 480, 0], 90], [2400, 600, 60, 5130]),
  ('normal control 7', [[300, 480, 600, 510, 300, 510, 300], 1725], [2400, 600, 0, 94875]),
  ('normal control 8', [[480, 721, 733, 899, 540, 900, 0], 90], [2400, 1500, 373, 8094])],
 [('regression: seventh day detection 1', [[480, 481, 900, 721, 0, 481, 720], 1500],
   [2400, 1202, 181, 114125]),
  ('regression variant: seventh day detection 2', [[240, 600, 0, 780, 450, 900, 900], 90],
   [2400, 1050, 420, 7223]),
  ('partial repair guard 3', [[721, 450, 540, 0, 190, 480, 900], 90], [2400, 700, 181, 5718]),
  ('boundary control 4', [[540, 540, 540, 540, 540, 540, 60], 2000], [2400, 900, 0, 125000]),
  ('boundary control 5', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
  ('normal control 6', [[720, 480, 900, 600, 240, 900, 720], 2000], [2400, 1560, 600, 198000]),
  ('normal control 7', [[904, 780, 481, 0, 900, 0, 481], 30], [2400, 722, 424, 2166]),
  ('normal control 8', [[600, 720, 240, 540, 480, 450, 780], 1725], [2400, 1110, 300, 134119])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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: seventh day detection 1[2370, 541, 60, 110050][2400, 571, 0, 108550]Failed
regression variant: seventh day detection 2[1920, 900, 300, 5805][2400, 660, 60, 5265]Failed
partial repair guard 3[2160, 1440, 540, 155250][2400, 1440, 300, 148350]Failed
boundary control 4[2400, 480, 0, 104000][2400, 480, 0, 104000]Passed
boundary control 5[9, 0, 0, 5][9, 0, 0, 5]Passed
normal control 6[2160, 1021, 360, 165431][2400, 781, 360, 160931]Failed
normal control 7[2400, 1501, 241, 171117][2400, 1501, 241, 171117]Passed
normal control 8[2400, 930, 0, 126500][2400, 930, 0, 126500]Passed

SHA-256 / e9ef5465f1f646e2e9868ac6a470b0964a1d53edb2b7a25bf2ae63ccfb597306

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(days, rate):
    reg = ot15 = ot2 = 0
    seventh = sum(1 for m in days if m > 0) >= 6
    for d, m in enumerate(days):
        if d == 6 and seventh:
            ot15 += min(m, 480)
            ot2 += max(m - 480, 0)
            continue
        reg += min(m, 480)
        ot15 += min(max(m - 480, 0), 240)
        ot2 += max(m - 720, 0)
    excess = max(reg - 2400, 0)
    reg -= excess
    ot15 += excess
    units = reg * rate * 2 + ot15 * rate * 3 + ot2 * rate * 4
    pay = (units + 60) // 120
    return [reg, ot15, ot2, pay]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: seventh day detection 1', [[0, 450, 480, 480, 540, 481, 540], 2000], [2400, 571, 0, 108550]),
  ('regression variant: seventh day detection 2', [[240, 540, 720, 240, 600, 0, 780], 90],
   [2400, 660, 60, 5265]),
  ('partial repair guard 3', [[720, 720, 900, 0, 780, 240, 780], 1725], [2400, 1440, 300, 148350]),
  ('boundary control 4', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
  ('boundary control 5', [[9, 0, 0, 0, 0, 0, 0], 30], [9, 0, 0, 5]),
  ('normal control 6', [[481, 0, 900, 240, 540, 900, 480], 2250], [2400, 781, 360, 160931]),
  ('normal control 7', [[720, 540, 240, 481, 900, 780, 481], 2000], [2400, 1501, 241, 171117]),
  ('normal control 8', [[510, 510, 510, 480, 510, 510, 300], 2000], [2400, 930, 0, 126500])],
 [('regression: seventh day detection 1', [[600, 481, 0, 540, 0, 450, 720], 2250], [2370, 421, 0, 112556]),
  ('regression variant: seventh day detection 2', [[780, 600, 780, 0, 600, 480, 540], 1725],
   [2400, 1260, 120, 130238]),
  ('partial repair guard 3', [[203, 0, 480, 481, 720, 720, 540], 90], [2400, 744, 0, 5274]),
  ('boundary control 4', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
  ('boundary control 5', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
  ('normal control 6', [[600, 0, 600, 540, 0, 481, 450], 1725], [2370, 301, 0, 81118]),
  ('normal control 7', [[450, 540, 450, 240, 240, 720, 481], 1725], [2340, 780, 1, 100970]),
  ('normal control 8', [[481, 600, 780, 450, 0, 0, 721], 1725], [2370, 601, 61, 97563])],
 [('regression: seventh day detection 1', [[481, 433, 0, 0, 450, 780, 780], 2000], [2323, 481, 120, 109483]),
  ('regression variant: seventh day detection 2', [[0, 0, 540, 481, 450, 540, 450], 1725],
   [2340, 121, 0, 72493]),
  ('partial repair guard 3', [[737, 951, 39, 0, 720, 600, 240], 1500], [2199, 840, 248, 98875]),
  ('boundary control 4', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
  ('boundary control 5', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
  ('normal control 6', [[780, 600, 721, 240, 780, 721, 780], 90], [2400, 1800, 422, 8916]),
  ('normal control 7', [[450, 0, 540, 900, 780, 0, 600], 1500], [2370, 660, 240, 96000]),
  ('normal control 8', [[300, 600, 300, 480, 600, 480, 600], 30], [2400, 840, 120, 1950])],
 [('regression: seventh day detection 1', [[540, 176, 0, 780, 450, 0, 481], 2250], [2066, 301, 60, 98906]),
  ('regression variant: seventh day detection 2', [[900, 0, 720, 540, 480, 450, 780], 2250],
   [2400, 1230, 240, 177188]),
  ('partial repair guard 3', [[450, 0, 586, 480, 900, 450, 720], 90], [2400, 1006, 180, 6404]),
  ('boundary control 4', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
  ('boundary control 5', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
  ('normal control 6', [[540, 540, 780, 240, 480, 480, 0], 90], [2400, 600, 60, 5130]),
  ('normal control 7', [[300, 480, 600, 510, 300, 510, 300], 1725], [2400, 600, 0, 94875]),
  ('normal control 8', [[480, 721, 733, 899, 540, 900, 0], 90], [2400, 1500, 373, 8094])],
 [('regression: seventh day detection 1', [[480, 481, 900, 721, 0, 481, 720], 1500],
   [2400, 1202, 181, 114125]),
  ('regression variant: seventh day detection 2', [[240, 600, 0, 780, 450, 900, 900], 90],
   [2400, 1050, 420, 7223]),
  ('partial repair guard 3', [[721, 450, 540, 0, 190, 480, 900], 90], [2400, 700, 181, 5718]),
  ('boundary control 4', [[540, 540, 540, 540, 540, 540, 60], 2000], [2400, 900, 0, 125000]),
  ('boundary control 5', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
  ('normal control 6', [[720, 480, 900, 600, 240, 900, 720], 2000], [2400, 1560, 600, 198000]),
  ('normal control 7', [[904, 780, 481, 0, 900, 0, 481], 30], [2400, 722, 424, 2166]),
  ('normal control 8', [[600, 720, 240, 540, 480, 450, 780], 1725], [2400, 1110, 300, 134119])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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: seventh day detection 1[2370, 541, 60, 110050][2400, 571, 0, 108550]Failed
regression variant: seventh day detection 2[1920, 900, 300, 5805][2400, 660, 60, 5265]Failed
partial repair guard 3[2160, 1440, 540, 155250][2400, 1440, 300, 148350]Failed
boundary control 4[2400, 480, 0, 104000][2400, 480, 0, 104000]Passed
boundary control 5[9, 0, 0, 5][9, 0, 0, 5]Passed
normal control 6[2160, 1021, 360, 165431][2400, 781, 360, 160931]Failed
normal control 7[2400, 1501, 241, 171117][2400, 1501, 241, 171117]Passed
normal control 8[2400, 930, 0, 126500][2400, 930, 0, 126500]Passed

SHA-256 / 393207a8d7f54588f0f0a24b698ae2d43990b11117eca1009fb944cbf9898e7c

3 / The verified repair

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

N = 1
observations = []
def solve(days, rate):
    reg = ot15 = ot2 = 0
    seventh = all(m > 0 for m in days)
    for d, m in enumerate(days):
        if d == 6 and seventh:
            ot15 += min(m, 480)
            ot2 += max(m - 480, 0)
            continue
        reg += min(m, 480)
        ot15 += min(max(m - 480, 0), 240)
        ot2 += max(m - 720, 0)
    excess = max(reg - 2400, 0)
    reg -= excess
    ot15 += excess
    units = reg * rate * 2 + ot15 * rate * 3 + ot2 * rate * 4
    pay = (units + 60) // 120
    return [reg, ot15, ot2, pay]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: seventh day detection 1', [[0, 450, 480, 480, 540, 481, 540], 2000], [2400, 571, 0, 108550]),
  ('regression variant: seventh day detection 2', [[240, 540, 720, 240, 600, 0, 780], 90],
   [2400, 660, 60, 5265]),
  ('partial repair guard 3', [[720, 720, 900, 0, 780, 240, 780], 1725], [2400, 1440, 300, 148350]),
  ('boundary control 4', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
  ('boundary control 5', [[9, 0, 0, 0, 0, 0, 0], 30], [9, 0, 0, 5]),
  ('normal control 6', [[481, 0, 900, 240, 540, 900, 480], 2250], [2400, 781, 360, 160931]),
  ('normal control 7', [[720, 540, 240, 481, 900, 780, 481], 2000], [2400, 1501, 241, 171117]),
  ('normal control 8', [[510, 510, 510, 480, 510, 510, 300], 2000], [2400, 930, 0, 126500])],
 [('regression: seventh day detection 1', [[600, 481, 0, 540, 0, 450, 720], 2250], [2370, 421, 0, 112556]),
  ('regression variant: seventh day detection 2', [[780, 600, 780, 0, 600, 480, 540], 1725],
   [2400, 1260, 120, 130238]),
  ('partial repair guard 3', [[203, 0, 480, 481, 720, 720, 540], 90], [2400, 744, 0, 5274]),
  ('boundary control 4', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
  ('boundary control 5', [[480, 480, 480, 480, 480, 480, 0], 2000], [2400, 480, 0, 104000]),
  ('normal control 6', [[600, 0, 600, 540, 0, 481, 450], 1725], [2370, 301, 0, 81118]),
  ('normal control 7', [[450, 540, 450, 240, 240, 720, 481], 1725], [2340, 780, 1, 100970]),
  ('normal control 8', [[481, 600, 780, 450, 0, 0, 721], 1725], [2370, 601, 61, 97563])],
 [('regression: seventh day detection 1', [[481, 433, 0, 0, 450, 780, 780], 2000], [2323, 481, 120, 109483]),
  ('regression variant: seventh day detection 2', [[0, 0, 540, 481, 450, 540, 450], 1725],
   [2340, 121, 0, 72493]),
  ('partial repair guard 3', [[737, 951, 39, 0, 720, 600, 240], 1500], [2199, 840, 248, 98875]),
  ('boundary control 4', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
  ('boundary control 5', [[0, 480, 480, 480, 480, 480, 480], 1500], [2400, 480, 0, 78000]),
  ('normal control 6', [[780, 600, 721, 240, 780, 721, 780], 90], [2400, 1800, 422, 8916]),
  ('normal control 7', [[450, 0, 540, 900, 780, 0, 600], 1500], [2370, 660, 240, 96000]),
  ('normal control 8', [[300, 600, 300, 480, 600, 480, 600], 30], [2400, 840, 120, 1950])],
 [('regression: seventh day detection 1', [[540, 176, 0, 780, 450, 0, 481], 2250], [2066, 301, 60, 98906]),
  ('regression variant: seventh day detection 2', [[900, 0, 720, 540, 480, 450, 780], 2250],
   [2400, 1230, 240, 177188]),
  ('partial repair guard 3', [[450, 0, 586, 480, 900, 450, 720], 90], [2400, 1006, 180, 6404]),
  ('boundary control 4', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
  ('boundary control 5', [[27, 0, 0, 0, 0, 0, 0], 30], [27, 0, 0, 14]),
  ('normal control 6', [[540, 540, 780, 240, 480, 480, 0], 90], [2400, 600, 60, 5130]),
  ('normal control 7', [[300, 480, 600, 510, 300, 510, 300], 1725], [2400, 600, 0, 94875]),
  ('normal control 8', [[480, 721, 733, 899, 540, 900, 0], 90], [2400, 1500, 373, 8094])],
 [('regression: seventh day detection 1', [[480, 481, 900, 721, 0, 481, 720], 1500],
   [2400, 1202, 181, 114125]),
  ('regression variant: seventh day detection 2', [[240, 600, 0, 780, 450, 900, 900], 90],
   [2400, 1050, 420, 7223]),
  ('partial repair guard 3', [[721, 450, 540, 0, 190, 480, 900], 90], [2400, 700, 181, 5718]),
  ('boundary control 4', [[540, 540, 540, 540, 540, 540, 60], 2000], [2400, 900, 0, 125000]),
  ('boundary control 5', [[600, 600, 600, 600, 600, 0, 0], 1500], [2400, 600, 0, 82500]),
  ('normal control 6', [[720, 480, 900, 600, 240, 900, 720], 2000], [2400, 1560, 600, 198000]),
  ('normal control 7', [[904, 780, 481, 0, 900, 0, 481], 30], [2400, 722, 424, 2166]),
  ('normal control 8', [[600, 720, 240, 540, 480, 450, 780], 1725], [2400, 1110, 300, 134119])]]
for label, args, expected in fixtures[N-1]:
    check(label, 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: seventh day detection 1[2400, 571, 0, 108550][2400, 571, 0, 108550]Passed
regression variant: seventh day detection 2[2400, 660, 60, 5265][2400, 660, 60, 5265]Passed
partial repair guard 3[2400, 1440, 300, 148350][2400, 1440, 300, 148350]Passed
boundary control 4[2400, 480, 0, 104000][2400, 480, 0, 104000]Passed
boundary control 5[9, 0, 0, 5][9, 0, 0, 5]Passed
normal control 6[2400, 781, 360, 160931][2400, 781, 360, 160931]Passed
normal control 7[2400, 1501, 241, 171117][2400, 1501, 241, 171117]Passed
normal control 8[2400, 930, 0, 126500][2400, 930, 0, 126500]Passed

SHA-256 / 5bbb6bceff237f2b5bff60b34e937c42c8657672ba0e595978706225e287b3e4

Verification & scope

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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:51:59.090135+00:00.

Case digest / ddf1c61a09e10d15b90f17641a986bac5d3ec69b9cc0d2632ea395266af92f57