FA-37671 / Table interactions / Open access
Sparse loaded table row slots: slot page alignment · case 01
The table slot page alignment result violates the stipulated sparse loaded table row slots contract.
ROOT CAUSE
The slot page alignment decision uses "page=s['index']" instead of "page=(s['index']//size)*size".
VERIFIED REPAIR
Apply the complete slot page alignment rule: page=(s['index']//size)*size.
Unsuccessful approach: The attempted repair "page=(s['index']//size+1)*size" still loses a required part of the table contract.
Case contract
Sparse table slots retain absolute indices across unloaded pages, distinguish placeholder and stable row keys, clip loaded pages to declared total, decorate only placeholders with page loading/errors, and schedule each missing nonfailed noninflight page once.
Why this case matters
An offline table UI model isolates sparse loaded table row slots, including adversarial row/column relationships.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(total, pages, size, loading, errors, selected, estimate):
slots=[{'kind':'placeholder','index':i,'key':('placeholder',i),'height':estimate} for i in range(total)]
for offset,items in pages:
for j,row in enumerate(items):
i=offset+j
if not 0<=i<total: continue
if i>=len(slots): continue
slots[i]={'kind':'row','index':i,'key':('row',row['id']),'row':row,'selected':row['id'] in selected}
for s in slots:
page=s['index']
if s['kind']=='placeholder': s['loading']=page in loading; s['error']=errors.get(page)
return {'slots':slots,'requests':sorted({(s['index']//size)*size for s in slots if s['kind']=='placeholder' and (s['index']//size)*size not in loading and (s['index']//size)*size not in errors})}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':1}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 2:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':2}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 2}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 3:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':3}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 3}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 4:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':4}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 4}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 5:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':5}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 5}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| partial loaded pages | {'requests': [4], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': True}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}, {'index': 4, 'key': ['row', 'e'], 'kind': 'row', 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'error': None, 'height': 9, 'index': 5, 'key': ['placeholder', 5], 'kind': 'placeholder', 'loading': False}, {'error': 'failed', 'height': 9, 'index': 6, 'key': ['placeholder', 6], 'kind': 'placeholder', 'loading': False}]} | {'requests': [4], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': True}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': True}, {'index': 4, 'key': ['row', 'e'], 'kind': 'row', 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'error': None, 'height': 9, 'index': 5, 'key': ['placeholder', 5], 'kind': 'placeholder', 'loading': False}, {'error': 'failed', 'height': 9, 'index': 6, 'key': ['placeholder', 6], 'kind': 'placeholder', 'loading': False}]} | Failed |
| offset loaded rows | {'requests': [0, 4], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': True}, {'index': 3, 'key': ['row', 'd'], 'kind': 'row', 'row': {'id': 'd'}, 'selected': False}, {'error': None, 'height': 9, 'index': 4, 'key': ['placeholder', 4], 'kind': 'placeholder', 'loading': False}]} | {'requests': [0, 4], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': True}, {'index': 3, 'key': ['row', 'd'], 'kind': 'row', 'row': {'id': 'd'}, 'selected': False}, {'error': None, 'height': 9, 'index': 4, 'key': ['placeholder', 4], 'kind': 'placeholder', 'loading': False}]} | Passed |
| outside total | {'requests': [0], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': False}]} | {'requests': [0], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': False}]} | Passed |
| empty table | {'requests': [], 'slots': []} | {'requests': [], 'slots': []} | Passed |
| all placeholders | {'requests': [0, 2], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}]} | {'requests': [0, 2], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}]} | Passed |
| replacement page | {'requests': [], 'slots': [{'index': 0, 'key': ['row', 'new'], 'kind': 'row', 'row': {'id': 'new'}, 'selected': True}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}]} | {'requests': [], 'slots': [{'index': 0, 'key': ['row', 'new'], 'kind': 'row', 'row': {'id': 'new'}, 'selected': True}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}]} | Passed |
SHA-256 / facd399642825db175d2d7d1d451eea01128ac9a541225266bb45facb42567b4
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(total, pages, size, loading, errors, selected, estimate):
slots=[{'kind':'placeholder','index':i,'key':('placeholder',i),'height':estimate} for i in range(total)]
for offset,items in pages:
for j,row in enumerate(items):
i=offset+j
if not 0<=i<total: continue
if i>=len(slots): continue
slots[i]={'kind':'row','index':i,'key':('row',row['id']),'row':row,'selected':row['id'] in selected}
for s in slots:
page=(s['index']//size+1)*size
if s['kind']=='placeholder': s['loading']=page in loading; s['error']=errors.get(page)
return {'slots':slots,'requests':sorted({(s['index']//size)*size for s in slots if s['kind']=='placeholder' and (s['index']//size)*size not in loading and (s['index']//size)*size not in errors})}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':1}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 2:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':2}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 2}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 3:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':3}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 3}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 4:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':4}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 4}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 5:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':5}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 5}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| partial loaded pages | {'requests': [4], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}, {'index': 4, 'key': ['row', 'e'], 'kind': 'row', 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'error': 'failed', 'height': 9, 'index': 5, 'key': ['placeholder', 5], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 6, 'key': ['placeholder', 6], 'kind': 'placeholder', 'loading': False}]} | {'requests': [4], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': True}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': True}, {'index': 4, 'key': ['row', 'e'], 'kind': 'row', 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'error': None, 'height': 9, 'index': 5, 'key': ['placeholder', 5], 'kind': 'placeholder', 'loading': False}, {'error': 'failed', 'height': 9, 'index': 6, 'key': ['placeholder', 6], 'kind': 'placeholder', 'loading': False}]} | Failed |
| offset loaded rows | {'requests': [0, 4], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': True}, {'index': 3, 'key': ['row', 'd'], 'kind': 'row', 'row': {'id': 'd'}, 'selected': False}, {'error': None, 'height': 9, 'index': 4, 'key': ['placeholder', 4], 'kind': 'placeholder', 'loading': False}]} | {'requests': [0, 4], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': True}, {'index': 3, 'key': ['row', 'd'], 'kind': 'row', 'row': {'id': 'd'}, 'selected': False}, {'error': None, 'height': 9, 'index': 4, 'key': ['placeholder', 4], 'kind': 'placeholder', 'loading': False}]} | Passed |
| outside total | {'requests': [0], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': False}]} | {'requests': [0], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': False}]} | Passed |
| empty table | {'requests': [], 'slots': []} | {'requests': [], 'slots': []} | Passed |
| all placeholders | {'requests': [0, 2], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}]} | {'requests': [0, 2], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}]} | Passed |
| replacement page | {'requests': [], 'slots': [{'index': 0, 'key': ['row', 'new'], 'kind': 'row', 'row': {'id': 'new'}, 'selected': True}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}]} | {'requests': [], 'slots': [{'index': 0, 'key': ['row', 'new'], 'kind': 'row', 'row': {'id': 'new'}, 'selected': True}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}]} | Passed |
SHA-256 / 7890dcce19e7bd799daac262641d32955821f1a8e19394d65e953843cfee12eb
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(total, pages, size, loading, errors, selected, estimate):
slots=[{'kind':'placeholder','index':i,'key':('placeholder',i),'height':estimate} for i in range(total)]
for offset,items in pages:
for j,row in enumerate(items):
i=offset+j
if not 0<=i<total: continue
if i>=len(slots): continue
slots[i]={'kind':'row','index':i,'key':('row',row['id']),'row':row,'selected':row['id'] in selected}
for s in slots:
page=(s['index']//size)*size
if s['kind']=='placeholder': s['loading']=page in loading; s['error']=errors.get(page)
return {'slots':slots,'requests':sorted({(s['index']//size)*size for s in slots if s['kind']=='placeholder' and (s['index']//size)*size not in loading and (s['index']//size)*size not in errors})}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':1}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 2:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':2}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 2}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 3:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':3}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 3}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 4:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':4}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 4}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
if N == 5:
check('partial loaded pages', solve(7, [(0,[{'id':'a'},{'id':'b'}]),(4,[{'id':'e','v':5}])], 2, [2], {6:'failed'}, ['e'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': True, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': True, 'error': None}, {'kind': 'row', 'index': 4, 'key': ('row', 'e'), 'row': {'id': 'e', 'v': 5}, 'selected': True}, {'kind': 'placeholder', 'index': 5, 'key': ('placeholder', 5), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 6, 'key': ('placeholder', 6), 'height': 9, 'loading': False, 'error': 'failed'}], 'requests': [4]})
check('offset loaded rows', solve(5, [(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, ['c'], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': True}, {'kind': 'row', 'index': 3, 'key': ('row', 'd'), 'row': {'id': 'd'}, 'selected': False}, {'kind': 'placeholder', 'index': 4, 'key': ('placeholder', 4), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 4]})
check('outside total', solve(3, [(-1,[{'id':'x'},{'id':'a'}]),(2,[{'id':'c'},{'id':'d'}])], 2, [], {}, [], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'a'), 'row': {'id': 'a'}, 'selected': False}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'row', 'index': 2, 'key': ('row', 'c'), 'row': {'id': 'c'}, 'selected': False}], 'requests': [0]})
check('empty table', solve(0, [], 2, [], {}, [], 9), {'slots': [], 'requests': []})
check('all placeholders', solve(4, [], 2, [], {}, [], 9), {'slots': [{'kind': 'placeholder', 'index': 0, 'key': ('placeholder', 0), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 1, 'key': ('placeholder', 1), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 2, 'key': ('placeholder', 2), 'height': 9, 'loading': False, 'error': None}, {'kind': 'placeholder', 'index': 3, 'key': ('placeholder', 3), 'height': 9, 'loading': False, 'error': None}], 'requests': [0, 2]})
check('replacement page', solve(2, [(0,[{'id':'a'},{'id':'b'}]),(0,[{'id':'new'}])], 2, [0], {0:'stale'}, ['new'], 9), {'slots': [{'kind': 'row', 'index': 0, 'key': ('row', 'new'), 'row': {'id': 'new'}, 'selected': True}, {'kind': 'row', 'index': 1, 'key': ('row', 'b'), 'row': {'id': 'b'}, 'selected': False}], 'requests': []})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| partial loaded pages | {'requests': [4], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': True}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': True}, {'index': 4, 'key': ['row', 'e'], 'kind': 'row', 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'error': None, 'height': 9, 'index': 5, 'key': ['placeholder', 5], 'kind': 'placeholder', 'loading': False}, {'error': 'failed', 'height': 9, 'index': 6, 'key': ['placeholder', 6], 'kind': 'placeholder', 'loading': False}]} | {'requests': [4], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': True}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': True}, {'index': 4, 'key': ['row', 'e'], 'kind': 'row', 'row': {'id': 'e', 'v': 1}, 'selected': True}, {'error': None, 'height': 9, 'index': 5, 'key': ['placeholder', 5], 'kind': 'placeholder', 'loading': False}, {'error': 'failed', 'height': 9, 'index': 6, 'key': ['placeholder', 6], 'kind': 'placeholder', 'loading': False}]} | Passed |
| offset loaded rows | {'requests': [0, 4], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': True}, {'index': 3, 'key': ['row', 'd'], 'kind': 'row', 'row': {'id': 'd'}, 'selected': False}, {'error': None, 'height': 9, 'index': 4, 'key': ['placeholder', 4], 'kind': 'placeholder', 'loading': False}]} | {'requests': [0, 4], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': True}, {'index': 3, 'key': ['row', 'd'], 'kind': 'row', 'row': {'id': 'd'}, 'selected': False}, {'error': None, 'height': 9, 'index': 4, 'key': ['placeholder', 4], 'kind': 'placeholder', 'loading': False}]} | Passed |
| outside total | {'requests': [0], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': False}]} | {'requests': [0], 'slots': [{'index': 0, 'key': ['row', 'a'], 'kind': 'row', 'row': {'id': 'a'}, 'selected': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'index': 2, 'key': ['row', 'c'], 'kind': 'row', 'row': {'id': 'c'}, 'selected': False}]} | Passed |
| empty table | {'requests': [], 'slots': []} | {'requests': [], 'slots': []} | Passed |
| all placeholders | {'requests': [0, 2], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}]} | {'requests': [0, 2], 'slots': [{'error': None, 'height': 9, 'index': 0, 'key': ['placeholder', 0], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 1, 'key': ['placeholder', 1], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 2, 'key': ['placeholder', 2], 'kind': 'placeholder', 'loading': False}, {'error': None, 'height': 9, 'index': 3, 'key': ['placeholder', 3], 'kind': 'placeholder', 'loading': False}]} | Passed |
| replacement page | {'requests': [], 'slots': [{'index': 0, 'key': ['row', 'new'], 'kind': 'row', 'row': {'id': 'new'}, 'selected': True}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}]} | {'requests': [], 'slots': [{'index': 0, 'key': ['row', 'new'], 'kind': 'row', 'row': {'id': 'new'}, 'selected': True}, {'index': 1, 'key': ['row', 'b'], 'kind': 'row', 'row': {'id': 'b'}, 'selected': False}]} | Passed |
SHA-256 / dc8cb6c4ee073b0547ec45ff509a935c49897a8c671a07d16eac821595565ea8
Verification & scope
Total is a nonnegative integer and page size is positive; page offsets are integral and may clip outside the table. Deterministic offline table UI model; no browser, DOM, framework, or standards conformance is claimed. 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:03.513959+00:00.
Case digest / e8589051c534621a0d0874fa8ee0fa94b5a844c859d0a51368bff40fb887991c