FAILURE MAP
← Case archive

FA-93946 / Shift rostering labor rules / Open access

Short-shift rest exemption extended to four hours · case 01

Shifts between 3.5 and 4 hours lose their rest break entitlement.

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

ROOT CAUSE

The rest exemption boundary uses 240 minutes instead of 210.

VERIFIED REPAIR

Exempt only shifts shorter than 210 minutes.

Unsuccessful approach: Making the 210 boundary inclusive exempts exactly 3.5-hour shifts.

Case contract

Shift [start, end] and breaks [start, end, kind]. Meals required: one if the shift exceeds 300 minutes, two if it exceeds 600. A meal counts if it lasts at least 30 minutes and lies inside the shift; the k-th counted meal (by start) is late if it starts after shift start + 300*k. Rest breaks required: none under 210 minutes, else (L + 120) // 240 (one per four hours or major fraction); a rest counts if kind is rest and it lasts at least 10 minutes. Return required meals, late meal ordinals, missing meals and missing rests.

Why this case matters

Break-entitlement checks gate roster publication and trigger premium pay; every boundary here is a distinct audit finding.

1 / The failure

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

N = 1
observations = []
def solve(shift, breaks):
    s, e = shift
    L = e - s
    need_meal = (L > 300) + (L > 600)
    meals = sorted(b[0] for b in breaks if b[2] == 'meal' and b[1] - b[0] >= 30 and b[0] >= s and b[1] <= e)
    late = [k + 1 for k, start in enumerate(meals[:need_meal]) if start > s + 300 * (k + 1)]
    need_rest = 0 if L < 240 else (L + 120) // 240
    rests = sum(1 for b in breaks if b[2] == 'rest' and b[1] - b[0] >= 10)
    return {'meals_required': need_meal, 'late': late, 'missing_meal': max(need_meal - len(meals), 0),
            'missing_rest': max(need_rest - rests, 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rest exempt short shift 1', [[1320, 1530], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[360, 570], [[630, 675, 'meal'], [560, 569, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[420, 630], [[610, 620, 'meal'], [610, 639, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('boundary control 5', [[0, 600], [[-40, -10, 'meal'], [330, 360, 'meal']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6', [[1320, 1680], [[1440, 1460, 'meal'], [1280, 1289, 'rest'], [1660, 1670, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7',
   [[420, 750], [[730, 739, 'rest'], [690, 699, 'rest'], [540, 550, 'rest'], [480, 490, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 8', [[360, 660], [[320, 329, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest exempt short shift 1', [[420, 630], [[380, 389, 'meal'], [610, 619, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2',
   [[1320, 1530], [[1880, 1890, 'meal'], [1380, 1389, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[360, 570], [[550, 581, 'meal'], [920, 951, 'meal'], [630, 639, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 210], [[100, 110, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('boundary control 5', [[60, 720], [[200, 230, 'meal'], [500, 530, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6',
   [[1320, 1921], [[1620, 1629, 'rest'], [1280, 1300, 'meal'], [1620, 1651, 'meal'], [1610, 1641, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 7', [[0, 180], [[301, 321, 'meal'], [300, 315, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8',
   [[0, 180], [[270, 279, 'rest'], [-40, -30, 'meal'], [270, 280, 'meal'], [300, 315, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0})],
 [('regression: rest exempt short shift 1', [[0, 210], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[1320, 1530], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[420, 630], [[480, 525, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 480], [[310, 340, 'meal'], [100, 109, 'rest']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 5', [[100, 800], [[600, 630, 'meal'], [300, 330, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6', [[420, 1021], [[480, 509, 'meal'], [980, 1000, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 7', [[0, 330], [[301, 310, 'meal'], [270, 290, 'meal'], [310, 325, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 8', [[1320, 1921], [[1920, 1949, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3})],
 [('regression: rest exempt short shift 1', [[420, 630], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2',
   [[1320, 1530], [[1380, 1389, 'rest'], [1880, 1895, 'meal'], [1525, 1534, 'meal'], [1440, 1449, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3',
   [[0, 210], [[200, 229, 'meal'], [301, 332, 'meal'], [270, 279, 'rest'], [-40, -30, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 660], [[250, 280, 'meal'], [590, 620, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('boundary control 5', [[420, 721], [[700, 730, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 6', [[1320, 1500], [[1280, 1295, 'rest'], [1650, 1679, 'meal'], [1480, 1490, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[1320, 1620], [[1440, 1470, 'meal'], [1620, 1640, 'meal'], [1650, 1665, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[1320, 1530], [[1880, 1890, 'meal'], [1380, 1389, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest exempt short shift 1', [[420, 630], [[480, 525, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[0, 210], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 3', [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 4', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 5', [[1320, 1620], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 6',
   [[360, 600], [[580, 590, 'rest'], [960, 969, 'rest'], [420, 449, 'meal'], [661, 692, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 750], [[720, 750, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[420, 900], [[690, 700, 'rest'], [480, 500, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})]]
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: rest exempt short shift 1{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Failed
regression variant: rest exempt short shift 2{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Failed
partial repair guard 3{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Failed
boundary control 4{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}Passed
boundary control 5{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Passed
normal control 6{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 2}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 2}Passed
normal control 7{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}Passed
normal control 8{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed

SHA-256 / fd2a9cecd68eb56d01f20e86c8a175482f344287c3428016f11ea6c89001110c

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(shift, breaks):
    s, e = shift
    L = e - s
    need_meal = (L > 300) + (L > 600)
    meals = sorted(b[0] for b in breaks if b[2] == 'meal' and b[1] - b[0] >= 30 and b[0] >= s and b[1] <= e)
    late = [k + 1 for k, start in enumerate(meals[:need_meal]) if start > s + 300 * (k + 1)]
    need_rest = 0 if L <= 210 else (L + 120) // 240
    rests = sum(1 for b in breaks if b[2] == 'rest' and b[1] - b[0] >= 10)
    return {'meals_required': need_meal, 'late': late, 'missing_meal': max(need_meal - len(meals), 0),
            'missing_rest': max(need_rest - rests, 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rest exempt short shift 1', [[1320, 1530], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[360, 570], [[630, 675, 'meal'], [560, 569, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[420, 630], [[610, 620, 'meal'], [610, 639, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('boundary control 5', [[0, 600], [[-40, -10, 'meal'], [330, 360, 'meal']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6', [[1320, 1680], [[1440, 1460, 'meal'], [1280, 1289, 'rest'], [1660, 1670, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7',
   [[420, 750], [[730, 739, 'rest'], [690, 699, 'rest'], [540, 550, 'rest'], [480, 490, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 8', [[360, 660], [[320, 329, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest exempt short shift 1', [[420, 630], [[380, 389, 'meal'], [610, 619, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2',
   [[1320, 1530], [[1880, 1890, 'meal'], [1380, 1389, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[360, 570], [[550, 581, 'meal'], [920, 951, 'meal'], [630, 639, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 210], [[100, 110, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('boundary control 5', [[60, 720], [[200, 230, 'meal'], [500, 530, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6',
   [[1320, 1921], [[1620, 1629, 'rest'], [1280, 1300, 'meal'], [1620, 1651, 'meal'], [1610, 1641, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 7', [[0, 180], [[301, 321, 'meal'], [300, 315, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8',
   [[0, 180], [[270, 279, 'rest'], [-40, -30, 'meal'], [270, 280, 'meal'], [300, 315, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0})],
 [('regression: rest exempt short shift 1', [[0, 210], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[1320, 1530], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[420, 630], [[480, 525, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 480], [[310, 340, 'meal'], [100, 109, 'rest']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 5', [[100, 800], [[600, 630, 'meal'], [300, 330, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6', [[420, 1021], [[480, 509, 'meal'], [980, 1000, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 7', [[0, 330], [[301, 310, 'meal'], [270, 290, 'meal'], [310, 325, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 8', [[1320, 1921], [[1920, 1949, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3})],
 [('regression: rest exempt short shift 1', [[420, 630], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2',
   [[1320, 1530], [[1380, 1389, 'rest'], [1880, 1895, 'meal'], [1525, 1534, 'meal'], [1440, 1449, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3',
   [[0, 210], [[200, 229, 'meal'], [301, 332, 'meal'], [270, 279, 'rest'], [-40, -30, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 660], [[250, 280, 'meal'], [590, 620, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('boundary control 5', [[420, 721], [[700, 730, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 6', [[1320, 1500], [[1280, 1295, 'rest'], [1650, 1679, 'meal'], [1480, 1490, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[1320, 1620], [[1440, 1470, 'meal'], [1620, 1640, 'meal'], [1650, 1665, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[1320, 1530], [[1880, 1890, 'meal'], [1380, 1389, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest exempt short shift 1', [[420, 630], [[480, 525, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[0, 210], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 3', [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 4', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 5', [[1320, 1620], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 6',
   [[360, 600], [[580, 590, 'rest'], [960, 969, 'rest'], [420, 449, 'meal'], [661, 692, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 750], [[720, 750, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[420, 900], [[690, 700, 'rest'], [480, 500, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})]]
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: rest exempt short shift 1{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Failed
regression variant: rest exempt short shift 2{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Failed
partial repair guard 3{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Failed
boundary control 4{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}Passed
boundary control 5{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Passed
normal control 6{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 2}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 2}Passed
normal control 7{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}Passed
normal control 8{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed

SHA-256 / bf6311f9e5313c7e24ea4085ee5f51a960364f5a420a6be6f9e4382a74251a25

3 / The verified repair

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

N = 1
observations = []
def solve(shift, breaks):
    s, e = shift
    L = e - s
    need_meal = (L > 300) + (L > 600)
    meals = sorted(b[0] for b in breaks if b[2] == 'meal' and b[1] - b[0] >= 30 and b[0] >= s and b[1] <= e)
    late = [k + 1 for k, start in enumerate(meals[:need_meal]) if start > s + 300 * (k + 1)]
    need_rest = 0 if L < 210 else (L + 120) // 240
    rests = sum(1 for b in breaks if b[2] == 'rest' and b[1] - b[0] >= 10)
    return {'meals_required': need_meal, 'late': late, 'missing_meal': max(need_meal - len(meals), 0),
            'missing_rest': max(need_rest - rests, 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rest exempt short shift 1', [[1320, 1530], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[360, 570], [[630, 675, 'meal'], [560, 569, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[420, 630], [[610, 620, 'meal'], [610, 639, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('boundary control 5', [[0, 600], [[-40, -10, 'meal'], [330, 360, 'meal']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6', [[1320, 1680], [[1440, 1460, 'meal'], [1280, 1289, 'rest'], [1660, 1670, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7',
   [[420, 750], [[730, 739, 'rest'], [690, 699, 'rest'], [540, 550, 'rest'], [480, 490, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 8', [[360, 660], [[320, 329, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest exempt short shift 1', [[420, 630], [[380, 389, 'meal'], [610, 619, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2',
   [[1320, 1530], [[1880, 1890, 'meal'], [1380, 1389, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[360, 570], [[550, 581, 'meal'], [920, 951, 'meal'], [630, 639, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 210], [[100, 110, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('boundary control 5', [[60, 720], [[200, 230, 'meal'], [500, 530, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6',
   [[1320, 1921], [[1620, 1629, 'rest'], [1280, 1300, 'meal'], [1620, 1651, 'meal'], [1610, 1641, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 7', [[0, 180], [[301, 321, 'meal'], [300, 315, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8',
   [[0, 180], [[270, 279, 'rest'], [-40, -30, 'meal'], [270, 280, 'meal'], [300, 315, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0})],
 [('regression: rest exempt short shift 1', [[0, 210], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[1320, 1530], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[420, 630], [[480, 525, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 480], [[310, 340, 'meal'], [100, 109, 'rest']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 5', [[100, 800], [[600, 630, 'meal'], [300, 330, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('normal control 6', [[420, 1021], [[480, 509, 'meal'], [980, 1000, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 7', [[0, 330], [[301, 310, 'meal'], [270, 290, 'meal'], [310, 325, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 8', [[1320, 1921], [[1920, 1949, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3})],
 [('regression: rest exempt short shift 1', [[420, 630], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2',
   [[1320, 1530], [[1380, 1389, 'rest'], [1880, 1895, 'meal'], [1525, 1534, 'meal'], [1440, 1449, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3',
   [[0, 210], [[200, 229, 'meal'], [301, 332, 'meal'], [270, 279, 'rest'], [-40, -30, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 4', [[0, 660], [[250, 280, 'meal'], [590, 620, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('boundary control 5', [[420, 721], [[700, 730, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 6', [[1320, 1500], [[1280, 1295, 'rest'], [1650, 1679, 'meal'], [1480, 1490, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[1320, 1620], [[1440, 1470, 'meal'], [1620, 1640, 'meal'], [1650, 1665, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[1320, 1530], [[1880, 1890, 'meal'], [1380, 1389, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest exempt short shift 1', [[420, 630], [[480, 525, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest exempt short shift 2', [[0, 210], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('boundary control 3', [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 4', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 5', [[1320, 1620], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 6',
   [[360, 600], [[580, 590, 'rest'], [960, 969, 'rest'], [420, 449, 'meal'], [661, 692, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 750], [[720, 750, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[420, 900], [[690, 700, 'rest'], [480, 500, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})]]
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: rest exempt short shift 1{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed
regression variant: rest exempt short shift 2{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed
partial repair guard 3{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed
boundary control 4{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}Passed
boundary control 5{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Passed
normal control 6{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 2}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 2}Passed
normal control 7{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}Passed
normal control 8{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed

SHA-256 / 7e464fcab7d72e48507cf3beff14317b5e679755a9a93334739af30c7abe39b9

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

Case digest / 6d67616bc82987278c2a1ed3ff80d75be607f7417564a6b033c1b721037dd233