FAILURE MAP
← Case archive

FA-94156 / Shift rostering labor rules / Open access

Clock-in grace applied to late arrivals · case 01

Late arrivals are paid from the scheduled start while early arrivals are rounded.

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

ROOT CAUSE

The clock-in grace window is measured after the start instead of before it.

VERIFIED REPAIR

Snap only punches up to seven minutes before the scheduled start.

Unsuccessful approach: A symmetric window also forgives late arrivals.

Case contract

Scheduled [start, end] and raw punches in minutes. A punch in at most 7 minutes before the scheduled start is treated as the start; a punch out at most 7 minutes after the scheduled end is treated as the end. Then each time is rounded to the quarter hour: remainder 0-7 down, 8-14 up. Return [in, out, max(out - in, 0)].

Why this case matters

Punch rounding and grace periods must be neutral; asymmetric boundaries systematically underpay.

1 / The failure

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

N = 1
observations = []
def solve(sched, punch_in, punch_out):
    start, end = sched
    def q(t):
        r = t % 15
        return t - r if r <= 7 else t + 15 - r
    i = start if 0 < punch_in - start <= 7 else punch_in
    o = end if 0 < punch_out - end <= 7 else punch_out
    i, o = q(i), q(o)
    return [i, o, max(o - i, 0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: early grace direction 1', [[487, 727], 490, 736], [495, 735, 240]),
  ('regression variant: early grace direction 2', [[487, 727], 494, 736], [495, 735, 240]),
  ('partial repair guard 3', [[487, 967], 490, 972], [495, 960, 465]),
  ('boundary control 4', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 5', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 6', [[600, 1080], 595, 1081], [600, 1080, 480]),
  ('normal control 7', [[600, 840], 609, 847], [615, 840, 225]),
  ('normal control 8', [[540, 1050], 548, 1040], [555, 1035, 480])],
 [('regression: early grace direction 1', [[487, 997], 494, 998], [495, 990, 495]),
  ('regression variant: early grace direction 2', [[487, 967], 490, 972], [495, 960, 465]),
  ('partial repair guard 3', [[487, 727], 490, 736], [495, 735, 240]),
  ('boundary control 4', [[480, 960], 473, 967], [480, 960, 480]),
  ('boundary control 5', [[480, 960], 500, 490], [495, 495, 0]),
  ('normal control 6', [[540, 1050], 539, 1049], [540, 1050, 510]),
  ('normal control 7', [[600, 1080], 592, 1080], [585, 1080, 495]),
  ('normal control 8', [[480, 720], 460, 719], [465, 720, 255])],
 [('regression: early grace direction 1', [[487, 997], 490, 1006], [495, 1005, 510]),
  ('partial repair guard 2', [[487, 727], 494, 749], [495, 750, 255]),
  ('boundary control 3', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 4', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 5', [[540, 1050], 532, 1050], [525, 1050, 525]),
  ('normal control 6', [[540, 1050], 535, 1057], [540, 1050, 510]),
  ('normal control 7', [[420, 930], 427, 942], [420, 945, 525]),
  ('normal control 8', [[540, 1050], 535, 1058], [540, 1065, 525])],
 [('regression: early grace direction 1', [[487, 727], 490, 726], [495, 720, 225]),
  ('regression variant: early grace direction 2', [[487, 997], 494, 1005], [495, 1005, 510]),
  ('partial repair guard 3', [[487, 727], 494, 736], [495, 735, 240]),
  ('boundary control 4', [[480, 960], 473, 967], [480, 960, 480]),
  ('boundary control 5', [[480, 960], 500, 490], [495, 495, 0]),
  ('normal control 6', [[487, 727], 477, 739], [480, 735, 255]),
  ('normal control 7', [[480, 990], 470, 989], [465, 990, 525]),
  ('normal control 8', [[600, 840], 593, 849], [600, 855, 255])],
 [('regression: early grace direction 1', [[487, 727], 494, 483], [495, 480, 0]),
  ('regression variant: early grace direction 2', [[487, 727], 494, 749], [495, 750, 255]),
  ('boundary control 3', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 4', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 5', [[600, 840], 614, 849], [615, 855, 240]),
  ('normal control 6', [[540, 780], 548, 788], [555, 795, 240]),
  ('normal control 7', [[480, 960], 480, 982], [480, 975, 495]),
  ('normal control 8', [[540, 1020], 547, 1028], [540, 1035, 495])]]
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: early grace direction 1[480, 735, 255][495, 735, 240]Failed
regression variant: early grace direction 2[480, 735, 255][495, 735, 240]Failed
partial repair guard 3[480, 960, 480][495, 960, 465]Failed
boundary control 4[495, 945, 450][495, 945, 450]Passed
boundary control 5[480, 960, 480][480, 960, 480]Passed
normal control 6[600, 1080, 480][600, 1080, 480]Passed
normal control 7[615, 840, 225][615, 840, 225]Passed
normal control 8[555, 1035, 480][555, 1035, 480]Passed

