FA-8101 / Disclosure widgets / Open access
Accordion open-panel state: Single-open accordions accumulate expanded panels · case 01
Single-open accordions accumulate expanded panels.
ROOT CAUSE
The single open operation uses `else: opened.add(target)` where the contract requires `else: opened = {target}`.
VERIFIED REPAIR
Implement the single open operation as `else: opened = {target}`.
Unsuccessful approach: Clearing the set opens no requested panel.
Case contract
Discard removed panels; ignore invalid targets; expanded panels close only when collapsible; multiple mode unions and single mode replaces.
Why this case matters
A deterministic model of accordion open-panel state; 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(panels, opened, target, multiple, collapsible):
valid = set(panels)
opened = set(opened) & valid
if target not in valid: return sorted(opened)
if target in opened:
if collapsible: opened.remove(target)
elif multiple: opened.add(target)
else: opened.add(target)
return sorted(opened)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removed', solve(['a','b'], ['a','gone'], 'unknown', True, True), ['a'])
check('unknown', solve(['a','b'], ['a'], 'unknown', True, True), ['a'])
check('locked', solve(['a','b'], ['a'], 'a', False, False), ['a'])
check('collapse', solve(['a','b'], ['a'], 'a', False, True), [])
check('multiple', solve(['a','b'], ['a'], 'b', True, True), ['a', 'b'])
check('single', solve(['a','b'], ['a'], 'b', False, True), ['b'])
check('parameterized panels', solve(list(range(N+1)), [0], N, True, True), [0,N])
for repetition in range(N):
check('repeat single', solve(['a','b'], ['a'], 'b', False, True), ['b'])
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 |
|---|---|---|---|
| removed | ['a'] | ['a'] | Passed |
| unknown | ['a'] | ['a'] | Passed |
| locked | ['a'] | ['a'] | Passed |
| collapse | [] | [] | Passed |
| multiple | ['a', 'b'] | ['a', 'b'] | Passed |
| single | ['a', 'b'] | ['b'] | Failed |
| parameterized panels | [0, 1] | [0, 1] | Passed |
| repeat single | ['a', 'b'] | ['b'] | Failed |
SHA-256 / 3b830f9c7df544e1d339c9cf84d4bee7b626f046bc75dd4b5e3ebea05bf36367
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(panels, opened, target, multiple, collapsible):
valid = set(panels)
opened = set(opened) & valid
if target not in valid: return sorted(opened)
if target in opened:
if collapsible: opened.remove(target)
elif multiple: opened.add(target)
else: opened = set()
return sorted(opened)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removed', solve(['a','b'], ['a','gone'], 'unknown', True, True), ['a'])
check('unknown', solve(['a','b'], ['a'], 'unknown', True, True), ['a'])
check('locked', solve(['a','b'], ['a'], 'a', False, False), ['a'])
check('collapse', solve(['a','b'], ['a'], 'a', False, True), [])
check('multiple', solve(['a','b'], ['a'], 'b', True, True), ['a', 'b'])
check('single', solve(['a','b'], ['a'], 'b', False, True), ['b'])
check('parameterized panels', solve(list(range(N+1)), [0], N, True, True), [0,N])
for repetition in range(N):
check('repeat single', solve(['a','b'], ['a'], 'b', False, True), ['b'])
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 |
|---|---|---|---|
| removed | ['a'] | ['a'] | Passed |
| unknown | ['a'] | ['a'] | Passed |
| locked | ['a'] | ['a'] | Passed |
| collapse | [] | [] | Passed |
| multiple | ['a', 'b'] | ['a', 'b'] | Passed |
| single | [] | ['b'] | Failed |
| parameterized panels | [0, 1] | [0, 1] | Passed |
| repeat single | [] | ['b'] | Failed |
SHA-256 / c0dcd1f4388fad88edf525396653c4e9133784729179a79d980c0b86036fdf23
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(panels, opened, target, multiple, collapsible):
valid = set(panels)
opened = set(opened) & valid
if target not in valid: return sorted(opened)
if target in opened:
if collapsible: opened.remove(target)
elif multiple: opened.add(target)
else: opened = {target}
return sorted(opened)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removed', solve(['a','b'], ['a','gone'], 'unknown', True, True), ['a'])
check('unknown', solve(['a','b'], ['a'], 'unknown', True, True), ['a'])
check('locked', solve(['a','b'], ['a'], 'a', False, False), ['a'])
check('collapse', solve(['a','b'], ['a'], 'a', False, True), [])
check('multiple', solve(['a','b'], ['a'], 'b', True, True), ['a', 'b'])
check('single', solve(['a','b'], ['a'], 'b', False, True), ['b'])
check('parameterized panels', solve(list(range(N+1)), [0], N, True, True), [0,N])
for repetition in range(N):
check('repeat single', solve(['a','b'], ['a'], 'b', False, True), ['b'])
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 |
|---|---|---|---|
| removed | ['a'] | ['a'] | Passed |
| unknown | ['a'] | ['a'] | Passed |
| locked | ['a'] | ['a'] | Passed |
| collapse | [] | [] | Passed |
| multiple | ['a', 'b'] | ['a', 'b'] | Passed |
| single | ['b'] | ['b'] | Passed |
| parameterized panels | [0, 1] | [0, 1] | Passed |
| repeat single | ['b'] | ['b'] | Passed |
SHA-256 / b8fe78cbde67bd47435fdfb2ceb8126435f2c64371760b474144ab9b1ae04f34
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:18.132215+00:00.
Case digest / 462300fbf64fe2b98fd4a637336860713abecbc6eac55af05c72a085cb43b2b3