FAILURE MAP
← Case archive

FA-39691 / Tree accessibility / Open access

Hierarchical branch command lock: Command lock lookup drops ancestor locks · case 01

Command lock lookup drops ancestor locks produces the wrong hierarchical widget state in a regression fixture.

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

ROOT CAUSE

The branch-command-lock contract is violated at `locks=dict(d['locks'])` by replacing it with `locks={}`.

THE FAILURE

The branch-command-lock contract is violated at `locks=dict(d['locks'])` by replacing it with `locks={}`.

Unsuccessful approach: The partial repair `locks={d['target']:d['locks'][d['target']]} if d['target'] in d['locks'] else {}` still violates a boundary or preservation case.

Case contract

A pending subtree mutation locks that branch and descendants, but does not lock siblings. Read-only inspection remains available. New commands use nearest locking ancestor for reason attribution; completed operation tokens release only their owned locks and never a replacement lock.

Why this case matters

Offline executable model of a hierarchical accessibility interaction; inputs are bounded and valid as stipulated. No browser, assistive technology, or normative ARIA conformance is claimed.

1 / The failure

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

N = 1
observations = []
def solve(d):
    locks={}
    if d['complete_node'] in locks and locks[d['complete_node']]==d['complete_token']: del locks[d['complete_node']]
    chain=d['ancestors'].get(d['target'],[])+[d['target']]
    owner=next((x for x in reversed(chain) if x in locks),None)
    mutating=d['command'] in ['rename','delete','move','check']
    allowed=d['target'] in d['rows'] and (not mutating or owner is None) and (not mutating or d['target'] not in d['readonly'])
    reason=('missing' if d['target'] not in d['rows'] else ('busy:'+owner if owner is not None and mutating else ('readonly' if mutating and d['target'] in d['readonly'] else None)))
    newlocks=dict(locks)
    if allowed and d['command'] in ['delete','move']: newlocks[d['target']]=d['new_token']
    busy=[x for x in d['rows'] if x in newlocks or any(a in newlocks for a in d['ancestors'].get(x,[]))]
    return [allowed,reason,newlocks,busy]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N1'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': ['v0'], 'new_token': 'N1'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N1'}, ['r', 'b', 'c', 'q', 's']])], 2: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N2'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': ['v0'], 'new_token': 'N2'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N2'}, ['r', 'b', 'c', 'q', 's']])], 3: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N3'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': ['v0'], 'new_token': 'N3'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N3'}, ['r', 'b', 'c', 'q', 's']])], 4: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N4'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': ['v0'], 'new_token': 'N4'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N4'}, ['r', 'b', 'c', 'q', 's']])], 5: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N5'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': ['v0'], 'new_token': 'N5'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N5'}, ['r', 'b', 'c', 'q', 's']])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
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
nested lock[True, None, {}, []][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
locked delete[True, None, {'c': 'N1'}, ['c']][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
inspection[True, None, {}, []][True, None, {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
release nearest[True, None, {}, []][False, 'busy:r', {'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
stale completion[True, None, {}, []][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
self lock[True, None, {}, []][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
free sibling delete[True, None, {'v0': 'N1'}, ['v0']][True, None, {'b': 'B', 'q': 'Q', 'r': 'R', 'v0': 'N1'}, ['r', 'b', 'c', 'q', 's', 'v0']]Failed
protected free[False, 'readonly', {}, []][False, 'readonly', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
missing target[False, 'missing', {}, []][False, 'missing', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
release and move[True, None, {'q': 'N1'}, ['q', 's']][True, None, {'b': 'B', 'q': 'N1', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed

SHA-256 / a56f8c82bbe677ed69affa09964978dc54da5783226f7c8c03b803498b00ee0f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    locks={d['target']:d['locks'][d['target']]} if d['target'] in d['locks'] else {}
    if d['complete_node'] in locks and locks[d['complete_node']]==d['complete_token']: del locks[d['complete_node']]
    chain=d['ancestors'].get(d['target'],[])+[d['target']]
    owner=next((x for x in reversed(chain) if x in locks),None)
    mutating=d['command'] in ['rename','delete','move','check']
    allowed=d['target'] in d['rows'] and (not mutating or owner is None) and (not mutating or d['target'] not in d['readonly'])
    reason=('missing' if d['target'] not in d['rows'] else ('busy:'+owner if owner is not None and mutating else ('readonly' if mutating and d['target'] in d['readonly'] else None)))
    newlocks=dict(locks)
    if allowed and d['command'] in ['delete','move']: newlocks[d['target']]=d['new_token']
    busy=[x for x in d['rows'] if x in newlocks or any(a in newlocks for a in d['ancestors'].get(x,[]))]
    return [allowed,reason,newlocks,busy]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N1'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': ['v0'], 'new_token': 'N1'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0'], 'readonly': [], 'new_token': 'N1'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N1'}, ['r', 'b', 'c', 'q', 's']])], 2: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N2'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': ['v0'], 'new_token': 'N2'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1'], 'readonly': [], 'new_token': 'N2'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N2'}, ['r', 'b', 'c', 'q', 's']])], 3: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N3'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': ['v0'], 'new_token': 'N3'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2'], 'readonly': [], 'new_token': 'N3'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N3'}, ['r', 'b', 'c', 'q', 's']])], 4: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N4'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': ['v0'], 'new_token': 'N4'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3'], 'readonly': [], 'new_token': 'N4'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N4'}, ['r', 'b', 'c', 'q', 's']])], 5: [('nested lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('locked delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('inspection', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'inspect', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release nearest', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'B', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:r', {'r': 'R', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('stale completion', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'b', 'complete_token': 'old', 'target': 'c', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('self lock', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'b', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'busy:b', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('free sibling delete', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'delete', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'Q', 'v0': 'N5'}, ['r', 'b', 'c', 'q', 's', 'v0']]), ('protected free', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'v0', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': ['v0'], 'new_token': 'N5'}, [False, 'readonly', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('missing target', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': None, 'complete_token': None, 'target': 'missing', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'rename', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [False, 'missing', {'r': 'R', 'b': 'B', 'q': 'Q'}, ['r', 'b', 'c', 'q', 's']]), ('release and move', {'locks': {'r': 'R', 'b': 'B', 'q': 'Q'}, 'complete_node': 'q', 'complete_token': 'Q', 'target': 'q', 'ancestors': {'b': ['r'], 'c': ['r', 'b'], 's': ['q']}, 'command': 'move', 'rows': ['r', 'b', 'c', 'q', 's', 'v0', 'v1', 'v2', 'v3', 'v4'], 'readonly': [], 'new_token': 'N5'}, [True, None, {'r': 'R', 'b': 'B', 'q': 'N5'}, ['r', 'b', 'c', 'q', 's']])]}
for label, data, expected in cases[N]:
    check(label, solve(data), expected)
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
nested lock[True, None, {}, []][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
locked delete[True, None, {'c': 'N1'}, ['c']][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
inspection[True, None, {}, []][True, None, {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
release nearest[True, None, {}, []][False, 'busy:r', {'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
stale completion[True, None, {}, []][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
self lock[False, 'busy:b', {'b': 'B'}, ['b', 'c']][False, 'busy:b', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
free sibling delete[True, None, {'v0': 'N1'}, ['v0']][True, None, {'b': 'B', 'q': 'Q', 'r': 'R', 'v0': 'N1'}, ['r', 'b', 'c', 'q', 's', 'v0']]Failed
protected free[False, 'readonly', {}, []][False, 'readonly', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
missing target[False, 'missing', {}, []][False, 'missing', {'b': 'B', 'q': 'Q', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed
release and move[True, None, {'q': 'N1'}, ['q', 's']][True, None, {'b': 'B', 'q': 'N1', 'r': 'R'}, ['r', 'b', 'c', 'q', 's']]Failed

SHA-256 / 5bcf3d65ff80515435c116b79e6c2c7e0081b82d5a29c93eaaf586dd46bbd839

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 10 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Synthetic deterministic hierarchical-widget data contract; not an implementation of a browser accessibility tree. 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:43:24.219740+00:00.

Case digest / 063217599458393e1aef0ce38050c08d3808412efd2b7757eff0b0411578c57c