FA-93906 / Shift rostering labor rules / Open access
Nested duplicate segment truncates the merged work block · case 01
A short duplicate punch inside a long segment cuts the block, creating a fake split and short spread.
ROOT CAUSE
Merging overwrites the block end with the nested segment's end.
THE FAILURE
Merging overwrites the block end with the nested segment's end.
Unsuccessful approach: Comparing against the block start still lets a nested segment shrink the block.
Case contract
Worked segments [start, end] of one workday (unordered, possibly overlapping) and a minimum wage in cents. Overlapping or touching segments merge. Spread is last end minus first start. Each gap longer than 60 minutes is a split. A spread over 600 minutes earns one hour of minimum wage and replaces any split premium; otherwise each split earns min_wage // 2, for at most two splits. Return [spread, splits, premium].
Why this case matters
Spread-of-hours and split-shift premiums are frequent roster-pay rules that depend on correct interval handling.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(segments, min_wage):
seg = sorted(segments)
merged = []
for s, e in seg:
if merged and s <= merged[-1][1]:
merged[-1][1] = e
else:
merged.append([s, e])
spread = merged[-1][1] - merged[0][0]
splits = sum(1 for a, b in zip(merged, merged[1:]) if b[0] - a[1] > 60)
if spread > 600:
premium = min_wage
else:
premium = (min_wage // 2) * min(splits, 2)
return [spread, splits, premium]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: merge extension shrinks 1',
[[[600, 780], [931, 1171], [1291, 1351], [750, 870], [610, 620]], 1655], [751, 2, 1655]),
('regression variant: merge extension shrinks 2', [[[900, 1020], [600, 780], [780, 900], [910, 920]], 1600],
[420, 0, 0]),
('partial repair guard 3', [[[809, 1109], [420, 480], [819, 829], [1168, 1468], [450, 750]], 1655],
[1048, 0, 1655]),
('boundary control 4', [[[420, 1020]], 1600], [600, 0, 0]),
('boundary control 5', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
[590, 4, 1654]),
('normal control 6', [[[661, 961], [541, 601], [420, 480], [551, 561]], 1701], [541, 1, 850]),
('normal control 7', [[[481, 541], [360, 420]], 1655], [181, 1, 827]),
('normal control 8', [[[900, 960], [360, 480], [541, 841]], 1655], [600, 1, 827])],
[('regression: merge extension shrinks 1', [[[720, 840], [730, 740], [420, 720], [870, 1170]], 1600],
[750, 0, 1600]),
('regression variant: merge extension shrinks 2', [[[600, 780], [610, 620]], 1655], [180, 0, 0]),
('partial repair guard 3', [[[970, 980], [1259, 1319], [600, 900], [960, 1200]], 1520], [719, 0, 1520]),
('boundary control 4', [[[900, 1000], [420, 600], [700, 800]], 1520], [580, 2, 1520]),
('boundary control 5', [[[480, 720], [781, 1080]], 1600], [600, 1, 800]),
('normal control 6', [[[600, 780], [960, 1020], [1080, 1260]], 1655], [660, 1, 1655]),
('normal control 7', [[[420, 660], [630, 810], [820, 830], [810, 870]], 1520], [450, 0, 0]),
('normal control 8', [[[721, 961], [1022, 1142], [480, 660]], 1520], [662, 2, 1520])],
[('regression: merge extension shrinks 1',
[[[930, 1230], [1230, 1530], [750, 930], [760, 770], [600, 780]], 1701], [930, 0, 1701]),
('regression variant: merge extension shrinks 2', [[[661, 961], [541, 601], [420, 480], [551, 561]], 1701],
[541, 1, 850]),
('partial repair guard 3', [[[420, 540], [430, 440]], 1600], [120, 0, 0]),
('boundary control 4', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701], [330, 3, 1700]),
('boundary control 5', [[[420, 1021]], 1600], [601, 0, 1600]),
('normal control 6', [[[900, 1140], [360, 420], [600, 780]], 1600], [780, 2, 1600]),
('normal control 7', [[[600, 780], [610, 620]], 1655], [180, 0, 0]),
('normal control 8', [[[430, 440], [420, 540]], 1600], [120, 0, 0])],
[('regression: merge extension shrinks 1', [[[610, 620], [360, 540], [600, 900]], 1655], [540, 0, 0]),
('regression variant: merge extension shrinks 2', [[[430, 440], [420, 660], [720, 900]], 1600],
[480, 0, 0]),
('partial repair guard 3', [[[489, 499], [899, 1019], [599, 839], [360, 420], [479, 539]], 1520],
[659, 0, 1520]),
('boundary control 4', [[[420, 600], [660, 780], [840, 1020]], 1701], [600, 0, 0]),
('boundary control 5', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600], [330, 3, 1600]),
('normal control 6', [[[420, 480]], 1520], [60, 0, 0]),
('normal control 7', [[[899, 959], [420, 720], [779, 839]], 1701], [539, 0, 0]),
('normal control 8', [[[961, 1081], [1171, 1231], [971, 981], [600, 900]], 1655], [631, 2, 1655])],
[('regression: merge extension shrinks 1', [[[370, 380], [360, 480]], 1520], [120, 0, 0]),
('regression variant: merge extension shrinks 2', [[[570, 750], [420, 540], [580, 590]], 1701],
[330, 0, 0]),
('partial repair guard 3', [[[360, 420], [370, 380]], 1701], [60, 0, 0]),
('boundary control 4', [[[600, 900], [610, 620], [1000, 1100]], 1655], [500, 1, 827]),
('boundary control 5', [[[480, 720], [780, 1080]], 1600], [600, 0, 0]),
('normal control 6', [[[630, 750], [640, 650], [420, 540]], 1701], [330, 1, 850]),
('normal control 7', [[[810, 870], [840, 1020], [600, 720], [990, 1290]], 1600], [690, 1, 1600]),
('normal control 8', [[[360, 540], [370, 380], [660, 720]], 1655], [360, 1, 827])]]
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: merge extension shrinks 1 | [751, 3, 1655] | [751, 2, 1655] | Failed |
| regression variant: merge extension shrinks 2 | [320, 0, 0] | [420, 0, 0] | Failed |
| partial repair guard 3 | [1048, 1, 1655] | [1048, 0, 1655] | Failed |
| boundary control 4 | [600, 0, 0] | [600, 0, 0] | Passed |
| boundary control 5 | [590, 4, 1654] | [590, 4, 1654] | Passed |
| normal control 6 | [541, 2, 1700] | [541, 1, 850] | Failed |
| normal control 7 | [181, 1, 827] | [181, 1, 827] | Passed |
| normal control 8 | [600, 1, 827] | [600, 1, 827] | Passed |
SHA-256 / 6cd2f35a378e5734169018bde64555a1e4c5e3416b300a665ce1e3509f13fc25
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(segments, min_wage):
seg = sorted(segments)
merged = []
for s, e in seg:
if merged and s <= merged[-1][1]:
merged[-1][1] = max(merged[-1][0], e)
else:
merged.append([s, e])
spread = merged[-1][1] - merged[0][0]
splits = sum(1 for a, b in zip(merged, merged[1:]) if b[0] - a[1] > 60)
if spread > 600:
premium = min_wage
else:
premium = (min_wage // 2) * min(splits, 2)
return [spread, splits, premium]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: merge extension shrinks 1',
[[[600, 780], [931, 1171], [1291, 1351], [750, 870], [610, 620]], 1655], [751, 2, 1655]),
('regression variant: merge extension shrinks 2', [[[900, 1020], [600, 780], [780, 900], [910, 920]], 1600],
[420, 0, 0]),
('partial repair guard 3', [[[809, 1109], [420, 480], [819, 829], [1168, 1468], [450, 750]], 1655],
[1048, 0, 1655]),
('boundary control 4', [[[420, 1020]], 1600], [600, 0, 0]),
('boundary control 5', [[[420, 480], [550, 600], [700, 760], [840, 900], [980, 1010]], 1655],
[590, 4, 1654]),
('normal control 6', [[[661, 961], [541, 601], [420, 480], [551, 561]], 1701], [541, 1, 850]),
('normal control 7', [[[481, 541], [360, 420]], 1655], [181, 1, 827]),
('normal control 8', [[[900, 960], [360, 480], [541, 841]], 1655], [600, 1, 827])],
[('regression: merge extension shrinks 1', [[[720, 840], [730, 740], [420, 720], [870, 1170]], 1600],
[750, 0, 1600]),
('regression variant: merge extension shrinks 2', [[[600, 780], [610, 620]], 1655], [180, 0, 0]),
('partial repair guard 3', [[[970, 980], [1259, 1319], [600, 900], [960, 1200]], 1520], [719, 0, 1520]),
('boundary control 4', [[[900, 1000], [420, 600], [700, 800]], 1520], [580, 2, 1520]),
('boundary control 5', [[[480, 720], [781, 1080]], 1600], [600, 1, 800]),
('normal control 6', [[[600, 780], [960, 1020], [1080, 1260]], 1655], [660, 1, 1655]),
('normal control 7', [[[420, 660], [630, 810], [820, 830], [810, 870]], 1520], [450, 0, 0]),
('normal control 8', [[[721, 961], [1022, 1142], [480, 660]], 1520], [662, 2, 1520])],
[('regression: merge extension shrinks 1',
[[[930, 1230], [1230, 1530], [750, 930], [760, 770], [600, 780]], 1701], [930, 0, 1701]),
('regression variant: merge extension shrinks 2', [[[661, 961], [541, 601], [420, 480], [551, 561]], 1701],
[541, 1, 850]),
('partial repair guard 3', [[[420, 540], [430, 440]], 1600], [120, 0, 0]),
('boundary control 4', [[[600, 630], [700, 730], [800, 830], [900, 930]], 1701], [330, 3, 1700]),
('boundary control 5', [[[420, 1021]], 1600], [601, 0, 1600]),
('normal control 6', [[[900, 1140], [360, 420], [600, 780]], 1600], [780, 2, 1600]),
('normal control 7', [[[600, 780], [610, 620]], 1655], [180, 0, 0]),
('normal control 8', [[[430, 440], [420, 540]], 1600], [120, 0, 0])],
[('regression: merge extension shrinks 1', [[[610, 620], [360, 540], [600, 900]], 1655], [540, 0, 0]),
('regression variant: merge extension shrinks 2', [[[430, 440], [420, 660], [720, 900]], 1600],
[480, 0, 0]),
('partial repair guard 3', [[[489, 499], [899, 1019], [599, 839], [360, 420], [479, 539]], 1520],
[659, 0, 1520]),
('boundary control 4', [[[420, 600], [660, 780], [840, 1020]], 1701], [600, 0, 0]),
('boundary control 5', [[[420, 450], [520, 550], [620, 650], [720, 750]], 1600], [330, 3, 1600]),
('normal control 6', [[[420, 480]], 1520], [60, 0, 0]),
('normal control 7', [[[899, 959], [420, 720], [779, 839]], 1701], [539, 0, 0]),
('normal control 8', [[[961, 1081], [1171, 1231], [971, 981], [600, 900]], 1655], [631, 2, 1655])],
[('regression: merge extension shrinks 1', [[[370, 380], [360, 480]], 1520], [120, 0, 0]),
('regression variant: merge extension shrinks 2', [[[570, 750], [420, 540], [580, 590]], 1701],
[330, 0, 0]),
('partial repair guard 3', [[[360, 420], [370, 380]], 1701], [60, 0, 0]),
('boundary control 4', [[[600, 900], [610, 620], [1000, 1100]], 1655], [500, 1, 827]),
('boundary control 5', [[[480, 720], [780, 1080]], 1600], [600, 0, 0]),
('normal control 6', [[[630, 750], [640, 650], [420, 540]], 1701], [330, 1, 850]),
('normal control 7', [[[810, 870], [840, 1020], [600, 720], [990, 1290]], 1600], [690, 1, 1600]),
('normal control 8', [[[360, 540], [370, 380], [660, 720]], 1655], [360, 1, 827])]]
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: merge extension shrinks 1 | [751, 3, 1655] | [751, 2, 1655] | Failed |
| regression variant: merge extension shrinks 2 | [320, 0, 0] | [420, 0, 0] | Failed |
| partial repair guard 3 | [1048, 1, 1655] | [1048, 0, 1655] | Failed |
| boundary control 4 | [600, 0, 0] | [600, 0, 0] | Passed |
| boundary control 5 | [590, 4, 1654] | [590, 4, 1654] | Passed |
| normal control 6 | [541, 2, 1700] | [541, 1, 850] | Failed |
| normal control 7 | [181, 1, 827] | [181, 1, 827] | Passed |
| normal control 8 | [600, 1, 827] | [600, 1, 827] | Passed |
SHA-256 / b11c4be84f771c3f9c9e9742ffccb06e0194a860b324caa4df65d3bca6d6c630
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:51:59.390894+00:00.
Case digest / 36c8d2def5e02e578d64ba9f6489ce1dafd31f59478d71ebeaa4015d14a184c8