FAILURE MAP
← Case archive

FA-93926 / Shift rostering labor rules / Open access

Meal deadline measured from midnight instead of shift start · case 01

Shifts starting after midnight report every meal as late.

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

ROOT CAUSE

The k-th meal deadline is compared with an absolute clock minute instead of an offset from shift start.

VERIFIED REPAIR

Late means the meal starts after shift start plus 300 minutes per meal ordinal.

Unsuccessful approach: Using a fixed 300-minute offset for every meal marks a timely second meal late.

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 > 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: meal deadline origin 1', [[420, 1020], [[720, 750, 'meal'], [900, 930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: meal deadline origin 2',
   [[360, 961], [[630, 661, 'meal'], [560, 590, 'meal'], [960, 990, 'meal'], [650, 665, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3',
   [[420, 1080], [[480, 511, 'meal'], [750, 780, 'meal'], [1020, 1051, 'meal'], [620, 629, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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', [[360, 660], [[320, 330, 'rest'], [640, 671, 'meal'], [920, 935, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 660], [[620, 629, 'rest'], [750, 765, 'meal'], [620, 629, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[1320, 1650], [[1590, 1599, 'meal'], [1621, 1652, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('regression variant: meal deadline origin 2', [[360, 661], [[650, 659, 'rest'], [560, 591, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[100, 800], [[600, 630, 'meal'], [300, 330, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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, 1529], [[1520, 1540, 'meal'], [1280, 1295, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7',
   [[0, 180], [[330, 375, 'meal'], [300, 309, 'meal'], [175, 185, 'meal'], [600, 609, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[1320, 1679], [[1920, 1930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1',
   [[1320, 1921], [[1901, 1932, 'meal'], [1590, 1635, 'meal'], [1380, 1395, 'rest'], [1901, 1946, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('regression variant: meal deadline origin 2',
   [[420, 900], [[710, 755, 'meal'], [721, 730, 'meal'], [480, 489, 'rest'], [895, 905, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[0, 660], [[250, 280, 'meal'], [590, 620, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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', [[1320, 1530], [[1610, 1620, 'meal'], [1880, 1895, 'rest'], [1650, 1665, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 660], [[620, 650, 'meal'], [640, 650, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 480], [[290, 321, 'meal'], [270, 290, 'meal'], [200, 220, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2})],
 [('regression: meal deadline origin 1',
   [[420, 721], [[540, 570, 'meal'], [1020, 1030, 'meal'], [716, 731, 'rest'], [980, 990, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('regression variant: meal deadline origin 2',
   [[360, 961], [[480, 511, 'meal'], [941, 971, 'meal'], [630, 659, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('partial repair guard 3', [[0, 700], [[100, 130, 'meal'], [400, 430, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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',
   [[0, 720], [[300, 320, 'meal'], [301, 316, 'meal'], [290, 305, 'rest'], [330, 361, 'meal']]],
   {'meals_required': 2, 'late': [1], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7', [[420, 629], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[420, 750], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1',
   [[1320, 1680], [[1675, 1704, 'meal'], [1620, 1629, 'meal'], [1610, 1641, 'meal'], [1880, 1895, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('regression variant: meal deadline origin 2', [[360, 961], [[660, 691, 'meal'], [941, 951, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 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', [[0, 330], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 6', [[360, 960], [[955, 965, 'rest'], [480, 495, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7', [[360, 1080], [[1060, 1069, 'rest'], [920, 929, 'meal'], [650, 665, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 8', [[1320, 1679], [[1920, 1930, '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: meal deadline origin 1{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Failed
regression variant: meal deadline origin 2{'late': [1, 2], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 2}{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 2}Failed
partial repair guard 3{'late': [1, 2], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 3}Failed
boundary control 4{'late': [1], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}Failed
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': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}Passed
normal control 7{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed
normal control 8{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 1}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 1}Passed

SHA-256 / 000d3955fd64a35cbfd49f148ed72309cfcd4b44f0f6e0ec155b7afda15a891d

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]
    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: meal deadline origin 1', [[420, 1020], [[720, 750, 'meal'], [900, 930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: meal deadline origin 2',
   [[360, 961], [[630, 661, 'meal'], [560, 590, 'meal'], [960, 990, 'meal'], [650, 665, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3',
   [[420, 1080], [[480, 511, 'meal'], [750, 780, 'meal'], [1020, 1051, 'meal'], [620, 629, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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', [[360, 660], [[320, 330, 'rest'], [640, 671, 'meal'], [920, 935, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 660], [[620, 629, 'rest'], [750, 765, 'meal'], [620, 629, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[1320, 1650], [[1590, 1599, 'meal'], [1621, 1652, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('regression variant: meal deadline origin 2', [[360, 661], [[650, 659, 'rest'], [560, 591, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[100, 800], [[600, 630, 'meal'], [300, 330, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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, 1529], [[1520, 1540, 'meal'], [1280, 1295, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7',
   [[0, 180], [[330, 375, 'meal'], [300, 309, 'meal'], [175, 185, 'meal'], [600, 609, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[1320, 1679], [[1920, 1930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1',
   [[1320, 1921], [[1901, 1932, 'meal'], [1590, 1635, 'meal'], [1380, 1395, 'rest'], [1901, 1946, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('regression variant: meal deadline origin 2',
   [[420, 900], [[710, 755, 'meal'], [721, 730, 'meal'], [480, 489, 'rest'], [895, 905, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[0, 660], [[250, 280, 'meal'], [590, 620, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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', [[1320, 1530], [[1610, 1620, 'meal'], [1880, 1895, 'rest'], [1650, 1665, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 660], [[620, 650, 'meal'], [640, 650, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 480], [[290, 321, 'meal'], [270, 290, 'meal'], [200, 220, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2})],
 [('regression: meal deadline origin 1',
   [[420, 721], [[540, 570, 'meal'], [1020, 1030, 'meal'], [716, 731, 'rest'], [980, 990, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('regression variant: meal deadline origin 2',
   [[360, 961], [[480, 511, 'meal'], [941, 971, 'meal'], [630, 659, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('partial repair guard 3', [[0, 700], [[100, 130, 'meal'], [400, 430, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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',
   [[0, 720], [[300, 320, 'meal'], [301, 316, 'meal'], [290, 305, 'rest'], [330, 361, 'meal']]],
   {'meals_required': 2, 'late': [1], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7', [[420, 629], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[420, 750], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1',
   [[1320, 1680], [[1675, 1704, 'meal'], [1620, 1629, 'meal'], [1610, 1641, 'meal'], [1880, 1895, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('regression variant: meal deadline origin 2', [[360, 961], [[660, 691, 'meal'], [941, 951, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 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', [[0, 330], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 6', [[360, 960], [[955, 965, 'rest'], [480, 495, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7', [[360, 1080], [[1060, 1069, 'rest'], [920, 929, 'meal'], [650, 665, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 8', [[1320, 1679], [[1920, 1930, '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: meal deadline origin 1{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Passed
regression variant: meal deadline origin 2{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 2}{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 2}Passed
partial repair guard 3{'late': [2], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 3}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': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}Passed
normal control 7{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed
normal control 8{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 1}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 1}Passed

SHA-256 / 066c514eea073d43621f58340ebb1099e9bca3d840628d8ab96f5d73e69cbb7d

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: meal deadline origin 1', [[420, 1020], [[720, 750, 'meal'], [900, 930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: meal deadline origin 2',
   [[360, 961], [[630, 661, 'meal'], [560, 590, 'meal'], [960, 990, 'meal'], [650, 665, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3',
   [[420, 1080], [[480, 511, 'meal'], [750, 780, 'meal'], [1020, 1051, 'meal'], [620, 629, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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', [[360, 660], [[320, 330, 'rest'], [640, 671, 'meal'], [920, 935, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 660], [[620, 629, 'rest'], [750, 765, 'meal'], [620, 629, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[1320, 1650], [[1590, 1599, 'meal'], [1621, 1652, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('regression variant: meal deadline origin 2', [[360, 661], [[650, 659, 'rest'], [560, 591, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[100, 800], [[600, 630, 'meal'], [300, 330, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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, 1529], [[1520, 1540, 'meal'], [1280, 1295, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7',
   [[0, 180], [[330, 375, 'meal'], [300, 309, 'meal'], [175, 185, 'meal'], [600, 609, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[1320, 1679], [[1920, 1930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1',
   [[1320, 1921], [[1901, 1932, 'meal'], [1590, 1635, 'meal'], [1380, 1395, 'rest'], [1901, 1946, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('regression variant: meal deadline origin 2',
   [[420, 900], [[710, 755, 'meal'], [721, 730, 'meal'], [480, 489, 'rest'], [895, 905, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('partial repair guard 3', [[0, 660], [[250, 280, 'meal'], [590, 620, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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', [[1320, 1530], [[1610, 1620, 'meal'], [1880, 1895, 'rest'], [1650, 1665, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 7', [[420, 660], [[620, 650, 'meal'], [640, 650, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 480], [[290, 321, 'meal'], [270, 290, 'meal'], [200, 220, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2})],
 [('regression: meal deadline origin 1',
   [[420, 721], [[540, 570, 'meal'], [1020, 1030, 'meal'], [716, 731, 'rest'], [980, 990, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('regression variant: meal deadline origin 2',
   [[360, 961], [[480, 511, 'meal'], [941, 971, 'meal'], [630, 659, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('partial repair guard 3', [[0, 700], [[100, 130, 'meal'], [400, 430, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('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',
   [[0, 720], [[300, 320, 'meal'], [301, 316, 'meal'], [290, 305, 'rest'], [330, 361, 'meal']]],
   {'meals_required': 2, 'late': [1], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7', [[420, 629], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[420, 750], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: meal deadline origin 1',
   [[1320, 1680], [[1675, 1704, 'meal'], [1620, 1629, 'meal'], [1610, 1641, 'meal'], [1880, 1895, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('regression variant: meal deadline origin 2', [[360, 961], [[660, 691, 'meal'], [941, 951, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 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', [[0, 330], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 6', [[360, 960], [[955, 965, 'rest'], [480, 495, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 7', [[360, 1080], [[1060, 1069, 'rest'], [920, 929, 'meal'], [650, 665, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 8', [[1320, 1679], [[1920, 1930, '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: meal deadline origin 1{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Passed
regression variant: meal deadline origin 2{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 2}{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 2}Passed
partial repair guard 3{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 3}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': 0, 'missing_meal': 0, 'missing_rest': 0}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 0}Passed
normal control 7{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed
normal control 8{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 1}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 1}Passed

SHA-256 / 561c31b6afa7b5c0881f063070418ae80058d8b330a3655c2b343fbefd31dd73

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

Case digest / 1bf2c62a349d7445a6f05fdc5f4c638a064375d60d909aff9fd9d4f17c8c7e8a