FAILURE MAP
← Case archive

FA-93916 / Shift rostering labor rules / Open access

Split premium not capped at two splits per day · case 01

Days broken into many fragments accumulate unbounded split premiums.

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

ROOT CAUSE

The split count is used directly instead of being capped at two.

THE FAILURE

The split count is used directly instead of being capped at two.

Unsuccessful approach: Capping at one split underpays genuine two-split days.

Case contract

Worked segments [start, end] of one workday (unordered, possibly overlapping) and a minimum wage in cents. Overlapping or touching segments merge. Spread is last end minus first start. Each gap longer than 60 minutes is a split. A spread over 600 minutes earns one hour of minimum wage and replaces any split premium; otherwise each split earns min_wage // 2, for at most two splits. Return [spread, splits, premium].

Why this case matters

Spread-of-hours and split-shift premiums are frequent roster-pay rules that depend on correct interval handling.

1 / The failure

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

N = 1
observations = []
def solve(segments, min_wage):
    seg = sorted(segments)
    merged = []
    for s, e in seg:
        if merged and s <= merged[-1][1]:
            merged[-1][1] = max(merged[-1][1], e)
        else:
            merged.append([s, e])
    spread = merged[-1][1] - merged[0][0]
    splits = sum(1 for a, b in zip(merged, merged[1:]) if b[0] - a[1] > 60)
    if spread > 600:
        premium = min_wage
    else:
        premium = (min_wage // 2) * splits
    return [spread, splits, premium]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: split premium cap 1', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600],
   [330, 3, 1600]),
  ('regression variant: split premium cap 2',
   [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655], [590, 4, 1654]),
  ('partial repair guard 3', [[[360, 540], [841, 901], [601, 661]], 1520], [541, 2, 1520]),
  ('boundary control 4', [[[420, 1020]], 1600], [600, 0, 0]),
  ('normal control 5', [[[420, 540]], 1701], [120, 0, 0]),
  ('normal control 6', [[[810, 1050], [480, 720]], 1701], [570, 1, 850]),
  ('normal control 7', [[[600, 840], [900, 1140]], 1655], [540, 0, 0]),
  ('normal control 8', [[[600, 840]], 1600], [240, 0, 0])],
 [('regression: split premium cap 1', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
   [590, 4, 1654]),
  ('regression variant: split premium cap 2', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701],
   [330, 3, 1700]),
  ('partial repair guard 3', [[[360, 420], [602, 782], [481, 541]], 1701], [422, 2, 1700]),
  ('boundary control 4', [[[900, 1000], [420, 600], [700, 800]], 1520], [580, 2, 1520]),
  ('boundary control 5', [[[480, 720], [781, 1080]], 1600], [600, 1, 800]),
  ('normal control 6', [[[360, 420], [479, 779], [370, 380]], 1600], [419, 0, 0]),
  ('normal control 7', [[[600, 660], [1081, 1381], [900, 1020]], 1520], [781, 2, 1520]),
  ('normal control 8', [[[810, 870], [840, 1020], [600, 720], [990, 1290]], 1600], [690, 1, 1600])],
 [('regression: split premium cap 1', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701],
   [330, 3, 1700]),
  ('regression variant: split premium cap 2', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600],
   [330, 3, 1600]),
  ('partial repair guard 3', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
   [590, 4, 1654]),
  ('boundary control 4', [[[420, 1021]], 1600], [601, 0, 1600]),
  ('normal control 5', [[[900, 1020], [600, 780], [780, 900], [910, 920]], 1600], [420, 0, 0]),
  ('normal control 6', [[[420, 660], [430, 440]], 1520], [240, 0, 0]),
  ('normal control 7', [[[360, 480], [600, 660]], 1655], [300, 1, 827]),
  ('normal control 8', [[[810, 1110], [480, 780]], 1520], [630, 0, 1520])],
 [('regression: split premium cap 1', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600],
   [330, 3, 1600]),
  ('regression variant: split premium cap 2',
   [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655], [590, 4, 1654]),
  ('partial repair guard 3', [[[900, 1000], [420, 600], [700, 800]], 1520], [580, 2, 1520]),
  ('boundary control 4', [[[420, 600], [660, 780], [840, 1020]], 1701], [600, 0, 0]),
  ('normal control 5', [[[1230, 1470], [480, 780], [960, 1140]], 1520], [990, 2, 1520]),
  ('normal control 6', [[[480, 720]], 1701], [240, 0, 0]),
  ('normal control 7', [[[630, 870], [600, 660]], 1655], [270, 0, 0]),
  ('normal control 8', [[[960, 1140], [420, 480], [480, 720]], 1520], [720, 1, 1520])],
 [('regression: split premium cap 1', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
   [590, 4, 1654]),
  ('regression variant: split premium cap 2', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701],
   [330, 3, 1700]),
  ('partial repair guard 3', [[[781, 961], [1081, 1141], [600, 720]], 1600], [541, 2, 1600]),
  ('boundary control 4', [[[600, 900], [610, 620], [1000, 1100]], 1655], [500, 1, 827]),
  ('boundary control 5', [[[480, 720], [780, 1080]], 1600], [600, 0, 0]),
  ('normal control 6', [[[1320, 1560], [960, 1080], [480, 720], [970, 980]], 1600], [1080, 2, 1600]),
  ('normal control 7', [[[1051, 1111], [630, 870], [870, 990], [420, 660]], 1520], [691, 1, 1520]),
  ('normal control 8', [[[1021, 1261], [781, 961], [480, 720]], 1600], [781, 1, 1600])]]
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: split premium cap 1[330, 3, 2400][330, 3, 1600]Failed
regression variant: split premium cap 2[590, 4, 3308][590, 4, 1654]Failed
partial repair guard 3[541, 2, 1520][541, 2, 1520]Passed
boundary control 4[600, 0, 0][600, 0, 0]Passed
normal control 5[120, 0, 0][120, 0, 0]Passed
normal control 6[570, 1, 850][570, 1, 850]Passed
normal control 7[540, 0, 0][540, 0, 0]Passed
normal control 8[240, 0, 0][240, 0, 0]Passed

