FAILURE MAP
← Case archive

FA-38906 / Tree accessibility / Open access

Paged tree children accessibility merge: Overlapping child refresh loses newest record · case 01

Overlapping child refresh loses newest record produces the wrong hierarchical widget state in a regression fixture.

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

ROOT CAUSE

The sibling-page contract is violated at `if accept: records.update(dict(d['page']))` by replacing it with `if accept: records={**dict(d['page']),**records}`.

VERIFIED REPAIR

Restore `if accept: records.update(dict(d['page']))` at this fault site while retaining the other tree state decisions.

Unsuccessful approach: The partial repair `records.update(dict(d['page']))` still violates a boundary or preservation case.

Case contract

Only the expected cursor and branch revision admit a page. Repeated child IDs preserve their first position but update their record. An empty string is a valid next cursor. Logical count is authoritative when supplied; otherwise unknown. Focus on the load-more row moves to first newly inserted child, or parent if no continuation.

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):
    accept=d['cursor']==d['expected_cursor'] and d['revision']==d['expected_revision']
    order=list(dict.fromkeys(d['order']+[r[0] for r in d['page']])) if accept else d['order']
    records=dict(d['records'])
    if accept: records={**dict(d['page']),**records}
    new=[r[0] for r in d['page'] if r[0] not in d['order']] if accept else []
    new=list(dict.fromkeys(new))
    nextcursor=d['next'] if accept else d['expected_cursor']
    more=nextcursor is not None
    size=d['total'] if accept and d['total'] is not None else d['size']
    focus=(new[0] if new else (d['parent'] if not more else d['focus'])) if accept and d['focus']=='more' else d['focus']
    positions={x:i+1 for i,x in enumerate(order)}
    return [order,records,new,nextcursor,more,size,focus,positions]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, 9, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 0, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': '', 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], '', True, 9, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 9, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, 9, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 2: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, 10, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': '', 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], '', True, 10, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 10, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, 10, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 3: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, 11, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': '', 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], '', True, 11, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 11, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, 11, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 4: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, 12, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': '', 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], '', True, 12, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 12, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, 12, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 5: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, 13, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': '', 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], '', True, 13, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 13, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, 13, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])]}
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
overlap page[['z', 'a', 'y', 'b'], {'a': 2, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Failed
stale cursor[['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}]Passed
stale revision[['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}]Passed
empty cursor[['z', 'a', 'y', 'b'], {'a': 2, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], '', True, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], '', True, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Failed
empty terminal[['z', 'a'], {'a': 2, 'z': 1}, [], None, False, 0, 'p', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], None, False, 0, 'p', {'a': 2, 'z': 1}]Passed
empty continued[['z', 'a'], {'a': 2, 'z': 1}, [], 'x', True, 9, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'x', True, 9, 'more', {'a': 2, 'z': 1}]Passed
unknown total[['z', 'a', 'y', 'b'], {'a': 2, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, -1, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, -1, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Failed
focus elsewhere[['z', 'a', 'y', 'b'], {'a': 2, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'z', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'z', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Failed

SHA-256 / 23b44bb96897f07673b03ba482e0066ea21702067e2b689a2622fbea3412c7a7

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(d):
    accept=d['cursor']==d['expected_cursor'] and d['revision']==d['expected_revision']
    order=list(dict.fromkeys(d['order']+[r[0] for r in d['page']])) if accept else d['order']
    records=dict(d['records'])
    records.update(dict(d['page']))
    new=[r[0] for r in d['page'] if r[0] not in d['order']] if accept else []
    new=list(dict.fromkeys(new))
    nextcursor=d['next'] if accept else d['expected_cursor']
    more=nextcursor is not None
    size=d['total'] if accept and d['total'] is not None else d['size']
    focus=(new[0] if new else (d['parent'] if not more else d['focus'])) if accept and d['focus']=='more' else d['focus']
    positions={x:i+1 for i,x in enumerate(order)}
    return [order,records,new,nextcursor,more,size,focus,positions]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, 9, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 0, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': '', 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], '', True, 9, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 9, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, 9, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 2: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, 10, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': '', 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], '', True, 10, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 10, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, 10, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 3: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, 11, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': '', 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], '', True, 11, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 11, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, 11, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 4: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, 12, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': '', 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], '', True, 12, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 12, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, 12, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 5: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, 13, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': '', 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], '', True, 13, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 13, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, 13, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])]}
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
overlap page[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed
stale cursor[['z', 'a'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}]Failed
stale revision[['z', 'a'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}]Failed
empty cursor[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], '', True, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], '', True, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed
empty terminal[['z', 'a'], {'a': 2, 'z': 1}, [], None, False, 0, 'p', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], None, False, 0, 'p', {'a': 2, 'z': 1}]Passed
empty continued[['z', 'a'], {'a': 2, 'z': 1}, [], 'x', True, 9, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'x', True, 9, 'more', {'a': 2, 'z': 1}]Passed
unknown total[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, -1, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, -1, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed
focus elsewhere[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'z', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'z', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed

SHA-256 / 20ecf3f3fa0fda807805c19a88ab8a9c92e0603c3f4849444faa3db95950c947

3 / The verified repair

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

N = 1
observations = []
def solve(d):
    accept=d['cursor']==d['expected_cursor'] and d['revision']==d['expected_revision']
    order=list(dict.fromkeys(d['order']+[r[0] for r in d['page']])) if accept else d['order']
    records=dict(d['records'])
    if accept: records.update(dict(d['page']))
    new=[r[0] for r in d['page'] if r[0] not in d['order']] if accept else []
    new=list(dict.fromkeys(new))
    nextcursor=d['next'] if accept else d['expected_cursor']
    more=nextcursor is not None
    size=d['total'] if accept and d['total'] is not None else d['size']
    focus=(new[0] if new else (d['parent'] if not more else d['focus'])) if accept and d['focus']=='more' else d['focus']
    positions={x:i+1 for i,x in enumerate(order)}
    return [order,records,new,nextcursor,more,size,focus,positions]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, 9, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 0, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': '', 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], '', True, 9, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 9, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 9, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 1, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 1], ['b', 8], ['y', 2]], 'next': None, 'total': 9, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 2, 'b': 8}, ['y', 'b'], None, False, 9, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 2: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, 10, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 1, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': '', 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], '', True, 10, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 10, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 10, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 2, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 2], ['b', 8], ['y', 3]], 'next': None, 'total': 10, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 3, 'b': 8}, ['y', 'b'], None, False, 10, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 3: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, 11, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 2, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': '', 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], '', True, 11, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 11, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 11, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 3, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 3], ['b', 8], ['y', 4]], 'next': None, 'total': 11, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 4, 'b': 8}, ['y', 'b'], None, False, 11, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 4: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, 12, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 3, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': '', 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], '', True, 12, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 12, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 12, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 4, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 4], ['b', 8], ['y', 5]], 'next': None, 'total': 12, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 5, 'b': 8}, ['y', 'b'], None, False, 12, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])], 5: [('overlap page', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, 13, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('stale cursor', {'cursor': 'old', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('stale revision', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 4, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'c', True, -1, 'more', {'z': 1, 'a': 2}]), ('empty cursor', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': '', 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], '', True, 13, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('empty terminal', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': None, 'total': 0, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], None, False, 0, 'p', {'z': 1, 'a': 2}]), ('empty continued', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [], 'next': 'x', 'total': 13, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a'], {'z': 1, 'a': 2}, [], 'x', True, 13, 'more', {'z': 1, 'a': 2}]), ('unknown total', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': None, 'size': -1, 'focus': 'more', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, -1, 'y', {'z': 1, 'a': 2, 'y': 3, 'b': 4}]), ('focus elsewhere', {'cursor': 'c', 'expected_cursor': 'c', 'revision': 5, 'expected_revision': 5, 'order': ['z', 'a'], 'records': {'z': 1, 'a': 2}, 'page': [['a', 3], ['y', 5], ['b', 8], ['y', 6]], 'next': None, 'total': 13, 'size': -1, 'focus': 'z', 'parent': 'p'}, [['z', 'a', 'y', 'b'], {'z': 1, 'a': 3, 'y': 6, 'b': 8}, ['y', 'b'], None, False, 13, 'z', {'z': 1, 'a': 2, 'y': 3, 'b': 4}])]}
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
overlap page[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed
stale cursor[['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}]Passed
stale revision[['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'c', True, -1, 'more', {'a': 2, 'z': 1}]Passed
empty cursor[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], '', True, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], '', True, 9, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed
empty terminal[['z', 'a'], {'a': 2, 'z': 1}, [], None, False, 0, 'p', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], None, False, 0, 'p', {'a': 2, 'z': 1}]Passed
empty continued[['z', 'a'], {'a': 2, 'z': 1}, [], 'x', True, 9, 'more', {'a': 2, 'z': 1}][['z', 'a'], {'a': 2, 'z': 1}, [], 'x', True, 9, 'more', {'a': 2, 'z': 1}]Passed
unknown total[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, -1, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, -1, 'y', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed
focus elsewhere[['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'z', {'a': 2, 'b': 4, 'y': 3, 'z': 1}][['z', 'a', 'y', 'b'], {'a': 3, 'b': 8, 'y': 2, 'z': 1}, ['y', 'b'], None, False, 9, 'z', {'a': 2, 'b': 4, 'y': 3, 'z': 1}]Passed

SHA-256 / 1f792fa664e0b403c7c2f3d324b93a2000a1a6e4ffa7767b6c8fb835aeda5bb0

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

Case digest / fd04968ce67315ab78210f5663a2014e68a4bf2c15d08d6ceebae7d5929a1a32