FA-8081 / Disclosure widgets / Open access
Accordion open-panel state: Removed panels retain their expanded state · case 01
Removed panels retain their expanded state.
ROOT CAUSE
The removed panels operation uses `set(opened)` where the contract requires `set(opened) & valid`.
VERIFIED REPAIR
Implement the removed panels operation as `set(opened) & valid`.
Unsuccessful approach: Opening every valid panel invents expansion state.
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)
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', 'gone'] | ['a'] | Failed |
| 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 / 4a2af29842568eba9f3bf47202fd7d698b71d3d7c77f05f99ea131b52b3185ad
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 = 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', 'b'] | ['a'] | Failed |
| unknown | ['a', 'b'] | ['a'] | Failed |
| locked | ['a', 'b'] | ['a'] | Failed |
| collapse | ['b'] | [] | Failed |
| multiple | ['a'] | ['a', 'b'] | Failed |
| single | ['a'] | ['b'] | Failed |
| parameterized panels | [0] | [0, 1] | Failed |
| repeat single | ['a'] | ['b'] | Failed |
SHA-256 / 8b438ef6f45f4e05ead977262b6ec452d1afd60b8972c09528853318700f3553
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.085435+00:00.
Case digest / b2ee5cddf76006f7d523bf42a914526e4953e88d5405bc82e08e773b48ede867