SHA-256 / 7be8167d4fe79aa0700f9e9793584ad3e1e06aad9503618131415e445659d7cf

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(segments, min_wage):
    seg = sorted(segments)
    merged = []
    for s, e in seg:
        if merged and s <= merged[-1][1]:
            merged[-1][1] = max(merged[-1][1], e)
        else:
            merged.append([s, e])
    spread = merged[-1][1] - merged[0][0]
    splits = sum(1 for a, b in zip(merged, merged[1:]) if b[0] - a[1] > 60)
    if spread > 600:
        premium = min_wage
    else:
        premium = (min_wage // 2) * min(splits, 1)
    return [spread, splits, premium]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: split premium cap 1', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600],
   [330, 3, 1600]),
  ('regression variant: split premium cap 2',
   [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655], [590, 4, 1654]),
  ('partial repair guard 3', [[[360, 540], [841, 901], [601, 661]], 1520], [541, 2, 1520]),
  ('boundary control 4', [[[420, 1020]], 1600], [600, 0, 0]),
  ('normal control 5', [[[420, 540]], 1701], [120, 0, 0]),
  ('normal control 6', [[[810, 1050], [480, 720]], 1701], [570, 1, 850]),
  ('normal control 7', [[[600, 840], [900, 1140]], 1655], [540, 0, 0]),
  ('normal control 8', [[[600, 840]], 1600], [240, 0, 0])],
 [('regression: split premium cap 1', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
   [590, 4, 1654]),
  ('regression variant: split premium cap 2', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701],
   [330, 3, 1700]),
  ('partial repair guard 3', [[[360, 420], [602, 782], [481, 541]], 1701], [422, 2, 1700]),
  ('boundary control 4', [[[900, 1000], [420, 600], [700, 800]], 1520], [580, 2, 1520]),
  ('boundary control 5', [[[480, 720], [781, 1080]], 1600], [600, 1, 800]),
  ('normal control 6', [[[360, 420], [479, 779], [370, 380]], 1600], [419, 0, 0]),
  ('normal control 7', [[[600, 660], [1081, 1381], [900, 1020]], 1520], [781, 2, 1520]),
  ('normal control 8', [[[810, 870], [840, 1020], [600, 720], [990, 1290]], 1600], [690, 1, 1600])],
 [('regression: split premium cap 1', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701],
   [330, 3, 1700]),
  ('regression variant: split premium cap 2', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600],
   [330, 3, 1600]),
  ('partial repair guard 3', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
   [590, 4, 1654]),
  ('boundary control 4', [[[420, 1021]], 1600], [601, 0, 1600]),
  ('normal control 5', [[[900, 1020], [600, 780], [780, 900], [910, 920]], 1600], [420, 0, 0]),
  ('normal control 6', [[[420, 660], [430, 440]], 1520], [240, 0, 0]),
  ('normal control 7', [[[360, 480], [600, 660]], 1655], [300, 1, 827]),
  ('normal control 8', [[[810, 1110], [480, 780]], 1520], [630, 0, 1520])],
 [('regression: split premium cap 1', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600],
   [330, 3, 1600]),
  ('regression variant: split premium cap 2',
   [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655], [590, 4, 1654]),
  ('partial repair guard 3', [[[900, 1000], [420, 600], [700, 800]], 1520], [580, 2, 1520]),
  ('boundary control 4', [[[420, 600], [660, 780], [840, 1020]], 1701], [600, 0, 0]),
  ('normal control 5', [[[1230, 1470], [480, 780], [960, 1140]], 1520], [990, 2, 1520]),
  ('normal control 6', [[[480, 720]], 1701], [240, 0, 0]),
  ('normal control 7', [[[630, 870], [600, 660]], 1655], [270, 0, 0]),
  ('normal control 8', [[[960, 1140], [420, 480], [480, 720]], 1520], [720, 1, 1520])],
 [('regression: split premium cap 1', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
   [590, 4, 1654]),
  ('regression variant: split premium cap 2', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701],
   [330, 3, 1700]),
  ('partial repair guard 3', [[[781, 961], [1081, 1141], [600, 720]], 1600], [541, 2, 1600]),
  ('boundary control 4', [[[600, 900], [610, 620], [1000, 1100]], 1655], [500, 1, 827]),
  ('boundary control 5', [[[480, 720], [780, 1080]], 1600], [600, 0, 0]),
  ('normal control 6', [[[1320, 1560], [960, 1080], [480, 720], [970, 980]], 1600], [1080, 2, 1600]),
  ('normal control 7', [[[1051, 1111], [630, 870], [870, 990], [420, 660]], 1520], [691, 1, 1520]),
  ('normal control 8', [[[1021, 1261], [781, 961], [480, 720]], 1600], [781, 1, 1600])]]
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: split premium cap 1[330, 3, 800][330, 3, 1600]Failed
regression variant: split premium cap 2[590, 4, 827][590, 4, 1654]Failed
partial repair guard 3[541, 2, 760][541, 2, 1520]Failed
boundary control 4[600, 0, 0][600, 0, 0]Passed
normal control 5[120, 0, 0][120, 0, 0]Passed
normal control 6[570, 1, 850][570, 1, 850]Passed
normal control 7[540, 0, 0][540, 0, 0]Passed
normal control 8[240, 0, 0][240, 0, 0]Passed

SHA-256 / b5e8d9a83bcd57eeb55d3d7625661c440a932b7daa184fdb4e7fa9d7bc519f7e

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

Case digest / f1b5d3d7640feb348dd6aaabde0ce702ad3c044ef1bb3fc4bcb7add2570c301d