FA-8216 / Direct manipulation / Open access
Drag-and-drop list reordering: Dropping an item onto itself destroys the list · case 01
Dropping an item onto itself destroys the list.
ROOT CAUSE
The self operation uses `if source == target: return []` where the contract requires `if source == target: return items`.
VERIFIED REPAIR
Implement the self operation as `if source == target: return items`.
Unsuccessful approach: Reversing the list is not a no-op self drop.
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 items
if source not in items or target not in items: return items
if source == target: return []
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cancel | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
| missing | ['a', 'b'] | ['a', 'b'] | Passed |
| self | [] | ['a', 'b'] | Failed |
| 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 / c0d013b93406cf336c9b1f006b3a0a6c3037774e42b414b1049a2f07fdfc9820
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 cancelled: return items
if source not in items or target not in items: return items
if source == target: return items[::-1]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| cancel | ['a', 'b', 'c'] | ['a', 'b', 'c'] | Passed |
| missing | ['a', 'b'] | ['a', 'b'] | Passed |
| self | ['b', 'a'] | ['a', 'b'] | Failed |
| 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 / 837dbe73dc06f2b261c2f38b08290448cbf4cfe9314a9e77f791bd7748be285b
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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.557038+00:00.
Case digest / 7fec5c79d3d4da348023e04869cd37fb165a0b84d3c79e9965314b36cc02e20a