FA-21261 / Assistive announcements / Open access
Duplicate refund replenishes speech budget twice · case 01
The announcement trace violates the stated speech-time-budget contract.
ROOT CAUSE
Fault site: remaining=min(cap,remaining+spent.pop(e[1])) is implemented as remaining=min(cap,remaining+spent[e[1]])
VERIFIED REPAIR
Restore the stated transition: remaining=min(cap,remaining+spent.pop(e[1]))
Unsuccessful approach: The attempted repair substitutes remaining=cap; spent.pop(e[1]) and still violates a regression oracle.
Case contract
Each turn has a spoken-character budget. Enqueue [id,text,cost] with positive cost. Begin replaces remaining budget. Pump selects first queued job that fits, allowing later small jobs to bypass large ones; sends one and subtracts its cost. Refund restores cost of a sent ID once, without requeueing. Cancel removes only unsent ID. Cap limits remaining credit immediately. Reset clears queue and refund ledger. Return speech IDs, queue IDs, remaining, cap.
Why this case matters
Deterministic controlled model of assistive announcement delivery.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
remaining=0; cap=100; q=[]; spent={}; out=[]
for e in events:
if e[0]=='begin': remaining=min(cap,max(0,e[1]))
elif e[0]=='enqueue': q.append(e[1:])
elif e[0]=='cap': cap=max(0,e[1]); remaining=min(remaining,cap)
elif e[0]=='cancel': q=[x for x in q if x[0]!=e[1]]
elif e[0]=='refund' and e[1] in spent:
remaining=min(cap,remaining+spent[e[1]])
elif e[0]=='reset': q=[]; spent={}; remaining=0
elif e[0]=='pump':
index=next((i for i,x in enumerate(q) if x[2]<=remaining),None)
if index is not None:
ident,text,cost=q.pop(index)
remaining-=cost
spent[ident]=cost
out.append([ident,text])
return [out,[x[0] for x in q],remaining,cap]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['begin',N+4],['enqueue','big','large',N+8],['enqueue','small','tiny',N+1],['pump'],['refund','small'],['refund','small']]", "[['begin',N],['enqueue','exact','x'*N,N],['pump']]", "[['begin',N+5],['begin',2]]", "[['begin',N+5],['begin',2],['cap',1],['cap',8]]", "[['cap',3],['begin',N+10]]", "[['enqueue','a','alpha'*N,2],['enqueue','b','beta',1],['cancel','b']]", "[['begin',N+10],['enqueue','a','alpha',2],['pump'],['refund','a']]", "[['begin',N+5],['enqueue','a','alpha',2],['pump']]", "[['begin',N+5],['enqueue','a','alpha',2],['enqueue','b','beta',1],['pump'],['reset'],['refund','a']]", '[]']
expected = {1: [[[['small', 'tiny']], ['big'], 5, 100], [[['exact', 'x']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 11, 100], [[['a', 'alpha']], [], 4, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 2: [[[['small', 'tiny']], ['big'], 6, 100], [[['exact', 'xx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 12, 100], [[['a', 'alpha']], [], 5, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 3: [[[['small', 'tiny']], ['big'], 7, 100], [[['exact', 'xxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 13, 100], [[['a', 'alpha']], [], 6, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 4: [[[['small', 'tiny']], ['big'], 8, 100], [[['exact', 'xxxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 14, 100], [[['a', 'alpha']], [], 7, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 5: [[[['small', 'tiny']], ['big'], 9, 100], [[['exact', 'xxxxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 15, 100], [[['a', 'alpha']], [], 8, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]]}[N]
for i, expression in enumerate(fixtures):
check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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 |
|---|---|---|---|
| trace-1 | [[['small', 'tiny']], ['big'], 7, 100] | [[['small', 'tiny']], ['big'], 5, 100] | Failed |
| trace-2 | [[['exact', 'x']], [], 0, 100] | [[['exact', 'x']], [], 0, 100] | Passed |
| trace-3 | [[], [], 2, 100] | [[], [], 2, 100] | Passed |
| trace-4 | [[], [], 1, 8] | [[], [], 1, 8] | Passed |
| trace-5 | [[], [], 3, 3] | [[], [], 3, 3] | Passed |
| trace-6 | [[], ['a'], 0, 100] | [[], ['a'], 0, 100] | Passed |
| trace-7 | [[['a', 'alpha']], [], 11, 100] | [[['a', 'alpha']], [], 11, 100] | Passed |
| trace-8 | [[['a', 'alpha']], [], 4, 100] | [[['a', 'alpha']], [], 4, 100] | Passed |
| trace-9 | [[['a', 'alpha']], [], 0, 100] | [[['a', 'alpha']], [], 0, 100] | Passed |
| trace-10 | [[], [], 0, 100] | [[], [], 0, 100] | Passed |
SHA-256 / 69bfaa34b6c4afd6d4aa5e3907f832d2cbd417169b114e9dcf7e4c9f6bd9522e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
remaining=0; cap=100; q=[]; spent={}; out=[]
for e in events:
if e[0]=='begin': remaining=min(cap,max(0,e[1]))
elif e[0]=='enqueue': q.append(e[1:])
elif e[0]=='cap': cap=max(0,e[1]); remaining=min(remaining,cap)
elif e[0]=='cancel': q=[x for x in q if x[0]!=e[1]]
elif e[0]=='refund' and e[1] in spent:
remaining=cap; spent.pop(e[1])
elif e[0]=='reset': q=[]; spent={}; remaining=0
elif e[0]=='pump':
index=next((i for i,x in enumerate(q) if x[2]<=remaining),None)
if index is not None:
ident,text,cost=q.pop(index)
remaining-=cost
spent[ident]=cost
out.append([ident,text])
return [out,[x[0] for x in q],remaining,cap]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['begin',N+4],['enqueue','big','large',N+8],['enqueue','small','tiny',N+1],['pump'],['refund','small'],['refund','small']]", "[['begin',N],['enqueue','exact','x'*N,N],['pump']]", "[['begin',N+5],['begin',2]]", "[['begin',N+5],['begin',2],['cap',1],['cap',8]]", "[['cap',3],['begin',N+10]]", "[['enqueue','a','alpha'*N,2],['enqueue','b','beta',1],['cancel','b']]", "[['begin',N+10],['enqueue','a','alpha',2],['pump'],['refund','a']]", "[['begin',N+5],['enqueue','a','alpha',2],['pump']]", "[['begin',N+5],['enqueue','a','alpha',2],['enqueue','b','beta',1],['pump'],['reset'],['refund','a']]", '[]']
expected = {1: [[[['small', 'tiny']], ['big'], 5, 100], [[['exact', 'x']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 11, 100], [[['a', 'alpha']], [], 4, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 2: [[[['small', 'tiny']], ['big'], 6, 100], [[['exact', 'xx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 12, 100], [[['a', 'alpha']], [], 5, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 3: [[[['small', 'tiny']], ['big'], 7, 100], [[['exact', 'xxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 13, 100], [[['a', 'alpha']], [], 6, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 4: [[[['small', 'tiny']], ['big'], 8, 100], [[['exact', 'xxxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 14, 100], [[['a', 'alpha']], [], 7, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 5: [[[['small', 'tiny']], ['big'], 9, 100], [[['exact', 'xxxxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 15, 100], [[['a', 'alpha']], [], 8, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]]}[N]
for i, expression in enumerate(fixtures):
check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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 |
|---|---|---|---|
| trace-1 | [[['small', 'tiny']], ['big'], 100, 100] | [[['small', 'tiny']], ['big'], 5, 100] | Failed |
| trace-2 | [[['exact', 'x']], [], 0, 100] | [[['exact', 'x']], [], 0, 100] | Passed |
| trace-3 | [[], [], 2, 100] | [[], [], 2, 100] | Passed |
| trace-4 | [[], [], 1, 8] | [[], [], 1, 8] | Passed |
| trace-5 | [[], [], 3, 3] | [[], [], 3, 3] | Passed |
| trace-6 | [[], ['a'], 0, 100] | [[], ['a'], 0, 100] | Passed |
| trace-7 | [[['a', 'alpha']], [], 100, 100] | [[['a', 'alpha']], [], 11, 100] | Failed |
| trace-8 | [[['a', 'alpha']], [], 4, 100] | [[['a', 'alpha']], [], 4, 100] | Passed |
| trace-9 | [[['a', 'alpha']], [], 0, 100] | [[['a', 'alpha']], [], 0, 100] | Passed |
| trace-10 | [[], [], 0, 100] | [[], [], 0, 100] | Passed |
SHA-256 / 789e0aa37d0db6df4988d3b9d4221754e19b14d1022c9eb4160ee445941cfd0f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(events):
remaining=0; cap=100; q=[]; spent={}; out=[]
for e in events:
if e[0]=='begin': remaining=min(cap,max(0,e[1]))
elif e[0]=='enqueue': q.append(e[1:])
elif e[0]=='cap': cap=max(0,e[1]); remaining=min(remaining,cap)
elif e[0]=='cancel': q=[x for x in q if x[0]!=e[1]]
elif e[0]=='refund' and e[1] in spent:
remaining=min(cap,remaining+spent.pop(e[1]))
elif e[0]=='reset': q=[]; spent={}; remaining=0
elif e[0]=='pump':
index=next((i for i,x in enumerate(q) if x[2]<=remaining),None)
if index is not None:
ident,text,cost=q.pop(index)
remaining-=cost
spent[ident]=cost
out.append([ident,text])
return [out,[x[0] for x in q],remaining,cap]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = ["[['begin',N+4],['enqueue','big','large',N+8],['enqueue','small','tiny',N+1],['pump'],['refund','small'],['refund','small']]", "[['begin',N],['enqueue','exact','x'*N,N],['pump']]", "[['begin',N+5],['begin',2]]", "[['begin',N+5],['begin',2],['cap',1],['cap',8]]", "[['cap',3],['begin',N+10]]", "[['enqueue','a','alpha'*N,2],['enqueue','b','beta',1],['cancel','b']]", "[['begin',N+10],['enqueue','a','alpha',2],['pump'],['refund','a']]", "[['begin',N+5],['enqueue','a','alpha',2],['pump']]", "[['begin',N+5],['enqueue','a','alpha',2],['enqueue','b','beta',1],['pump'],['reset'],['refund','a']]", '[]']
expected = {1: [[[['small', 'tiny']], ['big'], 5, 100], [[['exact', 'x']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 11, 100], [[['a', 'alpha']], [], 4, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 2: [[[['small', 'tiny']], ['big'], 6, 100], [[['exact', 'xx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 12, 100], [[['a', 'alpha']], [], 5, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 3: [[[['small', 'tiny']], ['big'], 7, 100], [[['exact', 'xxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 13, 100], [[['a', 'alpha']], [], 6, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 4: [[[['small', 'tiny']], ['big'], 8, 100], [[['exact', 'xxxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 14, 100], [[['a', 'alpha']], [], 7, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]], 5: [[[['small', 'tiny']], ['big'], 9, 100], [[['exact', 'xxxxx']], [], 0, 100], [[], [], 2, 100], [[], [], 1, 8], [[], [], 3, 3], [[], ['a'], 0, 100], [[['a', 'alpha']], [], 15, 100], [[['a', 'alpha']], [], 8, 100], [[['a', 'alpha']], [], 0, 100], [[], [], 0, 100]]}[N]
for i, expression in enumerate(fixtures):
check("trace-"+str(i+1), solve(eval(expression)), expected[i])
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 |
|---|---|---|---|
| trace-1 | [[['small', 'tiny']], ['big'], 5, 100] | [[['small', 'tiny']], ['big'], 5, 100] | Passed |
| trace-2 | [[['exact', 'x']], [], 0, 100] | [[['exact', 'x']], [], 0, 100] | Passed |
| trace-3 | [[], [], 2, 100] | [[], [], 2, 100] | Passed |
| trace-4 | [[], [], 1, 8] | [[], [], 1, 8] | Passed |
| trace-5 | [[], [], 3, 3] | [[], [], 3, 3] | Passed |
| trace-6 | [[], ['a'], 0, 100] | [[], ['a'], 0, 100] | Passed |
| trace-7 | [[['a', 'alpha']], [], 11, 100] | [[['a', 'alpha']], [], 11, 100] | Passed |
| trace-8 | [[['a', 'alpha']], [], 4, 100] | [[['a', 'alpha']], [], 4, 100] | Passed |
| trace-9 | [[['a', 'alpha']], [], 0, 100] | [[['a', 'alpha']], [], 0, 100] | Passed |
| trace-10 | [[], [], 0, 100] | [[], [], 0, 100] | Passed |
SHA-256 / bdbc4319fb090e4a978938843d3307b06ec697b2ab2559c293905eff17094e7a
Verification & scope
Stipulated bounded policy, not a browser, speech engine, platform API, or standards conformance claim. 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:40:26.956583+00:00.
Case digest / 25bc2a4f73d296c02db24396935ae385d1de86d50d5cd6f2ec2722672a738693