FAILURE MAP
← Case archive

FA-8846 / Selection controls / Open access

Radio group selection ownership: Clear removes the selection from a required group · case 01

Clear removes the selection from a required group.

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

ROOT CAUSE

The required clear operation uses `elif event == 'clear':` where the contract requires `elif event == 'clear' and not required:`.

VERIFIED REPAIR

Implement the required clear operation as `elif event == 'clear' and not required:`.

Unsuccessful approach: Reversing the flag disables clearing optional groups.

Case contract

Radio activation replaces selection with an existing enabled option and never toggles it off; required groups cannot clear; selected removal uses first remaining option only when required.

Why this case matters

A deterministic model of radio group selection ownership; 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(options, selected, target, required, disabled, event):
    if event == 'remove':
        options = [x for x in options if x != target]
        if selected not in options: selected = options[0] if required and options else None
    elif event == 'activate':
        if target in options and target not in disabled: selected = target
    elif event == 'clear': selected = None
    return (options, selected)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove other', solve(['a','b','c'], 'a', 'b', False, [], 'remove'), (['a', 'c'], 'a'))
check('required removal', solve(['a','b','c'], 'a', 'a', True, [], 'remove'), (['b', 'c'], 'b'))
check('unknown', solve(['a','b'], 'a', 'x', False, [], 'activate'), (['a', 'b'], 'a'))
check('disabled', solve(['a','b'], 'a', 'b', False, ['b'], 'activate'), (['a', 'b'], 'a'))
check('required clear', solve(['a','b'], 'a', None, True, [], 'clear'), (['a', 'b'], 'a'))
check('optional clear', solve(['a','b'], 'a', None, False, [], 'clear'), (['a', 'b'], None))
check('activate', solve(['a','b'], 'a', 'b', False, [], 'activate'), (['a', 'b'], 'b'))
check('reactivate', solve(['a','b'], 'a', 'a', False, [], 'activate'), (['a', 'b'], 'a'))
check('parameterized radio options', solve(list(range(N+1)),0,N,False,[],'activate'), (list(range(N+1)),N))
for repetition in range(N):
    check('repeat reactivate', solve(['a','b'], 'a', 'a', False, [], 'activate'), (['a', 'b'], 'a'))
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
remove other[['a', 'c'], 'a'][['a', 'c'], 'a']Passed
required removal[['b', 'c'], 'b'][['b', 'c'], 'b']Passed
unknown[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
disabled[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
required clear[['a', 'b'], None][['a', 'b'], 'a']Failed
optional clear[['a', 'b'], None][['a', 'b'], None]Passed
activate[['a', 'b'], 'b'][['a', 'b'], 'b']Passed
reactivate[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
parameterized radio options[[0, 1], 1][[0, 1], 1]Passed
repeat reactivate[['a', 'b'], 'a'][['a', 'b'], 'a']Passed

SHA-256 / fa2c641e78232a744908826bb5fd1ff18f54ac5220a2d377499810ff7a92980a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(options, selected, target, required, disabled, event):
    if event == 'remove':
        options = [x for x in options if x != target]
        if selected not in options: selected = options[0] if required and options else None
    elif event == 'activate':
        if target in options and target not in disabled: selected = target
    elif event == 'clear' and required: selected = None
    return (options, selected)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove other', solve(['a','b','c'], 'a', 'b', False, [], 'remove'), (['a', 'c'], 'a'))
check('required removal', solve(['a','b','c'], 'a', 'a', True, [], 'remove'), (['b', 'c'], 'b'))
check('unknown', solve(['a','b'], 'a', 'x', False, [], 'activate'), (['a', 'b'], 'a'))
check('disabled', solve(['a','b'], 'a', 'b', False, ['b'], 'activate'), (['a', 'b'], 'a'))
check('required clear', solve(['a','b'], 'a', None, True, [], 'clear'), (['a', 'b'], 'a'))
check('optional clear', solve(['a','b'], 'a', None, False, [], 'clear'), (['a', 'b'], None))
check('activate', solve(['a','b'], 'a', 'b', False, [], 'activate'), (['a', 'b'], 'b'))
check('reactivate', solve(['a','b'], 'a', 'a', False, [], 'activate'), (['a', 'b'], 'a'))
check('parameterized radio options', solve(list(range(N+1)),0,N,False,[],'activate'), (list(range(N+1)),N))
for repetition in range(N):
    check('repeat reactivate', solve(['a','b'], 'a', 'a', False, [], 'activate'), (['a', 'b'], 'a'))
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
remove other[['a', 'c'], 'a'][['a', 'c'], 'a']Passed
required removal[['b', 'c'], 'b'][['b', 'c'], 'b']Passed
unknown[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
disabled[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
required clear[['a', 'b'], None][['a', 'b'], 'a']Failed
optional clear[['a', 'b'], 'a'][['a', 'b'], None]Failed
activate[['a', 'b'], 'b'][['a', 'b'], 'b']Passed
reactivate[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
parameterized radio options[[0, 1], 1][[0, 1], 1]Passed
repeat reactivate[['a', 'b'], 'a'][['a', 'b'], 'a']Passed

SHA-256 / 5f598f83bce3634deded60acf7cf5744b4934e270b319c6416c2775118a99022

3 / The verified repair

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

N = 1
observations = []
def solve(options, selected, target, required, disabled, event):
    if event == 'remove':
        options = [x for x in options if x != target]
        if selected not in options: selected = options[0] if required and options else None
    elif event == 'activate':
        if target in options and target not in disabled: selected = target
    elif event == 'clear' and not required: selected = None
    return (options, selected)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('remove other', solve(['a','b','c'], 'a', 'b', False, [], 'remove'), (['a', 'c'], 'a'))
check('required removal', solve(['a','b','c'], 'a', 'a', True, [], 'remove'), (['b', 'c'], 'b'))
check('unknown', solve(['a','b'], 'a', 'x', False, [], 'activate'), (['a', 'b'], 'a'))
check('disabled', solve(['a','b'], 'a', 'b', False, ['b'], 'activate'), (['a', 'b'], 'a'))
check('required clear', solve(['a','b'], 'a', None, True, [], 'clear'), (['a', 'b'], 'a'))
check('optional clear', solve(['a','b'], 'a', None, False, [], 'clear'), (['a', 'b'], None))
check('activate', solve(['a','b'], 'a', 'b', False, [], 'activate'), (['a', 'b'], 'b'))
check('reactivate', solve(['a','b'], 'a', 'a', False, [], 'activate'), (['a', 'b'], 'a'))
check('parameterized radio options', solve(list(range(N+1)),0,N,False,[],'activate'), (list(range(N+1)),N))
for repetition in range(N):
    check('repeat reactivate', solve(['a','b'], 'a', 'a', False, [], 'activate'), (['a', 'b'], 'a'))
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
remove other[['a', 'c'], 'a'][['a', 'c'], 'a']Passed
required removal[['b', 'c'], 'b'][['b', 'c'], 'b']Passed
unknown[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
disabled[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
required clear[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
optional clear[['a', 'b'], None][['a', 'b'], None]Passed
activate[['a', 'b'], 'b'][['a', 'b'], 'b']Passed
reactivate[['a', 'b'], 'a'][['a', 'b'], 'a']Passed
parameterized radio options[[0, 1], 1][[0, 1], 1]Passed
repeat reactivate[['a', 'b'], 'a'][['a', 'b'], 'a']Passed

SHA-256 / 4f8f9a9b0059c204bdbca082b20c90cecc2a74313620caf4bb5bf20aea9fae2e

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

Case digest / d07284350d058491eeafc0e02052bcfcd1f8f0c19fe95336b3df7141ce9ac079