FAILURE MAP
← Case archive

FA-7941 / Selection controls / Open access

Hierarchical checkbox state: Clicking a checked child cannot deselect it · case 01

Clicking a checked child cannot deselect it.

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

ROOT CAUSE

The toggle operation uses `selected.add(child)` where the contract requires `selected.symmetric_difference_update({child})`.

VERIFIED REPAIR

Implement the toggle operation as `selected.symmetric_difference_update({child})`.

Unsuccessful approach: Always removing prevents unchecked children from being selected.

Case contract

Subtree actions preserve outside selections; toggle is symmetric; parent status depends only on selected descendants and distinguishes none, mixed and all.

Why this case matters

A deterministic model of hierarchical checkbox 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(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.add(child)
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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
all keeps outside[['a', 'b', 'x'], 'all'][['a', 'b', 'x'], 'all']Passed
none keeps outside[['x'], 'none'][['x'], 'none']Passed
toggle off[['a'], 'mixed'][[], 'none']Failed
toggle on[['a'], 'mixed'][['a'], 'mixed']Passed
outside only[['x'], 'none'][['x'], 'none']Passed
all[['a', 'b'], 'all'][['a', 'b'], 'all']Passed
parameterized checked subtree[[0], 'all'][[0], 'all']Passed
repeat all[['a', 'b'], 'all'][['a', 'b'], 'all']Passed

SHA-256 / 988ef4f4ea9538dd3ca42edbdf98f53af31ebc174f86b6416cf69768c802e3bb

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.discard(child)
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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
all keeps outside[['a', 'b', 'x'], 'all'][['a', 'b', 'x'], 'all']Passed
none keeps outside[['x'], 'none'][['x'], 'none']Passed
toggle off[[], 'none'][[], 'none']Passed
toggle on[[], 'none'][['a'], 'mixed']Failed
outside only[['x'], 'none'][['x'], 'none']Passed
all[['a', 'b'], 'all'][['a', 'b'], 'all']Passed
parameterized checked subtree[[0], 'all'][[0], 'all']Passed
repeat all[['a', 'b'], 'all'][['a', 'b'], 'all']Passed

SHA-256 / 6670be4a9f548c3ca08325a89268d6c83cab0f36c9ed1be0793c8cab54f9bbeb

3 / The verified repair

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

N = 1
observations = []
def solve(selected, children, event, child):
    selected = set(selected)
    children = set(children)
    if event == 'all': selected |= children
    elif event == 'none': selected -= children
    elif event == 'toggle': selected.symmetric_difference_update({child})
    visible = selected & children
    state = 'none' if not visible else ('all' if visible == children else 'mixed')
    return (sorted(selected), state)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('all keeps outside', solve(['x','a'], ['a','b'], 'all', None), (['a', 'b', 'x'], 'all'))
check('none keeps outside', solve(['x','a'], ['a','b'], 'none', None), (['x'], 'none'))
check('toggle off', solve(['a'], ['a','b'], 'toggle', 'a'), ([], 'none'))
check('toggle on', solve([], ['a','b'], 'toggle', 'a'), (['a'], 'mixed'))
check('outside only', solve(['x'], ['a','b'], 'read', None), (['x'], 'none'))
check('all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
check('parameterized checked subtree', solve(list(range(N)), list(range(N)), 'read', None), (list(range(N)), 'all'))
for repetition in range(N):
    check('repeat all', solve(['a','b'], ['a','b'], 'read', None), (['a', 'b'], 'all'))
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
all keeps outside[['a', 'b', 'x'], 'all'][['a', 'b', 'x'], 'all']Passed
none keeps outside[['x'], 'none'][['x'], 'none']Passed
toggle off[[], 'none'][[], 'none']Passed
toggle on[['a'], 'mixed'][['a'], 'mixed']Passed
outside only[['x'], 'none'][['x'], 'none']Passed
all[['a', 'b'], 'all'][['a', 'b'], 'all']Passed
parameterized checked subtree[[0], 'all'][[0], 'all']Passed
repeat all[['a', 'b'], 'all'][['a', 'b'], 'all']Passed

SHA-256 / 8601b5edb6a2428e9f04dc68f017ac8fa14035179bf7c42f7b2dc6a5cc451f6a

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

Case digest / 11158c651d32b6facc81bf0bdb3e6d40c9f8e0f8e956721067f87d856eaab6a0