FAILURE MAP
← Case archive

FA-94171 / Shift rostering labor rules / Open access

Change with exactly fourteen days notice earns predictability pay · case 01

Timely schedule edits are charged a premium.

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

ROOT CAUSE

The advance-notice comparison is inclusive at 14 days.

THE FAILURE

The advance-notice comparison is inclusive at 14 days.

Unsuccessful approach: Using a 13-day boundary exempts changes that were actually late.

Case contract

Each change is [kind (add/cut/cancel), notice minutes before the shift, changed minutes, initiator]. Changes initiated by the worker or mutual swaps, or with at least 14 days (20160 minutes) notice, earn nothing. Additions of at least 15 minutes earn 60 premium minutes. Cuts or cancellations earn 60, or max(60, lost // 2) with less than 24 hours notice. Return [per-change premiums, total].

Why this case matters

Fair-workweek predictability pay depends on precise notice thresholds and exemptions.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(changes):
    out = []
    for kind, notice, delta, by in changes:
        p = 0
        if by not in ('worker', 'mutual') and notice <= 20160:
            if kind == 'add':
                p = 60 if delta >= 15 else 0
            elif notice < 1440:
                p = max(60, delta // 2)
            else:
                p = 60
        out.append(p)
    return [out, sum(out)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: advance notice boundary 1', [[['add', 20160, 60, 'employer']]], [[0], 0]),
  ('regression variant: advance notice boundary 2',
   [[['add', 20161, 240, 'mutual'], ['add', 20160, 480, 'employer'], ['cancel', 1440, 30, 'employer'],
     ['add', 60, 15, 'worker']]],
   [[0, 0, 60, 0], 60]),
  ('partial repair guard 3',
   [[['add', 20159, 30, 'worker'], ['add', 20160, 90, 'worker'], ['cancel', 18720, 480, 'employer'],
     ['cut', 20161, 10, 'mutual'], ['cancel', 30000, 15, 'mutual']]],
   [[0, 0, 60, 0, 0], 60]),
  ('boundary control 4', [[['cut', 1440, 240, 'employer']]], [[60], 60]),
  ('boundary control 5', [[['add', 20159, 15, 'employer']]], [[60], 60]),
  ('normal control 6',
   [[['cancel', 1439, 14, 'employer'], ['cut', 20161, 30, 'employer'], ['add', 1439, 60, 'mutual'],
     ['cancel', 20160, 121, 'worker']]],
   [[60, 0, 0, 0], 60]),
  ('normal control 7',
   [[['add', 20160, 10, 'mutual'], ['add', 1441, 121, 'employer'], ['cut', 20159, 90, 'mutual'],
     ['cut', 1439, 121, 'employer']]],
   [[0, 60, 0, 60], 120]),
  ('normal control 8', [[['cancel', 1441, 14, 'mutual']]], [[0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 20159, 30, 'employer'], ['cut', 18720, 14, 'employer'], ['add', 1439, 90, 'employer'],
     ['add', 20160, 60, 'employer'], ['cancel', 20159, 90, 'worker']]],
   [[60, 60, 60, 0, 0], 180]),
  ('regression variant: advance notice boundary 2',
   [[['add', 20160, 30, 'employer'], ['add', 20159, 16, 'employer']]], [[0, 60], 60]),
  ('partial repair guard 3',
   [[['add', 20160, 121, 'worker'], ['cancel', 60, 14, 'employer'], ['cut', 1441, 16, 'employer'],
     ['add', 1439, 480, 'employer'], ['cancel', 18720, 240, 'employer']]],
   [[0, 60, 60, 60, 60], 240]),
  ('boundary control 4', [[['cut', 100, 300, 'mutual']]], [[0], 0]),
  ('boundary control 5', [[['cancel', 1439, 240, 'employer']]], [[120], 120]),
  ('normal control 6',
   [[['cut', 20160, 480, 'employer'], ['add', 20160, 14, 'worker'], ['cancel', 30000, 15, 'employer'],
     ['cancel', 18720, 240, 'employer']]],
   [[0, 0, 0, 60], 60]),
  ('normal control 7', [[['cancel', 30000, 15, 'worker'], ['cut', 5000, 15, 'employer']]], [[0, 60], 60]),
  ('normal control 8', [[['add', 30000, 16, 'employer']]], [[0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 18720, 30, 'worker'], ['add', 20160, 240, 'employer'], ['add', 30000, 30, 'employer'],
     ['cut', 18720, 60, 'worker']]],
   [[0, 0, 0, 0], 0]),
  ('regression variant: advance notice boundary 2', [[['cancel', 20160, 121, 'employer']]], [[0], 0]),
  ('partial repair guard 3',
   [[['add', 30000, 14, 'mutual'], ['cancel', 20159, 60, 'employer'], ['cancel', 5000, 10, 'worker'],
     ['cancel', 20161, 121, 'employer']]],
   [[0, 60, 0, 0], 60]),
  ('boundary control 4', [[['add', 1000, 14, 'employer']]], [[0], 0]),
  ('boundary control 5', [[['add', 20160, 60, 'employer']]], [[0], 0]),
  ('normal control 6',
   [[['cancel', 5000, 14, 'employer'], ['cut', 1441, 15, 'employer'], ['cancel', 1440, 121, 'employer'],
     ['add', 18720, 30, 'worker']]],
   [[60, 60, 60, 0], 180]),
  ('normal control 7',
   [[['cancel', 18720, 14, 'employer'], ['cut', 1440, 15, 'worker'], ['add', 20161, 30, 'employer'],
     ['cancel', 18720, 16, 'worker'], ['cut', 1440, 15, 'employer']]],
   [[60, 0, 0, 0, 60], 120]),
  ('normal control 8', [[['add', 20160, 90, 'employer'], ['add', 20160, 60, 'worker']]], [[0, 0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 1440, 10, 'employer'], ['cut', 20160, 15, 'employer'], ['add', 30000, 16, 'employer'],
     ['add', 60, 480, 'mutual'], ['cancel', 20159, 15, 'employer']]],
   [[0, 0, 0, 0, 60], 60]),
  ('regression variant: advance notice boundary 2',
   [[['cancel', 20160, 15, 'employer'], ['add', 30000, 121, 'worker'], ['add', 1440, 60, 'mutual'],
     ['cancel', 1441, 121, 'worker']]],
   [[0, 0, 0, 0], 0]),
  ('partial repair guard 3',
   [[['add', 1439, 14, 'employer'], ['cancel', 18720, 90, 'employer'], ['add', 1440, 15, 'mutual']]],
   [[0, 60, 0], 60]),
  ('boundary control 4', [[['cancel', 100, 60, 'employer']]], [[60], 60]),
  ('boundary control 5', [[['cut', 1440, 240, 'employer']]], [[60], 60]),
  ('normal control 6',
   [[['add', 20161, 240, 'mutual'], ['add', 20160, 480, 'employer'], ['cancel', 1440, 30, 'employer'],
     ['add', 60, 15, 'worker']]],
   [[0, 0, 60, 0], 60]),
  ('normal control 7',
   [[['cut', 20160, 15, 'employer'], ['cut', 30000, 10, 'employer'], ['add', 1441, 10, 'mutual']]],
   [[0, 0, 0], 0]),
  ('normal control 8', [[['add', 20160, 240, 'mutual']]], [[0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 20160, 16, 'employer'], ['add', 60, 60, 'employer'], ['add', 18720, 15, 'employer']]],
   [[0, 60, 60], 120]),
  ('regression variant: advance notice boundary 2',
   [[['cut', 20159, 10, 'worker'], ['cut', 1439, 121, 'worker'], ['add', 1440, 121, 'mutual'],
     ['cancel', 20160, 16, 'employer']]],
   [[0, 0, 0, 0], 0]),
  ('partial repair guard 3',
   [[['cancel', 1439, 240, 'worker'], ['cancel', 20159, 121, 'employer'], ['cut', 18720, 15, 'employer']]],
   [[0, 60, 60], 120]),
  ('boundary control 4', [[['add', 20159, 15, 'employer']]], [[60], 60]),
  ('boundary control 5', [[['cut', 100, 300, 'mutual']]], [[0], 0]),
  ('normal control 6',
   [[['cut', 20161, 30, 'employer'], ['cancel', 30000, 121, 'worker'], ['add', 20161, 30, 'worker']]],
   [[0, 0, 0], 0]),
  ('normal control 7',
   [[['cut', 1441, 90, 'mutual'], ['add', 60, 240, 'employer'], ['cut', 5000, 121, 'mutual'],
     ['cancel', 20161, 16, 'worker'], ['add', 1440, 480, 'mutual']]],
   [[0, 60, 0, 0, 0], 60]),
  ('normal control 8',
   [[['cut', 18720, 14, 'employer'], ['cut', 60, 10, 'employer'], ['add', 1440, 60, 'employer']]],
   [[60, 60, 60], 180])]]
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: advance notice boundary 1[[60], 60][[0], 0]Failed
regression variant: advance notice boundary 2[[0, 60, 60, 0], 120][[0, 0, 60, 0], 60]Failed
partial repair guard 3[[0, 0, 60, 0, 0], 60][[0, 0, 60, 0, 0], 60]Passed
boundary control 4[[60], 60][[60], 60]Passed
boundary control 5[[60], 60][[60], 60]Passed
normal control 6[[60, 0, 0, 0], 60][[60, 0, 0, 0], 60]Passed
normal control 7[[0, 60, 0, 60], 120][[0, 60, 0, 60], 120]Passed
normal control 8[[0], 0][[0], 0]Passed

