FAILURE MAP
← Case archive

FA-93881 / Shift rostering labor rules / Open access

Weekly overtime pyramids on top of daily overtime minutes · case 01

Weeks with long days move extra regular minutes into overtime, even making regular minutes negative.

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

ROOT CAUSE

The weekly 40-hour threshold is measured on all worked minutes including already-premium daily overtime.

THE FAILURE

The weekly 40-hour threshold is measured on all worked minutes including already-premium daily overtime.

Unsuccessful approach: Adding the 1.5x minutes to the weekly base still double counts daily overtime.

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 = 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(sum(days) - 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: weekly threshold pyramiding 1', [[480, 480, 480, 480, 480, 480, 480], 2000],
   [2400, 960, 0, 128000]),
  ('regression variant: weekly threshold pyramiding 2', [[0, 450, 480, 480, 540, 481, 540], 2000],
   [2400, 571, 0, 108550]),
  ('partial repair guard 3', [[480, 510, 300, 600, 300, 510, 300], 2250], [2400, 600, 0, 123750]),
  ('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', [[540, 540, 780, 240, 480, 480, 0], 90], [2400, 600, 60, 5130]),
  ('normal control 7', [[900, 721, 0, 900, 481, 450, 780], 30], [2400, 1411, 421, 2679]),
  ('normal control 8', [[721, 0, 813, 720, 600, 780, 480], 1810], [2400, 1560, 154, 152281])],
 [('regression: weekly threshold pyramiding 1', [[600, 600, 600, 600, 600, 0, 0], 1500],
   [2400, 600, 0, 82500]),
  ('regression variant: weekly threshold pyramiding 2', [[600, 480, 600, 510, 300, 300, 300], 1500],
   [2400, 690, 0, 85875]),
  ('partial repair guard 3', [[600, 481, 0, 540, 0, 450, 720], 2250], [2370, 421, 0, 112556]),
  ('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, 707, 480, 0, 240, 506, 600], 2250], [2400, 733, 0, 131231]),
  ('normal control 7', [[721, 211, 0, 720, 780, 721, 780], 2250], [2400, 1411, 122, 178519]),
  ('normal control 8', [[480, 510, 300, 600, 300, 510, 300], 2250], [2400, 600, 0, 123750])],
 [('regression: weekly threshold pyramiding 1', [[540, 540, 540, 540, 540, 540, 60], 2000],
   [2400, 900, 0, 125000]),
  ('regression variant: weekly threshold pyramiding 2', [[540, 176, 0, 780, 450, 0, 481], 2250],
   [2066, 301, 60, 98906]),
  ('partial repair guard 3', [[600, 480, 600, 510, 300, 300, 300], 1500], [2400, 690, 0, 85875]),
  ('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, 540, 0, 0, 450, 481, 540], 90], [2370, 361, 60, 4547]),
  ('normal control 7', [[600, 240, 900, 780, 0, 240, 590], 30], [2400, 710, 240, 1973]),
  ('normal control 8', [[450, 450, 780, 721, 480, 450, 525], 2250], [2400, 1350, 106, 173888])],
 [('regression: weekly threshold pyramiding 1', [[300, 600, 300, 600, 510, 600, 480], 90],
   [2400, 990, 0, 5828]),
  ('regression variant: weekly threshold pyramiding 2', [[510, 510, 600, 480, 300, 600, 480], 1725],
   [2400, 1080, 0, 115575]),
  ('partial repair guard 3', [[540, 480, 240, 780, 600, 481, 0], 90], [2400, 661, 60, 5267]),
  ('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', [[900, 720, 0, 480, 450, 240, 600], 2250], [2400, 810, 180, 149063]),
  ('normal control 7', [[721, 450, 540, 0, 190, 480, 900], 90], [2400, 700, 181, 5718]),
  ('normal control 8', [[300, 510, 300, 510, 300, 480, 600], 2250], [2340, 540, 120, 127125])],
 [('regression: weekly threshold pyramiding 1', [[300, 600, 510, 600, 510, 600, 600], 1810],
   [2400, 1200, 120, 133940]),
  ('regression variant: weekly threshold pyramiding 2', [[510, 600, 480, 300, 510, 480, 300], 1725],
   [2400, 780, 0, 102638]),
  ('partial repair guard 3', [[450, 0, 908, 480, 721, 540, 540], 2250], [2400, 1050, 189, 163238]),
  ('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', [[480, 480, 480, 480, 300, 480, 510], 90], [2400, 780, 30, 5445]),
  ('normal control 7', [[240, 721, 780, 900, 900, 600, 721], 1810], [2400, 1800, 662, 193791]),
  ('normal control 8', [[240, 240, 720, 240, 720, 450, 540], 1810], [2130, 960, 60, 111315])]]
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: weekly threshold pyramiding 1[1920, 1440, 0, 136000][2400, 960, 0, 128000]Failed
regression variant: weekly threshold pyramiding 2[2279, 692, 0, 110567][2400, 571, 0, 108550]Failed
partial repair guard 3[1920, 1080, 0, 132750][2400, 600, 0, 123750]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[1980, 1020, 60, 5445][2400, 600, 60, 5130]Failed
normal control 7[1018, 2793, 421, 3025][2400, 1411, 421, 2679]Failed
normal control 8[1166, 2794, 154, 170894][2400, 1560, 154, 152281]Failed

SHA-256 / 273061aee1d2f9a1b2a77499221007106933d105144e893b5cb68747f74ea9c7

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 = 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 + ot15 - 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: weekly threshold pyramiding 1', [[480, 480, 480, 480, 480, 480, 480], 2000],
   [2400, 960, 0, 128000]),
  ('regression variant: weekly threshold pyramiding 2', [[0, 450, 480, 480, 540, 481, 540], 2000],
   [2400, 571, 0, 108550]),
  ('partial repair guard 3', [[480, 510, 300, 600, 300, 510, 300], 2250], [2400, 600, 0, 123750]),
  ('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', [[540, 540, 780, 240, 480, 480, 0], 90], [2400, 600, 60, 5130]),
  ('normal control 7', [[900, 721, 0, 900, 481, 450, 780], 30], [2400, 1411, 421, 2679]),
  ('normal control 8', [[721, 0, 813, 720, 600, 780, 480], 1810], [2400, 1560, 154, 152281])],
 [('regression: weekly threshold pyramiding 1', [[600, 600, 600, 600, 600, 0, 0], 1500],
   [2400, 600, 0, 82500]),
  ('regression variant: weekly threshold pyramiding 2', [[600, 480, 600, 510, 300, 300, 300], 1500],
   [2400, 690, 0, 85875]),
  ('partial repair guard 3', [[600, 481, 0, 540, 0, 450, 720], 2250], [2370, 421, 0, 112556]),
  ('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, 707, 480, 0, 240, 506, 600], 2250], [2400, 733, 0, 131231]),
  ('normal control 7', [[721, 211, 0, 720, 780, 721, 780], 2250], [2400, 1411, 122, 178519]),
  ('normal control 8', [[480, 510, 300, 600, 300, 510, 300], 2250], [2400, 600, 0, 123750])],
 [('regression: weekly threshold pyramiding 1', [[540, 540, 540, 540, 540, 540, 60], 2000],
   [2400, 900, 0, 125000]),
  ('regression variant: weekly threshold pyramiding 2', [[540, 176, 0, 780, 450, 0, 481], 2250],
   [2066, 301, 60, 98906]),
  ('partial repair guard 3', [[600, 480, 600, 510, 300, 300, 300], 1500], [2400, 690, 0, 85875]),
  ('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, 540, 0, 0, 450, 481, 540], 90], [2370, 361, 60, 4547]),
  ('normal control 7', [[600, 240, 900, 780, 0, 240, 590], 30], [2400, 710, 240, 1973]),
  ('normal control 8', [[450, 450, 780, 721, 480, 450, 525], 2250], [2400, 1350, 106, 173888])],
 [('regression: weekly threshold pyramiding 1', [[300, 600, 300, 600, 510, 600, 480], 90],
   [2400, 990, 0, 5828]),
  ('regression variant: weekly threshold pyramiding 2', [[510, 510, 600, 480, 300, 600, 480], 1725],
   [2400, 1080, 0, 115575]),
  ('partial repair guard 3', [[540, 480, 240, 780, 600, 481, 0], 90], [2400, 661, 60, 5267]),
  ('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', [[900, 720, 0, 480, 450, 240, 600], 2250], [2400, 810, 180, 149063]),
  ('normal control 7', [[721, 450, 540, 0, 190, 480, 900], 90], [2400, 700, 181, 5718]),
  ('normal control 8', [[300, 510, 300, 510, 300, 480, 600], 2250], [2340, 540, 120, 127125])],
 [('regression: weekly threshold pyramiding 1', [[300, 600, 510, 600, 510, 600, 600], 1810],
   [2400, 1200, 120, 133940]),
  ('regression variant: weekly threshold pyramiding 2', [[510, 600, 480, 300, 510, 480, 300], 1725],
   [2400, 780, 0, 102638]),
  ('partial repair guard 3', [[450, 0, 908, 480, 721, 540, 540], 2250], [2400, 1050, 189, 163238]),
  ('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', [[480, 480, 480, 480, 300, 480, 510], 90], [2400, 780, 30, 5445]),
  ('normal control 7', [[240, 721, 780, 900, 900, 600, 721], 1810], [2400, 1800, 662, 193791]),
  ('normal control 8', [[240, 240, 720, 240, 720, 450, 540], 1810], [2130, 960, 60, 111315])]]
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: weekly threshold pyramiding 1[1920, 1440, 0, 136000][2400, 960, 0, 128000]Failed
regression variant: weekly threshold pyramiding 2[2279, 692, 0, 110567][2400, 571, 0, 108550]Failed
partial repair guard 3[1920, 1080, 0, 132750][2400, 600, 0, 123750]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[2040, 960, 60, 5400][2400, 600, 60, 5130]Failed
normal control 7[1439, 2372, 421, 2920][2400, 1411, 421, 2679]Failed
normal control 8[1320, 2640, 154, 168571][2400, 1560, 154, 152281]Failed

SHA-256 / e76dd972ec8522548e5f51bbde7b4ce4957f3f7501cbef2ab75342de52a7f619

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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.345353+00:00.

Case digest / 49d3c1e8e8ed8717c90753cd20b9ad7dd6737805e2d943f119fe66a0b5b4b506