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

N = 1
observations = []
def solve(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['prior_label']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['last_query']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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:
The baseline completion transition produces an incorrect observable state.

Reopening this editable picker starts from its committed label, keeps identity until text actually diverges, selects the whole label for replacement, and preserves explicit unresolved drafts on reopen. An accepted label is a baseline, not an automatic new search. Choosing edit mode invalidates old result context.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return True
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return False
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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:
The accepted-search completion transition produces an incorrect observable state.

Reopening this editable picker starts from its committed label, keeps identity until text actually diverges, selects the whole label for replacement, and preserves explicit unresolved drafts on reopen. An accepted label is a baseline, not an automatic new search. Choosing edit mode invalidates old result context.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['active'],'baseline_text':d['last_query']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['prior_label']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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:
The selection-baseline completion transition produces an incorrect observable state.

Reopening this editable picker starts from its committed label, keeps identity until text actually diverges, selects the whole label for replacement, and preserves explicit unresolved drafts on reopen. An accepted label is a baseline, not an automatic new search. Choosing edit mode invalidates old result context.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return d['value'] is not None
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return False
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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:
The accepted-baseline completion transition produces an incorrect observable state.

Reopening this editable picker starts from its committed label, keeps identity until text actually diverges, selects the whole label for replacement, and preserves explicit unresolved drafts on reopen. An accepted label is a baseline, not an automatic new search. Choosing edit mode invalidates old result context.

split: open-access


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

N = 1
observations = []
def solve(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':d['value'],'draft':d['prior_label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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(event, d):
    if event == 'initial-draft': return d['label']
    if event == 'unresolved-draft': return d['draft'] if d['unresolved'] else d['label']
    if event == 'selection': return [0,len(d['label'])]
    if event == 'identity': return d['value']
    if event == 'diverged': return d['value'] if d['new_text']==d['label'] else None
    if event == 'baseline': return d['label']
    if event == 'accepted-search': return not d['accepted']
    if event == 'selection-baseline': return {'baseline_id':d['value'],'baseline_text':d['label']}
    if event == 'accepted-baseline': return not d['unresolved'] and d['draft']==d['label']
    if event == 'cancel-edit': return {'value':None,'draft':d['label']}
    return {'unchanged': True}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
normal = {'value':'p1','label':'Pear','draft':'Peach','unresolved':True,'last_query':'pe','active':'p2','epoch':N,'prior_label':'Plum','new_text':'Pear!','accepted':True}
boundary = {'value':'','label':'','draft':'','unresolved':False,'last_query':'','active':None,'epoch':N,'prior_label':'','new_text':'','accepted':False}
check('normal initial-draft', solve('initial-draft', normal), 'Pear')
check('boundary initial-draft', solve('initial-draft', boundary), '')
check('normal unresolved-draft', solve('unresolved-draft', normal), 'Peach')
check('boundary unresolved-draft', solve('unresolved-draft', boundary), '')
check('normal selection', solve('selection', normal), [0,4])
check('boundary selection', solve('selection', boundary), [0,0])
check('normal identity', solve('identity', normal), 'p1')
check('boundary identity', solve('identity', boundary), '')
check('normal diverged', solve('diverged', normal), None)
check('boundary diverged', solve('diverged', boundary), '')
check('normal baseline', solve('baseline', normal), 'Pear')
check('boundary baseline', solve('baseline', boundary), '')
check('normal accepted-search', solve('accepted-search', normal), False)
check('boundary accepted-search', solve('accepted-search', boundary), True)
check('normal selection-baseline', solve('selection-baseline', normal), {'baseline_id':'p1','baseline_text':'Pear'})
check('boundary selection-baseline', solve('selection-baseline', boundary), {'baseline_id':'','baseline_text':''})
check('normal accepted-baseline', solve('accepted-baseline', normal), False)
check('boundary accepted-baseline', solve('accepted-baseline', boundary), True)
check('normal cancel-edit', solve('cancel-edit', normal), {'value':'p1','draft':'Pear'})
check('boundary cancel-edit', solve('cancel-edit', boundary), {'value':'','draft':''})
variant = dict(normal, **{'label':'L'*N})
check('variant query or selection payload', solve('initial-draft', variant), 'L'*N)
check('unknown completion event', solve('unrecognized', normal), {'unchanged': True})
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:
The cancel-edit completion transition produces an incorrect observable state.

Reopening this editable picker starts from its committed label, keeps identity until text actually diverges, selects the whole label for replacement, and preserves explicit unresolved drafts on reopen. An accepted label is a baseline, not an automatic new search. Choosing edit mode invalidates old result context.

split: open-access


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

N = 1
observations = []
def solve(operation, s):
    if operation == 'dirty-overlay':
        return s['server']
    if operation == 'missing-client-key':
        return s['client']['a'] if 'a' in s['client'] else s['server'].get('a')
    if operation == 'snapshot-admission':
        return s['revision'] >= s['client_revision']
    if operation == 'root-binding':
        return s['root'] == s['incoming_root']
    if operation == 'replay-gate':
        return s['pending'] if s['ready'] else []
    if operation == 'consumed-filter':
        return [e for e in s['pending'] if e not in s['consumed']]
    if operation == 'tombstones':
        return {k:v for k,v in s['server'].items() if k not in s['removed']}
    if operation == 'dirty-pruning':
        return [k for k in s['dirty'] if k in s['client']]
    if operation == 'new-client-fields':
        return sorted(set(s['client'])-set(s['server']))
    if operation == 'hydration-status':
        return 'hydrated' if s['ready'] else 'waiting'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dirty-overlay scenario 1', solve('dirty-overlay', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':9,'b':2})
