FAILURE MAP
← Case archive

FA-67976 / Traffic signal timing plans / Open access

Actuated phase gap-out and max-out: the raw passage expiry is compared with max-out · case 01

Actuated phase gap-out and max-out returns a wrong result when the raw passage expiry is compared with max-out.

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

ROOT CAUSE

When gap-out and max-out coincide the phase is reported as maxed out although the contract gives gap-out precedence.

THE FAILURE

When gap-out and max-out coincide the phase is reported as maxed out although the contract gives gap-out precedence.

Unsuccessful approach: Comparing the raw expiry ignores that the phase cannot gap out before min green ends.

Case contract

Input {min_green, gap, max_green, actuations: integer seconds since green start (any order), conflict_call: seconds or null}. Each actuation at a keeps the phase eligible until a+gap; an actuation exactly at expiry extends; actuations during min green always extend. Gap-out time = max(min_green, final expiry). With no conflicting call return ['rest', gap time]. The max timer starts at the call (a call before green start counts as 0); max-out at call+max_green. If gap time <= max-out the phase ends by 'gap-out' at max(gap time, call), else by 'max-out'.

Why this case matters

Signal timing arithmetic is exact and integer or rational; a wrong rule silently produces unsafe or inefficient timing plans.

1 / The failure

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

N = 1
observations = []
def solve(x):
    m, p, M = x['min_green'], x['gap'], x['max_green']
    exp = 0
    for a in sorted(x['actuations']):
        if a > exp and a > m:
            break
        exp = max(exp, a + p)
    gap_end = max(m, exp)
    tc = x['conflict_call']
    if tc is None:
        return ['rest', gap_end]
    tc = max(tc, 0)
    max_end = tc + M
    if gap_end < max_end:
        return ['gap-out', max(gap_end, tc)]
    return ['max-out', max_end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 5, 'gap': 4, 'max_green': 19, 'actuations': [1, 2, 3, 4, 5, 6, 8, 9, 11, 12, 19, 20, 25, 28, 30, 35, 36, 38, 40, 49, 59], 'conflict_call': None}, ['rest', 16]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 5, 'gap': 5, 'max_green': 43, 'actuations': [0, 2, 8, 9, 11, 24, 53], 'conflict_call': 25}, ['gap-out', 25]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15])], [({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 9, 'gap': 2, 'max_green': 19, 'actuations': [12, 17, 20, 29, 38, 40, 44], 'conflict_call': None}, ['rest', 9]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 9, 'gap': 2, 'max_green': 21, 'actuations': [59, 4, 58, 36, 53, 57, 17, 30, 23], 'conflict_call': -2}, ['gap-out', 9]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7])], [({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 10, 'gap': 3, 'max_green': 44, 'actuations': [1, 27, 56, 32, 11, 54, 44, 28, 7, 58, 37, 30, 52, 0, 47, 46, 48], 'conflict_call': 4}, ['gap-out', 10]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 5, 'gap': 3, 'max_green': 29, 'actuations': [2, 4, 6, 7, 10, 11, 14, 15, 19, 20, 21, 22, 24, 27, 29, 31, 32, 33, 34, 36, 39, 42, 43, 45, 47, 48, 50, 51, 52, 53, 54, 56, 57, 58, 59], 'conflict_call': None}, ['rest', 18]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15])], [({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 10, 'gap': 5, 'max_green': 37, 'actuations': [0, 1, 3, 4, 5, 7, 10, 12, 13, 17, 19, 23, 24, 26, 30, 31, 32, 34, 36, 37, 38, 42, 44, 45, 48, 49, 50, 51, 54, 55, 56], 'conflict_call': 22}, ['max-out', 59]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 6, 'gap': 5, 'max_green': 16, 'actuations': [1, 4, 8, 10, 11, 15, 20, 25, 31, 55, 59], 'conflict_call': 14}, ['gap-out', 30]), ({'min_green': 4, 'gap': 5, 'max_green': 19, 'actuations': [22, 17, 57, 12, 39, 42, 4, 38, 9, 2, 19, 16, 6, 8, 54, 43, 30, 58, 15, 59, 3, 35, 44, 53, 28, 51, 7, 27, 55, 40, 31, 36], 'conflict_call': 30}, ['gap-out', 49]), ({'min_green': 6, 'gap': 4, 'max_green': 30, 'actuations': [0, 7, 10, 12, 13, 17, 20, 22, 25, 38, 50, 53, 54, 58, 59], 'conflict_call': None}, ['rest', 6]), ({'min_green': 7, 'gap': 3, 'max_green': 39, 'actuations': [8, 10, 12, 13, 14, 17, 22, 29, 31, 36, 42, 44, 45, 50, 52, 54, 57, 58, 59], 'conflict_call': 30}, ['gap-out', 30])], [({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 8, 'gap': 4, 'max_green': 43, 'actuations': [1, 2, 4, 5, 7, 9, 15, 21, 23, 27, 28, 29, 30, 31, 33, 34, 35, 37, 39, 42, 43, 45, 46, 47, 49, 51, 53, 54, 55, 58, 59], 'conflict_call': 21}, ['gap-out', 21]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 9, 'gap': 5, 'max_green': 30, 'actuations': [0, 1, 2, 3, 4, 5, 7, 10, 12, 14, 16, 17, 19, 23, 24, 26, 27, 30, 33, 34, 37, 42, 43, 46, 47, 48, 50, 51, 55, 56, 59], 'conflict_call': 14}, ['max-out', 44]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 6, 'gap': 4, 'max_green': 26, 'actuations': [0, 8, 14, 15, 22, 31, 33, 40, 50, 52, 59], 'conflict_call': 33}, ['gap-out', 33])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('timing oracle' + ' %d' % i, 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
timing oracle 0['gap-out', 20]['gap-out', 20]Passed
timing oracle 1['rest', 16]['rest', 16]Passed
timing oracle 2['max-out', 7]['max-out', 7]Passed
timing oracle 3['gap-out', 25]['gap-out', 25]Passed
timing oracle 4['max-out', 15]['gap-out', 15]Failed
timing oracle 5['gap-out', 16]['gap-out', 16]Passed
timing oracle 6['max-out', 3]['max-out', 3]Passed
timing oracle 7['max-out', 15]['gap-out', 15]Failed

SHA-256 / 6136a540cb235d8108fdcf88cb756d4bac49dd1de0224818866b172f7f212f9a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    m, p, M = x['min_green'], x['gap'], x['max_green']
    exp = 0
    for a in sorted(x['actuations']):
        if a > exp and a > m:
            break
        exp = max(exp, a + p)
    gap_end = max(m, exp)
    tc = x['conflict_call']
    if tc is None:
        return ['rest', gap_end]
    tc = max(tc, 0)
    max_end = tc + M
    if exp <= max_end:
        return ['gap-out', max(gap_end, tc)]
    return ['max-out', max_end]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 5, 'gap': 4, 'max_green': 19, 'actuations': [1, 2, 3, 4, 5, 6, 8, 9, 11, 12, 19, 20, 25, 28, 30, 35, 36, 38, 40, 49, 59], 'conflict_call': None}, ['rest', 16]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 5, 'gap': 5, 'max_green': 43, 'actuations': [0, 2, 8, 9, 11, 24, 53], 'conflict_call': 25}, ['gap-out', 25]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15])], [({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 9, 'gap': 2, 'max_green': 19, 'actuations': [12, 17, 20, 29, 38, 40, 44], 'conflict_call': None}, ['rest', 9]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 9, 'gap': 2, 'max_green': 21, 'actuations': [59, 4, 58, 36, 53, 57, 17, 30, 23], 'conflict_call': -2}, ['gap-out', 9]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7])], [({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 10, 'gap': 3, 'max_green': 44, 'actuations': [1, 27, 56, 32, 11, 54, 44, 28, 7, 58, 37, 30, 52, 0, 47, 46, 48], 'conflict_call': 4}, ['gap-out', 10]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 5, 'gap': 3, 'max_green': 29, 'actuations': [2, 4, 6, 7, 10, 11, 14, 15, 19, 20, 21, 22, 24, 27, 29, 31, 32, 33, 34, 36, 39, 42, 43, 45, 47, 48, 50, 51, 52, 53, 54, 56, 57, 58, 59], 'conflict_call': None}, ['rest', 18]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15])], [({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 10, 'gap': 5, 'max_green': 37, 'actuations': [0, 1, 3, 4, 5, 7, 10, 12, 13, 17, 19, 23, 24, 26, 30, 31, 32, 34, 36, 37, 38, 42, 44, 45, 48, 49, 50, 51, 54, 55, 56], 'conflict_call': 22}, ['max-out', 59]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 6, 'gap': 5, 'max_green': 16, 'actuations': [1, 4, 8, 10, 11, 15, 20, 25, 31, 55, 59], 'conflict_call': 14}, ['gap-out', 30]), ({'min_green': 4, 'gap': 5, 'max_green': 19, 'actuations': [22, 17, 57, 12, 39, 42, 4, 38, 9, 2, 19, 16, 6, 8, 54, 43, 30, 58, 15, 59, 3, 35, 44, 53, 28, 51, 7, 27, 55, 40, 31, 36], 'conflict_call': 30}, ['gap-out', 49]), ({'min_green': 6, 'gap': 4, 'max_green': 30, 'actuations': [0, 7, 10, 12, 13, 17, 20, 22, 25, 38, 50, 53, 54, 58, 59], 'conflict_call': None}, ['rest', 6]), ({'min_green': 7, 'gap': 3, 'max_green': 39, 'actuations': [8, 10, 12, 13, 14, 17, 22, 29, 31, 36, 42, 44, 45, 50, 52, 54, 57, 58, 59], 'conflict_call': 30}, ['gap-out', 30])], [({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 8, 'gap': 4, 'max_green': 43, 'actuations': [1, 2, 4, 5, 7, 9, 15, 21, 23, 27, 28, 29, 30, 31, 33, 34, 35, 37, 39, 42, 43, 45, 46, 47, 49, 51, 53, 54, 55, 58, 59], 'conflict_call': 21}, ['gap-out', 21]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 9, 'gap': 5, 'max_green': 30, 'actuations': [0, 1, 2, 3, 4, 5, 7, 10, 12, 14, 16, 17, 19, 23, 24, 26, 27, 30, 33, 34, 37, 42, 43, 46, 47, 48, 50, 51, 55, 56, 59], 'conflict_call': 14}, ['max-out', 44]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 6, 'gap': 4, 'max_green': 26, 'actuations': [0, 8, 14, 15, 22, 31, 33, 40, 50, 52, 59], 'conflict_call': 33}, ['gap-out', 33])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check('timing oracle' + ' %d' % i, 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
timing oracle 0['gap-out', 20]['gap-out', 20]Passed
timing oracle 1['rest', 16]['rest', 16]Passed
timing oracle 2['gap-out', 12]['max-out', 7]Failed
timing oracle 3['gap-out', 25]['gap-out', 25]Passed
timing oracle 4['gap-out', 15]['gap-out', 15]Passed
timing oracle 5['gap-out', 16]['gap-out', 16]Passed
timing oracle 6['gap-out', 10]['max-out', 3]Failed
timing oracle 7['gap-out', 15]['gap-out', 15]Passed

SHA-256 / e5fecb648d2b919eba9103b95e5b3e8c9a625f8b0507288f5c2e339e3b15a3be

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

A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:47:57.886137+00:00.

Case digest / 2b0e3051593d7e6632192ae7d0ed4dab46363223e040991ef706d404b9cf4c5d