SHA-256 / dcb38fc1cd39f4080f0bedb08378298e01531ec7b44ac2a9e109bd369f7d801d

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(sched, punch_in, punch_out):
    start, end = sched
    def q(t):
        r = t % 15
        return t - r if r <= 7 else t + 15 - r
    i = start if abs(start - punch_in) <= 7 else punch_in
    o = end if 0 < punch_out - end <= 7 else punch_out
    i, o = q(i), q(o)
    return [i, o, max(o - i, 0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: early grace direction 1', [[487, 727], 490, 736], [495, 735, 240]),
  ('regression variant: early grace direction 2', [[487, 727], 494, 736], [495, 735, 240]),
  ('partial repair guard 3', [[487, 967], 490, 972], [495, 960, 465]),
  ('boundary control 4', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 5', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 6', [[600, 1080], 595, 1081], [600, 1080, 480]),
  ('normal control 7', [[600, 840], 609, 847], [615, 840, 225]),
  ('normal control 8', [[540, 1050], 548, 1040], [555, 1035, 480])],
 [('regression: early grace direction 1', [[487, 997], 494, 998], [495, 990, 495]),
  ('regression variant: early grace direction 2', [[487, 967], 490, 972], [495, 960, 465]),
  ('partial repair guard 3', [[487, 727], 490, 736], [495, 735, 240]),
  ('boundary control 4', [[480, 960], 473, 967], [480, 960, 480]),
  ('boundary control 5', [[480, 960], 500, 490], [495, 495, 0]),
  ('normal control 6', [[540, 1050], 539, 1049], [540, 1050, 510]),
  ('normal control 7', [[600, 1080], 592, 1080], [585, 1080, 495]),
  ('normal control 8', [[480, 720], 460, 719], [465, 720, 255])],
 [('regression: early grace direction 1', [[487, 997], 490, 1006], [495, 1005, 510]),
  ('partial repair guard 2', [[487, 727], 494, 749], [495, 750, 255]),
  ('boundary control 3', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 4', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 5', [[540, 1050], 532, 1050], [525, 1050, 525]),
  ('normal control 6', [[540, 1050], 535, 1057], [540, 1050, 510]),
  ('normal control 7', [[420, 930], 427, 942], [420, 945, 525]),
  ('normal control 8', [[540, 1050], 535, 1058], [540, 1065, 525])],
 [('regression: early grace direction 1', [[487, 727], 490, 726], [495, 720, 225]),
  ('regression variant: early grace direction 2', [[487, 997], 494, 1005], [495, 1005, 510]),
  ('partial repair guard 3', [[487, 727], 494, 736], [495, 735, 240]),
  ('boundary control 4', [[480, 960], 473, 967], [480, 960, 480]),
  ('boundary control 5', [[480, 960], 500, 490], [495, 495, 0]),
  ('normal control 6', [[487, 727], 477, 739], [480, 735, 255]),
  ('normal control 7', [[480, 990], 470, 989], [465, 990, 525]),
  ('normal control 8', [[600, 840], 593, 849], [600, 855, 255])],
 [('regression: early grace direction 1', [[487, 727], 494, 483], [495, 480, 0]),
  ('regression variant: early grace direction 2', [[487, 727], 494, 749], [495, 750, 255]),
  ('boundary control 3', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 4', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 5', [[600, 840], 614, 849], [615, 855, 240]),
  ('normal control 6', [[540, 780], 548, 788], [555, 795, 240]),
  ('normal control 7', [[480, 960], 480, 982], [480, 975, 495]),
  ('normal control 8', [[540, 1020], 547, 1028], [540, 1035, 495])]]
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: early grace direction 1[480, 735, 255][495, 735, 240]Failed
regression variant: early grace direction 2[480, 735, 255][495, 735, 240]Failed
partial repair guard 3[480, 960, 480][495, 960, 465]Failed
boundary control 4[495, 945, 450][495, 945, 450]Passed
boundary control 5[480, 960, 480][480, 960, 480]Passed
normal control 6[600, 1080, 480][600, 1080, 480]Passed
normal control 7[615, 840, 225][615, 840, 225]Passed
normal control 8[555, 1035, 480][555, 1035, 480]Passed

