FA-34741 / Notification interfaces / Open access
Notification surface account switch: switch-to-b from account-a-visible · case 01
The switch-to-b event leaves a notification in account-b-loading instead of scrubbing-a.
ROOT CAUSE
A new account load begins before old notification content is scrubbed.
VERIFIED REPAIR
Commit the account-a-visible / switch-to-b transition to scrubbing-a; preserve the other explicitly stipulated transitions.
Unsuccessful approach: Keeping old notifications visible leaks the prior account's surface.
Case contract
Notification surface account switch is a bounded visual-notification workflow with mutable policy state {'owner': 'a', 'rows': ['a-notice'], 'target': 'b', 'scrubbed': False}. Its default transition relation is {('account-a-visible', 'switch-to-b'): 'scrubbing-a', ('scrubbing-a', 'scrub-complete'): 'account-b-loading', ('account-b-loading', 'b-inbox-loaded'): 'account-b-visible', ('account-b-loading', 'b-inbox-failed'): 'switch-error', ('account-b-loading', 'late-a-response'): 'account-b-loading', ('switch-error', 'retry-b-load'): 'account-b-loading', ('account-b-visible', 'sign-out'): 'scrubbing-b', ('scrubbing-b', 'scrub-complete'): 'signed-out', ('signed-out', 'late-b-response'): 'signed-out', ('scrubbing-a', 'switch-back-to-a'): 'scrubbing-for-a'}; 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.
Why this case matters
Visual notification lifecycle ordering can leave an inbox or toast showing the wrong actionable state even when transport succeeds.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
table = {('account-a-visible', 'switch-to-b'): 'account-b-loading', ('scrubbing-a', 'scrub-complete'): 'account-b-loading', ('account-b-loading', 'b-inbox-loaded'): 'account-b-visible', ('account-b-loading', 'b-inbox-failed'): 'switch-error', ('account-b-loading', 'late-a-response'): 'account-b-loading', ('switch-error', 'retry-b-load'): 'account-b-loading', ('account-b-visible', 'sign-out'): 'scrubbing-b', ('scrubbing-b', 'scrub-complete'): 'signed-out', ('signed-out', 'late-b-response'): 'signed-out', ('scrubbing-a', 'switch-back-to-a'): 'scrubbing-for-a'}
data = json.loads(json.dumps({'owner': 'a', 'rows': ['a-notice'], 'target': 'b', 'scrubbed': False})) if payload is None else {**json.loads(json.dumps({'owner': 'a', 'rows': ['a-notice'], 'target': 'b', 'scrubbed': 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 == 'b-inbox-loaded' and arg.get('owner',data['target']) != data['target']: event = 'unknown-event'
if event == 'b-inbox-loaded' and not data['scrubbed'] and arg.get('require_scrub',False): event = 'unknown-event'
if event == 'switch-back-to-a': data['target'] = 'a'
state = table.get((state, event), state)
if state.startswith('scrubbing'):
data['rows'] = []
data['scrubbed'] = False
if event == 'scrub-complete': data['scrubbed'] = True
if state == 'account-b-visible':
data['owner'] = 'b'
data['rows'] = arg.get('rows',['b-notice'])[:]
if state == 'signed-out':
data['owner'] = None
data['rows'] = []
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('account-a-visible / switch-to-b', solve('account-a-visible', [('switch-to-b', N)], N), 'scrubbing-a')
check('scrubbing-a / scrub-complete', solve('scrubbing-a', [('scrub-complete', N)], N), 'account-b-loading')
check('account-b-loading / b-inbox-loaded', solve('account-b-loading', [('b-inbox-loaded', N)], N), 'account-b-visible')
check('account-b-loading / b-inbox-failed', solve('account-b-loading', [('b-inbox-failed', N)], N), 'switch-error')
check('account-b-loading / late-a-response', solve('account-b-loading', [('late-a-response', N)], N), 'account-b-loading')
check('switch-error / retry-b-load', solve('switch-error', [('retry-b-load', N)], N), 'account-b-loading')
check('account-b-visible / sign-out', solve('account-b-visible', [('sign-out', N)], N), 'scrubbing-b')
check('scrubbing-b / scrub-complete', solve('scrubbing-b', [('scrub-complete', N)], N), 'signed-out')
check('signed-out / late-b-response', solve('signed-out', [('late-b-response', N)], N), 'signed-out')
check('scrubbing-a / switch-back-to-a', solve('scrubbing-a', [('switch-back-to-a', N)], N), 'scrubbing-for-a')
check('older notification incarnation', solve('account-a-visible', [('switch-to-b', N - 1)], N), 'account-a-visible')
check('future notification incarnation', solve('account-a-visible', [('switch-to-b', N + 1)], N), 'account-a-visible')
check('unknown event is inert', solve('account-a-visible', [('unknown-event', N)], N), 'account-a-visible')
check('empty delivery batch', solve('account-a-visible', [], N), 'account-a-visible')
check('N stale deliveries before current delivery', solve('account-a-visible', [('switch-to-b', N - 1)] * N + [('switch-to-b', N)], N), 'scrubbing-a')
check('trace switch-to-b then scrub-complete', solve('account-a-visible', [('switch-to-b', N), ('scrub-complete', N)], N), 'account-b-loading')
check('trace switch-to-b then switch-back-to-a', solve('account-a-visible', [('switch-to-b', N), ('switch-back-to-a', N)], N), 'scrubbing-for-a')
check('trace scrub-complete then b-inbox-loaded', solve('scrubbing-a', [('scrub-complete', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace scrub-complete then b-inbox-failed', solve('scrubbing-a', [('scrub-complete', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace scrub-complete then late-a-response', solve('scrubbing-a', [('scrub-complete', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace b-inbox-loaded then sign-out', solve('account-b-loading', [('b-inbox-loaded', N), ('sign-out', N)], N), 'scrubbing-b')
check('trace b-inbox-failed then retry-b-load', solve('account-b-loading', [('b-inbox-failed', N), ('retry-b-load', N)], N), 'account-b-loading')
check('trace late-a-response then b-inbox-loaded', solve('account-b-loading', [('late-a-response', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace late-a-response then b-inbox-failed', solve('account-b-loading', [('late-a-response', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace late-a-response then late-a-response', solve('account-b-loading', [('late-a-response', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace retry-b-load then b-inbox-loaded', solve('switch-error', [('retry-b-load', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace retry-b-load then b-inbox-failed', solve('switch-error', [('retry-b-load', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace retry-b-load then late-a-response', solve('switch-error', [('retry-b-load', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace sign-out then scrub-complete', solve('account-b-visible', [('sign-out', N), ('scrub-complete', N)], N), 'signed-out')
check('trace scrub-complete then late-b-response', solve('scrubbing-b', [('scrub-complete', N), ('late-b-response', N)], N), 'signed-out')
check('trace late-b-response then late-b-response', solve('signed-out', [('late-b-response', N), ('late-b-response', N)], N), 'signed-out')
check('domain state regression 1: rows', solve('account-a-visible', [('switch-to-b', N, {})], N, {}, 'rows'), {'phase': 'scrubbing-a', 'value': []})
check('domain state regression 2: rows', solve('account-b-loading', [('b-inbox-loaded', N, {'owner': 'a'})], N, {}, 'rows'), {'phase': 'account-b-loading', 'value': ['a-notice']})
check('domain state regression 3: owner', solve('account-b-loading', [('b-inbox-loaded', N, {'require_scrub': True})], N, {}, 'owner'), {'phase': 'account-b-loading', 'value': 'a'})
check('domain state regression 4: rows', solve('account-b-loading', [('b-inbox-loaded', N, {'require_scrub': True})], N, {'scrubbed': True, 'rows': []}, 'rows'), {'phase': 'account-b-visible', 'value': ['b-notice']})
check('domain state regression 5: owner', solve('scrubbing-b', [('scrub-complete', N, {})], N, {'owner': 'b'}, 'owner'), {'phase': 'signed-out', 'value': None})
check('domain state regression 6: target', solve('scrubbing-a', [('switch-back-to-a', N, {})], N, {}, 'target'), {'phase': 'scrubbing-for-a', 'value': 'a'})
check('domain state regression 7: rows', solve('account-a-visible', [('switch-to-b', N, {}), ('scrub-complete', N, {}), ('b-inbox-loaded', N, {'require_scrub': True, 'rows': ['b']}), ('sign-out', N, {}), ('scrub-complete', N, {}), ('late-b-response', N, {})], N, {}, 'rows'), {'phase': 'signed-out', 'value': []})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| account-a-visible / switch-to-b | account-b-loading | scrubbing-a | Failed |
| scrubbing-a / scrub-complete | account-b-loading | account-b-loading | Passed |
| account-b-loading / b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| account-b-loading / b-inbox-failed | switch-error | switch-error | Passed |
| account-b-loading / late-a-response | account-b-loading | account-b-loading | Passed |
| switch-error / retry-b-load | account-b-loading | account-b-loading | Passed |
| account-b-visible / sign-out | scrubbing-b | scrubbing-b | Passed |
| scrubbing-b / scrub-complete | signed-out | signed-out | Passed |
| signed-out / late-b-response | signed-out | signed-out | Passed |
| scrubbing-a / switch-back-to-a | scrubbing-for-a | scrubbing-for-a | Passed |
| older notification incarnation | account-a-visible | account-a-visible | Passed |
| future notification incarnation | account-a-visible | account-a-visible | Passed |
| unknown event is inert | account-a-visible | account-a-visible | Passed |
| empty delivery batch | account-a-visible | account-a-visible | Passed |
| N stale deliveries before current delivery | account-b-loading | scrubbing-a | Failed |
| trace switch-to-b then scrub-complete | account-b-loading | account-b-loading | Passed |
| trace switch-to-b then switch-back-to-a | account-b-loading | scrubbing-for-a | Failed |
| trace scrub-complete then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace scrub-complete then b-inbox-failed | switch-error | switch-error | Passed |
| trace scrub-complete then late-a-response | account-b-loading | account-b-loading | Passed |
| trace b-inbox-loaded then sign-out | scrubbing-b | scrubbing-b | Passed |
| trace b-inbox-failed then retry-b-load | account-b-loading | account-b-loading | Passed |
| trace late-a-response then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace late-a-response then b-inbox-failed | switch-error | switch-error | Passed |
| trace late-a-response then late-a-response | account-b-loading | account-b-loading | Passed |
| trace retry-b-load then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace retry-b-load then b-inbox-failed | switch-error | switch-error | Passed |
| trace retry-b-load then late-a-response | account-b-loading | account-b-loading | Passed |
| trace sign-out then scrub-complete | signed-out | signed-out | Passed |
| trace scrub-complete then late-b-response | signed-out | signed-out | Passed |
| trace late-b-response then late-b-response | signed-out | signed-out | Passed |
| domain state regression 1: rows | {'phase': 'account-b-loading', 'value': ['a-notice']} | {'phase': 'scrubbing-a', 'value': []} | Failed |
| domain state regression 2: rows | {'phase': 'account-b-loading', 'value': ['a-notice']} | {'phase': 'account-b-loading', 'value': ['a-notice']} | Passed |
| domain state regression 3: owner | {'phase': 'account-b-loading', 'value': 'a'} | {'phase': 'account-b-loading', 'value': 'a'} | Passed |
| domain state regression 4: rows | {'phase': 'account-b-visible', 'value': ['b-notice']} | {'phase': 'account-b-visible', 'value': ['b-notice']} | Passed |
| domain state regression 5: owner | {'phase': 'signed-out', 'value': None} | {'phase': 'signed-out', 'value': None} | Passed |
| domain state regression 6: target | {'phase': 'scrubbing-for-a', 'value': 'a'} | {'phase': 'scrubbing-for-a', 'value': 'a'} | Passed |
| domain state regression 7: rows | {'phase': 'signed-out', 'value': []} | {'phase': 'signed-out', 'value': []} | Passed |
SHA-256 / a927179ac9b9db03db41eab4068dd588d5a704fbcd7e8510ee42c7938820ba25
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
table = {('account-a-visible', 'switch-to-b'): 'account-a-visible', ('scrubbing-a', 'scrub-complete'): 'account-b-loading', ('account-b-loading', 'b-inbox-loaded'): 'account-b-visible', ('account-b-loading', 'b-inbox-failed'): 'switch-error', ('account-b-loading', 'late-a-response'): 'account-b-loading', ('switch-error', 'retry-b-load'): 'account-b-loading', ('account-b-visible', 'sign-out'): 'scrubbing-b', ('scrubbing-b', 'scrub-complete'): 'signed-out', ('signed-out', 'late-b-response'): 'signed-out', ('scrubbing-a', 'switch-back-to-a'): 'scrubbing-for-a'}
data = json.loads(json.dumps({'owner': 'a', 'rows': ['a-notice'], 'target': 'b', 'scrubbed': False})) if payload is None else {**json.loads(json.dumps({'owner': 'a', 'rows': ['a-notice'], 'target': 'b', 'scrubbed': 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 == 'b-inbox-loaded' and arg.get('owner',data['target']) != data['target']: event = 'unknown-event'
if event == 'b-inbox-loaded' and not data['scrubbed'] and arg.get('require_scrub',False): event = 'unknown-event'
if event == 'switch-back-to-a': data['target'] = 'a'
state = table.get((state, event), state)
if state.startswith('scrubbing'):
data['rows'] = []
data['scrubbed'] = False
if event == 'scrub-complete': data['scrubbed'] = True
if state == 'account-b-visible':
data['owner'] = 'b'
data['rows'] = arg.get('rows',['b-notice'])[:]
if state == 'signed-out':
data['owner'] = None
data['rows'] = []
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('account-a-visible / switch-to-b', solve('account-a-visible', [('switch-to-b', N)], N), 'scrubbing-a')
check('scrubbing-a / scrub-complete', solve('scrubbing-a', [('scrub-complete', N)], N), 'account-b-loading')
check('account-b-loading / b-inbox-loaded', solve('account-b-loading', [('b-inbox-loaded', N)], N), 'account-b-visible')
check('account-b-loading / b-inbox-failed', solve('account-b-loading', [('b-inbox-failed', N)], N), 'switch-error')
check('account-b-loading / late-a-response', solve('account-b-loading', [('late-a-response', N)], N), 'account-b-loading')
check('switch-error / retry-b-load', solve('switch-error', [('retry-b-load', N)], N), 'account-b-loading')
check('account-b-visible / sign-out', solve('account-b-visible', [('sign-out', N)], N), 'scrubbing-b')
check('scrubbing-b / scrub-complete', solve('scrubbing-b', [('scrub-complete', N)], N), 'signed-out')
check('signed-out / late-b-response', solve('signed-out', [('late-b-response', N)], N), 'signed-out')
check('scrubbing-a / switch-back-to-a', solve('scrubbing-a', [('switch-back-to-a', N)], N), 'scrubbing-for-a')
check('older notification incarnation', solve('account-a-visible', [('switch-to-b', N - 1)], N), 'account-a-visible')
check('future notification incarnation', solve('account-a-visible', [('switch-to-b', N + 1)], N), 'account-a-visible')
check('unknown event is inert', solve('account-a-visible', [('unknown-event', N)], N), 'account-a-visible')
check('empty delivery batch', solve('account-a-visible', [], N), 'account-a-visible')
check('N stale deliveries before current delivery', solve('account-a-visible', [('switch-to-b', N - 1)] * N + [('switch-to-b', N)], N), 'scrubbing-a')
check('trace switch-to-b then scrub-complete', solve('account-a-visible', [('switch-to-b', N), ('scrub-complete', N)], N), 'account-b-loading')
check('trace switch-to-b then switch-back-to-a', solve('account-a-visible', [('switch-to-b', N), ('switch-back-to-a', N)], N), 'scrubbing-for-a')
check('trace scrub-complete then b-inbox-loaded', solve('scrubbing-a', [('scrub-complete', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace scrub-complete then b-inbox-failed', solve('scrubbing-a', [('scrub-complete', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace scrub-complete then late-a-response', solve('scrubbing-a', [('scrub-complete', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace b-inbox-loaded then sign-out', solve('account-b-loading', [('b-inbox-loaded', N), ('sign-out', N)], N), 'scrubbing-b')
check('trace b-inbox-failed then retry-b-load', solve('account-b-loading', [('b-inbox-failed', N), ('retry-b-load', N)], N), 'account-b-loading')
check('trace late-a-response then b-inbox-loaded', solve('account-b-loading', [('late-a-response', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace late-a-response then b-inbox-failed', solve('account-b-loading', [('late-a-response', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace late-a-response then late-a-response', solve('account-b-loading', [('late-a-response', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace retry-b-load then b-inbox-loaded', solve('switch-error', [('retry-b-load', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace retry-b-load then b-inbox-failed', solve('switch-error', [('retry-b-load', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace retry-b-load then late-a-response', solve('switch-error', [('retry-b-load', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace sign-out then scrub-complete', solve('account-b-visible', [('sign-out', N), ('scrub-complete', N)], N), 'signed-out')
check('trace scrub-complete then late-b-response', solve('scrubbing-b', [('scrub-complete', N), ('late-b-response', N)], N), 'signed-out')
check('trace late-b-response then late-b-response', solve('signed-out', [('late-b-response', N), ('late-b-response', N)], N), 'signed-out')
check('domain state regression 1: rows', solve('account-a-visible', [('switch-to-b', N, {})], N, {}, 'rows'), {'phase': 'scrubbing-a', 'value': []})
check('domain state regression 2: rows', solve('account-b-loading', [('b-inbox-loaded', N, {'owner': 'a'})], N, {}, 'rows'), {'phase': 'account-b-loading', 'value': ['a-notice']})
check('domain state regression 3: owner', solve('account-b-loading', [('b-inbox-loaded', N, {'require_scrub': True})], N, {}, 'owner'), {'phase': 'account-b-loading', 'value': 'a'})
check('domain state regression 4: rows', solve('account-b-loading', [('b-inbox-loaded', N, {'require_scrub': True})], N, {'scrubbed': True, 'rows': []}, 'rows'), {'phase': 'account-b-visible', 'value': ['b-notice']})
check('domain state regression 5: owner', solve('scrubbing-b', [('scrub-complete', N, {})], N, {'owner': 'b'}, 'owner'), {'phase': 'signed-out', 'value': None})
check('domain state regression 6: target', solve('scrubbing-a', [('switch-back-to-a', N, {})], N, {}, 'target'), {'phase': 'scrubbing-for-a', 'value': 'a'})
check('domain state regression 7: rows', solve('account-a-visible', [('switch-to-b', N, {}), ('scrub-complete', N, {}), ('b-inbox-loaded', N, {'require_scrub': True, 'rows': ['b']}), ('sign-out', N, {}), ('scrub-complete', N, {}), ('late-b-response', N, {})], N, {}, 'rows'), {'phase': 'signed-out', 'value': []})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| account-a-visible / switch-to-b | account-a-visible | scrubbing-a | Failed |
| scrubbing-a / scrub-complete | account-b-loading | account-b-loading | Passed |
| account-b-loading / b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| account-b-loading / b-inbox-failed | switch-error | switch-error | Passed |
| account-b-loading / late-a-response | account-b-loading | account-b-loading | Passed |
| switch-error / retry-b-load | account-b-loading | account-b-loading | Passed |
| account-b-visible / sign-out | scrubbing-b | scrubbing-b | Passed |
| scrubbing-b / scrub-complete | signed-out | signed-out | Passed |
| signed-out / late-b-response | signed-out | signed-out | Passed |
| scrubbing-a / switch-back-to-a | scrubbing-for-a | scrubbing-for-a | Passed |
| older notification incarnation | account-a-visible | account-a-visible | Passed |
| future notification incarnation | account-a-visible | account-a-visible | Passed |
| unknown event is inert | account-a-visible | account-a-visible | Passed |
| empty delivery batch | account-a-visible | account-a-visible | Passed |
| N stale deliveries before current delivery | account-a-visible | scrubbing-a | Failed |
| trace switch-to-b then scrub-complete | account-a-visible | account-b-loading | Failed |
| trace switch-to-b then switch-back-to-a | account-a-visible | scrubbing-for-a | Failed |
| trace scrub-complete then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace scrub-complete then b-inbox-failed | switch-error | switch-error | Passed |
| trace scrub-complete then late-a-response | account-b-loading | account-b-loading | Passed |
| trace b-inbox-loaded then sign-out | scrubbing-b | scrubbing-b | Passed |
| trace b-inbox-failed then retry-b-load | account-b-loading | account-b-loading | Passed |
| trace late-a-response then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace late-a-response then b-inbox-failed | switch-error | switch-error | Passed |
| trace late-a-response then late-a-response | account-b-loading | account-b-loading | Passed |
| trace retry-b-load then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace retry-b-load then b-inbox-failed | switch-error | switch-error | Passed |
| trace retry-b-load then late-a-response | account-b-loading | account-b-loading | Passed |
| trace sign-out then scrub-complete | signed-out | signed-out | Passed |
| trace scrub-complete then late-b-response | signed-out | signed-out | Passed |
| trace late-b-response then late-b-response | signed-out | signed-out | Passed |
| domain state regression 1: rows | {'phase': 'account-a-visible', 'value': ['a-notice']} | {'phase': 'scrubbing-a', 'value': []} | Failed |
| domain state regression 2: rows | {'phase': 'account-b-loading', 'value': ['a-notice']} | {'phase': 'account-b-loading', 'value': ['a-notice']} | Passed |
| domain state regression 3: owner | {'phase': 'account-b-loading', 'value': 'a'} | {'phase': 'account-b-loading', 'value': 'a'} | Passed |
| domain state regression 4: rows | {'phase': 'account-b-visible', 'value': ['b-notice']} | {'phase': 'account-b-visible', 'value': ['b-notice']} | Passed |
| domain state regression 5: owner | {'phase': 'signed-out', 'value': None} | {'phase': 'signed-out', 'value': None} | Passed |
| domain state regression 6: target | {'phase': 'scrubbing-for-a', 'value': 'a'} | {'phase': 'scrubbing-for-a', 'value': 'a'} | Passed |
| domain state regression 7: rows | {'phase': 'account-a-visible', 'value': ['a-notice']} | {'phase': 'signed-out', 'value': []} | Failed |
SHA-256 / 12db285a84d1dad0c51c5cd2735076c5d4a73dcb4329dd3356c253669de1b671
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(initial, events, generation, payload=None, observe=None):
table = {('account-a-visible', 'switch-to-b'): 'scrubbing-a', ('scrubbing-a', 'scrub-complete'): 'account-b-loading', ('account-b-loading', 'b-inbox-loaded'): 'account-b-visible', ('account-b-loading', 'b-inbox-failed'): 'switch-error', ('account-b-loading', 'late-a-response'): 'account-b-loading', ('switch-error', 'retry-b-load'): 'account-b-loading', ('account-b-visible', 'sign-out'): 'scrubbing-b', ('scrubbing-b', 'scrub-complete'): 'signed-out', ('signed-out', 'late-b-response'): 'signed-out', ('scrubbing-a', 'switch-back-to-a'): 'scrubbing-for-a'}
data = json.loads(json.dumps({'owner': 'a', 'rows': ['a-notice'], 'target': 'b', 'scrubbed': False})) if payload is None else {**json.loads(json.dumps({'owner': 'a', 'rows': ['a-notice'], 'target': 'b', 'scrubbed': 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 == 'b-inbox-loaded' and arg.get('owner',data['target']) != data['target']: event = 'unknown-event'
if event == 'b-inbox-loaded' and not data['scrubbed'] and arg.get('require_scrub',False): event = 'unknown-event'
if event == 'switch-back-to-a': data['target'] = 'a'
state = table.get((state, event), state)
if state.startswith('scrubbing'):
data['rows'] = []
data['scrubbed'] = False
if event == 'scrub-complete': data['scrubbed'] = True
if state == 'account-b-visible':
data['owner'] = 'b'
data['rows'] = arg.get('rows',['b-notice'])[:]
if state == 'signed-out':
data['owner'] = None
data['rows'] = []
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('account-a-visible / switch-to-b', solve('account-a-visible', [('switch-to-b', N)], N), 'scrubbing-a')
check('scrubbing-a / scrub-complete', solve('scrubbing-a', [('scrub-complete', N)], N), 'account-b-loading')
check('account-b-loading / b-inbox-loaded', solve('account-b-loading', [('b-inbox-loaded', N)], N), 'account-b-visible')
check('account-b-loading / b-inbox-failed', solve('account-b-loading', [('b-inbox-failed', N)], N), 'switch-error')
check('account-b-loading / late-a-response', solve('account-b-loading', [('late-a-response', N)], N), 'account-b-loading')
check('switch-error / retry-b-load', solve('switch-error', [('retry-b-load', N)], N), 'account-b-loading')
check('account-b-visible / sign-out', solve('account-b-visible', [('sign-out', N)], N), 'scrubbing-b')
check('scrubbing-b / scrub-complete', solve('scrubbing-b', [('scrub-complete', N)], N), 'signed-out')
check('signed-out / late-b-response', solve('signed-out', [('late-b-response', N)], N), 'signed-out')
check('scrubbing-a / switch-back-to-a', solve('scrubbing-a', [('switch-back-to-a', N)], N), 'scrubbing-for-a')
check('older notification incarnation', solve('account-a-visible', [('switch-to-b', N - 1)], N), 'account-a-visible')
check('future notification incarnation', solve('account-a-visible', [('switch-to-b', N + 1)], N), 'account-a-visible')
check('unknown event is inert', solve('account-a-visible', [('unknown-event', N)], N), 'account-a-visible')
check('empty delivery batch', solve('account-a-visible', [], N), 'account-a-visible')
check('N stale deliveries before current delivery', solve('account-a-visible', [('switch-to-b', N - 1)] * N + [('switch-to-b', N)], N), 'scrubbing-a')
check('trace switch-to-b then scrub-complete', solve('account-a-visible', [('switch-to-b', N), ('scrub-complete', N)], N), 'account-b-loading')
check('trace switch-to-b then switch-back-to-a', solve('account-a-visible', [('switch-to-b', N), ('switch-back-to-a', N)], N), 'scrubbing-for-a')
check('trace scrub-complete then b-inbox-loaded', solve('scrubbing-a', [('scrub-complete', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace scrub-complete then b-inbox-failed', solve('scrubbing-a', [('scrub-complete', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace scrub-complete then late-a-response', solve('scrubbing-a', [('scrub-complete', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace b-inbox-loaded then sign-out', solve('account-b-loading', [('b-inbox-loaded', N), ('sign-out', N)], N), 'scrubbing-b')
check('trace b-inbox-failed then retry-b-load', solve('account-b-loading', [('b-inbox-failed', N), ('retry-b-load', N)], N), 'account-b-loading')
check('trace late-a-response then b-inbox-loaded', solve('account-b-loading', [('late-a-response', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace late-a-response then b-inbox-failed', solve('account-b-loading', [('late-a-response', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace late-a-response then late-a-response', solve('account-b-loading', [('late-a-response', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace retry-b-load then b-inbox-loaded', solve('switch-error', [('retry-b-load', N), ('b-inbox-loaded', N)], N), 'account-b-visible')
check('trace retry-b-load then b-inbox-failed', solve('switch-error', [('retry-b-load', N), ('b-inbox-failed', N)], N), 'switch-error')
check('trace retry-b-load then late-a-response', solve('switch-error', [('retry-b-load', N), ('late-a-response', N)], N), 'account-b-loading')
check('trace sign-out then scrub-complete', solve('account-b-visible', [('sign-out', N), ('scrub-complete', N)], N), 'signed-out')
check('trace scrub-complete then late-b-response', solve('scrubbing-b', [('scrub-complete', N), ('late-b-response', N)], N), 'signed-out')
check('trace late-b-response then late-b-response', solve('signed-out', [('late-b-response', N), ('late-b-response', N)], N), 'signed-out')
check('domain state regression 1: rows', solve('account-a-visible', [('switch-to-b', N, {})], N, {}, 'rows'), {'phase': 'scrubbing-a', 'value': []})
check('domain state regression 2: rows', solve('account-b-loading', [('b-inbox-loaded', N, {'owner': 'a'})], N, {}, 'rows'), {'phase': 'account-b-loading', 'value': ['a-notice']})
check('domain state regression 3: owner', solve('account-b-loading', [('b-inbox-loaded', N, {'require_scrub': True})], N, {}, 'owner'), {'phase': 'account-b-loading', 'value': 'a'})
check('domain state regression 4: rows', solve('account-b-loading', [('b-inbox-loaded', N, {'require_scrub': True})], N, {'scrubbed': True, 'rows': []}, 'rows'), {'phase': 'account-b-visible', 'value': ['b-notice']})
check('domain state regression 5: owner', solve('scrubbing-b', [('scrub-complete', N, {})], N, {'owner': 'b'}, 'owner'), {'phase': 'signed-out', 'value': None})
check('domain state regression 6: target', solve('scrubbing-a', [('switch-back-to-a', N, {})], N, {}, 'target'), {'phase': 'scrubbing-for-a', 'value': 'a'})
check('domain state regression 7: rows', solve('account-a-visible', [('switch-to-b', N, {}), ('scrub-complete', N, {}), ('b-inbox-loaded', N, {'require_scrub': True, 'rows': ['b']}), ('sign-out', N, {}), ('scrub-complete', N, {}), ('late-b-response', N, {})], N, {}, 'rows'), {'phase': 'signed-out', 'value': []})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| account-a-visible / switch-to-b | scrubbing-a | scrubbing-a | Passed |
| scrubbing-a / scrub-complete | account-b-loading | account-b-loading | Passed |
| account-b-loading / b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| account-b-loading / b-inbox-failed | switch-error | switch-error | Passed |
| account-b-loading / late-a-response | account-b-loading | account-b-loading | Passed |
| switch-error / retry-b-load | account-b-loading | account-b-loading | Passed |
| account-b-visible / sign-out | scrubbing-b | scrubbing-b | Passed |
| scrubbing-b / scrub-complete | signed-out | signed-out | Passed |
| signed-out / late-b-response | signed-out | signed-out | Passed |
| scrubbing-a / switch-back-to-a | scrubbing-for-a | scrubbing-for-a | Passed |
| older notification incarnation | account-a-visible | account-a-visible | Passed |
| future notification incarnation | account-a-visible | account-a-visible | Passed |
| unknown event is inert | account-a-visible | account-a-visible | Passed |
| empty delivery batch | account-a-visible | account-a-visible | Passed |
| N stale deliveries before current delivery | scrubbing-a | scrubbing-a | Passed |
| trace switch-to-b then scrub-complete | account-b-loading | account-b-loading | Passed |
| trace switch-to-b then switch-back-to-a | scrubbing-for-a | scrubbing-for-a | Passed |
| trace scrub-complete then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace scrub-complete then b-inbox-failed | switch-error | switch-error | Passed |
| trace scrub-complete then late-a-response | account-b-loading | account-b-loading | Passed |
| trace b-inbox-loaded then sign-out | scrubbing-b | scrubbing-b | Passed |
| trace b-inbox-failed then retry-b-load | account-b-loading | account-b-loading | Passed |
| trace late-a-response then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace late-a-response then b-inbox-failed | switch-error | switch-error | Passed |
| trace late-a-response then late-a-response | account-b-loading | account-b-loading | Passed |
| trace retry-b-load then b-inbox-loaded | account-b-visible | account-b-visible | Passed |
| trace retry-b-load then b-inbox-failed | switch-error | switch-error | Passed |
| trace retry-b-load then late-a-response | account-b-loading | account-b-loading | Passed |
| trace sign-out then scrub-complete | signed-out | signed-out | Passed |
| trace scrub-complete then late-b-response | signed-out | signed-out | Passed |
| trace late-b-response then late-b-response | signed-out | signed-out | Passed |
| domain state regression 1: rows | {'phase': 'scrubbing-a', 'value': []} | {'phase': 'scrubbing-a', 'value': []} | Passed |
| domain state regression 2: rows | {'phase': 'account-b-loading', 'value': ['a-notice']} | {'phase': 'account-b-loading', 'value': ['a-notice']} | Passed |
| domain state regression 3: owner | {'phase': 'account-b-loading', 'value': 'a'} | {'phase': 'account-b-loading', 'value': 'a'} | Passed |
| domain state regression 4: rows | {'phase': 'account-b-visible', 'value': ['b-notice']} | {'phase': 'account-b-visible', 'value': ['b-notice']} | Passed |
| domain state regression 5: owner | {'phase': 'signed-out', 'value': None} | {'phase': 'signed-out', 'value': None} | Passed |
| domain state regression 6: target | {'phase': 'scrubbing-for-a', 'value': 'a'} | {'phase': 'scrubbing-for-a', 'value': 'a'} | Passed |
| domain state regression 7: rows | {'phase': 'signed-out', 'value': []} | {'phase': 'signed-out', 'value': []} | Passed |
SHA-256 / 2e205b9b96477c5261258640f8547121fbd0a0d65de12d28dd69bd8c6b7d281c
Verification & scope
Stipulated single-notification state and policy model only. Event delivery and acknowledgements are explicit test inputs. No DOM, accessibility announcements, live timers, networking, actual rendering, or production-platform conformance is simulated. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:42:34.853333+00:00.
Case digest / 34ca55ece760915dbd6ce38cbff452ba8e40e57865db2666108e2f36dee9c0fc