FAILURE MAP
← Case archive

FA-67286 / Railway interlocking logic / Open access

Flank protection selection: flank table key · case 01

Route points receive no flank protection or the wrong one.

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

ROOT CAUSE

The flank table is looked up without the lie of the route point.

THE FAILURE

The flank table is looked up without the lie of the route point.

Unsuccessful approach: Looking up the opposite lie protects the wrong side of the junction.

Case contract

For each route point (sorted) in its lie, the flank table (key point+lie) lists flank points with the protecting lie and an optional flank signal. A flank point is set to its protecting lie if it is free, locked in that lie by another route, or already demanded in that lie by this route; if it is unavailable, its flank signal is held at danger when the signal exists and is holdable; otherwise the route is refused (refused:<flank point>, nothing set or held). Held signals are returned sorted and unique.

Why this case matters

Interlocking logic decides whether trains may be given authority; a wrong decision at this point either grants unsafe movements or strands traffic.

1 / The failure

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

N = 1
observations = []
def solve(x):
    set_pts = {}
    held = []
    locks = x['point_locks']
    for p, pos in sorted(x['route_points'].items()):
        for fp, fpos, fsig in x['flank'].get(p, []):
            lk = locks.get(fp, set_pts.get(fp))
            if lk is None or lk == fpos:
                set_pts[fp] = fpos
            elif fsig is not None and fsig in x['holdable']:
                held.append(fsig)
            else:
                return {'result': 'refused:' + fp, 'set_points': {}, 'held_signals': []}
    return {'result': 'protected', 'set_points': set_pts, 'held_signals': sorted(set(held))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: flank point locked in the protecting lie', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('regression: flank signal not holdable', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': []}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('regression: flank point free', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('regression: two route points disagree on a flank point', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('regression: no flank signal available', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 1', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 4', {'route_points': {'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S21', 'S22']}, {'result': 'protected', 'set_points': {'P9': 'N', 'P7': 'N'}, 'held_signals': []}), ('sampled regression 7', {'route_points': {'P2': 'R', 'P1': 'R', 'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P8': 'R', 'P9': 'R'}, 'holdable': ['S22', 'S24']}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []})], [('regression: flank point free', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 2', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P9': 'R'}, 'held_signals': []}), ('regression: same signal held twice', {'route_points': {'P1': 'N', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P8': 'N', 'P9': 'N'}, 'holdable': ['S20', 'S22']}, {'result': 'protected', 'set_points': {'P8': 'N'}, 'held_signals': ['S20', 'S22']}), ('regression: two route points disagree on a flank point', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('regression: flank signal not holdable', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': []}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('sampled regression 12', {'route_points': {'P1': 'R', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 15', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S24']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': []}), ('sampled regression 18', {'route_points': {'P3': 'R', 'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P9': 'N'}, 'holdable': ['S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N', 'P8': 'N'}, 'held_signals': []})], [('regression: two route points disagree on a flank point', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('sampled regression 9', {'route_points': {'P3': 'N', 'P1': 'R', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S21', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 3', {'route_points': {'P2': 'N', 'P1': 'R', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': ['S24']}), ('regression: no flank signal available', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('regression: reverse lie flank entry', {'route_points': {'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': ['S23']}), ('sampled regression 23', {'route_points': {'P1': 'R', 'P2': 'N', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': ['S24']}), ('sampled regression 26', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P8': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P9': 'R'}, 'held_signals': []}), ('sampled regression 29', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S23']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': ['S23']})], [('regression: flank signal not holdable', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': []}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('sampled regression 16', {'route_points': {'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P8': 'R'}, 'holdable': ['S20', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P8': 'R', 'P9': 'R'}, 'held_signals': []}), ('sampled regression 9', {'route_points': {'P3': 'N', 'P1': 'R', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S21', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('regression: same signal held twice', {'route_points': {'P1': 'N', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P8': 'N', 'P9': 'N'}, 'holdable': ['S20', 'S22']}, {'result': 'protected', 'set_points': {'P8': 'N'}, 'held_signals': ['S20', 'S22']}), ('regression: own conflicting demand with a holdable signal', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S21', 'S23']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('sampled regression 34', {'route_points': {'P3': 'R', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S20', 'S21', 'S24']}, {'result': 'protected', 'set_points': {'P8': 'R'}, 'held_signals': ['S20', 'S24']}), ('sampled regression 37', {'route_points': {'P2': 'N', 'P1': 'R', 'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P8': 'R'}, 'holdable': ['S21', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': []}), ('sampled regression 40', {'route_points': {'P3': 'R', 'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'N'}, 'held_signals': []})], [('regression: no flank signal available', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 23', {'route_points': {'P1': 'R', 'P2': 'N', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': ['S24']}), ('sampled regression 15', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S24']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': []}), ('regression: own conflicting demand without a signal', {'route_points': {'P1': 'N', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('regression: flank point locked in the protecting lie', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 45', {'route_points': {'P2': 'N', 'P1': 'N', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P8': 'R'}, 'holdable': ['S20', 'S21', 'S23', 'S24']}, {'result': 'refused:P8', 'set_points': {}, 'held_signals': []}), ('sampled regression 48', {'route_points': {'P2': 'R', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P8': 'N'}, 'holdable': ['S20', 'S21', 'S22']}, {'result': 'protected', 'set_points': {'P9': 'N', 'P7': 'N', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 51', {'route_points': {'P3': 'N', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'R'}, 'held_signals': ['S23']})]]
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: flank point locked in the protecting lie{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}}Failed
regression: flank signal not holdable{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'refused:P7', 'set_points': {}}Failed
regression: flank point free{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}}Failed
regression: two route points disagree on a flank point{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}}Failed
regression: no flank signal available{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'refused:P9', 'set_points': {}}Failed
sampled regression 1{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'refused:P9', 'set_points': {}}Failed
sampled regression 4{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}}Failed
sampled regression 7{'held_signals': [], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'refused:P7', 'set_points': {}}Failed

SHA-256 / 8b280ca508cda8125ec121ac24647229b9ec06b4c00012c76d3f0922ff4dd20f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    set_pts = {}
    held = []
    locks = x['point_locks']
    for p, pos in sorted(x['route_points'].items()):
        for fp, fpos, fsig in x['flank'].get(p + ('R' if pos == 'N' else 'N'), []):
            lk = locks.get(fp, set_pts.get(fp))
            if lk is None or lk == fpos:
                set_pts[fp] = fpos
            elif fsig is not None and fsig in x['holdable']:
                held.append(fsig)
            else:
                return {'result': 'refused:' + fp, 'set_points': {}, 'held_signals': []}
    return {'result': 'protected', 'set_points': set_pts, 'held_signals': sorted(set(held))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: flank point locked in the protecting lie', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('regression: flank signal not holdable', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': []}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('regression: flank point free', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('regression: two route points disagree on a flank point', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('regression: no flank signal available', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 1', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 4', {'route_points': {'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S21', 'S22']}, {'result': 'protected', 'set_points': {'P9': 'N', 'P7': 'N'}, 'held_signals': []}), ('sampled regression 7', {'route_points': {'P2': 'R', 'P1': 'R', 'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P8': 'R', 'P9': 'R'}, 'holdable': ['S22', 'S24']}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []})], [('regression: flank point free', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 2', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P9': 'R'}, 'held_signals': []}), ('regression: same signal held twice', {'route_points': {'P1': 'N', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P8': 'N', 'P9': 'N'}, 'holdable': ['S20', 'S22']}, {'result': 'protected', 'set_points': {'P8': 'N'}, 'held_signals': ['S20', 'S22']}), ('regression: two route points disagree on a flank point', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('regression: flank signal not holdable', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': []}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('sampled regression 12', {'route_points': {'P1': 'R', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 15', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S24']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': []}), ('sampled regression 18', {'route_points': {'P3': 'R', 'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P9': 'N'}, 'holdable': ['S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N', 'P8': 'N'}, 'held_signals': []})], [('regression: two route points disagree on a flank point', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('sampled regression 9', {'route_points': {'P3': 'N', 'P1': 'R', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S21', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 3', {'route_points': {'P2': 'N', 'P1': 'R', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': ['S24']}), ('regression: no flank signal available', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('regression: reverse lie flank entry', {'route_points': {'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': ['S23']}), ('sampled regression 23', {'route_points': {'P1': 'R', 'P2': 'N', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': ['S24']}), ('sampled regression 26', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P8': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P9': 'R'}, 'held_signals': []}), ('sampled regression 29', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S23']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': ['S23']})], [('regression: flank signal not holdable', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': []}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('sampled regression 16', {'route_points': {'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P8': 'R'}, 'holdable': ['S20', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P8': 'R', 'P9': 'R'}, 'held_signals': []}), ('sampled regression 9', {'route_points': {'P3': 'N', 'P1': 'R', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S21', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('regression: same signal held twice', {'route_points': {'P1': 'N', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P8': 'N', 'P9': 'N'}, 'holdable': ['S20', 'S22']}, {'result': 'protected', 'set_points': {'P8': 'N'}, 'held_signals': ['S20', 'S22']}), ('regression: own conflicting demand with a holdable signal', {'route_points': {'P1': 'R', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S21', 'S23']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}, 'held_signals': []}), ('sampled regression 34', {'route_points': {'P3': 'R', 'P2': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P9': 'N'}, 'holdable': ['S20', 'S21', 'S24']}, {'result': 'protected', 'set_points': {'P8': 'R'}, 'held_signals': ['S20', 'S24']}), ('sampled regression 37', {'route_points': {'P2': 'N', 'P1': 'R', 'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P8': 'R'}, 'holdable': ['S21', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': []}), ('sampled regression 40', {'route_points': {'P3': 'R', 'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'N'}, 'held_signals': []})], [('regression: no flank signal available', {'route_points': {'P3': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P9', 'set_points': {}, 'held_signals': []}), ('sampled regression 23', {'route_points': {'P1': 'R', 'P2': 'N', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P8': 'R', 'P9': 'R'}, 'held_signals': ['S24']}), ('sampled regression 15', {'route_points': {'P1': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'N'}, 'holdable': ['S24']}, {'result': 'protected', 'set_points': {'P7': 'N'}, 'held_signals': []}), ('regression: own conflicting demand without a signal', {'route_points': {'P1': 'N', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'refused:P7', 'set_points': {}, 'held_signals': []}), ('regression: flank point locked in the protecting lie', {'route_points': {'P1': 'N'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 45', {'route_points': {'P2': 'N', 'P1': 'N', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'R', 'P8': 'R'}, 'holdable': ['S20', 'S21', 'S23', 'S24']}, {'result': 'refused:P8', 'set_points': {}, 'held_signals': []}), ('sampled regression 48', {'route_points': {'P2': 'R', 'P3': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P7': 'N', 'P8': 'N'}, 'holdable': ['S20', 'S21', 'S22']}, {'result': 'protected', 'set_points': {'P9': 'N', 'P7': 'N', 'P8': 'N'}, 'held_signals': []}), ('sampled regression 51', {'route_points': {'P3': 'N', 'P2': 'R'}, 'flank': {'P1N': [['P7', 'R', 'S20'], ['P8', 'N', None]], 'P1R': [['P7', 'N', 'S21']], 'P2N': [['P8', 'R', 'S22'], ['P9', 'R', 'S20']], 'P2R': [['P9', 'N', 'S23'], ['P7', 'N', None]], 'P3N': [['P9', 'R', None]], 'P3R': [['P8', 'N', 'S24']]}, 'point_locks': {'P9': 'R'}, 'holdable': ['S20', 'S21', 'S22', 'S23', 'S24']}, {'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'R'}, 'held_signals': ['S23']})]]
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: flank point locked in the protecting lie{'held_signals': ['S21'], 'result': 'protected', 'set_points': {}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}}Failed
regression: flank signal not holdable{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}}{'held_signals': [], 'result': 'refused:P7', 'set_points': {}}Failed
regression: flank point free{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'N'}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N'}}Failed
regression: two route points disagree on a flank point{'held_signals': ['S22'], 'result': 'protected', 'set_points': {'P7': 'R', 'P8': 'N', 'P9': 'R'}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}}Failed
regression: no flank signal available{'held_signals': [], 'result': 'protected', 'set_points': {'P8': 'N'}}{'held_signals': [], 'result': 'refused:P9', 'set_points': {}}Failed
sampled regression 1{'held_signals': [], 'result': 'protected', 'set_points': {'P8': 'N'}}{'held_signals': [], 'result': 'refused:P9', 'set_points': {}}Failed
sampled regression 4{'held_signals': [], 'result': 'protected', 'set_points': {'P8': 'R', 'P9': 'R'}}{'held_signals': [], 'result': 'protected', 'set_points': {'P7': 'N', 'P9': 'N'}}Failed
sampled regression 7{'held_signals': [], 'result': 'refused:P8', 'set_points': {}}{'held_signals': [], 'result': 'refused:P7', 'set_points': {}}Failed

SHA-256 / a8d88d8e0f576adfdfcb571231d9aef82c1dc90a045660ec7a6582e36a930fa0

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 interlocking contract for a bounded teaching model; it makes no claim of conformance to any railway signalling standard and omits real safety cases. 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:51.351745+00:00.

Case digest / d8509fe0f2161ff4f95c0893beefb34b8bc15a76a019018cb82460e7443bd8c0