FA-68226 / Traffic signal timing plans / Open access
Transit signal priority decision: time to next green is measured backwards · case 01
Transit signal priority decision returns a wrong result when time to next green is measured backwards.
ROOT CAUSE
The wait is computed from green start to arrival, reversing the direction around the cycle.
THE FAILURE
The wait is computed from green start to arrival, reversing the direction around the cycle.
Unsuccessful approach: Without the modulo, arrivals after green start in the same cycle get a negative wait.
Case contract
Input {cycle, green_start, green_end (exclusive), max_ext, max_early, arrival (seconds, reduced modulo cycle), last_granted (cycle index or null), cycle_index, lockout}. A request within lockout cycles of the last grant (difference <= lockout) returns ['locked', 0]. Arrival in green needs nothing. If the arrival is less than max_ext seconds after green end (cyclically) green is extended through the arrival second: ['extend', d+1]. Otherwise green starts early by min(max_early, seconds until next green start).
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):
C = x['cycle']
a = x['arrival'] % C
last = x['last_granted']
if last is not None and x['cycle_index'] - last <= x['lockout']:
return ['locked', 0]
gs, ge = x['green_start'], x['green_end']
if gs <= a < ge:
return ['none', 0]
d = (a - ge) % C
if d < x['max_ext']:
return ['extend', d + 1]
wait = (a - gs) % C
return ['early', min(x['max_early'], wait)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 130, 'green_start': 5, 'green_end': 23, 'max_ext': 5, 'max_early': 14, 'arrival': 261, 'last_granted': 0, 'cycle_index': 12, 'lockout': 1}, ['early', 4]), ({'cycle': 120, 'green_start': 28, 'green_end': 81, 'max_ext': 11, 'max_early': 16, 'arrival': 17, 'last_granted': None, 'cycle_index': 17, 'lockout': 2}, ['early', 11]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 90, 'green_start': 2, 'green_end': 24, 'max_ext': 19, 'max_early': 10, 'arrival': 151, 'last_granted': None, 'cycle_index': 3, 'lockout': 2}, ['early', 10]), ({'cycle': 140, 'green_start': 23, 'green_end': 39, 'max_ext': 18, 'max_early': 10, 'arrival': 206, 'last_granted': 1, 'cycle_index': 18, 'lockout': 3}, ['early', 10]), ({'cycle': 140, 'green_start': 36, 'green_end': 98, 'max_ext': 10, 'max_early': 15, 'arrival': 23, 'last_granted': 10, 'cycle_index': 13, 'lockout': 1}, ['early', 13])], [({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 110, 'green_start': 49, 'green_end': 88, 'max_ext': 8, 'max_early': 20, 'arrival': 36, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['early', 13]), ({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 80, 'green_start': 13, 'green_end': 42, 'max_ext': 10, 'max_early': 5, 'arrival': 66, 'last_granted': None, 'cycle_index': 10, 'lockout': 3}, ['early', 5]), ({'cycle': 100, 'green_start': 24, 'green_end': 51, 'max_ext': 20, 'max_early': 20, 'arrival': 87, 'last_granted': 4, 'cycle_index': 17, 'lockout': 1}, ['early', 20]), ({'cycle': 80, 'green_start': 10, 'green_end': 38, 'max_ext': 10, 'max_early': 16, 'arrival': 157, 'last_granted': 17, 'cycle_index': 22, 'lockout': 2}, ['early', 13]), ({'cycle': 110, 'green_start': 9, 'green_end': 41, 'max_ext': 17, 'max_early': 18, 'arrival': 115, 'last_granted': None, 'cycle_index': 18, 'lockout': 3}, ['early', 4])], [({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 140, 'green_start': 4, 'green_end': 36, 'max_ext': 15, 'max_early': 11, 'arrival': 99, 'last_granted': None, 'cycle_index': 6, 'lockout': 1}, ['early', 11]), ({'cycle': 90, 'green_start': 25, 'green_end': 40, 'max_ext': 8, 'max_early': 9, 'arrival': 60, 'last_granted': None, 'cycle_index': 20, 'lockout': 1}, ['early', 9]), ({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 100, 'green_start': 2, 'green_end': 30, 'max_ext': 12, 'max_early': 13, 'arrival': 297, 'last_granted': None, 'cycle_index': 10, 'lockout': 3}, ['early', 5]), ({'cycle': 120, 'green_start': 50, 'green_end': 90, 'max_ext': 11, 'max_early': 8, 'arrival': 49, 'last_granted': 4, 'cycle_index': 13, 'lockout': 3}, ['early', 1]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 90, 'green_start': 42, 'green_end': 86, 'max_ext': 9, 'max_early': 11, 'arrival': 38, 'last_granted': None, 'cycle_index': 16, 'lockout': 3}, ['early', 4])], [({'cycle': 90, 'green_start': 42, 'green_end': 78, 'max_ext': 18, 'max_early': 14, 'arrival': 209, 'last_granted': None, 'cycle_index': 8, 'lockout': 2}, ['early', 13]), ({'cycle': 100, 'green_start': 1, 'green_end': 27, 'max_ext': 13, 'max_early': 8, 'arrival': 261, 'last_granted': None, 'cycle_index': 2, 'lockout': 3}, ['early', 8]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 100, 'green_start': 26, 'green_end': 44, 'max_ext': 5, 'max_early': 15, 'arrival': 251, 'last_granted': None, 'cycle_index': 7, 'lockout': 3}, ['early', 15]), ({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 120, 'green_start': 18, 'green_end': 55, 'max_ext': 12, 'max_early': 18, 'arrival': 126, 'last_granted': None, 'cycle_index': 20, 'lockout': 1}, ['early', 12]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 130, 'green_start': 4, 'green_end': 40, 'max_ext': 12, 'max_early': 20, 'arrival': 388, 'last_granted': None, 'cycle_index': 10, 'lockout': 1}, ['early', 6])], [({'cycle': 90, 'green_start': 29, 'green_end': 48, 'max_ext': 19, 'max_early': 20, 'arrival': 14, 'last_granted': 6, 'cycle_index': 10, 'lockout': 1}, ['early', 15]), ({'cycle': 130, 'green_start': 18, 'green_end': 48, 'max_ext': 17, 'max_early': 6, 'arrival': 257, 'last_granted': 19, 'cycle_index': 0, 'lockout': 1}, ['locked', 0]), ({'cycle': 120, 'green_start': 9, 'green_end': 40, 'max_ext': 10, 'max_early': 11, 'arrival': 349, 'last_granted': None, 'cycle_index': 1, 'lockout': 1}, ['early', 11]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 130, 'green_start': 33, 'green_end': 59, 'max_ext': 11, 'max_early': 17, 'arrival': 153, 'last_granted': None, 'cycle_index': 10, 'lockout': 1}, ['early', 10]), ({'cycle': 140, 'green_start': 23, 'green_end': 87, 'max_ext': 18, 'max_early': 8, 'arrival': 409, 'last_granted': 8, 'cycle_index': 17, 'lockout': 2}, ['early', 8]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 100, 'green_start': 30, 'green_end': 45, 'max_ext': 20, 'max_early': 10, 'arrival': 28, 'last_granted': 1, 'cycle_index': 6, 'lockout': 2}, ['early', 2])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| timing oracle 0 | ['locked', 0] | ['locked', 0] | Passed |
| timing oracle 1 | ['early', 14] | ['early', 4] | Failed |
| timing oracle 2 | ['early', 16] | ['early', 11] | Failed |
| timing oracle 3 | ['none', 0] | ['none', 0] | Passed |
| timing oracle 4 | ['extend', 1] | ['extend', 1] | Passed |
| timing oracle 5 | ['early', 10] | ['early', 10] | Passed |
| timing oracle 6 | ['early', 10] | ['early', 10] | Passed |
| timing oracle 7 | ['early', 15] | ['early', 13] | Failed |
SHA-256 / 5b8bb595b9b1a8de890e11935b64c6fa9fdaa5cf534b5062f3c0b32d08ff5783
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
C = x['cycle']
a = x['arrival'] % C
last = x['last_granted']
if last is not None and x['cycle_index'] - last <= x['lockout']:
return ['locked', 0]
gs, ge = x['green_start'], x['green_end']
if gs <= a < ge:
return ['none', 0]
d = (a - ge) % C
if d < x['max_ext']:
return ['extend', d + 1]
wait = gs - a
return ['early', min(x['max_early'], wait)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 130, 'green_start': 5, 'green_end': 23, 'max_ext': 5, 'max_early': 14, 'arrival': 261, 'last_granted': 0, 'cycle_index': 12, 'lockout': 1}, ['early', 4]), ({'cycle': 120, 'green_start': 28, 'green_end': 81, 'max_ext': 11, 'max_early': 16, 'arrival': 17, 'last_granted': None, 'cycle_index': 17, 'lockout': 2}, ['early', 11]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 90, 'green_start': 2, 'green_end': 24, 'max_ext': 19, 'max_early': 10, 'arrival': 151, 'last_granted': None, 'cycle_index': 3, 'lockout': 2}, ['early', 10]), ({'cycle': 140, 'green_start': 23, 'green_end': 39, 'max_ext': 18, 'max_early': 10, 'arrival': 206, 'last_granted': 1, 'cycle_index': 18, 'lockout': 3}, ['early', 10]), ({'cycle': 140, 'green_start': 36, 'green_end': 98, 'max_ext': 10, 'max_early': 15, 'arrival': 23, 'last_granted': 10, 'cycle_index': 13, 'lockout': 1}, ['early', 13])], [({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 110, 'green_start': 49, 'green_end': 88, 'max_ext': 8, 'max_early': 20, 'arrival': 36, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['early', 13]), ({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 80, 'green_start': 13, 'green_end': 42, 'max_ext': 10, 'max_early': 5, 'arrival': 66, 'last_granted': None, 'cycle_index': 10, 'lockout': 3}, ['early', 5]), ({'cycle': 100, 'green_start': 24, 'green_end': 51, 'max_ext': 20, 'max_early': 20, 'arrival': 87, 'last_granted': 4, 'cycle_index': 17, 'lockout': 1}, ['early', 20]), ({'cycle': 80, 'green_start': 10, 'green_end': 38, 'max_ext': 10, 'max_early': 16, 'arrival': 157, 'last_granted': 17, 'cycle_index': 22, 'lockout': 2}, ['early', 13]), ({'cycle': 110, 'green_start': 9, 'green_end': 41, 'max_ext': 17, 'max_early': 18, 'arrival': 115, 'last_granted': None, 'cycle_index': 18, 'lockout': 3}, ['early', 4])], [({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 140, 'green_start': 4, 'green_end': 36, 'max_ext': 15, 'max_early': 11, 'arrival': 99, 'last_granted': None, 'cycle_index': 6, 'lockout': 1}, ['early', 11]), ({'cycle': 90, 'green_start': 25, 'green_end': 40, 'max_ext': 8, 'max_early': 9, 'arrival': 60, 'last_granted': None, 'cycle_index': 20, 'lockout': 1}, ['early', 9]), ({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 100, 'green_start': 2, 'green_end': 30, 'max_ext': 12, 'max_early': 13, 'arrival': 297, 'last_granted': None, 'cycle_index': 10, 'lockout': 3}, ['early', 5]), ({'cycle': 120, 'green_start': 50, 'green_end': 90, 'max_ext': 11, 'max_early': 8, 'arrival': 49, 'last_granted': 4, 'cycle_index': 13, 'lockout': 3}, ['early', 1]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 90, 'green_start': 42, 'green_end': 86, 'max_ext': 9, 'max_early': 11, 'arrival': 38, 'last_granted': None, 'cycle_index': 16, 'lockout': 3}, ['early', 4])], [({'cycle': 90, 'green_start': 42, 'green_end': 78, 'max_ext': 18, 'max_early': 14, 'arrival': 209, 'last_granted': None, 'cycle_index': 8, 'lockout': 2}, ['early', 13]), ({'cycle': 100, 'green_start': 1, 'green_end': 27, 'max_ext': 13, 'max_early': 8, 'arrival': 261, 'last_granted': None, 'cycle_index': 2, 'lockout': 3}, ['early', 8]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 100, 'green_start': 26, 'green_end': 44, 'max_ext': 5, 'max_early': 15, 'arrival': 251, 'last_granted': None, 'cycle_index': 7, 'lockout': 3}, ['early', 15]), ({'cycle': 100, 'green_start': 10, 'green_end': 50, 'max_ext': 10, 'max_early': 10, 'arrival': 250, 'last_granted': 3, 'cycle_index': 5, 'lockout': 2}, ['locked', 0]), ({'cycle': 120, 'green_start': 18, 'green_end': 55, 'max_ext': 12, 'max_early': 18, 'arrival': 126, 'last_granted': None, 'cycle_index': 20, 'lockout': 1}, ['early', 12]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 130, 'green_start': 4, 'green_end': 40, 'max_ext': 12, 'max_early': 20, 'arrival': 388, 'last_granted': None, 'cycle_index': 10, 'lockout': 1}, ['early', 6])], [({'cycle': 90, 'green_start': 29, 'green_end': 48, 'max_ext': 19, 'max_early': 20, 'arrival': 14, 'last_granted': 6, 'cycle_index': 10, 'lockout': 1}, ['early', 15]), ({'cycle': 130, 'green_start': 18, 'green_end': 48, 'max_ext': 17, 'max_early': 6, 'arrival': 257, 'last_granted': 19, 'cycle_index': 0, 'lockout': 1}, ['locked', 0]), ({'cycle': 120, 'green_start': 9, 'green_end': 40, 'max_ext': 10, 'max_early': 11, 'arrival': 349, 'last_granted': None, 'cycle_index': 1, 'lockout': 1}, ['early', 11]), ({'cycle': 100, 'green_start': 10, 'green_end': 45, 'max_ext': 10, 'max_early': 10, 'arrival': 110, 'last_granted': None, 'cycle_index': 4, 'lockout': 1}, ['none', 0]), ({'cycle': 130, 'green_start': 33, 'green_end': 59, 'max_ext': 11, 'max_early': 17, 'arrival': 153, 'last_granted': None, 'cycle_index': 10, 'lockout': 1}, ['early', 10]), ({'cycle': 140, 'green_start': 23, 'green_end': 87, 'max_ext': 18, 'max_early': 8, 'arrival': 409, 'last_granted': 8, 'cycle_index': 17, 'lockout': 2}, ['early', 8]), ({'cycle': 90, 'green_start': 0, 'green_end': 40, 'max_ext': 12, 'max_early': 8, 'arrival': 40, 'last_granted': None, 'cycle_index': 0, 'lockout': 1}, ['extend', 1]), ({'cycle': 100, 'green_start': 30, 'green_end': 45, 'max_ext': 20, 'max_early': 10, 'arrival': 28, 'last_granted': 1, 'cycle_index': 6, 'lockout': 2}, ['early', 2])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| timing oracle 0 | ['locked', 0] | ['locked', 0] | Passed |
| timing oracle 1 | ['early', 4] | ['early', 4] | Passed |
| timing oracle 2 | ['early', 11] | ['early', 11] | Passed |
| timing oracle 3 | ['none', 0] | ['none', 0] | Passed |
| timing oracle 4 | ['extend', 1] | ['extend', 1] | Passed |
| timing oracle 5 | ['early', -59] | ['early', 10] | Failed |
| timing oracle 6 | ['early', -43] | ['early', 10] | Failed |
| timing oracle 7 | ['early', 13] | ['early', 13] | Passed |
SHA-256 / 435aaf33b8622ee6d223bdd2031261239faab52ac79bab2f2f5bb8395cc1265f
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:48:00.252145+00:00.
Case digest / 42bdd6469fb5a2dcd87bdd97ceffe7bdd2071768ee626193fb2dd05445db1979