FAILURE MAP
← Case archive

FA-8726 / Notification interfaces / Open access

Toast queue lifecycle: Clear-all removes only the newest toast · case 01

Clear-all removes only the newest toast.

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

ROOT CAUSE

The clear operation uses `if event == 'clear': items = items[:-1]` where the contract requires `if event == 'clear': items = []`.

THE FAILURE

The clear operation uses `if event == 'clear': items = items[:-1]` where the contract requires `if event == 'clear': items = []`.

Unsuccessful approach: Removing only the oldest also leaves queued toasts.

Case contract

Toast IDs deduplicate additions; equal content may belong to distinct IDs; keep newest within capacity; update/dismiss target one ID; clear removes all.

Why this case matters

A deterministic model of toast queue lifecycle; this isolates one interface invariant without requiring a browser.

1 / The failure

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

N = 1
observations = []
def solve(items, event, ident, message, limit):
    items = [dict(x) for x in items]
    if event == 'add':
        if any(x['id'] == ident for x in items): return items
        items.append({'id': ident, 'message': message})
        return items[-limit:] if limit else []
    if event == 'update':
        for x in items:
            if x['id'] == ident: x['message'] = message
    if event == 'dismiss': items = [x for x in items if x['id'] != ident]
    if event == 'clear': items = items[:-1]
    return items
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('distinct messages equal', solve([dict(id='a',message='same')], 'add', 'b', 'same', 3), [{'id': 'a', 'message': 'same'}, {'id': 'b', 'message': 'same'}])
check('retry identity', solve([dict(id='a',message='first')], 'add', 'a', 'new', 3), [{'id': 'a', 'message': 'first'}])
check('capacity', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'add', 'c', 'c', 2), [{'id': 'b', 'message': 'b'}, {'id': 'c', 'message': 'c'}])
check('zero', solve([], 'add', 'a', 'a', 0), [])
check('update', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'update', 'a', 'new', 3), [{'id': 'a', 'message': 'new'}, {'id': 'b', 'message': 'b'}])
check('dismiss', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'dismiss', 'a', None, 3), [{'id': 'b', 'message': 'b'}])
check('clear', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'clear', None, None, 3), [])
check('parameterized toast identity', solve([], 'add', str(N), 'message'+str(N), 2), [dict(id=str(N),message='message'+str(N))])
for repetition in range(N):
    check('repeat clear', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'clear', None, None, 3), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
distinct messages equal[{'id': 'a', 'message': 'same'}, {'id': 'b', 'message': 'same'}][{'id': 'a', 'message': 'same'}, {'id': 'b', 'message': 'same'}]Passed
retry identity[{'id': 'a', 'message': 'first'}][{'id': 'a', 'message': 'first'}]Passed
capacity[{'id': 'b', 'message': 'b'}, {'id': 'c', 'message': 'c'}][{'id': 'b', 'message': 'b'}, {'id': 'c', 'message': 'c'}]Passed
zero[][]Passed
update[{'id': 'a', 'message': 'new'}, {'id': 'b', 'message': 'b'}][{'id': 'a', 'message': 'new'}, {'id': 'b', 'message': 'b'}]Passed
dismiss[{'id': 'b', 'message': 'b'}][{'id': 'b', 'message': 'b'}]Passed
clear[{'id': 'a', 'message': 'a'}][]Failed
parameterized toast identity[{'id': '1', 'message': 'message1'}][{'id': '1', 'message': 'message1'}]Passed
repeat clear[{'id': 'a', 'message': 'a'}][]Failed

SHA-256 / 11f355d229410a3f9b99cd71ecfb98c861870afecd46c4a5ab5ecc8e6d7bae67

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(items, event, ident, message, limit):
    items = [dict(x) for x in items]
    if event == 'add':
        if any(x['id'] == ident for x in items): return items
        items.append({'id': ident, 'message': message})
        return items[-limit:] if limit else []
    if event == 'update':
        for x in items:
            if x['id'] == ident: x['message'] = message
    if event == 'dismiss': items = [x for x in items if x['id'] != ident]
    if event == 'clear': items = items[1:]
    return items
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('distinct messages equal', solve([dict(id='a',message='same')], 'add', 'b', 'same', 3), [{'id': 'a', 'message': 'same'}, {'id': 'b', 'message': 'same'}])
check('retry identity', solve([dict(id='a',message='first')], 'add', 'a', 'new', 3), [{'id': 'a', 'message': 'first'}])
check('capacity', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'add', 'c', 'c', 2), [{'id': 'b', 'message': 'b'}, {'id': 'c', 'message': 'c'}])
check('zero', solve([], 'add', 'a', 'a', 0), [])
check('update', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'update', 'a', 'new', 3), [{'id': 'a', 'message': 'new'}, {'id': 'b', 'message': 'b'}])
check('dismiss', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'dismiss', 'a', None, 3), [{'id': 'b', 'message': 'b'}])
check('clear', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'clear', None, None, 3), [])
check('parameterized toast identity', solve([], 'add', str(N), 'message'+str(N), 2), [dict(id=str(N),message='message'+str(N))])
for repetition in range(N):
    check('repeat clear', solve([dict(id='a',message='a'),dict(id='b',message='b')], 'clear', None, None, 3), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
distinct messages equal[{'id': 'a', 'message': 'same'}, {'id': 'b', 'message': 'same'}][{'id': 'a', 'message': 'same'}, {'id': 'b', 'message': 'same'}]Passed
retry identity[{'id': 'a', 'message': 'first'}][{'id': 'a', 'message': 'first'}]Passed
capacity[{'id': 'b', 'message': 'b'}, {'id': 'c', 'message': 'c'}][{'id': 'b', 'message': 'b'}, {'id': 'c', 'message': 'c'}]Passed
zero[][]Passed
update[{'id': 'a', 'message': 'new'}, {'id': 'b', 'message': 'b'}][{'id': 'a', 'message': 'new'}, {'id': 'b', 'message': 'b'}]Passed
dismiss[{'id': 'b', 'message': 'b'}][{'id': 'b', 'message': 'b'}]Passed
clear[{'id': 'b', 'message': 'b'}][]Failed
parameterized toast identity[{'id': '1', 'message': 'message1'}][{'id': '1', 'message': 'message1'}]Passed
repeat clear[{'id': 'b', 'message': 'b'}][]Failed

SHA-256 / b3eabde0a655b80b630485cc1ebba5637d461b4c397920dc66557d8b9d6b2841

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

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:38:23.819316+00:00.

Case digest / e35f8341154e0502dac821c44e261969e0a0ce69d55873a6808578219e47e442