FAILURE MAP
← Case archive

FA-93971 / Shift rostering labor rules / Open access

Callback at the exact guarantee end merges into the old window · case 01

A callback starting exactly when the previous guarantee ends gets no guarantee of its own.

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

ROOT CAUSE

The merge test is inclusive of the window end.

THE FAILURE

The merge test is inclusive of the window end.

Unsuccessful approach: Merging only callbacks that finish inside the window opens a new window for a callback that started inside it.

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:
        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 merge boundary 1', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('regression variant: window merge boundary 2', [[[1580, 1595], [1400, 1415], [1760, 1820]], 180],
   [540, 3]),
  ('partial repair guard 3', [[[360, 600], [0, 30], [181, 241]], 180], [599, 2]),
  ('boundary control 4', [[[0, 240]], 180], [240, 1]),
  ('normal control 5', [[[1550, 1580], [2180, 2210], [1580, 1780], [1400, 1520]], 120], [470, 3]),
  ('normal control 6', [[[661, 781], [181, 196], [481, 511], [0, 120]], 180], [720, 4]),
  ('normal control 7', [[[30, 150], [0, 30]], 240], [240, 1]),
  ('normal control 8', [[[1400, 1430]], 180], [180, 1])],
 [('regression: window merge boundary 1', [[[270, 300], [0, 60], [30, 270]], 180], [450, 2]),
  ('regression variant: window merge boundary 2', [[[100, 160], [310, 370], [280, 340]], 180], [360, 2]),
  ('partial repair guard 3', [[[180, 420], [0, 240], [480, 540]], 240], [660, 2]),
  ('boundary control 4', [[], 180], [0, 0]), ('boundary control 5', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('normal control 6', [[[240, 300], [0, 30], [330, 390]], 120], [270, 2]),
  ('normal control 7', [[[340, 370], [700, 820], [100, 130], [519, 719]], 120], [541, 3]),
  ('normal control 8', [[[1490, 1610], [1400, 1520], [1580, 1610]], 120], [210, 1])],
 [('regression: window merge boundary 1', [[[280, 295], [100, 130], [130, 145]], 180], [360, 2]),
  ('regression variant: window merge boundary 2', [[[640, 700], [100, 160], [340, 460]], 240], [720, 3]),
  ('partial repair guard 3', [[[430, 630], [340, 580], [100, 130]], 180], [470, 2]),
  ('boundary control 4', [[[0, 30], [179, 200]], 180], [200, 1]),
  ('boundary control 5', [[[0, 30]], 180], [180, 1]), ('normal control 6', [[[1400, 1600]], 180], [200, 1]),
  ('normal control 7', [[[0, 15]], 180], [180, 1]),
  ('normal control 8', [[[100, 220], [700, 900]], 120], [320, 2])],
 [('regression: window merge boundary 1', [[[519, 549], [100, 340], [340, 580]], 240], [480, 2]),
  ('regression variant: window merge boundary 2',
   [[[1969, 2169], [1579, 1594], [1729, 1929], [1400, 1460]], 240], [720, 3]),
  ('partial repair guard 3', [[[100, 115], [279, 519]], 240], [419, 1]),
  ('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
  ('boundary control 5', [[[0, 240]], 180], [240, 1]),
  ('normal control 6', [[[1579, 1639], [1400, 1430]], 120], [240, 2]),
  ('normal control 7', [[[2150, 2270], [1400, 1640], [1550, 1790]], 240], [630, 2]),
  ('normal control 8', [[[1729, 1849], [1579, 1699], [1400, 1430]], 240], [539, 2])],
 [('regression: window merge boundary 1', [[[1819, 1939], [1640, 1760], [1400, 1640]], 180], [539, 2]),
  ('partial repair guard 2', [[[400, 415], [100, 340], [581, 641]], 240], [481, 2]),
  ('boundary control 3', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 4', [[], 180], [0, 0]),
  ('normal control 5', [[[100, 340], [190, 250]], 240], [240, 1]),
  ('normal control 6', [[[1000, 1060], [250, 310], [100, 220], [400, 600]], 180], [590, 3]),
  ('normal control 7', [[[100, 220], [762, 792], [462, 522], [281, 521]], 180], [601, 3]),
  ('normal control 8', [[[0, 60]], 120], [120, 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: window merge boundary 1[200, 1][360, 2]Failed
regression variant: window merge boundary 2[375, 2][540, 3]Failed
partial repair guard 3[599, 2][599, 2]Passed
boundary control 4[240, 1][240, 1]Passed
normal control 5[470, 3][470, 3]Passed
normal control 6[660, 3][720, 4]Failed
normal control 7[240, 1][240, 1]Passed
normal control 8[180, 1][180, 1]Passed

SHA-256 / 20943a55734c9e310fde1bb22bff1f9ded4d61ad0b1f23f112bbade3c00a7f51

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 e < 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 merge boundary 1', [[[0, 30], [180, 200]], 180], [360, 2]),
  ('regression variant: window merge boundary 2', [[[1580, 1595], [1400, 1415], [1760, 1820]], 180],
   [540, 3]),
  ('partial repair guard 3', [[[360, 600], [0, 30], [181, 241]], 180], [599, 2]),
  ('boundary control 4', [[[0, 240]], 180], [240, 1]),
  ('normal control 5', [[[1550, 1580], [2180, 2210], [1580, 1780], [1400, 1520]], 120], [470, 3]),
  ('normal control 6', [[[661, 781], [181, 196], [481, 511], [0, 120]], 180], [720, 4]),
  ('normal control 7', [[[30, 150], [0, 30]], 240], [240, 1]),
  ('normal control 8', [[[1400, 1430]], 180], [180, 1])],
 [('regression: window merge boundary 1', [[[270, 300], [0, 60], [30, 270]], 180], [450, 2]),
  ('regression variant: window merge boundary 2', [[[100, 160], [310, 370], [280, 340]], 180], [360, 2]),
  ('partial repair guard 3', [[[180, 420], [0, 240], [480, 540]], 240], [660, 2]),
  ('boundary control 4', [[], 180], [0, 0]), ('boundary control 5', [[[0, 30], [60, 400]], 180], [400, 1]),
  ('normal control 6', [[[240, 300], [0, 30], [330, 390]], 120], [270, 2]),
  ('normal control 7', [[[340, 370], [700, 820], [100, 130], [519, 719]], 120], [541, 3]),
  ('normal control 8', [[[1490, 1610], [1400, 1520], [1580, 1610]], 120], [210, 1])],
 [('regression: window merge boundary 1', [[[280, 295], [100, 130], [130, 145]], 180], [360, 2]),
  ('regression variant: window merge boundary 2', [[[640, 700], [100, 160], [340, 460]], 240], [720, 3]),
  ('partial repair guard 3', [[[430, 630], [340, 580], [100, 130]], 180], [470, 2]),
  ('boundary control 4', [[[0, 30], [179, 200]], 180], [200, 1]),
  ('boundary control 5', [[[0, 30]], 180], [180, 1]), ('normal control 6', [[[1400, 1600]], 180], [200, 1]),
  ('normal control 7', [[[0, 15]], 180], [180, 1]),
  ('normal control 8', [[[100, 220], [700, 900]], 120], [320, 2])],
 [('regression: window merge boundary 1', [[[519, 549], [100, 340], [340, 580]], 240], [480, 2]),
  ('regression variant: window merge boundary 2',
   [[[1969, 2169], [1579, 1594], [1729, 1929], [1400, 1460]], 240], [720, 3]),
  ('partial repair guard 3', [[[100, 115], [279, 519]], 240], [419, 1]),
  ('boundary control 4', [[[300, 330], [0, 30]], 180], [360, 2]),
  ('boundary control 5', [[[0, 240]], 180], [240, 1]),
  ('normal control 6', [[[1579, 1639], [1400, 1430]], 120], [240, 2]),
  ('normal control 7', [[[2150, 2270], [1400, 1640], [1550, 1790]], 240], [630, 2]),
  ('normal control 8', [[[1729, 1849], [1579, 1699], [1400, 1430]], 240], [539, 2])],
 [('regression: window merge boundary 1', [[[1819, 1939], [1640, 1760], [1400, 1640]], 180], [539, 2]),
  ('partial repair guard 2', [[[400, 415], [100, 340], [581, 641]], 240], [481, 2]),
  ('boundary control 3', [[[0, 30], [180, 200]], 180], [360, 2]), ('boundary control 4', [[], 180], [0, 0]),
  ('normal control 5', [[[100, 340], [190, 250]], 240], [240, 1]),
  ('normal control 6', [[[1000, 1060], [250, 310], [100, 220], [400, 600]], 180], [590, 3]),
  ('normal control 7', [[[100, 220], [762, 792], [462, 522], [281, 521]], 180], [601, 3]),
  ('normal control 8', [[[0, 60]], 120], [120, 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: window merge boundary 1[360, 2][360, 2]Passed
regression variant: window merge boundary 2[540, 3][540, 3]Passed
partial repair guard 3[600, 3][599, 2]Failed
boundary control 4[240, 1][240, 1]Passed
normal control 5[560, 4][470, 3]Failed
normal control 6[720, 4][720, 4]Passed
normal control 7[240, 1][240, 1]Passed
normal control 8[180, 1][180, 1]Passed

SHA-256 / ab8af0834c4e262b472db4eff5d12998890a3952e7f417ca028535e3bf6fd373

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 07dad439c7f4d9f064506fe9c61c1c16714ac384a517bf4668017856a68a20a9