FA-93976 / Shift rostering labor rules / Open access
Merged callback restarts a fresh guarantee · case 01
Clustered callbacks are paid a new three-hour minimum each time.
ROOT CAUSE
A callback inside an open window extends the window by its own guarantee.
VERIFIED REPAIR
Inside an open window, extend only to the callback's actual end when later.
Unsuccessful approach: Setting the end to the callback end can shrink the window when the callback ends early.
Case contract
Callback work intervals [start, end] and a minimum guarantee in minutes. Sorted by start, each callback that does not start inside the current guarantee window opens a new window from its start to max(end, start + guarantee); a callback starting before the window end extends the window to its own end if later. Return [paid minutes as the sum of window lengths, window count].
Why this case matters
Callback and show-up minimum-pay rules routinely double pay or underpay when callbacks cluster.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(callbacks, guarantee):
paid = 0
windows = 0
win_start = win_end = None
for s, e in sorted(callbacks):
if win_end is not None and s < win_end:
win_end = max(win_end, s + guarantee)
else:
if win_end is not None:
paid += win_end - win_start
win_start, win_end = s, max(e, s + guarantee)
windows += 1
if win_end is not None:
paid += win_end - win_start
return [paid, windows]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: window extension restarts guarantee 1', [[[0, 30], [179, 200]], 180], [200, 1]),
('regression variant: window extension restarts guarantee 2', [[[360, 600], [0, 30], [181, 241]], 180],
[599, 2]),
('partial repair guard 3', [[[280, 295], [880, 1120], [100, 340]], 120], [480, 2]),
('boundary control 4', [[[0, 240]], 180], [240, 1]),
('boundary control 5', [[[0, 30], [180, 200]], 180], [360, 2]),
('normal control 6', [[[0, 200], [240, 255]], 240], [480, 2]),
('normal control 7', [[[1400, 1520], [1579, 1594], [1758, 1878]], 180], [374, 2]),
('normal control 8', [[[2180, 2380], [1400, 1520], [1640, 1700], [1880, 2120]], 240], [960, 4])],
[('regression: window extension restarts guarantee 1', [[[0, 30], [60, 400]], 180], [400, 1]),
('regression variant: window extension restarts guarantee 2', [[[371, 611], [100, 130], [190, 205]], 180],
[420, 2]),
('partial repair guard 3', [[[1580, 1595], [1820, 1835], [1999, 2014], [1400, 1430]], 240], [480, 2]),
('boundary control 4', [[], 180], [0, 0]),
('normal control 5', [[[1640, 1700], [1730, 1850], [1400, 1520], [1820, 2060]], 120], [540, 2]),
('normal control 6', [[[309, 509], [130, 145], [549, 579], [100, 340]], 240], [649, 2]),
('normal control 7', [[[2030, 2270], [1400, 1430], [1430, 1550], [2180, 2300]], 180], [450, 2]),
('normal control 8', [[[580, 610], [400, 415], [490, 610], [100, 340]], 180], [450, 2])],
[('regression: window extension restarts guarantee 1',
[[[1550, 1580], [2180, 2210], [1580, 1780], [1400, 1520]], 120], [470, 3]),
('regression variant: window extension restarts guarantee 2', [[[430, 630], [340, 580], [100, 130]], 180],
[470, 2]),
('partial repair guard 3', [[[1400, 1640], [1610, 1850], [1640, 1655], [1430, 1630]], 120], [450, 1]),
('boundary control 4', [[[0, 30], [179, 200]], 180], [200, 1]),
('boundary control 5', [[[0, 30]], 180], [180, 1]),
('normal control 6', [[[0, 15], [90, 290]], 240], [290, 1]),
('normal control 7', [[[1400, 1640]], 180], [240, 1]),
('normal control 8', [[[100, 220]], 240], [240, 1])],
[('regression: window extension restarts guarantee 1', [[[1430, 1490], [1400, 1430]], 240], [240, 1]),
('regression variant: window extension restarts guarantee 2',
[[[1671, 1911], [1400, 1415], [1490, 1610], [1701, 1761]], 240], [480, 2]),
('partial repair guard 3', [[[130, 370], [100, 340], [309, 369]], 120], [270, 1]),
('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
('boundary control 5', [[[0, 240]], 180], [240, 1]),
('normal control 6', [[[100, 130], [130, 330], [430, 445]], 180], [410, 2]),
('normal control 7', [[[100, 300], [281, 521]], 240], [421, 1]),
('normal control 8', [[[0, 120], [150, 210], [450, 690]], 180], [450, 2])],
[('regression: window extension restarts guarantee 1', [[[1490, 1550], [1400, 1600]], 240], [240, 1]),
('regression variant: window extension restarts guarantee 2',
[[[1400, 1640], [1610, 1850], [1640, 1655], [1430, 1630]], 120], [450, 1]),
('partial repair guard 3', [[[250, 265], [100, 115]], 180], [180, 1]),
('boundary control 4', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 5', [[], 180], [0, 0]),
('normal control 6', [[[100, 300], [250, 265]], 180], [200, 1]),
('normal control 7', [[[1000, 1060], [250, 310], [100, 220], [400, 600]], 180], [590, 3]),
('normal control 8', [[[0, 120]], 180], [180, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: window extension restarts guarantee 1 | [359, 1] | [200, 1] | Failed |
| regression variant: window extension restarts guarantee 2 | [539, 2] | [599, 2] | Failed |
| partial repair guard 3 | [540, 2] | [480, 2] | Failed |
| boundary control 4 | [240, 1] | [240, 1] | Passed |
| boundary control 5 | [360, 2] | [360, 2] | Passed |
| normal control 6 | [480, 2] | [480, 2] | Passed |
| normal control 7 | [538, 1] | [374, 2] | Failed |
| normal control 8 | [960, 4] | [960, 4] | Passed |
SHA-256 / 0031eec2815ac51bf12e329fc2d76457959d1c0b3532ca5d68843dfa74a4ea53
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(callbacks, guarantee):
paid = 0
windows = 0
win_start = win_end = None
for s, e in sorted(callbacks):
if win_end is not None and s < win_end:
win_end = e
else:
if win_end is not None:
paid += win_end - win_start
win_start, win_end = s, max(e, s + guarantee)
windows += 1
if win_end is not None:
paid += win_end - win_start
return [paid, windows]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: window extension restarts guarantee 1', [[[0, 30], [179, 200]], 180], [200, 1]),
('regression variant: window extension restarts guarantee 2', [[[360, 600], [0, 30], [181, 241]], 180],
[599, 2]),
('partial repair guard 3', [[[280, 295], [880, 1120], [100, 340]], 120], [480, 2]),
('boundary control 4', [[[0, 240]], 180], [240, 1]),
('boundary control 5', [[[0, 30], [180, 200]], 180], [360, 2]),
('normal control 6', [[[0, 200], [240, 255]], 240], [480, 2]),
('normal control 7', [[[1400, 1520], [1579, 1594], [1758, 1878]], 180], [374, 2]),
('normal control 8', [[[2180, 2380], [1400, 1520], [1640, 1700], [1880, 2120]], 240], [960, 4])],
[('regression: window extension restarts guarantee 1', [[[0, 30], [60, 400]], 180], [400, 1]),
('regression variant: window extension restarts guarantee 2', [[[371, 611], [100, 130], [190, 205]], 180],
[420, 2]),
('partial repair guard 3', [[[1580, 1595], [1820, 1835], [1999, 2014], [1400, 1430]], 240], [480, 2]),
('boundary control 4', [[], 180], [0, 0]),
('normal control 5', [[[1640, 1700], [1730, 1850], [1400, 1520], [1820, 2060]], 120], [540, 2]),
('normal control 6', [[[309, 509], [130, 145], [549, 579], [100, 340]], 240], [649, 2]),
('normal control 7', [[[2030, 2270], [1400, 1430], [1430, 1550], [2180, 2300]], 180], [450, 2]),
('normal control 8', [[[580, 610], [400, 415], [490, 610], [100, 340]], 180], [450, 2])],
[('regression: window extension restarts guarantee 1',
[[[1550, 1580], [2180, 2210], [1580, 1780], [1400, 1520]], 120], [470, 3]),
('regression variant: window extension restarts guarantee 2', [[[430, 630], [340, 580], [100, 130]], 180],
[470, 2]),
('partial repair guard 3', [[[1400, 1640], [1610, 1850], [1640, 1655], [1430, 1630]], 120], [450, 1]),
('boundary control 4', [[[0, 30], [179, 200]], 180], [200, 1]),
('boundary control 5', [[[0, 30]], 180], [180, 1]),
('normal control 6', [[[0, 15], [90, 290]], 240], [290, 1]),
('normal control 7', [[[1400, 1640]], 180], [240, 1]),
('normal control 8', [[[100, 220]], 240], [240, 1])],
[('regression: window extension restarts guarantee 1', [[[1430, 1490], [1400, 1430]], 240], [240, 1]),
('regression variant: window extension restarts guarantee 2',
[[[1671, 1911], [1400, 1415], [1490, 1610], [1701, 1761]], 240], [480, 2]),
('partial repair guard 3', [[[130, 370], [100, 340], [309, 369]], 120], [270, 1]),
('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
('boundary control 5', [[[0, 240]], 180], [240, 1]),
('normal control 6', [[[100, 130], [130, 330], [430, 445]], 180], [410, 2]),
('normal control 7', [[[100, 300], [281, 521]], 240], [421, 1]),
('normal control 8', [[[0, 120], [150, 210], [450, 690]], 180], [450, 2])],
[('regression: window extension restarts guarantee 1', [[[1490, 1550], [1400, 1600]], 240], [240, 1]),
('regression variant: window extension restarts guarantee 2',
[[[1400, 1640], [1610, 1850], [1640, 1655], [1430, 1630]], 120], [450, 1]),
('partial repair guard 3', [[[250, 265], [100, 115]], 180], [180, 1]),
('boundary control 4', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 5', [[], 180], [0, 0]),
('normal control 6', [[[100, 300], [250, 265]], 180], [200, 1]),
('normal control 7', [[[1000, 1060], [250, 310], [100, 220], [400, 600]], 180], [590, 3]),
('normal control 8', [[[0, 120]], 180], [180, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: window extension restarts guarantee 1 | [200, 1] | [200, 1] | Passed |
| regression variant: window extension restarts guarantee 2 | [599, 2] | [599, 2] | Passed |
| partial repair guard 3 | [435, 2] | [480, 2] | Failed |
| boundary control 4 | [240, 1] | [240, 1] | Passed |
| boundary control 5 | [360, 2] | [360, 2] | Passed |
| normal control 6 | [480, 2] | [480, 2] | Passed |
| normal control 7 | [374, 2] | [374, 2] | Passed |
| normal control 8 | [960, 4] | [960, 4] | Passed |
SHA-256 / 34bc8c8815f5974bb1badff557d32ab0501ecc0d04f4414ad21e1ba667e81141
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(callbacks, guarantee):
paid = 0
windows = 0
win_start = win_end = None
for s, e in sorted(callbacks):
if win_end is not None and s < win_end:
win_end = max(win_end, e)
else:
if win_end is not None:
paid += win_end - win_start
win_start, win_end = s, max(e, s + guarantee)
windows += 1
if win_end is not None:
paid += win_end - win_start
return [paid, windows]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: window extension restarts guarantee 1', [[[0, 30], [179, 200]], 180], [200, 1]),
('regression variant: window extension restarts guarantee 2', [[[360, 600], [0, 30], [181, 241]], 180],
[599, 2]),
('partial repair guard 3', [[[280, 295], [880, 1120], [100, 340]], 120], [480, 2]),
('boundary control 4', [[[0, 240]], 180], [240, 1]),
('boundary control 5', [[[0, 30], [180, 200]], 180], [360, 2]),
('normal control 6', [[[0, 200], [240, 255]], 240], [480, 2]),
('normal control 7', [[[1400, 1520], [1579, 1594], [1758, 1878]], 180], [374, 2]),
('normal control 8', [[[2180, 2380], [1400, 1520], [1640, 1700], [1880, 2120]], 240], [960, 4])],
[('regression: window extension restarts guarantee 1', [[[0, 30], [60, 400]], 180], [400, 1]),
('regression variant: window extension restarts guarantee 2', [[[371, 611], [100, 130], [190, 205]], 180],
[420, 2]),
('partial repair guard 3', [[[1580, 1595], [1820, 1835], [1999, 2014], [1400, 1430]], 240], [480, 2]),
('boundary control 4', [[], 180], [0, 0]),
('normal control 5', [[[1640, 1700], [1730, 1850], [1400, 1520], [1820, 2060]], 120], [540, 2]),
('normal control 6', [[[309, 509], [130, 145], [549, 579], [100, 340]], 240], [649, 2]),
('normal control 7', [[[2030, 2270], [1400, 1430], [1430, 1550], [2180, 2300]], 180], [450, 2]),
('normal control 8', [[[580, 610], [400, 415], [490, 610], [100, 340]], 180], [450, 2])],
[('regression: window extension restarts guarantee 1',
[[[1550, 1580], [2180, 2210], [1580, 1780], [1400, 1520]], 120], [470, 3]),
('regression variant: window extension restarts guarantee 2', [[[430, 630], [340, 580], [100, 130]], 180],
[470, 2]),
('partial repair guard 3', [[[1400, 1640], [1610, 1850], [1640, 1655], [1430, 1630]], 120], [450, 1]),
('boundary control 4', [[[0, 30], [179, 200]], 180], [200, 1]),
('boundary control 5', [[[0, 30]], 180], [180, 1]),
('normal control 6', [[[0, 15], [90, 290]], 240], [290, 1]),
('normal control 7', [[[1400, 1640]], 180], [240, 1]),
('normal control 8', [[[100, 220]], 240], [240, 1])],
[('regression: window extension restarts guarantee 1', [[[1430, 1490], [1400, 1430]], 240], [240, 1]),
('regression variant: window extension restarts guarantee 2',
[[[1671, 1911], [1400, 1415], [1490, 1610], [1701, 1761]], 240], [480, 2]),
('partial repair guard 3', [[[130, 370], [100, 340], [309, 369]], 120], [270, 1]),
('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
('boundary control 5', [[[0, 240]], 180], [240, 1]),
('normal control 6', [[[100, 130], [130, 330], [430, 445]], 180], [410, 2]),
('normal control 7', [[[100, 300], [281, 521]], 240], [421, 1]),
('normal control 8', [[[0, 120], [150, 210], [450, 690]], 180], [450, 2])],
[('regression: window extension restarts guarantee 1', [[[1490, 1550], [1400, 1600]], 240], [240, 1]),
('regression variant: window extension restarts guarantee 2',
[[[1400, 1640], [1610, 1850], [1640, 1655], [1430, 1630]], 120], [450, 1]),
('partial repair guard 3', [[[250, 265], [100, 115]], 180], [180, 1]),
('boundary control 4', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 5', [[], 180], [0, 0]),
('normal control 6', [[[100, 300], [250, 265]], 180], [200, 1]),
('normal control 7', [[[1000, 1060], [250, 310], [100, 220], [400, 600]], 180], [590, 3]),
('normal control 8', [[[0, 120]], 180], [180, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: window extension restarts guarantee 1 | [200, 1] | [200, 1] | Passed |
| regression variant: window extension restarts guarantee 2 | [599, 2] | [599, 2] | Passed |
| partial repair guard 3 | [480, 2] | [480, 2] | Passed |
| boundary control 4 | [240, 1] | [240, 1] | Passed |
| boundary control 5 | [360, 2] | [360, 2] | Passed |
| normal control 6 | [480, 2] | [480, 2] | Passed |
| normal control 7 | [374, 2] | [374, 2] | Passed |
| normal control 8 | [960, 4] | [960, 4] | Passed |
SHA-256 / 4a80fca1b2ef877f06fc536bba1df52ff43ea20be75a1bdae8ee64a8abbdb409
Verification & scope
Stipulated toy labor rule for a bounded roster model; it is not legal advice and does not claim conformance with any jurisdiction, award, or collective agreement. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:52:00.032662+00:00.
Case digest / f3833c06c5ec33fee263f25c6b698aa655e8d65ac32021af0f9737265f3113ea