FAILURE MAP
← Case archive

FA-93941 / Shift rostering labor rules / Open access

Rest break count ignores the major-fraction rule · case 01

A 6-hour shift gets one rest break instead of two.

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

ROOT CAUSE

Rest entitlement floors whole four-hour blocks, dropping the major fraction.

VERIFIED REPAIR

One rest per four hours or major fraction: (L + 120) // 240.

Unsuccessful approach: Ceiling division grants a rest for any fraction, over-requiring rests on short remainders.

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 < 210 else L // 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 major fraction 1', [[420, 1020], [[720, 750, 'meal'], [900, 930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2',
   [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3', [[0, 301], [[-40, -25, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('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', [[0, 301], [[296, 306, 'rest'], [290, 305, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 7',
   [[360, 600], [[660, 705, 'meal'], [920, 951, 'meal'], [661, 676, 'meal'], [690, 719, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 240], [[560, 591, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest major fraction 1', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2',
   [[1320, 1680], [[1675, 1704, 'meal'], [1620, 1629, 'meal'], [1610, 1641, 'meal'], [1880, 1895, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3', [[420, 721], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, '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', [[0, 359], [[560, 570, 'rest'], [339, 348, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 7', [[0, 240], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 330], [[301, 310, 'meal'], [270, 290, 'meal'], [310, 325, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: rest major fraction 1', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('regression variant: rest major fraction 2', [[420, 780], [[380, 395, 'meal'], [540, 549, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 3', [[0, 301], [[-40, -30, 'meal'], [200, 209, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, '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', [[360, 690], [[661, 670, 'rest'], [661, 681, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 7', [[0, 209], [[600, 615, 'rest'], [204, 249, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[360, 1080], [[661, 670, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3})],
 [('regression: rest major fraction 1',
   [[0, 360], [[200, 230, 'meal'], [100, 110, 'rest'], [300, 310, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest major fraction 2', [[360, 960], [[955, 965, 'rest'], [480, 495, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 3',
   [[360, 660], [[660, 691, 'meal'], [640, 655, 'meal'], [920, 951, 'meal'], [560, 570, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('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, 660], [[-40, -9, 'meal'], [330, 359, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 7', [[1320, 1620], [[1650, 1660, 'meal'], [1280, 1290, 'meal'], [1920, 1930, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[360, 720], [[560, 569, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2})],
 [('regression: rest major fraction 1', [[0, 600], [[-40, -10, 'meal'], [330, 360, 'meal']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2', [[1320, 1921], []],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('partial repair guard 3', [[360, 690], [[661, 670, 'rest'], [661, 681, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('boundary control 4', [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 5', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 6', [[360, 690], [[660, 689, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 7', [[420, 1021], [[480, 509, 'meal'], [980, 1000, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 8', [[360, 720], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2})]]
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 major fraction 1{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 2}{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Failed
regression variant: rest major fraction 2{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 2, 'missing_meal': 0, 'missing_rest': 2}Failed
partial repair guard 3{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}Passed
boundary control 4{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 2}{'late': [], 'meals_required': 2, 'missing_meal': 1, 'missing_rest': 3}Failed
boundary control 5{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 2}{'late': [1], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Failed
normal control 6{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, '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': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed

SHA-256 / b92555d976305a6dbac102429a3ee819cc66d0f107cd682bce253c5c78d1bf68

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 // 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 major fraction 1', [[420, 1020], [[720, 750, 'meal'], [900, 930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2',
   [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3', [[0, 301], [[-40, -25, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('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', [[0, 301], [[296, 306, 'rest'], [290, 305, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 7',
   [[360, 600], [[660, 705, 'meal'], [920, 951, 'meal'], [661, 676, 'meal'], [690, 719, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 240], [[560, 591, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest major fraction 1', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2',
   [[1320, 1680], [[1675, 1704, 'meal'], [1620, 1629, 'meal'], [1610, 1641, 'meal'], [1880, 1895, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3', [[420, 721], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, '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', [[0, 359], [[560, 570, 'rest'], [339, 348, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 7', [[0, 240], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 330], [[301, 310, 'meal'], [270, 290, 'meal'], [310, 325, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: rest major fraction 1', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('regression variant: rest major fraction 2', [[420, 780], [[380, 395, 'meal'], [540, 549, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 3', [[0, 301], [[-40, -30, 'meal'], [200, 209, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, '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', [[360, 690], [[661, 670, 'rest'], [661, 681, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 7', [[0, 209], [[600, 615, 'rest'], [204, 249, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[360, 1080], [[661, 670, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3})],
 [('regression: rest major fraction 1',
   [[0, 360], [[200, 230, 'meal'], [100, 110, 'rest'], [300, 310, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest major fraction 2', [[360, 960], [[955, 965, 'rest'], [480, 495, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 3',
   [[360, 660], [[660, 691, 'meal'], [640, 655, 'meal'], [920, 951, 'meal'], [560, 570, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('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, 660], [[-40, -9, 'meal'], [330, 359, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 7', [[1320, 1620], [[1650, 1660, 'meal'], [1280, 1290, 'meal'], [1920, 1930, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[360, 720], [[560, 569, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2})],
 [('regression: rest major fraction 1', [[0, 600], [[-40, -10, 'meal'], [330, 360, 'meal']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2', [[1320, 1921], []],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('partial repair guard 3', [[360, 690], [[661, 670, 'rest'], [661, 681, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('boundary control 4', [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 5', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 6', [[360, 690], [[660, 689, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 7', [[420, 1021], [[480, 509, 'meal'], [980, 1000, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 8', [[360, 720], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2})]]
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 major fraction 1{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Passed
regression variant: rest major fraction 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': 1, 'missing_meal': 1, 'missing_rest': 1}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}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': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, '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': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed

SHA-256 / 99848d1b5dfd6eee21aaa6b15a0efd1912b8fd2b5ff433348d8c7e316d9b316e

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 major fraction 1', [[420, 1020], [[720, 750, 'meal'], [900, 930, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2',
   [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3', [[0, 301], [[-40, -25, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('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', [[0, 301], [[296, 306, 'rest'], [290, 305, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 7',
   [[360, 600], [[660, 705, 'meal'], [920, 951, 'meal'], [661, 676, 'meal'], [690, 719, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 240], [[560, 591, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1})],
 [('regression: rest major fraction 1', [[420, 1021], [[600, 630, 'meal'], [1000, 1021, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 1, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2',
   [[1320, 1680], [[1675, 1704, 'meal'], [1620, 1629, 'meal'], [1610, 1641, 'meal'], [1880, 1895, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('partial repair guard 3', [[420, 721], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, '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', [[0, 359], [[560, 570, 'rest'], [339, 348, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 0}),
  ('normal control 7', [[0, 240], []],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('normal control 8', [[0, 330], [[301, 310, 'meal'], [270, 290, 'meal'], [310, 325, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1})],
 [('regression: rest major fraction 1', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('regression variant: rest major fraction 2', [[420, 780], [[380, 395, 'meal'], [540, 549, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 3', [[0, 301], [[-40, -30, 'meal'], [200, 209, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, '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', [[360, 690], [[661, 670, 'rest'], [661, 681, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 7', [[0, 209], [[600, 615, 'rest'], [204, 249, 'meal']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[360, 1080], [[661, 670, 'rest']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3})],
 [('regression: rest major fraction 1',
   [[0, 360], [[200, 230, 'meal'], [100, 110, 'rest'], [300, 310, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 0, 'missing_rest': 1}),
  ('regression variant: rest major fraction 2', [[360, 960], [[955, 965, 'rest'], [480, 495, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('partial repair guard 3',
   [[360, 660], [[660, 691, 'meal'], [640, 655, 'meal'], [920, 951, 'meal'], [560, 570, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('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, 660], [[-40, -9, 'meal'], [330, 359, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 7', [[1320, 1620], [[1650, 1660, 'meal'], [1280, 1290, 'meal'], [1920, 1930, 'rest']]],
   {'meals_required': 0, 'late': [], 'missing_meal': 0, 'missing_rest': 0}),
  ('normal control 8', [[360, 720], [[560, 569, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2})],
 [('regression: rest major fraction 1', [[0, 600], [[-40, -10, 'meal'], [330, 360, 'meal']]],
   {'meals_required': 1, 'late': [1], 'missing_meal': 0, 'missing_rest': 3}),
  ('regression variant: rest major fraction 2', [[1320, 1921], []],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('partial repair guard 3', [[360, 690], [[661, 670, 'rest'], [661, 681, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('boundary control 4', [[0, 650], [[550, 580, 'rest'], [500, 530, 'meal'], [250, 280, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 0, 'missing_rest': 2}),
  ('boundary control 5', [[1320, 1920], [[1600, 1629, 'meal'], [1450, 1460, 'rest']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2}),
  ('normal control 6', [[360, 690], [[660, 689, 'meal']]],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 1}),
  ('normal control 7', [[420, 1021], [[480, 509, 'meal'], [980, 1000, 'meal']]],
   {'meals_required': 2, 'late': [], 'missing_meal': 2, 'missing_rest': 3}),
  ('normal control 8', [[360, 720], []],
   {'meals_required': 1, 'late': [], 'missing_meal': 1, 'missing_rest': 2})]]
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 major fraction 1{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}{'late': [], 'meals_required': 1, 'missing_meal': 0, 'missing_rest': 3}Passed
regression variant: rest major fraction 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': 1, 'missing_meal': 1, 'missing_rest': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, 'missing_rest': 0}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': 0}{'late': [], 'meals_required': 1, 'missing_meal': 1, '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': 0, 'missing_meal': 0, 'missing_rest': 1}{'late': [], 'meals_required': 0, 'missing_meal': 0, 'missing_rest': 1}Passed

SHA-256 / e1123665df4ea17176e64db7779b05712270b6dac02a910ff2f8e299f441f613

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

Case digest / 10bfd0f461c27ec9ba6ee23c2c54b637105f701561c05d6e12c2912a3e0f5db3