SHA-256 / e27bed34d75b90ffab6641bd33e9ebc74c9ad0ee9d1b26feb4d197edc7d862e4

3 / The verified repair

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

N = 1
observations = []
def solve(sched, punch_in, punch_out):
    start, end = sched
    def q(t):
        r = t % 15
        return t - r if r <= 7 else t + 15 - r
    i = start if 0 < start - punch_in <= 7 else punch_in
    o = end if 0 < punch_out - end <= 7 else punch_out
    i, o = q(i), q(o)
    return [i, o, max(o - i, 0)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: early grace direction 1', [[487, 727], 490, 736], [495, 735, 240]),
  ('regression variant: early grace direction 2', [[487, 727], 494, 736], [495, 735, 240]),
  ('partial repair guard 3', [[487, 967], 490, 972], [495, 960, 465]),
  ('boundary control 4', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 5', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 6', [[600, 1080], 595, 1081], [600, 1080, 480]),
  ('normal control 7', [[600, 840], 609, 847], [615, 840, 225]),
  ('normal control 8', [[540, 1050], 548, 1040], [555, 1035, 480])],
 [('regression: early grace direction 1', [[487, 997], 494, 998], [495, 990, 495]),
  ('regression variant: early grace direction 2', [[487, 967], 490, 972], [495, 960, 465]),
  ('partial repair guard 3', [[487, 727], 490, 736], [495, 735, 240]),
  ('boundary control 4', [[480, 960], 473, 967], [480, 960, 480]),
  ('boundary control 5', [[480, 960], 500, 490], [495, 495, 0]),
  ('normal control 6', [[540, 1050], 539, 1049], [540, 1050, 510]),
  ('normal control 7', [[600, 1080], 592, 1080], [585, 1080, 495]),
  ('normal control 8', [[480, 720], 460, 719], [465, 720, 255])],
 [('regression: early grace direction 1', [[487, 997], 490, 1006], [495, 1005, 510]),
  ('partial repair guard 2', [[487, 727], 494, 749], [495, 750, 255]),
  ('boundary control 3', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 4', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 5', [[540, 1050], 532, 1050], [525, 1050, 525]),
  ('normal control 6', [[540, 1050], 535, 1057], [540, 1050, 510]),
  ('normal control 7', [[420, 930], 427, 942], [420, 945, 525]),
  ('normal control 8', [[540, 1050], 535, 1058], [540, 1065, 525])],
 [('regression: early grace direction 1', [[487, 727], 490, 726], [495, 720, 225]),
  ('regression variant: early grace direction 2', [[487, 997], 494, 1005], [495, 1005, 510]),
  ('partial repair guard 3', [[487, 727], 494, 736], [495, 735, 240]),
  ('boundary control 4', [[480, 960], 473, 967], [480, 960, 480]),
  ('boundary control 5', [[480, 960], 500, 490], [495, 495, 0]),
  ('normal control 6', [[487, 727], 477, 739], [480, 735, 255]),
  ('normal control 7', [[480, 990], 470, 989], [465, 990, 525]),
  ('normal control 8', [[600, 840], 593, 849], [600, 855, 255])],
 [('regression: early grace direction 1', [[487, 727], 494, 483], [495, 480, 0]),
  ('regression variant: early grace direction 2', [[487, 727], 494, 749], [495, 750, 255]),
  ('boundary control 3', [[480, 960], 488, 952], [495, 945, 450]),
  ('boundary control 4', [[480, 960], 487, 953], [480, 960, 480]),
  ('normal control 5', [[600, 840], 614, 849], [615, 855, 240]),
  ('normal control 6', [[540, 780], 548, 788], [555, 795, 240]),
  ('normal control 7', [[480, 960], 480, 982], [480, 975, 495]),
  ('normal control 8', [[540, 1020], 547, 1028], [540, 1035, 495])]]
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: early grace direction 1[495, 735, 240][495, 735, 240]Passed
regression variant: early grace direction 2[495, 735, 240][495, 735, 240]Passed
partial repair guard 3[495, 960, 465][495, 960, 465]Passed
boundary control 4[495, 945, 450][495, 945, 450]Passed
boundary control 5[480, 960, 480][480, 960, 480]Passed
normal control 6[600, 1080, 480][600, 1080, 480]Passed
normal control 7[615, 840, 225][615, 840, 225]Passed
normal control 8[555, 1035, 480][555, 1035, 480]Passed

SHA-256 / 39cce16f5e11b4ab90343f2de9b9bbefdc37b3edc2f9a45104ebd2a5e78a350d

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

Case digest / b16303a20916016498cb44b0a1a26f5e4440c93574f0ea0768d73cf69c6820b0