broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'opened', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'unavailable', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

prompt:
The open-target event leaves a notification in opened instead of resolving.

Notification target opening feedback is a bounded visual-notification workflow with mutable policy state {'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False}. Its default transition relation is {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}; domain inputs can suppress or redirect transitions and update policy fields, as specified in solve. Different-generation events are inert. Batches apply in order. Optional observe returns the selected policy field alongside the phase.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'opened', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'actionable', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

prompt:
The target-found event leaves a notification in opened instead of navigating.

Notification target opening feedback is a bounded visual-notification workflow with mutable policy state {'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False}. Its default transition relation is {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}; domain inputs can suppress or redirect transitions and update policy fields, as specified in solve. Different-generation events are inert. Batches apply in order. Optional observe returns the selected policy field alongside the phase.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'actionable', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'unavailable', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

prompt:
The navigation-complete event leaves a notification in actionable instead of opened.

Notification target opening feedback is a bounded visual-notification workflow with mutable policy state {'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False}. Its default transition relation is {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}; domain inputs can suppress or redirect transitions and update policy fields, as specified in solve. Different-generation events are inert. Batches apply in order. Optional observe returns the selected policy field alongside the phase.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'navigating', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'opened', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

prompt:
The target-deleted event leaves a notification in navigating instead of unavailable.

Notification target opening feedback is a bounded visual-notification workflow with mutable policy state {'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False}. Its default transition relation is {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}; domain inputs can suppress or redirect transitions and update policy fields, as specified in solve. Different-generation events are inert. Batches apply in order. Optional observe returns the selected policy field alongside the phase.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'unavailable', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'opened', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

prompt:
The access-required event leaves a notification in unavailable instead of permission-needed.

Notification target opening feedback is a bounded visual-notification workflow with mutable policy state {'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False}. Its default transition relation is {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}; domain inputs can suppress or redirect transitions and update policy fields, as specified in solve. Different-generation events are inert. Batches apply in order. Optional observe returns the selected policy field alongside the phase.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'opened', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
    table = {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'resolving', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}
    data = json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})) if payload is None else {**json.loads(json.dumps({'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False})), **json.loads(json.dumps(payload))}
    state = initial
    for delivery in events:
        event, event_generation = delivery[:2]
        arg = delivery[2] if len(delivery) > 2 else {}
        if event_generation == generation:
            previous = state
            if event in ('target-found','target-deleted','access-granted') and arg.get('target',data['target']) != data['target']: event = 'unknown-event'
            if event == 'target-found': data['resolved'] = arg.get('route','/documents/7')
            if event == 'access-granted': data['permission'] = True
            state = table.get((state, event), state)
            if state == 'opened' and data['resolved'] is not None: data['visited'].append(data['resolved'])
            if state == 'unavailable': data['resolved'] = None
    return {'phase': state, 'value': data[observe]} if observe else state
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('actionable / open-target', solve('actionable', [('open-target', N)], N), 'resolving')
check('resolving / target-found', solve('resolving', [('target-found', N)], N), 'navigating')
check('navigating / navigation-complete', solve('navigating', [('navigation-complete', N)], N), 'opened')
check('resolving / target-deleted', solve('resolving', [('target-deleted', N)], N), 'unavailable')
check('resolving / access-required', solve('resolving', [('access-required', N)], N), 'permission-needed')
check('permission-needed / request-access', solve('permission-needed', [('request-access', N)], N), 'access-pending')
check('access-pending / access-granted', solve('access-pending', [('access-granted', N)], N), 'resolving')
check('navigating / navigation-failed', solve('navigating', [('navigation-failed', N)], N), 'navigation-error')
check('navigation-error / retry-navigation', solve('navigation-error', [('retry-navigation', N)], N), 'navigating')
check('resolving / cancel-open', solve('resolving', [('cancel-open', N)], N), 'actionable')
check('older notification incarnation', solve('actionable', [('open-target', N - 1)], N), 'actionable')
check('future notification incarnation', solve('actionable', [('open-target', N + 1)], N), 'actionable')
check('unknown event is inert', solve('actionable', [('unknown-event', N)], N), 'actionable')
check('empty delivery batch', solve('actionable', [], N), 'actionable')
check('N stale deliveries before current delivery', solve('actionable', [('open-target', N - 1)] * N + [('open-target', N)], N), 'resolving')
check('trace open-target then target-found', solve('actionable', [('open-target', N), ('target-found', N)], N), 'navigating')
check('trace open-target then target-deleted', solve('actionable', [('open-target', N), ('target-deleted', N)], N), 'unavailable')
check('trace open-target then access-required', solve('actionable', [('open-target', N), ('access-required', N)], N), 'permission-needed')
check('trace open-target then cancel-open', solve('actionable', [('open-target', N), ('cancel-open', N)], N), 'actionable')
check('trace target-found then navigation-complete', solve('resolving', [('target-found', N), ('navigation-complete', N)], N), 'opened')
check('trace target-found then navigation-failed', solve('resolving', [('target-found', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace access-required then request-access', solve('resolving', [('access-required', N), ('request-access', N)], N), 'access-pending')
check('trace request-access then access-granted', solve('permission-needed', [('request-access', N), ('access-granted', N)], N), 'resolving')
check('trace access-granted then target-found', solve('access-pending', [('access-granted', N), ('target-found', N)], N), 'navigating')
check('trace access-granted then target-deleted', solve('access-pending', [('access-granted', N), ('target-deleted', N)], N), 'unavailable')
check('trace access-granted then access-required', solve('access-pending', [('access-granted', N), ('access-required', N)], N), 'permission-needed')
check('trace access-granted then cancel-open', solve('access-pending', [('access-granted', N), ('cancel-open', N)], N), 'actionable')
check('trace navigation-failed then retry-navigation', solve('navigating', [('navigation-failed', N), ('retry-navigation', N)], N), 'navigating')
check('trace retry-navigation then navigation-complete', solve('navigation-error', [('retry-navigation', N), ('navigation-complete', N)], N), 'opened')
check('trace retry-navigation then navigation-failed', solve('navigation-error', [('retry-navigation', N), ('navigation-failed', N)], N), 'navigation-error')
check('trace cancel-open then open-target', solve('resolving', [('cancel-open', N), ('open-target', N)], N), 'resolving')
check('domain state regression 1: resolved', solve('resolving', [('target-found', N, {'target': 'document-6'})], N, {}, 'resolved'), {'phase': 'resolving', 'value': None})
check('domain state regression 2: resolved', solve('resolving', [('target-found', N, {'route': '/documents/renamed'})], N, {}, 'resolved'), {'phase': 'navigating', 'value': '/documents/renamed'})
check('domain state regression 3: visited', solve('navigating', [('navigation-complete', N, {})], N, {'resolved': '/documents/7'}, 'visited'), {'phase': 'opened', 'value': ['/documents/7']})
check('domain state regression 4: permission', solve('access-pending', [('access-granted', N, {})], N, {}, 'permission'), {'phase': 'resolving', 'value': True})
check('domain state regression 5: resolved', solve('resolving', [('target-deleted', N, {})], N, {'resolved': '/old'}, 'resolved'), {'phase': 'unavailable', 'value': None})
check('domain state regression 6: resolved', solve('navigation-error', [('retry-navigation', N, {})], N, {'resolved': '/documents/7'}, 'resolved'), {'phase': 'navigating', 'value': '/documents/7'})
check('domain state regression 7: visited', solve('actionable', [('open-target', N, {}), ('target-found', N, {'route': '/documents/new'}), ('navigation-failed', N, {}), ('retry-navigation', N, {}), ('navigation-complete', N, {})], N, {}, 'visited'), {'phase': 'opened', 'value': ['/documents/new']})
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)

prompt:
The request-access event leaves a notification in opened instead of access-pending.

Notification target opening feedback is a bounded visual-notification workflow with mutable policy state {'target': 'document-7', 'resolved': None, 'visited': [], 'permission': False}. Its default transition relation is {('actionable', 'open-target'): 'resolving', ('resolving', 'target-found'): 'navigating', ('navigating', 'navigation-complete'): 'opened', ('resolving', 'target-deleted'): 'unavailable', ('resolving', 'access-required'): 'permission-needed', ('permission-needed', 'request-access'): 'access-pending', ('access-pending', 'access-granted'): 'resolving', ('navigating', 'navigation-failed'): 'navigation-error', ('navigation-error', 'retry-navigation'): 'navigating', ('resolving', 'cancel-open'): 'actionable'}; domain inputs can suppress or redirect transitions and update policy fields, as specified in solve. Different-generation events are inert. Batches apply in order. Optional observe returns the selected policy field alongside the phase.

split: open-access