FAILURE MAP
← Case archive

FA-8206 / Direct manipulation / Open access

Drag-and-drop list reordering: Cancelling a drag removes the entire list · case 01

Cancelling a drag removes the entire list.

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

ROOT CAUSE

The cancel operation uses `if cancelled: return []` where the contract requires `if cancelled: return items`.

VERIFIED REPAIR

Implement the cancel operation as `if cancelled: return items`.

Unsuccessful approach: Ignoring cancellation still commits the pending drag.

Case contract

Cancellation, missing endpoints and self drops preserve order; otherwise remove the source and insert it immediately before or after the surviving target.

Why this case matters

A deterministic model of drag-and-drop list reordering; 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, source, target, after, cancelled):
    items = list(items)
    if cancelled: return []
    if source not in items or target not in items: return items
    if source == target: return items
    items.remove(source)
    index = items.index(target) + (1 if after else 0)
    items.insert(index, source)
    return items
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel', solve(['a','b','c'], 'a', 'c', True, True), ['a', 'b', 'c'])
check('missing', solve(['a','b'], 'a', 'gone', True, False), ['a', 'b'])
check('self', solve(['a','b'], 'a', 'a', True, False), ['a', 'b'])
check('after', solve(['a','b','c'], 'a', 'c', True, False), ['b', 'c', 'a'])
check('before', solve(['a','b','c'], 'c', 'a', False, False), ['c', 'a', 'b'])
check('parameterized drag length', solve(list(range(N+2)), 0, N+1, True, False), list(range(1,N+2))+[0])
for repetition in range(N):
    check('repeat before', solve(['a','b','c'], 'c', 'a', False, False), ['c', 'a', '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 fixtureActualExpectedOutcome
cancel[]['a', 'b', 'c']Failed
missing['a', 'b']['a', 'b']Passed
self['a', 'b']['a', 'b']Passed
after['b', 'c', 'a']['b', 'c', 'a']Passed
before['c', 'a', 'b']['c', 'a', 'b']Passed
parameterized drag length[1, 2, 0][1, 2, 0]Passed
repeat before['c', 'a', 'b']['c', 'a', 'b']Passed

SHA-256 / dd5475d03b18157f58731fdda56147e77cc4ca3597360c95566030dd3ba9ce72

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(items, source, target, after, cancelled):
    items = list(items)
    if False: return items
    if source not in items or target not in items: return items
    if source == target: return items
    items.remove(source)
    index = items.index(target) + (1 if after else 0)
    items.insert(index, source)
    return items
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel', solve(['a','b','c'], 'a', 'c', True, True), ['a', 'b', 'c'])
check('missing', solve(['a','b'], 'a', 'gone', True, False), ['a', 'b'])
check('self', solve(['a','b'], 'a', 'a', True, False), ['a', 'b'])
check('after', solve(['a','b','c'], 'a', 'c', True, False), ['b', 'c', 'a'])
check('before', solve(['a','b','c'], 'c', 'a', False, False), ['c', 'a', 'b'])
check('parameterized drag length', solve(list(range(N+2)), 0, N+1, True, False), list(range(1,N+2))+[0])
for repetition in range(N):
    check('repeat before', solve(['a','b','c'], 'c', 'a', False, False), ['c', 'a', '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 fixtureActualExpectedOutcome
cancel['b', 'c', 'a']['a', 'b', 'c']Failed
missing['a', 'b']['a', 'b']Passed
self['a', 'b']['a', 'b']Passed
after['b', 'c', 'a']['b', 'c', 'a']Passed
before['c', 'a', 'b']['c', 'a', 'b']Passed
parameterized drag length[1, 2, 0][1, 2, 0]Passed
repeat before['c', 'a', 'b']['c', 'a', 'b']Passed

SHA-256 / 7cd526d9c8c85382b670949b2815f9a756e601fec854ebc51efcfa2b08cc1e51

3 / The verified repair

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

N = 1
observations = []
def solve(items, source, target, after, cancelled):
    items = list(items)
    if cancelled: return items
    if source not in items or target not in items: return items
    if source == target: return items
    items.remove(source)
    index = items.index(target) + (1 if after else 0)
    items.insert(index, source)
    return items
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cancel', solve(['a','b','c'], 'a', 'c', True, True), ['a', 'b', 'c'])
check('missing', solve(['a','b'], 'a', 'gone', True, False), ['a', 'b'])
check('self', solve(['a','b'], 'a', 'a', True, False), ['a', 'b'])
check('after', solve(['a','b','c'], 'a', 'c', True, False), ['b', 'c', 'a'])
check('before', solve(['a','b','c'], 'c', 'a', False, False), ['c', 'a', 'b'])
check('parameterized drag length', solve(list(range(N+2)), 0, N+1, True, False), list(range(1,N+2))+[0])
for repetition in range(N):
    check('repeat before', solve(['a','b','c'], 'c', 'a', False, False), ['c', 'a', '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 fixtureActualExpectedOutcome
cancel['a', 'b', 'c']['a', 'b', 'c']Passed
missing['a', 'b']['a', 'b']Passed
self['a', 'b']['a', 'b']Passed
after['b', 'c', 'a']['b', 'c', 'a']Passed
before['c', 'a', 'b']['c', 'a', 'b']Passed
parameterized drag length[1, 2, 0][1, 2, 0]Passed
repeat before['c', 'a', 'b']['c', 'a', 'b']Passed

SHA-256 / dd447b91b66ff81728f3bffe4798f9817fe7259a02b0987235ab214a33f6dfd8

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

Case digest / ea0185e145ff23cb9a42dd555b01ddd4796d1661604146017c807777b8240b2e