FAILURE MAP
← Case archive

FA-7966 / Selection controls / Open access

Anchored range selection: Backward shift selection produces an empty range · case 01

Backward shift selection produces an empty range.

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

ROOT CAUSE

The reverse operation uses `(items.index(anchor), items.index(target))` where the contract requires `sorted((items.index(anchor), items.index(target)))`.

VERIFIED REPAIR

Implement the reverse operation as `sorted((items.index(anchor), items.index(target)))`.

Unsuccessful approach: Swapping endpoints without normalization instead breaks forward ranges.

Case contract

Ranges include both endpoints in document order; plain clicks replace; additive selection unions; missing targets preserve selection.

Why this case matters

A deterministic model of anchored range selection; 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(items, selected, anchor, target, extend, additive):
    if target not in items: return sorted(selected)
    if not extend or anchor not in items: span = {target}
    else:
        a, b = (items.index(anchor), items.index(target))
        span = set(items[a:b+1])
    return sorted(set(selected) | span if additive else span)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removed', solve(['a','b'], ['a'], 'a', 'x', False, False), ['a'])
check('plain', solve(['a','b','c'], ['a'], 'a', 'c', False, False), ['c'])
check('forward', solve(['a','b','c'], [], 'a', 'c', True, False), ['a', 'b', 'c'])
check('backward', solve(['a','b','c'], [], 'c', 'a', True, False), ['a', 'b', 'c'])
check('union', solve(['a','b','c'], ['a'], 'b', 'c', True, True), ['a', 'b', 'c'])
check('replace', solve(['a','b','c'], ['a'], 'b', 'c', True, False), ['b', 'c'])
check('parameterized inclusive range', solve(list(range(N+2)), [], 0, N, True, False), list(range(N+1)))
for repetition in range(N):
    check('repeat replace', solve(['a','b','c'], ['a'], 'b', 'c', True, False), ['b', 'c'])
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
removed['a']['a']Passed
plain['c']['c']Passed
forward['a', 'b', 'c']['a', 'b', 'c']Passed
backward[]['a', 'b', 'c']Failed
union['a', 'b', 'c']['a', 'b', 'c']Passed
replace['b', 'c']['b', 'c']Passed
parameterized inclusive range[0, 1][0, 1]Passed
repeat replace['b', 'c']['b', 'c']Passed

SHA-256 / 2bde1c04c1dda16b1cffe6a4d23e838a1bf7843bf072a8335e992a50b5fa2b93

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(items, selected, anchor, target, extend, additive):
    if target not in items: return sorted(selected)
    if not extend or anchor not in items: span = {target}
    else:
        a, b = (items.index(target), items.index(anchor))
        span = set(items[a:b+1])
    return sorted(set(selected) | span if additive else span)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removed', solve(['a','b'], ['a'], 'a', 'x', False, False), ['a'])
check('plain', solve(['a','b','c'], ['a'], 'a', 'c', False, False), ['c'])
check('forward', solve(['a','b','c'], [], 'a', 'c', True, False), ['a', 'b', 'c'])
check('backward', solve(['a','b','c'], [], 'c', 'a', True, False), ['a', 'b', 'c'])
check('union', solve(['a','b','c'], ['a'], 'b', 'c', True, True), ['a', 'b', 'c'])
check('replace', solve(['a','b','c'], ['a'], 'b', 'c', True, False), ['b', 'c'])
check('parameterized inclusive range', solve(list(range(N+2)), [], 0, N, True, False), list(range(N+1)))
for repetition in range(N):
    check('repeat replace', solve(['a','b','c'], ['a'], 'b', 'c', True, False), ['b', 'c'])
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
removed['a']['a']Passed
plain['c']['c']Passed
forward[]['a', 'b', 'c']Failed
backward['a', 'b', 'c']['a', 'b', 'c']Passed
union['a']['a', 'b', 'c']Failed
replace[]['b', 'c']Failed
parameterized inclusive range[][0, 1]Failed
repeat replace[]['b', 'c']Failed

SHA-256 / 089a422365375b953fb867ff06f73b93077ea156219305b38db3d919d2d405e4

3 / The verified repair

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

N = 1
observations = []
def solve(items, selected, anchor, target, extend, additive):
    if target not in items: return sorted(selected)
    if not extend or anchor not in items: span = {target}
    else:
        a, b = sorted((items.index(anchor), items.index(target)))
        span = set(items[a:b+1])
    return sorted(set(selected) | span if additive else span)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('removed', solve(['a','b'], ['a'], 'a', 'x', False, False), ['a'])
check('plain', solve(['a','b','c'], ['a'], 'a', 'c', False, False), ['c'])
check('forward', solve(['a','b','c'], [], 'a', 'c', True, False), ['a', 'b', 'c'])
check('backward', solve(['a','b','c'], [], 'c', 'a', True, False), ['a', 'b', 'c'])
check('union', solve(['a','b','c'], ['a'], 'b', 'c', True, True), ['a', 'b', 'c'])
check('replace', solve(['a','b','c'], ['a'], 'b', 'c', True, False), ['b', 'c'])
check('parameterized inclusive range', solve(list(range(N+2)), [], 0, N, True, False), list(range(N+1)))
for repetition in range(N):
    check('repeat replace', solve(['a','b','c'], ['a'], 'b', 'c', True, False), ['b', 'c'])
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
removed['a']['a']Passed
plain['c']['c']Passed
forward['a', 'b', 'c']['a', 'b', 'c']Passed
backward['a', 'b', 'c']['a', 'b', 'c']Passed
union['a', 'b', 'c']['a', 'b', 'c']Passed
replace['b', 'c']['b', 'c']Passed
parameterized inclusive range[0, 1][0, 1]Passed
repeat replace['b', 'c']['b', 'c']Passed

SHA-256 / caeebbec1387af3a4eff6775092231c4860974fc3c1fee025be129f473c5877c

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

Case digest / 8482a317e506783021f0d57c24c5ad6441a41f11af1518761d5fbe28e84ea0b1