FAILURE MAP
← Case archive

FA-94061 / Shift rostering labor rules / Open access

Sixteen-year-olds restricted as minors · case 01

Workers who just turned 16 are rejected for evening shifts.

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

ROOT CAUSE

The exemption requires age above 16 instead of at least 16.

THE FAILURE

The exemption requires age above 16 instead of at least 16.

Unsuccessful approach: Exempting 16-year-olds only in vacation weeks still restricts them during school weeks.

Case contract

Toy youth rule: age 16 or older has no restrictions. Otherwise each shift [day, start, end] must lie within 07:00-19:00 (start >= 420, end <= 1140); daily total minutes may not exceed 180 on a listed school day or 480 otherwise; the weekly total may not exceed 1080 if the week has any school day, else 2400. Return window violations in shift order, then daily caps by day, then the weekly cap as ["weekly_cap", -1].

Why this case matters

Minor-worker hour limits are strict roster constraints with many boundary conditions.

1 / The failure

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

N = 1
observations = []
def solve(age, shifts, school_days):
    if age > 16:
        return []
    out = []
    per = {}
    for d, st, en in shifts:
        per[d] = per.get(d, 0) + en - st
        if st < 420 or en > 1140:
            out.append(['hours_window', d])
    for d in sorted(per):
        cap = 180 if d in school_days else 480
        if per[d] > cap:
            out.append(['daily_cap', d])
    week_cap = 1080 if school_days else 2400
    if sum(per.values()) > week_cap:
        out.append(['weekly_cap', -1])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: age boundary 1', [16, [[0, 300, 1300]], [0]], []),
  ('regression variant: age boundary 2', [16, [[3, 960, 1140], [4, 360, 420]], [0, 2, 3, 4, 5]], []),
  ('partial repair guard 3', [17, [[6, 420, 660], [2, 1080, 1261], [5, 900, 1200]], [0, 1, 2, 4, 6]], []),
  ('boundary control 4', [15, [[5, 960, 1141]], []], [['hours_window', 5]]),
  ('boundary control 5', [15, [[0, 900, 1081]], [0, 1, 2, 3, 4]], [['daily_cap', 0]]),
  ('normal control 6',
   [17, [[2, 900, 1380], [6, 960, 1020], [2, 960, 1141], [5, 900, 1020], [3, 960, 1141], [6, 420, 480]],
    [2, 4, 6]],
   []),
  ('normal control 7', [14, [[6, 420, 601], [0, 420, 900], [3, 419, 599], [1, 360, 480]], []],
   [['hours_window', 3], ['hours_window', 1]]),
  ('normal control 8', [15, [[1, 900, 1020], [6, 360, 660]], [0, 1, 2, 5]], [['hours_window', 6]])],
 [('regression: age boundary 1',
   [16, [[2, 419, 599], [6, 360, 480], [0, 419, 599], [0, 900, 1200], [6, 900, 1140]], [0, 1, 2, 4, 6]], []),
  ('regression variant: age boundary 2', [16, [[5, 1020, 1200], [6, 1080, 1320], [4, 480, 780]], []], []),
  ('partial repair guard 3', [16, [[3, 960, 1140], [4, 360, 420]], [0, 2, 3, 4, 5]], []),
  ('boundary control 4', [14, [[5, 480, 960], [6, 480, 960], [0, 900, 1080], [2, 900, 1080]], [0, 2]],
   [['weekly_cap', -1]]),
  ('boundary control 5', [16, [[0, 300, 1300]], [0]], []),
  ('normal control 6', [16, [[6, 420, 900], [4, 420, 480], [0, 419, 539]], [0, 1, 2, 3, 6]], []),
  ('normal control 7', [17, [[3, 420, 900], [0, 900, 1020], [3, 420, 540], [6, 1020, 1201]], [0, 1, 2, 3, 5]],
   []),
  ('normal control 8', [15, [[3, 420, 600]], []], [])],
 [('regression: age boundary 1', [16, [[4, 1080, 1200], [4, 419, 599]], []], []),
  ('regression variant: age boundary 2',
   [16, [[6, 1020, 1260], [1, 360, 540], [0, 1020, 1440], [6, 900, 1200], [0, 960, 1200], [1, 420, 660]],
    [3, 4, 5, 6]],
   []),
  ('partial repair guard 3',
   [17, [[2, 1080, 1320], [2, 960, 1140], [6, 480, 720], [0, 960, 1140]], [1, 2, 5]], []),
  ('boundary control 4', [15, [[5, 960, 1140]], []], []),
  ('boundary control 5', [15, [[0, 900, 1080]], [0, 1, 2, 3, 4]], []),
  ('normal control 6', [17, [[4, 900, 1081], [0, 360, 840]], [1, 2, 3, 6]], []),
  ('normal control 7',
   [15, [[6, 960, 1440], [1, 1020, 1260], [2, 360, 541], [0, 360, 840], [3, 960, 1141], [0, 1020, 1080]],
    [1, 2, 4]],
   [['hours_window', 6], ['hours_window', 1], ['hours_window', 2], ['hours_window', 0], ['hours_window', 3],
    ['daily_cap', 0], ['daily_cap', 1], ['daily_cap', 2], ['weekly_cap', -1]]),
  ('normal control 8', [14, [[2, 1020, 1440], [5, 419, 539]], [0, 1, 2, 4, 5]],
   [['hours_window', 2], ['hours_window', 5], ['daily_cap', 2]])],
 [('regression: age boundary 1', [16, [[3, 419, 600], [5, 1020, 1260]], [2, 3, 4, 6]], []),
  ('regression variant: age boundary 2',
   [16, [[6, 360, 541], [0, 1020, 1200], [5, 960, 1200], [0, 960, 1140], [4, 900, 1140]], []], []),
  ('partial repair guard 3',
   [16, [[3, 1020, 1260], [0, 1080, 1320], [5, 419, 899], [2, 960, 1141], [4, 900, 1080], [3, 480, 780]],
    [0, 1, 2, 5, 6]],
   []),
  ('boundary control 4', [15, [[1, 900, 1000], [1, 1020, 1120]], [1]], [['daily_cap', 1]]),
  ('boundary control 5', [15, [[5, 960, 1141]], []], [['hours_window', 5]]),
  ('normal control 6',
   [15, [[3, 420, 480], [5, 480, 960], [5, 1020, 1320], [1, 1080, 1200], [3, 419, 600], [5, 419, 599]],
    [1, 3, 4]],
   [['hours_window', 5], ['hours_window', 1], ['hours_window', 3], ['hours_window', 5], ['daily_cap', 3],
    ['daily_cap', 5], ['weekly_cap', -1]]),
  ('normal control 7', [17, [[0, 420, 600], [2, 1080, 1140]], [0, 1, 4]], []),
  ('normal control 8',
   [14, [[6, 1020, 1140], [3, 419, 479], [2, 480, 960], [4, 1020, 1320], [4, 1080, 1200], [1, 360, 540]],
    [0, 1, 3, 4]],
   [['hours_window', 3], ['hours_window', 4], ['hours_window', 4], ['hours_window', 1], ['daily_cap', 4],
    ['weekly_cap', -1]])],
 [('regression: age boundary 1',
   [16, [[3, 360, 600], [4, 419, 599], [6, 360, 541], [6, 419, 599], [4, 480, 960], [4, 900, 1140]],
    [0, 1, 4, 5, 6]],
   []),
  ('regression variant: age boundary 2', [16, [[3, 960, 1260], [3, 1020, 1201], [1, 420, 720]], []], []),
  ('partial repair guard 3',
   [17, [[4, 960, 1140], [4, 1020, 1080], [5, 900, 960], [0, 1020, 1140], [6, 480, 540], [5, 420, 480]],
    [0, 3, 4, 5, 6]],
   []),
  ('boundary control 4', [15, [[0, 900, 1081]], [0, 1, 2, 3, 4]], [['daily_cap', 0]]),
  ('boundary control 5', [14, [[5, 480, 960], [6, 480, 960], [0, 900, 1080], [2, 900, 1080]], [0, 2]],
   [['weekly_cap', -1]]),
  ('normal control 6',
   [17, [[1, 960, 1020], [4, 360, 420], [3, 420, 720], [0, 420, 601], [1, 1080, 1260], [4, 1020, 1260]], []],
   []),
  ('normal control 7', [15, [[4, 1080, 1320], [3, 1080, 1440], [4, 900, 1380], [4, 1080, 1140]], [2, 3, 4]],
   [['hours_window', 4], ['hours_window', 3], ['hours_window', 4], ['daily_cap', 3], ['daily_cap', 4],
    ['weekly_cap', -1]]),
  ('normal control 8',
   [15, [[0, 480, 661], [4, 420, 540], [1, 420, 660], [1, 360, 480], [2, 1080, 1440]], []],
   [['hours_window', 1], ['hours_window', 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: age boundary 1[['hours_window', 0], ['daily_cap', 0]][]Failed
regression variant: age boundary 2[['hours_window', 4]][]Failed
partial repair guard 3[][]Passed
boundary control 4[['hours_window', 5]][['hours_window', 5]]Passed
boundary control 5[['daily_cap', 0]][['daily_cap', 0]]Passed
normal control 6[][]Passed
normal control 7[['hours_window', 3], ['hours_window', 1]][['hours_window', 3], ['hours_window', 1]]Passed
normal control 8[['hours_window', 6]][['hours_window', 6]]Passed

SHA-256 / e518a42600190b809680ddc50607b50b82622708e4194b502887acdb74b6b51b

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(age, shifts, school_days):
    if age >= 16 and not school_days:
        return []
    out = []
    per = {}
    for d, st, en in shifts:
        per[d] = per.get(d, 0) + en - st
        if st < 420 or en > 1140:
            out.append(['hours_window', d])
    for d in sorted(per):
        cap = 180 if d in school_days else 480
        if per[d] > cap:
            out.append(['daily_cap', d])
    week_cap = 1080 if school_days else 2400
    if sum(per.values()) > week_cap:
        out.append(['weekly_cap', -1])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: age boundary 1', [16, [[0, 300, 1300]], [0]], []),
  ('regression variant: age boundary 2', [16, [[3, 960, 1140], [4, 360, 420]], [0, 2, 3, 4, 5]], []),
  ('partial repair guard 3', [17, [[6, 420, 660], [2, 1080, 1261], [5, 900, 1200]], [0, 1, 2, 4, 6]], []),
  ('boundary control 4', [15, [[5, 960, 1141]], []], [['hours_window', 5]]),
  ('boundary control 5', [15, [[0, 900, 1081]], [0, 1, 2, 3, 4]], [['daily_cap', 0]]),
  ('normal control 6',
   [17, [[2, 900, 1380], [6, 960, 1020], [2, 960, 1141], [5, 900, 1020], [3, 960, 1141], [6, 420, 480]],
    [2, 4, 6]],
   []),
  ('normal control 7', [14, [[6, 420, 601], [0, 420, 900], [3, 419, 599], [1, 360, 480]], []],
   [['hours_window', 3], ['hours_window', 1]]),
  ('normal control 8', [15, [[1, 900, 1020], [6, 360, 660]], [0, 1, 2, 5]], [['hours_window', 6]])],
 [('regression: age boundary 1',
   [16, [[2, 419, 599], [6, 360, 480], [0, 419, 599], [0, 900, 1200], [6, 900, 1140]], [0, 1, 2, 4, 6]], []),
  ('regression variant: age boundary 2', [16, [[5, 1020, 1200], [6, 1080, 1320], [4, 480, 780]], []], []),
  ('partial repair guard 3', [16, [[3, 960, 1140], [4, 360, 420]], [0, 2, 3, 4, 5]], []),
  ('boundary control 4', [14, [[5, 480, 960], [6, 480, 960], [0, 900, 1080], [2, 900, 1080]], [0, 2]],
   [['weekly_cap', -1]]),
  ('boundary control 5', [16, [[0, 300, 1300]], [0]], []),
  ('normal control 6', [16, [[6, 420, 900], [4, 420, 480], [0, 419, 539]], [0, 1, 2, 3, 6]], []),
  ('normal control 7', [17, [[3, 420, 900], [0, 900, 1020], [3, 420, 540], [6, 1020, 1201]], [0, 1, 2, 3, 5]],
   []),
  ('normal control 8', [15, [[3, 420, 600]], []], [])],
 [('regression: age boundary 1', [16, [[4, 1080, 1200], [4, 419, 599]], []], []),
  ('regression variant: age boundary 2',
   [16, [[6, 1020, 1260], [1, 360, 540], [0, 1020, 1440], [6, 900, 1200], [0, 960, 1200], [1, 420, 660]],
    [3, 4, 5, 6]],
   []),
  ('partial repair guard 3',
   [17, [[2, 1080, 1320], [2, 960, 1140], [6, 480, 720], [0, 960, 1140]], [1, 2, 5]], []),
  ('boundary control 4', [15, [[5, 960, 1140]], []], []),
  ('boundary control 5', [15, [[0, 900, 1080]], [0, 1, 2, 3, 4]], []),
  ('normal control 6', [17, [[4, 900, 1081], [0, 360, 840]], [1, 2, 3, 6]], []),
  ('normal control 7',
   [15, [[6, 960, 1440], [1, 1020, 1260], [2, 360, 541], [0, 360, 840], [3, 960, 1141], [0, 1020, 1080]],
    [1, 2, 4]],
   [['hours_window', 6], ['hours_window', 1], ['hours_window', 2], ['hours_window', 0], ['hours_window', 3],
    ['daily_cap', 0], ['daily_cap', 1], ['daily_cap', 2], ['weekly_cap', -1]]),
  ('normal control 8', [14, [[2, 1020, 1440], [5, 419, 539]], [0, 1, 2, 4, 5]],
   [['hours_window', 2], ['hours_window', 5], ['daily_cap', 2]])],
 [('regression: age boundary 1', [16, [[3, 419, 600], [5, 1020, 1260]], [2, 3, 4, 6]], []),
  ('regression variant: age boundary 2',
   [16, [[6, 360, 541], [0, 1020, 1200], [5, 960, 1200], [0, 960, 1140], [4, 900, 1140]], []], []),
  ('partial repair guard 3',
   [16, [[3, 1020, 1260], [0, 1080, 1320], [5, 419, 899], [2, 960, 1141], [4, 900, 1080], [3, 480, 780]],
    [0, 1, 2, 5, 6]],
   []),
  ('boundary control 4', [15, [[1, 900, 1000], [1, 1020, 1120]], [1]], [['daily_cap', 1]]),
  ('boundary control 5', [15, [[5, 960, 1141]], []], [['hours_window', 5]]),
  ('normal control 6',
   [15, [[3, 420, 480], [5, 480, 960], [5, 1020, 1320], [1, 1080, 1200], [3, 419, 600], [5, 419, 599]],
    [1, 3, 4]],
   [['hours_window', 5], ['hours_window', 1], ['hours_window', 3], ['hours_window', 5], ['daily_cap', 3],
    ['daily_cap', 5], ['weekly_cap', -1]]),
  ('normal control 7', [17, [[0, 420, 600], [2, 1080, 1140]], [0, 1, 4]], []),
  ('normal control 8',
   [14, [[6, 1020, 1140], [3, 419, 479], [2, 480, 960], [4, 1020, 1320], [4, 1080, 1200], [1, 360, 540]],
    [0, 1, 3, 4]],
   [['hours_window', 3], ['hours_window', 4], ['hours_window', 4], ['hours_window', 1], ['daily_cap', 4],
    ['weekly_cap', -1]])],
 [('regression: age boundary 1',
   [16, [[3, 360, 600], [4, 419, 599], [6, 360, 541], [6, 419, 599], [4, 480, 960], [4, 900, 1140]],
    [0, 1, 4, 5, 6]],
   []),
  ('regression variant: age boundary 2', [16, [[3, 960, 1260], [3, 1020, 1201], [1, 420, 720]], []], []),
  ('partial repair guard 3',
   [17, [[4, 960, 1140], [4, 1020, 1080], [5, 900, 960], [0, 1020, 1140], [6, 480, 540], [5, 420, 480]],
    [0, 3, 4, 5, 6]],
   []),
  ('boundary control 4', [15, [[0, 900, 1081]], [0, 1, 2, 3, 4]], [['daily_cap', 0]]),
  ('boundary control 5', [14, [[5, 480, 960], [6, 480, 960], [0, 900, 1080], [2, 900, 1080]], [0, 2]],
   [['weekly_cap', -1]]),
  ('normal control 6',
   [17, [[1, 960, 1020], [4, 360, 420], [3, 420, 720], [0, 420, 601], [1, 1080, 1260], [4, 1020, 1260]], []],
   []),
  ('normal control 7', [15, [[4, 1080, 1320], [3, 1080, 1440], [4, 900, 1380], [4, 1080, 1140]], [2, 3, 4]],
   [['hours_window', 4], ['hours_window', 3], ['hours_window', 4], ['daily_cap', 3], ['daily_cap', 4],
    ['weekly_cap', -1]]),
  ('normal control 8',
   [15, [[0, 480, 661], [4, 420, 540], [1, 420, 660], [1, 360, 480], [2, 1080, 1440]], []],
   [['hours_window', 1], ['hours_window', 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: age boundary 1[['hours_window', 0], ['daily_cap', 0]][]Failed
regression variant: age boundary 2[['hours_window', 4]][]Failed
partial repair guard 3[['hours_window', 2], ['hours_window', 5], ['daily_cap', 2], ['daily_cap', 6]][]Failed
boundary control 4[['hours_window', 5]][['hours_window', 5]]Passed
boundary control 5[['daily_cap', 0]][['daily_cap', 0]]Passed
normal control 6[['hours_window', 2], ['hours_window', 2], ['hours_window', 3], ['daily_cap', 2], ['weekly_cap', -1]][]Failed
normal control 7[['hours_window', 3], ['hours_window', 1]][['hours_window', 3], ['hours_window', 1]]Passed
normal control 8[['hours_window', 6]][['hours_window', 6]]Passed

SHA-256 / 47ba572274894fdee99e7f10e9fb1c54591aefeb8b8814887bb520122cc3cf41

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

Case digest / 252c297d00e433109f735e47e93e257939440ce379b01c761b41bd600db03202