check('dirty-overlay scenario 2', solve('dirty-overlay', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('dirty-overlay scenario 3', solve('dirty-overlay', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {'a':N})
check('dirty-overlay scenario 4', solve('dirty-overlay', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'a':None,'b':N})
check('dirty-overlay scenario 5', solve('dirty-overlay', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('dirty-overlay scenario 6', solve('dirty-overlay', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('missing-client-key scenario 1', solve('missing-client-key', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 9)
check('missing-client-key scenario 2', solve('missing-client-key', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 0)
check('missing-client-key scenario 3', solve('missing-client-key', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), N)
check('missing-client-key scenario 4', solve('missing-client-key', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), None)
check('missing-client-key scenario 5', solve('missing-client-key', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), N)
check('missing-client-key scenario 6', solve('missing-client-key', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('snapshot-admission scenario 1', solve('snapshot-admission', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('snapshot-admission scenario 2', solve('snapshot-admission', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('snapshot-admission scenario 3', solve('snapshot-admission', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('snapshot-admission scenario 4', solve('snapshot-admission', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), True)
check('snapshot-admission scenario 5', solve('snapshot-admission', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('snapshot-admission scenario 6', solve('snapshot-admission', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), False)
check('root-binding scenario 1', solve('root-binding', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('root-binding scenario 2', solve('root-binding', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('root-binding scenario 3', solve('root-binding', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('root-binding scenario 4', solve('root-binding', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), False)
check('root-binding scenario 5', solve('root-binding', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('root-binding scenario 6', solve('root-binding', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('replay-gate scenario 1', solve('replay-gate', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e1','e2'])
check('replay-gate scenario 2', solve('replay-gate', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('replay-gate scenario 3', solve('replay-gate', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('replay-gate scenario 4', solve('replay-gate', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['e2'])
check('replay-gate scenario 5', solve('replay-gate', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('replay-gate scenario 6', solve('replay-gate', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('consumed-filter scenario 1', solve('consumed-filter', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e2'])
check('consumed-filter scenario 2', solve('consumed-filter', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['e1'])
check('consumed-filter scenario 3', solve('consumed-filter', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('consumed-filter scenario 4', solve('consumed-filter', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('consumed-filter scenario 5', solve('consumed-filter', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), ['e3'])
check('consumed-filter scenario 6', solve('consumed-filter', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('tombstones scenario 1', solve('tombstones', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':N})
check('tombstones scenario 2', solve('tombstones', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('tombstones scenario 3', solve('tombstones', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {})
check('tombstones scenario 4', solve('tombstones', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'b':N})
check('tombstones scenario 5', solve('tombstones', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('tombstones scenario 6', solve('tombstones', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('dirty-pruning scenario 1', solve('dirty-pruning', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['a'])
check('dirty-pruning scenario 2', solve('dirty-pruning', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('dirty-pruning scenario 3', solve('dirty-pruning', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('dirty-pruning scenario 4', solve('dirty-pruning', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['a'])
check('dirty-pruning scenario 5', solve('dirty-pruning', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('dirty-pruning scenario 6', solve('dirty-pruning', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('new-client-fields scenario 1', solve('new-client-fields', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), [])
check('new-client-fields scenario 2', solve('new-client-fields', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['c'])
check('new-client-fields scenario 3', solve('new-client-fields', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('new-client-fields scenario 4', solve('new-client-fields', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('new-client-fields scenario 5', solve('new-client-fields', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('new-client-fields scenario 6', solve('new-client-fields', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('hydration-status scenario 1', solve('hydration-status', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 'hydrated')
check('hydration-status scenario 2', solve('hydration-status', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 'waiting')
check('hydration-status scenario 3', solve('hydration-status', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), 'hydrated')
check('hydration-status scenario 4', solve('hydration-status', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), 'hydrated')
check('hydration-status scenario 5', solve('hydration-status', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), 'waiting')
check('hydration-status scenario 6', solve('hydration-status', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), 'hydrated')
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):
    if operation == 'dirty-overlay':
        return {**s['server'], **s['client']}
    if operation == 'missing-client-key':
        return s['client']['a'] if 'a' in s['client'] else s['server'].get('a')
    if operation == 'snapshot-admission':
        return s['revision'] >= s['client_revision']
    if operation == 'root-binding':
        return s['root'] == s['incoming_root']
    if operation == 'replay-gate':
        return s['pending'] if s['ready'] else []
    if operation == 'consumed-filter':
        return [e for e in s['pending'] if e not in s['consumed']]
    if operation == 'tombstones':
        return {k:v for k,v in s['server'].items() if k not in s['removed']}
    if operation == 'dirty-pruning':
        return [k for k in s['dirty'] if k in s['client']]
    if operation == 'new-client-fields':
        return sorted(set(s['client'])-set(s['server']))
    if operation == 'hydration-status':
        return 'hydrated' if s['ready'] else 'waiting'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dirty-overlay scenario 1', solve('dirty-overlay', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':9,'b':2})
check('dirty-overlay scenario 2', solve('dirty-overlay', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('dirty-overlay scenario 3', solve('dirty-overlay', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {'a':N})
check('dirty-overlay scenario 4', solve('dirty-overlay', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'a':None,'b':N})
check('dirty-overlay scenario 5', solve('dirty-overlay', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('dirty-overlay scenario 6', solve('dirty-overlay', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('missing-client-key scenario 1', solve('missing-client-key', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 9)
check('missing-client-key scenario 2', solve('missing-client-key', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 0)
check('missing-client-key scenario 3', solve('missing-client-key', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), N)
check('missing-client-key scenario 4', solve('missing-client-key', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), None)
check('missing-client-key scenario 5', solve('missing-client-key', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), N)
check('missing-client-key scenario 6', solve('missing-client-key', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('snapshot-admission scenario 1', solve('snapshot-admission', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('snapshot-admission scenario 2', solve('snapshot-admission', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('snapshot-admission scenario 3', solve('snapshot-admission', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('snapshot-admission scenario 4', solve('snapshot-admission', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), True)
check('snapshot-admission scenario 5', solve('snapshot-admission', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('snapshot-admission scenario 6', solve('snapshot-admission', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), False)
check('root-binding scenario 1', solve('root-binding', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('root-binding scenario 2', solve('root-binding', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('root-binding scenario 3', solve('root-binding', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('root-binding scenario 4', solve('root-binding', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), False)
check('root-binding scenario 5', solve('root-binding', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('root-binding scenario 6', solve('root-binding', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('replay-gate scenario 1', solve('replay-gate', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e1','e2'])
check('replay-gate scenario 2', solve('replay-gate', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('replay-gate scenario 3', solve('replay-gate', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('replay-gate scenario 4', solve('replay-gate', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['e2'])
check('replay-gate scenario 5', solve('replay-gate', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('replay-gate scenario 6', solve('replay-gate', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('consumed-filter scenario 1', solve('consumed-filter', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e2'])
check('consumed-filter scenario 2', solve('consumed-filter', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['e1'])
check('consumed-filter scenario 3', solve('consumed-filter', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('consumed-filter scenario 4', solve('consumed-filter', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('consumed-filter scenario 5', solve('consumed-filter', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), ['e3'])
check('consumed-filter scenario 6', solve('consumed-filter', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('tombstones scenario 1', solve('tombstones', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':N})
check('tombstones scenario 2', solve('tombstones', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('tombstones scenario 3', solve('tombstones', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {})
check('tombstones scenario 4', solve('tombstones', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'b':N})
check('tombstones scenario 5', solve('tombstones', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('tombstones scenario 6', solve('tombstones', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('dirty-pruning scenario 1', solve('dirty-pruning', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['a'])
check('dirty-pruning scenario 2', solve('dirty-pruning', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('dirty-pruning scenario 3', solve('dirty-pruning', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('dirty-pruning scenario 4', solve('dirty-pruning', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['a'])
check('dirty-pruning scenario 5', solve('dirty-pruning', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('dirty-pruning scenario 6', solve('dirty-pruning', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('new-client-fields scenario 1', solve('new-client-fields', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), [])
check('new-client-fields scenario 2', solve('new-client-fields', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['c'])
check('new-client-fields scenario 3', solve('new-client-fields', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('new-client-fields scenario 4', solve('new-client-fields', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('new-client-fields scenario 5', solve('new-client-fields', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('new-client-fields scenario 6', solve('new-client-fields', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('hydration-status scenario 1', solve('hydration-status', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 'hydrated')
check('hydration-status scenario 2', solve('hydration-status', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 'waiting')
check('hydration-status scenario 3', solve('hydration-status', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), 'hydrated')
check('hydration-status scenario 4', solve('hydration-status', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), 'hydrated')
check('hydration-status scenario 5', solve('hydration-status', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), 'waiting')
check('hydration-status scenario 6', solve('hydration-status', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), 'hydrated')
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:
Dirty pre-hydration edits are overwritten.

Server snapshot supplies untouched keys; pre-hydration edits win only for dirty keys. Missing and null differ. Revision, roots, readiness and replay are separate hydration facts. Operation dirty-overlay 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):
    if operation == 'dirty-overlay':
        return {**s['server'], **{k:v for k,v in s['client'].items() if k in s['dirty']}}
    if operation == 'missing-client-key':
        return s['client'].get('a')
    if operation == 'snapshot-admission':
        return s['revision'] >= s['client_revision']
    if operation == 'root-binding':
        return s['root'] == s['incoming_root']
    if operation == 'replay-gate':
        return s['pending'] if s['ready'] else []
    if operation == 'consumed-filter':
        return [e for e in s['pending'] if e not in s['consumed']]
    if operation == 'tombstones':
        return {k:v for k,v in s['server'].items() if k not in s['removed']}
    if operation == 'dirty-pruning':
        return [k for k in s['dirty'] if k in s['client']]
    if operation == 'new-client-fields':
        return sorted(set(s['client'])-set(s['server']))
    if operation == 'hydration-status':
        return 'hydrated' if s['ready'] else 'waiting'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dirty-overlay scenario 1', solve('dirty-overlay', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':9,'b':2})
check('dirty-overlay scenario 2', solve('dirty-overlay', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('dirty-overlay scenario 3', solve('dirty-overlay', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {'a':N})
check('dirty-overlay scenario 4', solve('dirty-overlay', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'a':None,'b':N})
check('dirty-overlay scenario 5', solve('dirty-overlay', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('dirty-overlay scenario 6', solve('dirty-overlay', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('missing-client-key scenario 1', solve('missing-client-key', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 9)
check('missing-client-key scenario 2', solve('missing-client-key', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 0)
check('missing-client-key scenario 3', solve('missing-client-key', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), N)
check('missing-client-key scenario 4', solve('missing-client-key', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), None)
check('missing-client-key scenario 5', solve('missing-client-key', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), N)
check('missing-client-key scenario 6', solve('missing-client-key', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('snapshot-admission scenario 1', solve('snapshot-admission', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('snapshot-admission scenario 2', solve('snapshot-admission', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('snapshot-admission scenario 3', solve('snapshot-admission', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('snapshot-admission scenario 4', solve('snapshot-admission', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), True)
check('snapshot-admission scenario 5', solve('snapshot-admission', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('snapshot-admission scenario 6', solve('snapshot-admission', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), False)
check('root-binding scenario 1', solve('root-binding', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('root-binding scenario 2', solve('root-binding', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('root-binding scenario 3', solve('root-binding', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('root-binding scenario 4', solve('root-binding', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), False)
check('root-binding scenario 5', solve('root-binding', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('root-binding scenario 6', solve('root-binding', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('replay-gate scenario 1', solve('replay-gate', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e1','e2'])
check('replay-gate scenario 2', solve('replay-gate', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('replay-gate scenario 3', solve('replay-gate', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('replay-gate scenario 4', solve('replay-gate', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['e2'])
check('replay-gate scenario 5', solve('replay-gate', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('replay-gate scenario 6', solve('replay-gate', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('consumed-filter scenario 1', solve('consumed-filter', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e2'])
check('consumed-filter scenario 2', solve('consumed-filter', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['e1'])
check('consumed-filter scenario 3', solve('consumed-filter', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('consumed-filter scenario 4', solve('consumed-filter', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('consumed-filter scenario 5', solve('consumed-filter', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), ['e3'])
check('consumed-filter scenario 6', solve('consumed-filter', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('tombstones scenario 1', solve('tombstones', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':N})
check('tombstones scenario 2', solve('tombstones', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('tombstones scenario 3', solve('tombstones', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {})
check('tombstones scenario 4', solve('tombstones', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'b':N})
check('tombstones scenario 5', solve('tombstones', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('tombstones scenario 6', solve('tombstones', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('dirty-pruning scenario 1', solve('dirty-pruning', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['a'])
check('dirty-pruning scenario 2', solve('dirty-pruning', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('dirty-pruning scenario 3', solve('dirty-pruning', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('dirty-pruning scenario 4', solve('dirty-pruning', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['a'])
check('dirty-pruning scenario 5', solve('dirty-pruning', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('dirty-pruning scenario 6', solve('dirty-pruning', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('new-client-fields scenario 1', solve('new-client-fields', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), [])
check('new-client-fields scenario 2', solve('new-client-fields', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['c'])
check('new-client-fields scenario 3', solve('new-client-fields', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('new-client-fields scenario 4', solve('new-client-fields', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('new-client-fields scenario 5', solve('new-client-fields', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('new-client-fields scenario 6', solve('new-client-fields', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('hydration-status scenario 1', solve('hydration-status', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 'hydrated')
check('hydration-status scenario 2', solve('hydration-status', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 'waiting')
check('hydration-status scenario 3', solve('hydration-status', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), 'hydrated')
check('hydration-status scenario 4', solve('hydration-status', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), 'hydrated')
check('hydration-status scenario 5', solve('hydration-status', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), 'waiting')
check('hydration-status scenario 6', solve('hydration-status', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), 'hydrated')
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):
    if operation == 'dirty-overlay':
        return {**s['server'], **{k:v for k,v in s['client'].items() if k in s['dirty']}}
    if operation == 'missing-client-key':
        return s['client'].get('a') or s['server'].get('a')
    if operation == 'snapshot-admission':
        return s['revision'] >= s['client_revision']
    if operation == 'root-binding':
        return s['root'] == s['incoming_root']
    if operation == 'replay-gate':
        return s['pending'] if s['ready'] else []
    if operation == 'consumed-filter':
        return [e for e in s['pending'] if e not in s['consumed']]
    if operation == 'tombstones':
        return {k:v for k,v in s['server'].items() if k not in s['removed']}
    if operation == 'dirty-pruning':
        return [k for k in s['dirty'] if k in s['client']]
    if operation == 'new-client-fields':
        return sorted(set(s['client'])-set(s['server']))
    if operation == 'hydration-status':
        return 'hydrated' if s['ready'] else 'waiting'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dirty-overlay scenario 1', solve('dirty-overlay', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':9,'b':2})
check('dirty-overlay scenario 2', solve('dirty-overlay', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('dirty-overlay scenario 3', solve('dirty-overlay', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {'a':N})
check('dirty-overlay scenario 4', solve('dirty-overlay', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'a':None,'b':N})
check('dirty-overlay scenario 5', solve('dirty-overlay', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('dirty-overlay scenario 6', solve('dirty-overlay', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('missing-client-key scenario 1', solve('missing-client-key', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 9)
check('missing-client-key scenario 2', solve('missing-client-key', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 0)
check('missing-client-key scenario 3', solve('missing-client-key', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), N)
check('missing-client-key scenario 4', solve('missing-client-key', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), None)
check('missing-client-key scenario 5', solve('missing-client-key', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), N)
check('missing-client-key scenario 6', solve('missing-client-key', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('snapshot-admission scenario 1', solve('snapshot-admission', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('snapshot-admission scenario 2', solve('snapshot-admission', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('snapshot-admission scenario 3', solve('snapshot-admission', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('snapshot-admission scenario 4', solve('snapshot-admission', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), True)
check('snapshot-admission scenario 5', solve('snapshot-admission', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('snapshot-admission scenario 6', solve('snapshot-admission', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), False)
check('root-binding scenario 1', solve('root-binding', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), True)
check('root-binding scenario 2', solve('root-binding', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), False)
check('root-binding scenario 3', solve('root-binding', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), True)
check('root-binding scenario 4', solve('root-binding', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), False)
check('root-binding scenario 5', solve('root-binding', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), True)
check('root-binding scenario 6', solve('root-binding', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), True)
check('replay-gate scenario 1', solve('replay-gate', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e1','e2'])
check('replay-gate scenario 2', solve('replay-gate', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('replay-gate scenario 3', solve('replay-gate', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('replay-gate scenario 4', solve('replay-gate', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['e2'])
check('replay-gate scenario 5', solve('replay-gate', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('replay-gate scenario 6', solve('replay-gate', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('consumed-filter scenario 1', solve('consumed-filter', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['e2'])
check('consumed-filter scenario 2', solve('consumed-filter', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['e1'])
check('consumed-filter scenario 3', solve('consumed-filter', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), [])
check('consumed-filter scenario 4', solve('consumed-filter', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('consumed-filter scenario 5', solve('consumed-filter', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), ['e3'])
check('consumed-filter scenario 6', solve('consumed-filter', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), ['e4'])
check('tombstones scenario 1', solve('tombstones', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), {'a':N})
check('tombstones scenario 2', solve('tombstones', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), {'a':None})
check('tombstones scenario 3', solve('tombstones', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), {})
check('tombstones scenario 4', solve('tombstones', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), {'b':N})
check('tombstones scenario 5', solve('tombstones', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), {'a':N})
check('tombstones scenario 6', solve('tombstones', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), {'a':False})
check('dirty-pruning scenario 1', solve('dirty-pruning', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), ['a'])
check('dirty-pruning scenario 2', solve('dirty-pruning', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), [])
check('dirty-pruning scenario 3', solve('dirty-pruning', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('dirty-pruning scenario 4', solve('dirty-pruning', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), ['a'])
check('dirty-pruning scenario 5', solve('dirty-pruning', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('dirty-pruning scenario 6', solve('dirty-pruning', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('new-client-fields scenario 1', solve('new-client-fields', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), [])
check('new-client-fields scenario 2', solve('new-client-fields', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), ['c'])
check('new-client-fields scenario 3', solve('new-client-fields', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), ['a'])
check('new-client-fields scenario 4', solve('new-client-fields', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), [])
check('new-client-fields scenario 5', solve('new-client-fields', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), [])
check('new-client-fields scenario 6', solve('new-client-fields', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), [])
check('hydration-status scenario 1', solve('hydration-status', dict(server={'a':N,'b':2}, client={'a':9,'b':3}, dirty=['a'], revision=2, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e1','e2'], consumed=['e1'], removed=['b'])), 'hydrated')
check('hydration-status scenario 2', solve('hydration-status', dict(server={'a':None}, client={'a':0,'c':N}, dirty=[], revision=1, client_revision=2, root='r', incoming_root='x', ready=False, pending=['e1'], consumed=[], removed=[])), 'waiting')
check('hydration-status scenario 3', solve('hydration-status', dict(server={}, client={'a':N}, dirty=['a'], revision=0, client_revision=0, root='x', incoming_root='x', ready=True, pending=[], consumed=[], removed=[])), 'hydrated')
check('hydration-status scenario 4', solve('hydration-status', dict(server={'a':0,'b':N}, client={'a':None}, dirty=['a'], revision=3, client_revision=3, root='x', incoming_root='r', ready=True, pending=['e2'], consumed=['e2'], removed=['a'])), 'hydrated')
check('hydration-status scenario 5', solve('hydration-status', dict(server={'a':N}, client={}, dirty=[], revision=1, client_revision=0, root='r', incoming_root='r', ready=False, pending=['e3','e1'], consumed=['e1'], removed=['z'])), 'waiting')
check('hydration-status scenario 6', solve('hydration-status', dict(server={'a':False}, client={'a':True}, dirty=['z'], revision=0, client_revision=1, root='r', incoming_root='r', ready=True, pending=['e4'], consumed=['e9'], removed=[])), 'hydrated')
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 client properties erase server data.

Server snapshot supplies untouched keys; pre-hydration edits win only for dirty keys. Missing and null differ. Revision, roots, readiness and replay are separate hydration facts. Operation missing-client-key has the six explicit input/output oracles below.

split: open-access