broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0)
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

prompt:
Push resets position.

Scroll state belongs to a history entry, not its repeated URL. Pop restores after layout, pushes start at top, explicit anchors including the empty anchor take precedence, and positions clamp to the scrollable extent. Operation push-resets-position has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0)
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready and positions else None
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

prompt:
Layout ready deferral.

Scroll state belongs to a history entry, not its repeated URL. Pop restores after layout, pushes start at top, explicit anchors including the empty anchor take precedence, and positions clamp to the scrollable extent. Operation layout-ready-deferral has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return positions.get(entry,0)
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return min(positions.get(entry,0),height)
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

prompt:
Clamp restored position.

Scroll state belongs to a history entry, not its repeated URL. Pop restores after layout, pushes start at top, explicit anchors including the empty anchor take precedence, and positions clamp to the scrollable extent. Operation clamp-restored-position has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return anchor or positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return entry not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

prompt:
Anchor precedes saved position.

Scroll state belongs to a history entry, not its repeated URL. Pop restores after layout, pushes start at top, explicit anchors including the empty anchor take precedence, and positions clamp to the scrollable extent. Operation anchor-precedes-saved-position has the six explicit input/output oracles below.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return not positions.get(entry)
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(operation, s):
    positions, entry, path, event, ready, anchor, height, viewport = s
    if operation == 'entry-key-lookup':
        return positions.get(entry,0)
    if operation == 'push-resets-position':
        return positions.get(entry,0) if event=='pop' else 0
    if operation == 'layout-ready-deferral':
        return positions.get(entry,0) if ready else None
    if operation == 'clamp-restored-position':
        return min(max(0,positions.get(entry,0)),max(0,height-viewport))
    if operation == 'anchor-precedes-saved-position':
        return anchor if anchor is not None else positions.get(entry,0)
    if operation == 'missing-entry-detection':
        return path not in positions
    if operation == 'restoration-mode':
        return 'manual' if event=='pop' else 'auto'
    if operation == 'saved-position-prune':
        return {k:v for k,v in positions.items() if k!=entry}
    if operation == 'anchor-layout-gate':
        return anchor if ready and anchor is not None else None
    if operation == 'restore-command':
        return 'wait' if not ready else ('anchor' if anchor is not None else ('saved' if event=='pop' else 'top'))
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('entry-key-lookup scenario 1', solve('entry-key-lookup', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('entry-key-lookup scenario 2', solve('entry-key-lookup', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('entry-key-lookup scenario 3', solve('entry-key-lookup', ({},'e2','/a','pop',True,None,10,20)), 0)
check('entry-key-lookup scenario 4', solve('entry-key-lookup', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('entry-key-lookup scenario 5', solve('entry-key-lookup', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('entry-key-lookup scenario 6', solve('entry-key-lookup', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('push-resets-position scenario 1', solve('push-resets-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('push-resets-position scenario 2', solve('push-resets-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('push-resets-position scenario 3', solve('push-resets-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('push-resets-position scenario 4', solve('push-resets-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('push-resets-position scenario 5', solve('push-resets-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('push-resets-position scenario 6', solve('push-resets-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('layout-ready-deferral scenario 1', solve('layout-ready-deferral', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('layout-ready-deferral scenario 2', solve('layout-ready-deferral', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('layout-ready-deferral scenario 3', solve('layout-ready-deferral', ({},'e2','/a','pop',True,None,10,20)), 0)
check('layout-ready-deferral scenario 4', solve('layout-ready-deferral', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('layout-ready-deferral scenario 5', solve('layout-ready-deferral', ({'e1':-5},'e1','/b','replace',True,'',100,20)), -5)
check('layout-ready-deferral scenario 6', solve('layout-ready-deferral', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('clamp-restored-position scenario 1', solve('clamp-restored-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('clamp-restored-position scenario 2', solve('clamp-restored-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 0)
check('clamp-restored-position scenario 3', solve('clamp-restored-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('clamp-restored-position scenario 4', solve('clamp-restored-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 80)
check('clamp-restored-position scenario 5', solve('clamp-restored-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 0)
check('clamp-restored-position scenario 6', solve('clamp-restored-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 15)
check('anchor-precedes-saved-position scenario 1', solve('anchor-precedes-saved-position', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), N*10)
check('anchor-precedes-saved-position scenario 2', solve('anchor-precedes-saved-position', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-precedes-saved-position scenario 3', solve('anchor-precedes-saved-position', ({},'e2','/a','pop',True,None,10,20)), 0)
check('anchor-precedes-saved-position scenario 4', solve('anchor-precedes-saved-position', ({'e1':90},'e1','/a','pop',False,None,100,20)), 90)
check('anchor-precedes-saved-position scenario 5', solve('anchor-precedes-saved-position', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-precedes-saved-position scenario 6', solve('anchor-precedes-saved-position', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('missing-entry-detection scenario 1', solve('missing-entry-detection', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), False)
check('missing-entry-detection scenario 2', solve('missing-entry-detection', ({'e1':0},'e1','/a','push',True,'section',100,20)), False)
check('missing-entry-detection scenario 3', solve('missing-entry-detection', ({},'e2','/a','pop',True,None,10,20)), True)
check('missing-entry-detection scenario 4', solve('missing-entry-detection', ({'e1':90},'e1','/a','pop',False,None,100,20)), False)
check('missing-entry-detection scenario 5', solve('missing-entry-detection', ({'e1':-5},'e1','/b','replace',True,'',100,20)), False)
check('missing-entry-detection scenario 6', solve('missing-entry-detection', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), False)
check('restoration-mode scenario 1', solve('restoration-mode', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'manual')
check('restoration-mode scenario 2', solve('restoration-mode', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'auto')
check('restoration-mode scenario 3', solve('restoration-mode', ({},'e2','/a','pop',True,None,10,20)), 'manual')
check('restoration-mode scenario 4', solve('restoration-mode', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'manual')
check('restoration-mode scenario 5', solve('restoration-mode', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'auto')
check('restoration-mode scenario 6', solve('restoration-mode', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'manual')
check('saved-position-prune scenario 1', solve('saved-position-prune', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), {'e2':50})
check('saved-position-prune scenario 2', solve('saved-position-prune', ({'e1':0},'e1','/a','push',True,'section',100,20)), {})
check('saved-position-prune scenario 3', solve('saved-position-prune', ({},'e2','/a','pop',True,None,10,20)), {})
check('saved-position-prune scenario 4', solve('saved-position-prune', ({'e1':90},'e1','/a','pop',False,None,100,20)), {})
check('saved-position-prune scenario 5', solve('saved-position-prune', ({'e1':-5},'e1','/b','replace',True,'',100,20)), {})
check('saved-position-prune scenario 6', solve('saved-position-prune', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), {'/a':70})
check('anchor-layout-gate scenario 1', solve('anchor-layout-gate', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), None)
check('anchor-layout-gate scenario 2', solve('anchor-layout-gate', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'section')
check('anchor-layout-gate scenario 3', solve('anchor-layout-gate', ({},'e2','/a','pop',True,None,10,20)), None)
check('anchor-layout-gate scenario 4', solve('anchor-layout-gate', ({'e1':90},'e1','/a','pop',False,None,100,20)), None)
check('anchor-layout-gate scenario 5', solve('anchor-layout-gate', ({'e1':-5},'e1','/b','replace',True,'',100,20)), '')
check('anchor-layout-gate scenario 6', solve('anchor-layout-gate', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'section')
check('restore-command scenario 1', solve('restore-command', ({'e1':N*10,'e2':50},'e1','/a','pop',True,None,100,20)), 'saved')
check('restore-command scenario 2', solve('restore-command', ({'e1':0},'e1','/a','push',True,'section',100,20)), 'anchor')
check('restore-command scenario 3', solve('restore-command', ({},'e2','/a','pop',True,None,10,20)), 'saved')
check('restore-command scenario 4', solve('restore-command', ({'e1':90},'e1','/a','pop',False,None,100,20)), 'wait')
check('restore-command scenario 5', solve('restore-command', ({'e1':-5},'e1','/b','replace',True,'',100,20)), 'anchor')
check('restore-command scenario 6', solve('restore-command', ({'/a':70,'e1':15},'e1','/a','pop',True,'section',40,20)), 'anchor')
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)

prompt:
Missing entry detection.

Scroll state belongs to a history entry, not its repeated URL. Pop restores after layout, pushes start at top, explicit anchors including the empty anchor take precedence, and positions clamp to the scrollable extent. Operation missing-entry-detection has the six explicit input/output oracles below.

split: open-access