SHA-256 / d2362f33544a6ac4a38ff5be4166e2fb1af956d5fb098ea357b4192b88ee85ea

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(changes):
    out = []
    for kind, notice, delta, by in changes:
        p = 0
        if by not in ('worker', 'mutual') and notice < 20160 - 1440:
            if kind == 'add':
                p = 60 if delta >= 15 else 0
            elif notice < 1440:
                p = max(60, delta // 2)
            else:
                p = 60
        out.append(p)
    return [out, sum(out)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: advance notice boundary 1', [[['add', 20160, 60, 'employer']]], [[0], 0]),
  ('regression variant: advance notice boundary 2',
   [[['add', 20161, 240, 'mutual'], ['add', 20160, 480, 'employer'], ['cancel', 1440, 30, 'employer'],
     ['add', 60, 15, 'worker']]],
   [[0, 0, 60, 0], 60]),
  ('partial repair guard 3',
   [[['add', 20159, 30, 'worker'], ['add', 20160, 90, 'worker'], ['cancel', 18720, 480, 'employer'],
     ['cut', 20161, 10, 'mutual'], ['cancel', 30000, 15, 'mutual']]],
   [[0, 0, 60, 0, 0], 60]),
  ('boundary control 4', [[['cut', 1440, 240, 'employer']]], [[60], 60]),
  ('boundary control 5', [[['add', 20159, 15, 'employer']]], [[60], 60]),
  ('normal control 6',
   [[['cancel', 1439, 14, 'employer'], ['cut', 20161, 30, 'employer'], ['add', 1439, 60, 'mutual'],
     ['cancel', 20160, 121, 'worker']]],
   [[60, 0, 0, 0], 60]),
  ('normal control 7',
   [[['add', 20160, 10, 'mutual'], ['add', 1441, 121, 'employer'], ['cut', 20159, 90, 'mutual'],
     ['cut', 1439, 121, 'employer']]],
   [[0, 60, 0, 60], 120]),
  ('normal control 8', [[['cancel', 1441, 14, 'mutual']]], [[0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 20159, 30, 'employer'], ['cut', 18720, 14, 'employer'], ['add', 1439, 90, 'employer'],
     ['add', 20160, 60, 'employer'], ['cancel', 20159, 90, 'worker']]],
   [[60, 60, 60, 0, 0], 180]),
  ('regression variant: advance notice boundary 2',
   [[['add', 20160, 30, 'employer'], ['add', 20159, 16, 'employer']]], [[0, 60], 60]),
  ('partial repair guard 3',
   [[['add', 20160, 121, 'worker'], ['cancel', 60, 14, 'employer'], ['cut', 1441, 16, 'employer'],
     ['add', 1439, 480, 'employer'], ['cancel', 18720, 240, 'employer']]],
   [[0, 60, 60, 60, 60], 240]),
  ('boundary control 4', [[['cut', 100, 300, 'mutual']]], [[0], 0]),
  ('boundary control 5', [[['cancel', 1439, 240, 'employer']]], [[120], 120]),
  ('normal control 6',
   [[['cut', 20160, 480, 'employer'], ['add', 20160, 14, 'worker'], ['cancel', 30000, 15, 'employer'],
     ['cancel', 18720, 240, 'employer']]],
   [[0, 0, 0, 60], 60]),
  ('normal control 7', [[['cancel', 30000, 15, 'worker'], ['cut', 5000, 15, 'employer']]], [[0, 60], 60]),
  ('normal control 8', [[['add', 30000, 16, 'employer']]], [[0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 18720, 30, 'worker'], ['add', 20160, 240, 'employer'], ['add', 30000, 30, 'employer'],
     ['cut', 18720, 60, 'worker']]],
   [[0, 0, 0, 0], 0]),
  ('regression variant: advance notice boundary 2', [[['cancel', 20160, 121, 'employer']]], [[0], 0]),
  ('partial repair guard 3',
   [[['add', 30000, 14, 'mutual'], ['cancel', 20159, 60, 'employer'], ['cancel', 5000, 10, 'worker'],
     ['cancel', 20161, 121, 'employer']]],
   [[0, 60, 0, 0], 60]),
  ('boundary control 4', [[['add', 1000, 14, 'employer']]], [[0], 0]),
  ('boundary control 5', [[['add', 20160, 60, 'employer']]], [[0], 0]),
  ('normal control 6',
   [[['cancel', 5000, 14, 'employer'], ['cut', 1441, 15, 'employer'], ['cancel', 1440, 121, 'employer'],
     ['add', 18720, 30, 'worker']]],
   [[60, 60, 60, 0], 180]),
  ('normal control 7',
   [[['cancel', 18720, 14, 'employer'], ['cut', 1440, 15, 'worker'], ['add', 20161, 30, 'employer'],
     ['cancel', 18720, 16, 'worker'], ['cut', 1440, 15, 'employer']]],
   [[60, 0, 0, 0, 60], 120]),
  ('normal control 8', [[['add', 20160, 90, 'employer'], ['add', 20160, 60, 'worker']]], [[0, 0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 1440, 10, 'employer'], ['cut', 20160, 15, 'employer'], ['add', 30000, 16, 'employer'],
     ['add', 60, 480, 'mutual'], ['cancel', 20159, 15, 'employer']]],
   [[0, 0, 0, 0, 60], 60]),
  ('regression variant: advance notice boundary 2',
   [[['cancel', 20160, 15, 'employer'], ['add', 30000, 121, 'worker'], ['add', 1440, 60, 'mutual'],
     ['cancel', 1441, 121, 'worker']]],
   [[0, 0, 0, 0], 0]),
  ('partial repair guard 3',
   [[['add', 1439, 14, 'employer'], ['cancel', 18720, 90, 'employer'], ['add', 1440, 15, 'mutual']]],
   [[0, 60, 0], 60]),
  ('boundary control 4', [[['cancel', 100, 60, 'employer']]], [[60], 60]),
  ('boundary control 5', [[['cut', 1440, 240, 'employer']]], [[60], 60]),
  ('normal control 6',
   [[['add', 20161, 240, 'mutual'], ['add', 20160, 480, 'employer'], ['cancel', 1440, 30, 'employer'],
     ['add', 60, 15, 'worker']]],
   [[0, 0, 60, 0], 60]),
  ('normal control 7',
   [[['cut', 20160, 15, 'employer'], ['cut', 30000, 10, 'employer'], ['add', 1441, 10, 'mutual']]],
   [[0, 0, 0], 0]),
  ('normal control 8', [[['add', 20160, 240, 'mutual']]], [[0], 0])],
 [('regression: advance notice boundary 1',
   [[['add', 20160, 16, 'employer'], ['add', 60, 60, 'employer'], ['add', 18720, 15, 'employer']]],
   [[0, 60, 60], 120]),
  ('regression variant: advance notice boundary 2',
   [[['cut', 20159, 10, 'worker'], ['cut', 1439, 121, 'worker'], ['add', 1440, 121, 'mutual'],
     ['cancel', 20160, 16, 'employer']]],
   [[0, 0, 0, 0], 0]),
  ('partial repair guard 3',
   [[['cancel', 1439, 240, 'worker'], ['cancel', 20159, 121, 'employer'], ['cut', 18720, 15, 'employer']]],
   [[0, 60, 60], 120]),
  ('boundary control 4', [[['add', 20159, 15, 'employer']]], [[60], 60]),
  ('boundary control 5', [[['cut', 100, 300, 'mutual']]], [[0], 0]),
  ('normal control 6',
   [[['cut', 20161, 30, 'employer'], ['cancel', 30000, 121, 'worker'], ['add', 20161, 30, 'worker']]],
   [[0, 0, 0], 0]),
  ('normal control 7',
   [[['cut', 1441, 90, 'mutual'], ['add', 60, 240, 'employer'], ['cut', 5000, 121, 'mutual'],
     ['cancel', 20161, 16, 'worker'], ['add', 1440, 480, 'mutual']]],
   [[0, 60, 0, 0, 0], 60]),
  ('normal control 8',
   [[['cut', 18720, 14, 'employer'], ['cut', 60, 10, 'employer'], ['add', 1440, 60, 'employer']]],
   [[60, 60, 60], 180])]]
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: advance notice boundary 1[[0], 0][[0], 0]Passed
regression variant: advance notice boundary 2[[0, 0, 60, 0], 60][[0, 0, 60, 0], 60]Passed
partial repair guard 3[[0, 0, 0, 0, 0], 0][[0, 0, 60, 0, 0], 60]Failed
boundary control 4[[60], 60][[60], 60]Passed
boundary control 5[[0], 0][[60], 60]Failed
normal control 6[[60, 0, 0, 0], 60][[60, 0, 0, 0], 60]Passed
normal control 7[[0, 60, 0, 60], 120][[0, 60, 0, 60], 120]Passed
normal control 8[[0], 0][[0], 0]Passed

SHA-256 / 86d2b5905dc2c22a279fd0d9959b9bf84e11359065d4fc68bc4ff8c5b6b72411

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

Case digest / 9c74fe440c927f3c570800bb01641c8e655164d8117ec022547f3f41403b3ae2