FAILURE MAP
← Case archive

FA-94316 / Shift rostering labor rules / Open access

Negative top-up recorded for weeks above contract · case 01

Busy weeks show negative guaranteed-hours top-ups that offset pay.

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

ROOT CAUSE

The shortfall is not clamped at zero.

THE FAILURE

The shortfall is not clamped at zero.

Unsuccessful approach: Absolute value pays top-up for weeks above contract.

Case contract

Contract minutes per week and worked minutes per week. Per week: top-up = shortfall below contract; additional = minutes between contract and 2400; supplement base = additional minutes beyond a tolerance of contract // 10; overtime = minutes above 2400. Return [top-up, additional, supplement base, overtime] per week.

Why this case matters

Part-time contracts pay guaranteed hours, additional hours and supplements; each band has its own boundary.

1 / The failure

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

N = 1
observations = []
def solve(contract, weeks):
    out = []
    free = contract // 10
    for w in weeks:
        top = contract - w
        add = max(min(w, 2400) - contract, 0)
        sup = max(add - free, 0)
        ot = max(w - 2400, 0)
        out.append([top, add, sup, ot])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: top up clamp 1', [1200, [1320, 1321]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('regression variant: top up clamp 2', [1234, [2880, 1056, 2880, 2400, 1357]],
   [[0, 1166, 1043, 480], [178, 0, 0, 0], [0, 1166, 1043, 480], [0, 1166, 1043, 0], [0, 123, 0, 0]]),
  ('partial repair guard 3', [1500, [2880, 2880, 2880]],
   [[0, 900, 750, 480], [0, 900, 750, 480], [0, 900, 750, 480]]),
  ('boundary control 4', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('normal control 5', [1200, [2267, 2400]], [[0, 1067, 947, 0], [0, 1200, 1080, 0]]),
  ('normal control 6', [1500, [1651, 1650, 2400]], [[0, 151, 1, 0], [0, 150, 0, 0], [0, 900, 750, 0]]),
  ('normal control 7', [2100, [2100, 2400]], [[0, 0, 0, 0], [0, 300, 90, 0]]),
  ('normal control 8', [1500, [0, 1440]], [[1500, 0, 0, 0], [60, 0, 0, 0]])],
 [('regression: top up clamp 1', [1205, [1325, 1326]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('regression variant: top up clamp 2', [1800, [1740, 2880]], [[60, 0, 0, 0], [0, 600, 420, 480]]),
  ('partial repair guard 3', [1500, [1500, 2500, 1651]], [[0, 0, 0, 0], [0, 900, 750, 100], [0, 151, 1, 0]]),
  ('boundary control 4', [1500, [2500, 1000]], [[0, 900, 750, 100], [500, 0, 0, 0]]),
  ('boundary control 5', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('normal control 6', [1800, [0, 1981]], [[1800, 0, 0, 0], [0, 181, 1, 0]]),
  ('normal control 7', [1205, [2500, 0, 2400, 1145, 1325]],
   [[0, 1195, 1075, 100], [1205, 0, 0, 0], [0, 1195, 1075, 0], [60, 0, 0, 0], [0, 120, 0, 0]]),
  ('normal control 8', [2100, [2100, 2040, 2289]], [[0, 0, 0, 0], [60, 0, 0, 0], [0, 189, 0, 0]])],
 [('regression: top up clamp 1', [1500, [2500, 1000]], [[0, 900, 750, 100], [500, 0, 0, 0]]),
  ('regression variant: top up clamp 2', [1234, [1174, 2400, 1358]],
   [[60, 0, 0, 0], [0, 1166, 1043, 0], [0, 124, 1, 0]]),
  ('partial repair guard 3', [1800, [2880, 0, 2500, 1488, 1981]],
   [[0, 600, 420, 480], [1800, 0, 0, 0], [0, 600, 420, 100], [312, 0, 0, 0], [0, 181, 1, 0]]),
  ('boundary control 4', [1205, [1325, 1326]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('normal control 5', [1800, [1800, 0, 1981, 2500]],
   [[0, 0, 0, 0], [1800, 0, 0, 0], [0, 181, 1, 0], [0, 600, 420, 100]]),
  ('normal control 6', [1500, [2400, 2880, 1432]], [[0, 900, 750, 0], [0, 900, 750, 480], [68, 0, 0, 0]]),
  ('normal control 7', [1200, [0, 1321, 2400, 1200, 1140]],
   [[1200, 0, 0, 0], [0, 121, 1, 0], [0, 1200, 1080, 0], [0, 0, 0, 0], [60, 0, 0, 0]]),
  ('normal control 8', [1200, [1200, 1321]], [[0, 0, 0, 0], [0, 121, 1, 0]])],
 [('regression: top up clamp 1', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('regression variant: top up clamp 2', [1800, [0, 1981]], [[1800, 0, 0, 0], [0, 181, 1, 0]]),
  ('partial repair guard 3', [1500, [1500, 0, 2880, 0]],
   [[0, 0, 0, 0], [1500, 0, 0, 0], [0, 900, 750, 480], [1500, 0, 0, 0]]),
  ('boundary control 4', [1200, [1320, 1321]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('boundary control 5', [1205, [1325, 1326]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('normal control 6', [1205, [2400, 2500, 1145]], [[0, 1195, 1075, 0], [0, 1195, 1075, 100], [60, 0, 0, 0]]),
  ('normal control 7', [1205, [1326, 1145, 2400, 1205, 2880]],
   [[0, 121, 1, 0], [60, 0, 0, 0], [0, 1195, 1075, 0], [0, 0, 0, 0], [0, 1195, 1075, 480]]),
  ('normal control 8', [1200, [1140, 1320, 1140, 1140]],
   [[60, 0, 0, 0], [0, 120, 0, 0], [60, 0, 0, 0], [60, 0, 0, 0]])],
 [('regression: top up clamp 1', [1500, [1650, 1500]], [[0, 150, 0, 0], [0, 0, 0, 0]]),
  ('regression variant: top up clamp 2', [1500, [1500, 1957, 1500]],
   [[0, 0, 0, 0], [0, 457, 307, 0], [0, 0, 0, 0]]),
  ('partial repair guard 3', [1800, [2500, 2500]], [[0, 600, 420, 100], [0, 600, 420, 100]]),
  ('boundary control 4', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('boundary control 5', [1200, [1320, 1321]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('normal control 6', [1500, [1650, 1650, 1440]], [[0, 150, 0, 0], [0, 150, 0, 0], [60, 0, 0, 0]]),
  ('normal control 7', [1500, [0, 2400, 1651, 1651]],
   [[1500, 0, 0, 0], [0, 900, 750, 0], [0, 151, 1, 0], [0, 151, 1, 0]]),
  ('normal control 8', [1205, [1325, 2400]], [[0, 120, 0, 0], [0, 1195, 1075, 0]])]]
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: top up clamp 1[[-120, 120, 0, 0], [-121, 121, 1, 0]][[0, 120, 0, 0], [0, 121, 1, 0]]Failed
regression variant: top up clamp 2[[-1646, 1166, 1043, 480], [178, 0, 0, 0], [-1646, 1166, 1043, 480], [-1166, 1166, 1043, 0], [-123, 123, 0, 0]][[0, 1166, 1043, 480], [178, 0, 0, 0], [0, 1166, 1043, 480], [0, 1166, 1043, 0], [0, 123, 0, 0]]Failed
partial repair guard 3[[-1380, 900, 750, 480], [-1380, 900, 750, 480], [-1380, 900, 750, 480]][[0, 900, 750, 480], [0, 900, 750, 480], [0, 900, 750, 480]]Failed
boundary control 4[[-600, 600, 420, 0], [-1200, 600, 420, 600]][[0, 600, 420, 0], [0, 600, 420, 600]]Failed
normal control 5[[-1067, 1067, 947, 0], [-1200, 1200, 1080, 0]][[0, 1067, 947, 0], [0, 1200, 1080, 0]]Failed
normal control 6[[-151, 151, 1, 0], [-150, 150, 0, 0], [-900, 900, 750, 0]][[0, 151, 1, 0], [0, 150, 0, 0], [0, 900, 750, 0]]Failed
normal control 7[[0, 0, 0, 0], [-300, 300, 90, 0]][[0, 0, 0, 0], [0, 300, 90, 0]]Failed
normal control 8[[1500, 0, 0, 0], [60, 0, 0, 0]][[1500, 0, 0, 0], [60, 0, 0, 0]]Passed

SHA-256 / 1572afe58e7b807c60e983462965bb7126ba249727948736f43504107816395d

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(contract, weeks):
    out = []
    free = contract // 10
    for w in weeks:
        top = abs(contract - w)
        add = max(min(w, 2400) - contract, 0)
        sup = max(add - free, 0)
        ot = max(w - 2400, 0)
        out.append([top, add, sup, ot])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: top up clamp 1', [1200, [1320, 1321]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('regression variant: top up clamp 2', [1234, [2880, 1056, 2880, 2400, 1357]],
   [[0, 1166, 1043, 480], [178, 0, 0, 0], [0, 1166, 1043, 480], [0, 1166, 1043, 0], [0, 123, 0, 0]]),
  ('partial repair guard 3', [1500, [2880, 2880, 2880]],
   [[0, 900, 750, 480], [0, 900, 750, 480], [0, 900, 750, 480]]),
  ('boundary control 4', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('normal control 5', [1200, [2267, 2400]], [[0, 1067, 947, 0], [0, 1200, 1080, 0]]),
  ('normal control 6', [1500, [1651, 1650, 2400]], [[0, 151, 1, 0], [0, 150, 0, 0], [0, 900, 750, 0]]),
  ('normal control 7', [2100, [2100, 2400]], [[0, 0, 0, 0], [0, 300, 90, 0]]),
  ('normal control 8', [1500, [0, 1440]], [[1500, 0, 0, 0], [60, 0, 0, 0]])],
 [('regression: top up clamp 1', [1205, [1325, 1326]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('regression variant: top up clamp 2', [1800, [1740, 2880]], [[60, 0, 0, 0], [0, 600, 420, 480]]),
  ('partial repair guard 3', [1500, [1500, 2500, 1651]], [[0, 0, 0, 0], [0, 900, 750, 100], [0, 151, 1, 0]]),
  ('boundary control 4', [1500, [2500, 1000]], [[0, 900, 750, 100], [500, 0, 0, 0]]),
  ('boundary control 5', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('normal control 6', [1800, [0, 1981]], [[1800, 0, 0, 0], [0, 181, 1, 0]]),
  ('normal control 7', [1205, [2500, 0, 2400, 1145, 1325]],
   [[0, 1195, 1075, 100], [1205, 0, 0, 0], [0, 1195, 1075, 0], [60, 0, 0, 0], [0, 120, 0, 0]]),
  ('normal control 8', [2100, [2100, 2040, 2289]], [[0, 0, 0, 0], [60, 0, 0, 0], [0, 189, 0, 0]])],
 [('regression: top up clamp 1', [1500, [2500, 1000]], [[0, 900, 750, 100], [500, 0, 0, 0]]),
  ('regression variant: top up clamp 2', [1234, [1174, 2400, 1358]],
   [[60, 0, 0, 0], [0, 1166, 1043, 0], [0, 124, 1, 0]]),
  ('partial repair guard 3', [1800, [2880, 0, 2500, 1488, 1981]],
   [[0, 600, 420, 480], [1800, 0, 0, 0], [0, 600, 420, 100], [312, 0, 0, 0], [0, 181, 1, 0]]),
  ('boundary control 4', [1205, [1325, 1326]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('normal control 5', [1800, [1800, 0, 1981, 2500]],
   [[0, 0, 0, 0], [1800, 0, 0, 0], [0, 181, 1, 0], [0, 600, 420, 100]]),
  ('normal control 6', [1500, [2400, 2880, 1432]], [[0, 900, 750, 0], [0, 900, 750, 480], [68, 0, 0, 0]]),
  ('normal control 7', [1200, [0, 1321, 2400, 1200, 1140]],
   [[1200, 0, 0, 0], [0, 121, 1, 0], [0, 1200, 1080, 0], [0, 0, 0, 0], [60, 0, 0, 0]]),
  ('normal control 8', [1200, [1200, 1321]], [[0, 0, 0, 0], [0, 121, 1, 0]])],
 [('regression: top up clamp 1', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('regression variant: top up clamp 2', [1800, [0, 1981]], [[1800, 0, 0, 0], [0, 181, 1, 0]]),
  ('partial repair guard 3', [1500, [1500, 0, 2880, 0]],
   [[0, 0, 0, 0], [1500, 0, 0, 0], [0, 900, 750, 480], [1500, 0, 0, 0]]),
  ('boundary control 4', [1200, [1320, 1321]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('boundary control 5', [1205, [1325, 1326]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('normal control 6', [1205, [2400, 2500, 1145]], [[0, 1195, 1075, 0], [0, 1195, 1075, 100], [60, 0, 0, 0]]),
  ('normal control 7', [1205, [1326, 1145, 2400, 1205, 2880]],
   [[0, 121, 1, 0], [60, 0, 0, 0], [0, 1195, 1075, 0], [0, 0, 0, 0], [0, 1195, 1075, 480]]),
  ('normal control 8', [1200, [1140, 1320, 1140, 1140]],
   [[60, 0, 0, 0], [0, 120, 0, 0], [60, 0, 0, 0], [60, 0, 0, 0]])],
 [('regression: top up clamp 1', [1500, [1650, 1500]], [[0, 150, 0, 0], [0, 0, 0, 0]]),
  ('regression variant: top up clamp 2', [1500, [1500, 1957, 1500]],
   [[0, 0, 0, 0], [0, 457, 307, 0], [0, 0, 0, 0]]),
  ('partial repair guard 3', [1800, [2500, 2500]], [[0, 600, 420, 100], [0, 600, 420, 100]]),
  ('boundary control 4', [1800, [2400, 3000]], [[0, 600, 420, 0], [0, 600, 420, 600]]),
  ('boundary control 5', [1200, [1320, 1321]], [[0, 120, 0, 0], [0, 121, 1, 0]]),
  ('normal control 6', [1500, [1650, 1650, 1440]], [[0, 150, 0, 0], [0, 150, 0, 0], [60, 0, 0, 0]]),
  ('normal control 7', [1500, [0, 2400, 1651, 1651]],
   [[1500, 0, 0, 0], [0, 900, 750, 0], [0, 151, 1, 0], [0, 151, 1, 0]]),
  ('normal control 8', [1205, [1325, 2400]], [[0, 120, 0, 0], [0, 1195, 1075, 0]])]]
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: top up clamp 1[[120, 120, 0, 0], [121, 121, 1, 0]][[0, 120, 0, 0], [0, 121, 1, 0]]Failed
regression variant: top up clamp 2[[1646, 1166, 1043, 480], [178, 0, 0, 0], [1646, 1166, 1043, 480], [1166, 1166, 1043, 0], [123, 123, 0, 0]][[0, 1166, 1043, 480], [178, 0, 0, 0], [0, 1166, 1043, 480], [0, 1166, 1043, 0], [0, 123, 0, 0]]Failed
partial repair guard 3[[1380, 900, 750, 480], [1380, 900, 750, 480], [1380, 900, 750, 480]][[0, 900, 750, 480], [0, 900, 750, 480], [0, 900, 750, 480]]Failed
boundary control 4[[600, 600, 420, 0], [1200, 600, 420, 600]][[0, 600, 420, 0], [0, 600, 420, 600]]Failed
normal control 5[[1067, 1067, 947, 0], [1200, 1200, 1080, 0]][[0, 1067, 947, 0], [0, 1200, 1080, 0]]Failed
normal control 6[[151, 151, 1, 0], [150, 150, 0, 0], [900, 900, 750, 0]][[0, 151, 1, 0], [0, 150, 0, 0], [0, 900, 750, 0]]Failed
normal control 7[[0, 0, 0, 0], [300, 300, 90, 0]][[0, 0, 0, 0], [0, 300, 90, 0]]Failed
normal control 8[[1500, 0, 0, 0], [60, 0, 0, 0]][[1500, 0, 0, 0], [60, 0, 0, 0]]Passed

SHA-256 / c7ea579ac1ff6c917c1bcf375456eddcf77671de571a26d9e33126034fcb64bb

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

Case digest / cc4cc04fca97a6e995dff2a38d28348d535690a734445548ed825af716d6ce10