FAILURE MAP
← Case archive

FA-93966 / Shift rostering labor rules / Open access

Last callback window never paid · case 01

The final guarantee window of the night is missing from paid minutes.

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

ROOT CAUSE

The open window is not flushed into the total after the loop.

VERIFIED REPAIR

After the loop add the open window length to paid minutes.

Unsuccessful approach: Adding a flat guarantee for the last window underpays a callback longer than the guarantee.

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, 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:
        pass
    return [paid, windows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: final window flush 1', [[[0, 30]], 180], [180, 1]),
  ('regression variant: final window flush 2', [[[1580, 1595], [1760, 1960], [1400, 1460]], 120], [440, 3]),
  ('partial repair guard 3', [[[100, 130], [130, 370]], 180], [270, 1]),
  ('boundary control 4', [[[0, 240]], 180], [240, 1]),
  ('boundary control 5', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('normal control 6', [[[0, 200], [181, 241]], 240], [241, 1]),
  ('normal control 7', [[[639, 879], [100, 130], [460, 490], [279, 479]], 180], [630, 2]),
  ('normal control 8', [[[0, 240], [779, 1019], [600, 800]], 180], [659, 2])],
 [('regression: final window flush 1', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('regression variant: final window flush 2', [[[100, 340]], 120], [240, 1]),
  ('partial repair guard 3', [[[280, 295], [880, 1120], [100, 340]], 120], [480, 2]),
  ('boundary control 4', [[], 180], [0, 0]), ('boundary control 5', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('normal control 6', [[[1940, 2180], [1400, 1460], [1700, 1940]], 180], [660, 3]),
  ('normal control 7', [[[100, 130]], 180], [180, 1]),
  ('normal control 8', [[[0, 15], [150, 270]], 240], [270, 1])],
 [('regression: final window flush 1', [[[0, 30], [179, 200]], 180], [200, 1]),
  ('regression variant: final window flush 2', [[[160, 280], [760, 820], [130, 250], [100, 340]], 120],
   [360, 2]),
  ('partial repair guard 3', [[[0, 200], [869, 1109], [179, 379], [779, 979]], 180], [709, 2]),
  ('boundary control 4', [[[0, 30]], 180], [180, 1]),
  ('normal control 5', [[[371, 611], [100, 130], [190, 205]], 180], [420, 2]),
  ('normal control 6', [[[490, 730], [279, 399], [309, 509], [100, 160]], 120], [571, 2]),
  ('normal control 7', [[[370, 570], [100, 300], [340, 460]], 240], [480, 2]),
  ('normal control 8', [[[100, 300], [281, 341], [762, 962], [581, 821]], 240], [622, 2])],
 [('regression: final window flush 1', [[[0, 240]], 180], [240, 1]),
  ('regression variant: final window flush 2', [[[100, 340], [250, 450], [850, 865]], 240], [590, 2]),
  ('partial repair guard 3', [[[100, 115], [279, 519]], 240], [419, 1]),
  ('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
  ('normal control 5', [[[150, 390], [0, 30], [390, 630]], 240], [630, 2]),
  ('normal control 6', [[[100, 115], [250, 310], [430, 550]], 240], [480, 2]),
  ('normal control 7', [[[310, 510], [130, 190], [491, 731], [100, 115]], 240], [631, 1]),
  ('normal control 8', [[[1400, 1460], [1640, 1670]], 180], [360, 2])],
 [('regression: final window flush 1', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('regression variant: final window flush 2', [[[180, 420], [0, 240], [480, 540]], 240], [660, 2]),
  ('partial repair guard 3', [[[100, 130], [220, 340], [130, 250]], 120], [240, 1]),
  ('boundary control 4', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 5', [[], 180], [0, 0]),
  ('normal control 6', [[[370, 570], [100, 115], [130, 190]], 120], [320, 2]),
  ('normal control 7', [[[310, 510], [130, 190], [491, 731], [100, 115]], 240], [631, 1]),
  ('normal control 8', [[[360, 480], [0, 30], [179, 239]], 240], [480, 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: final window flush 1[0, 1][180, 1]Failed
regression variant: final window flush 2[240, 3][440, 3]Failed
partial repair guard 3[0, 1][270, 1]Failed
boundary control 4[0, 1][240, 1]Failed
boundary control 5[180, 2][360, 2]Failed
normal control 6[0, 1][241, 1]Failed
normal control 7[390, 2][630, 2]Failed
normal control 8[240, 2][659, 2]Failed

SHA-256 / c9f6ddd058a3890af50da79a7ce95371404cfce82736ba251691f631044256e2

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 = 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 += guarantee
    return [paid, windows]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: final window flush 1', [[[0, 30]], 180], [180, 1]),
  ('regression variant: final window flush 2', [[[1580, 1595], [1760, 1960], [1400, 1460]], 120], [440, 3]),
  ('partial repair guard 3', [[[100, 130], [130, 370]], 180], [270, 1]),
  ('boundary control 4', [[[0, 240]], 180], [240, 1]),
  ('boundary control 5', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('normal control 6', [[[0, 200], [181, 241]], 240], [241, 1]),
  ('normal control 7', [[[639, 879], [100, 130], [460, 490], [279, 479]], 180], [630, 2]),
  ('normal control 8', [[[0, 240], [779, 1019], [600, 800]], 180], [659, 2])],
 [('regression: final window flush 1', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('regression variant: final window flush 2', [[[100, 340]], 120], [240, 1]),
  ('partial repair guard 3', [[[280, 295], [880, 1120], [100, 340]], 120], [480, 2]),
  ('boundary control 4', [[], 180], [0, 0]), ('boundary control 5', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('normal control 6', [[[1940, 2180], [1400, 1460], [1700, 1940]], 180], [660, 3]),
  ('normal control 7', [[[100, 130]], 180], [180, 1]),
  ('normal control 8', [[[0, 15], [150, 270]], 240], [270, 1])],
 [('regression: final window flush 1', [[[0, 30], [179, 200]], 180], [200, 1]),
  ('regression variant: final window flush 2', [[[160, 280], [760, 820], [130, 250], [100, 340]], 120],
   [360, 2]),
  ('partial repair guard 3', [[[0, 200], [869, 1109], [179, 379], [779, 979]], 180], [709, 2]),
  ('boundary control 4', [[[0, 30]], 180], [180, 1]),
  ('normal control 5', [[[371, 611], [100, 130], [190, 205]], 180], [420, 2]),
  ('normal control 6', [[[490, 730], [279, 399], [309, 509], [100, 160]], 120], [571, 2]),
  ('normal control 7', [[[370, 570], [100, 300], [340, 460]], 240], [480, 2]),
  ('normal control 8', [[[100, 300], [281, 341], [762, 962], [581, 821]], 240], [622, 2])],
 [('regression: final window flush 1', [[[0, 240]], 180], [240, 1]),
  ('regression variant: final window flush 2', [[[100, 340], [250, 450], [850, 865]], 240], [590, 2]),
  ('partial repair guard 3', [[[100, 115], [279, 519]], 240], [419, 1]),
  ('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
  ('normal control 5', [[[150, 390], [0, 30], [390, 630]], 240], [630, 2]),
  ('normal control 6', [[[100, 115], [250, 310], [430, 550]], 240], [480, 2]),
  ('normal control 7', [[[310, 510], [130, 190], [491, 731], [100, 115]], 240], [631, 1]),
  ('normal control 8', [[[1400, 1460], [1640, 1670]], 180], [360, 2])],
 [('regression: final window flush 1', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('regression variant: final window flush 2', [[[180, 420], [0, 240], [480, 540]], 240], [660, 2]),
  ('partial repair guard 3', [[[100, 130], [220, 340], [130, 250]], 120], [240, 1]),
  ('boundary control 4', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 5', [[], 180], [0, 0]),
  ('normal control 6', [[[370, 570], [100, 115], [130, 190]], 120], [320, 2]),
  ('normal control 7', [[[310, 510], [130, 190], [491, 731], [100, 115]], 240], [631, 1]),
  ('normal control 8', [[[360, 480], [0, 30], [179, 239]], 240], [480, 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: final window flush 1[180, 1][180, 1]Passed
regression variant: final window flush 2[360, 3][440, 3]Failed
partial repair guard 3[180, 1][270, 1]Failed
boundary control 4[180, 1][240, 1]Failed
boundary control 5[360, 2][360, 2]Passed
normal control 6[240, 1][241, 1]Failed
normal control 7[570, 2][630, 2]Failed
normal control 8[420, 2][659, 2]Failed

SHA-256 / 16237e5e4191261cb16205800ebe2b57d86aba20b9361cdcec4b4cd2a131794f

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: final window flush 1', [[[0, 30]], 180], [180, 1]),
  ('regression variant: final window flush 2', [[[1580, 1595], [1760, 1960], [1400, 1460]], 120], [440, 3]),
  ('partial repair guard 3', [[[100, 130], [130, 370]], 180], [270, 1]),
  ('boundary control 4', [[[0, 240]], 180], [240, 1]),
  ('boundary control 5', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('normal control 6', [[[0, 200], [181, 241]], 240], [241, 1]),
  ('normal control 7', [[[639, 879], [100, 130], [460, 490], [279, 479]], 180], [630, 2]),
  ('normal control 8', [[[0, 240], [779, 1019], [600, 800]], 180], [659, 2])],
 [('regression: final window flush 1', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('regression variant: final window flush 2', [[[100, 340]], 120], [240, 1]),
  ('partial repair guard 3', [[[280, 295], [880, 1120], [100, 340]], 120], [480, 2]),
  ('boundary control 4', [[], 180], [0, 0]), ('boundary control 5', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('normal control 6', [[[1940, 2180], [1400, 1460], [1700, 1940]], 180], [660, 3]),
  ('normal control 7', [[[100, 130]], 180], [180, 1]),
  ('normal control 8', [[[0, 15], [150, 270]], 240], [270, 1])],
 [('regression: final window flush 1', [[[0, 30], [179, 200]], 180], [200, 1]),
  ('regression variant: final window flush 2', [[[160, 280], [760, 820], [130, 250], [100, 340]], 120],
   [360, 2]),
  ('partial repair guard 3', [[[0, 200], [869, 1109], [179, 379], [779, 979]], 180], [709, 2]),
  ('boundary control 4', [[[0, 30]], 180], [180, 1]),
  ('normal control 5', [[[371, 611], [100, 130], [190, 205]], 180], [420, 2]),
  ('normal control 6', [[[490, 730], [279, 399], [309, 509], [100, 160]], 120], [571, 2]),
  ('normal control 7', [[[370, 570], [100, 300], [340, 460]], 240], [480, 2]),
  ('normal control 8', [[[100, 300], [281, 341], [762, 962], [581, 821]], 240], [622, 2])],
 [('regression: final window flush 1', [[[0, 240]], 180], [240, 1]),
  ('regression variant: final window flush 2', [[[100, 340], [250, 450], [850, 865]], 240], [590, 2]),
  ('partial repair guard 3', [[[100, 115], [279, 519]], 240], [419, 1]),
  ('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
  ('normal control 5', [[[150, 390], [0, 30], [390, 630]], 240], [630, 2]),
  ('normal control 6', [[[100, 115], [250, 310], [430, 550]], 240], [480, 2]),
  ('normal control 7', [[[310, 510], [130, 190], [491, 731], [100, 115]], 240], [631, 1]),
  ('normal control 8', [[[1400, 1460], [1640, 1670]], 180], [360, 2])],
 [('regression: final window flush 1', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('regression variant: final window flush 2', [[[180, 420], [0, 240], [480, 540]], 240], [660, 2]),
  ('partial repair guard 3', [[[100, 130], [220, 340], [130, 250]], 120], [240, 1]),
  ('boundary control 4', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 5', [[], 180], [0, 0]),
  ('normal control 6', [[[370, 570], [100, 115], [130, 190]], 120], [320, 2]),
  ('normal control 7', [[[310, 510], [130, 190], [491, 731], [100, 115]], 240], [631, 1]),
  ('normal control 8', [[[360, 480], [0, 30], [179, 239]], 240], [480, 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: final window flush 1[180, 1][180, 1]Passed
regression variant: final window flush 2[440, 3][440, 3]Passed
partial repair guard 3[270, 1][270, 1]Passed
boundary control 4[240, 1][240, 1]Passed
boundary control 5[360, 2][360, 2]Passed
normal control 6[241, 1][241, 1]Passed
normal control 7[630, 2][630, 2]Passed
normal control 8[659, 2][659, 2]Passed

SHA-256 / ef6b9d10fffb04e46f13dbb5c219afbcf291ba73bc8acf8b432da5c5d04524de

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

Case digest / 41e1d1596e62cf79b18377365688128882c64fc3bd219d06bb55f734dd028624