FAILURE MAP
← Case archive

FA-94036 / Shift rostering labor rules / Open access

Weekend differential stacks on the night differential · case 01

Weekend nights are paid 27% extra instead of the larger single differential.

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

ROOT CAUSE

The weekend premium is added to the time-of-day premium.

THE FAILURE

The weekend premium is added to the time-of-day premium.

Unsuccessful approach: Overriding with the weekend rate underpays weekend nights, whose 15% is larger.

Case contract

Shift [start, end] in minutes from Monday 00:00 and a base rate in cents per hour. Each minute earns base * (100 + pct) / 6000 cents where pct is 10 for 15:00-23:00, 15 for 23:00-07:00, else 0; on Saturday and Sunday (days 5 and 6) pct is the larger of that value and 12 (differentials do not stack). The exact total is rounded half up to a cent once.

Why this case matters

Shift differential calculations are where roster data meets payroll; stacking and day attribution errors are common.

1 / The failure

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

N = 1
observations = []
def solve(shift, base):
    s, e = shift
    total = 0
    for t in range(s, e):
        day = (t // 1440) % 7
        m = t % 1440
        pct = 0
        if 900 <= m < 1380:
            pct = 10
        if m >= 1380 or m < 420:
            pct = 15
        if day >= 5:
            pct += 12
        total += base * (100 + pct)
    return (total + 3000) // 6000
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weekend stacking 1', [[6600, 7260], 2000], 24200),
  ('regression variant: weekend stacking 2', [[7894, 8374], 2150], 19264),
  ('partial repair guard 3', [[7200, 7260], 90], 104), ('boundary control 4', [[8580, 8700], 2000], 4600),
  ('boundary control 5', [[900, 960], 1800], 1980), ('normal control 6', [[3300, 3540], 2150], 8600),
  ('normal control 7', [[4320, 4800], 90], 815), ('normal control 8', [[5160, 5760], 90], 986)],
 [('regression: weekend stacking 1', [[7200, 7800], 2000], 22820),
  ('regression variant: weekend stacking 2', [[9960, 10020], 90], 101),
  ('partial repair guard 3', [[7560, 7800], 2000], 9020), ('boundary control 4', [[0, 3], 10], 1),
  ('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[5280, 5904], 2150], 24962),
  ('normal control 7', [[5860, 6580], 1999], 25587), ('normal control 8', [[4680, 5160], 1800], 14670)],
 [('regression: weekend stacking 1', [[8580, 8700], 2000], 4600),
  ('regression variant: weekend stacking 2', [[9892, 10372], 2000], 18272),
  ('partial repair guard 3', [[7200, 7920], 90], 1229), ('boundary control 4', [[6600, 7260], 2000], 24200),
  ('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[2400, 2640], 2150], 9460),
  ('normal control 7', [[0, 720], 60], 783), ('normal control 8', [[9540, 10183], 60], 725)],
 [('regression: weekend stacking 1', [[6720, 7320], 1999], 22289),
  ('regression variant: weekend stacking 2', [[9540, 10183], 60], 725),
  ('partial repair guard 3', [[9480, 10080], 60], 674), ('boundary control 4', [[1320, 1500], 60], 204),
  ('boundary control 5', [[6600, 7260], 2000], 24200), ('normal control 6', [[7200, 7395], 90], 336),
  ('normal control 7', [[5700, 6180], 90], 828), ('normal control 8', [[4740, 4980], 90], 360)],
 [('regression: weekend stacking 1', [[9600, 10200], 2000], 22580),
  ('regression variant: weekend stacking 2', [[7200, 7260], 1999], 2299),
  ('partial repair guard 3', [[9000, 9600], 1800], 20214), ('boundary control 4', [[480, 960], 1999], 16192),
  ('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[6720, 7200], 1999], 17691),
  ('normal control 7', [[2340, 2837], 1800], 16427), ('normal control 8', [[420, 480], 2000], 2000)]]
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: weekend stacking 12444024200Failed
regression variant: weekend stacking 22024619264Failed
partial repair guard 3114104Failed
boundary control 450804600Failed
boundary control 519801980Passed
normal control 686008600Passed
normal control 7815815Passed
normal control 8986986Passed

SHA-256 / 1d49ffb35609bd183927e7e8f26a38ee6e17ecf888c1378498b03fb2eaf306e8

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(shift, base):
    s, e = shift
    total = 0
    for t in range(s, e):
        day = (t // 1440) % 7
        m = t % 1440
        pct = 0
        if 900 <= m < 1380:
            pct = 10
        if m >= 1380 or m < 420:
            pct = 15
        if day >= 5:
            pct = 12
        total += base * (100 + pct)
    return (total + 3000) // 6000
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: weekend stacking 1', [[6600, 7260], 2000], 24200),
  ('regression variant: weekend stacking 2', [[7894, 8374], 2150], 19264),
  ('partial repair guard 3', [[7200, 7260], 90], 104), ('boundary control 4', [[8580, 8700], 2000], 4600),
  ('boundary control 5', [[900, 960], 1800], 1980), ('normal control 6', [[3300, 3540], 2150], 8600),
  ('normal control 7', [[4320, 4800], 90], 815), ('normal control 8', [[5160, 5760], 90], 986)],
 [('regression: weekend stacking 1', [[7200, 7800], 2000], 22820),
  ('regression variant: weekend stacking 2', [[9960, 10020], 90], 101),
  ('partial repair guard 3', [[7560, 7800], 2000], 9020), ('boundary control 4', [[0, 3], 10], 1),
  ('boundary control 5', [[8580, 8700], 2000], 4600), ('normal control 6', [[5280, 5904], 2150], 24962),
  ('normal control 7', [[5860, 6580], 1999], 25587), ('normal control 8', [[4680, 5160], 1800], 14670)],
 [('regression: weekend stacking 1', [[8580, 8700], 2000], 4600),
  ('regression variant: weekend stacking 2', [[9892, 10372], 2000], 18272),
  ('partial repair guard 3', [[7200, 7920], 90], 1229), ('boundary control 4', [[6600, 7260], 2000], 24200),
  ('boundary control 5', [[0, 3], 10], 1), ('normal control 6', [[2400, 2640], 2150], 9460),
  ('normal control 7', [[0, 720], 60], 783), ('normal control 8', [[9540, 10183], 60], 725)],
 [('regression: weekend stacking 1', [[6720, 7320], 1999], 22289),
  ('regression variant: weekend stacking 2', [[9540, 10183], 60], 725),
  ('partial repair guard 3', [[9480, 10080], 60], 674), ('boundary control 4', [[1320, 1500], 60], 204),
  ('boundary control 5', [[6600, 7260], 2000], 24200), ('normal control 6', [[7200, 7395], 90], 336),
  ('normal control 7', [[5700, 6180], 90], 828), ('normal control 8', [[4740, 4980], 90], 360)],
 [('regression: weekend stacking 1', [[9600, 10200], 2000], 22580),
  ('regression variant: weekend stacking 2', [[7200, 7260], 1999], 2299),
  ('partial repair guard 3', [[9000, 9600], 1800], 20214), ('boundary control 4', [[480, 960], 1999], 16192),
  ('boundary control 5', [[1320, 1500], 60], 204), ('normal control 6', [[6720, 7200], 1999], 17691),
  ('normal control 7', [[2340, 2837], 1800], 16427), ('normal control 8', [[420, 480], 2000], 2000)]]
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: weekend stacking 12414024200Failed
regression variant: weekend stacking 21926419264Passed
partial repair guard 3101104Failed
boundary control 444804600Failed
boundary control 519801980Passed
normal control 686008600Passed
normal control 7815815Passed
normal control 8986986Passed

SHA-256 / 5d630f7e437398e5cdf538289a6cb0add434391ab4b1d7d1bffcd28f74264fd9

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

Case digest / 33c003aa648a7a3326933d23339f6c2e50017920c87c6d8b0f7581808e7237af