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

N = 1
observations = []
def solve(operation, s):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return None
    if operation == 'unchanged-write-suppression':
        return draft!=saved
    if operation == 'failed-write-retry-buffer':
        return draft if outcome!='ok' else None
    if operation == 'timer-delay-remaining':
        return max(0,scheduled+debounce-now) if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
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):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return 'storage-full' if outcome!='ok' else None
    if operation == 'unchanged-write-suppression':
        return draft!=saved
    if operation == 'failed-write-retry-buffer':
        return draft if outcome!='ok' else None
    if operation == 'timer-delay-remaining':
        return max(0,scheduled+debounce-now) if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
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:
Quota error classification.

A debounced local snapshot write commits saved data only after a permitted successful write. Failures retain dirty edits, no-op snapshots avoid writes, and timer deadlines include equality. Operation quota-error-classification 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):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return 'storage-full' if outcome=='quota' else ('unavailable' if not writable else None)
    if operation == 'unchanged-write-suppression':
        return draft is not saved
    if operation == 'failed-write-retry-buffer':
        return draft if outcome!='ok' else None
    if operation == 'timer-delay-remaining':
        return max(0,scheduled+debounce-now) if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(operation, s):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return 'storage-full' if outcome=='quota' else ('unavailable' if not writable else None)
    if operation == 'unchanged-write-suppression':
        return bool(draft)
    if operation == 'failed-write-retry-buffer':
        return draft if outcome!='ok' else None
    if operation == 'timer-delay-remaining':
        return max(0,scheduled+debounce-now) if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
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:
Unchanged write suppression.

A debounced local snapshot write commits saved data only after a permitted successful write. Failures retain dirty edits, no-op snapshots avoid writes, and timer deadlines include equality. Operation unchanged-write-suppression 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):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return 'storage-full' if outcome=='quota' else ('unavailable' if not writable else None)
    if operation == 'unchanged-write-suppression':
        return draft!=saved
    if operation == 'failed-write-retry-buffer':
        return None
    if operation == 'timer-delay-remaining':
        return max(0,scheduled+debounce-now) if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
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):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return 'storage-full' if outcome=='quota' else ('unavailable' if not writable else None)
    if operation == 'unchanged-write-suppression':
        return draft!=saved
    if operation == 'failed-write-retry-buffer':
        return draft if outcome=='quota' else None
    if operation == 'timer-delay-remaining':
        return max(0,scheduled+debounce-now) if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
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:
Failed write retry buffer.

A debounced local snapshot write commits saved data only after a permitted successful write. Failures retain dirty edits, no-op snapshots avoid writes, and timer deadlines include equality. Operation failed-write-retry-buffer 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):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return 'storage-full' if outcome=='quota' else ('unavailable' if not writable else None)
    if operation == 'unchanged-write-suppression':
        return draft!=saved
    if operation == 'failed-write-retry-buffer':
        return draft if outcome!='ok' else None
    if operation == 'timer-delay-remaining':
        return scheduled+debounce-now if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
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):
    saved, draft, dirty, writable, outcome, scheduled, now, debounce = s
    if operation == 'commit-only-on-success':
        return draft if outcome=='ok' and writable else saved
    if operation == 'retain-dirty-on-quota':
        return dirty and (not writable or outcome!='ok')
    if operation == 'schedule-debounce':
        return None if not dirty else (now+debounce if scheduled is None else scheduled)
    if operation == 'flush-deadline-inclusive':
        return scheduled is not None and now>=scheduled+debounce
    if operation == 'write-permission-gate':
        return dirty and writable
    if operation == 'success-cancels-timer':
        return None if outcome=='ok' else scheduled
    if operation == 'quota-error-classification':
        return 'storage-full' if outcome=='quota' else ('unavailable' if not writable else None)
    if operation == 'unchanged-write-suppression':
        return draft!=saved
    if operation == 'failed-write-retry-buffer':
        return draft if outcome!='ok' else None
    if operation == 'timer-delay-remaining':
        return max(0,scheduled-now) if scheduled is not None else None
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('commit-only-on-success scenario 1', solve('commit-only-on-success', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), {'a':N+2})
check('commit-only-on-success scenario 2', solve('commit-only-on-success', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':N})
check('commit-only-on-success scenario 3', solve('commit-only-on-success', ({}, {},False,True,'ok',None,5,2)), {})
check('commit-only-on-success scenario 4', solve('commit-only-on-success', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':1})
check('commit-only-on-success scenario 5', solve('commit-only-on-success', ({'a':0},{'a':None},True,True,'ok',3,5,2)), {'a':None})
check('commit-only-on-success scenario 6', solve('commit-only-on-success', ({'a':N},{'a':N},False,False,'ok',2,9,2)), {'a':N})
check('retain-dirty-on-quota scenario 1', solve('retain-dirty-on-quota', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), False)
check('retain-dirty-on-quota scenario 2', solve('retain-dirty-on-quota', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('retain-dirty-on-quota scenario 3', solve('retain-dirty-on-quota', ({}, {},False,True,'ok',None,5,2)), False)
check('retain-dirty-on-quota scenario 4', solve('retain-dirty-on-quota', ({'a':1},{'a':N},True,False,'denied',None,5,0)), True)
check('retain-dirty-on-quota scenario 5', solve('retain-dirty-on-quota', ({'a':0},{'a':None},True,True,'ok',3,5,2)), False)
check('retain-dirty-on-quota scenario 6', solve('retain-dirty-on-quota', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('schedule-debounce scenario 1', solve('schedule-debounce', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 2)
check('schedule-debounce scenario 2', solve('schedule-debounce', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('schedule-debounce scenario 3', solve('schedule-debounce', ({}, {},False,True,'ok',None,5,2)), None)
check('schedule-debounce scenario 4', solve('schedule-debounce', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 5)
check('schedule-debounce scenario 5', solve('schedule-debounce', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 3)
check('schedule-debounce scenario 6', solve('schedule-debounce', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('flush-deadline-inclusive scenario 1', solve('flush-deadline-inclusive', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('flush-deadline-inclusive scenario 2', solve('flush-deadline-inclusive', ({'a':N},{'a':0},True,True,'quota',3,4,2)), False)
check('flush-deadline-inclusive scenario 3', solve('flush-deadline-inclusive', ({}, {},False,True,'ok',None,5,2)), False)
check('flush-deadline-inclusive scenario 4', solve('flush-deadline-inclusive', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('flush-deadline-inclusive scenario 5', solve('flush-deadline-inclusive', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('flush-deadline-inclusive scenario 6', solve('flush-deadline-inclusive', ({'a':N},{'a':N},False,False,'ok',2,9,2)), True)
check('write-permission-gate scenario 1', solve('write-permission-gate', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('write-permission-gate scenario 2', solve('write-permission-gate', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('write-permission-gate scenario 3', solve('write-permission-gate', ({}, {},False,True,'ok',None,5,2)), False)
check('write-permission-gate scenario 4', solve('write-permission-gate', ({'a':1},{'a':N},True,False,'denied',None,5,0)), False)
check('write-permission-gate scenario 5', solve('write-permission-gate', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('write-permission-gate scenario 6', solve('write-permission-gate', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('success-cancels-timer scenario 1', solve('success-cancels-timer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('success-cancels-timer scenario 2', solve('success-cancels-timer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 3)
check('success-cancels-timer scenario 3', solve('success-cancels-timer', ({}, {},False,True,'ok',None,5,2)), None)
check('success-cancels-timer scenario 4', solve('success-cancels-timer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('success-cancels-timer scenario 5', solve('success-cancels-timer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('success-cancels-timer scenario 6', solve('success-cancels-timer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('quota-error-classification scenario 1', solve('quota-error-classification', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('quota-error-classification scenario 2', solve('quota-error-classification', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 'storage-full')
check('quota-error-classification scenario 3', solve('quota-error-classification', ({}, {},False,True,'ok',None,5,2)), None)
check('quota-error-classification scenario 4', solve('quota-error-classification', ({'a':1},{'a':N},True,False,'denied',None,5,0)), 'unavailable')
check('quota-error-classification scenario 5', solve('quota-error-classification', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('quota-error-classification scenario 6', solve('quota-error-classification', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 'unavailable')
check('unchanged-write-suppression scenario 1', solve('unchanged-write-suppression', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), True)
check('unchanged-write-suppression scenario 2', solve('unchanged-write-suppression', ({'a':N},{'a':0},True,True,'quota',3,4,2)), True)
check('unchanged-write-suppression scenario 3', solve('unchanged-write-suppression', ({}, {},False,True,'ok',None,5,2)), False)
check('unchanged-write-suppression scenario 4', solve('unchanged-write-suppression', ({'a':1},{'a':N},True,False,'denied',None,5,0)), N!=1)
check('unchanged-write-suppression scenario 5', solve('unchanged-write-suppression', ({'a':0},{'a':None},True,True,'ok',3,5,2)), True)
check('unchanged-write-suppression scenario 6', solve('unchanged-write-suppression', ({'a':N},{'a':N},False,False,'ok',2,9,2)), False)
check('failed-write-retry-buffer scenario 1', solve('failed-write-retry-buffer', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), None)
check('failed-write-retry-buffer scenario 2', solve('failed-write-retry-buffer', ({'a':N},{'a':0},True,True,'quota',3,4,2)), {'a':0})
check('failed-write-retry-buffer scenario 3', solve('failed-write-retry-buffer', ({}, {},False,True,'ok',None,5,2)), None)
check('failed-write-retry-buffer scenario 4', solve('failed-write-retry-buffer', ({'a':1},{'a':N},True,False,'denied',None,5,0)), {'a':N})
check('failed-write-retry-buffer scenario 5', solve('failed-write-retry-buffer', ({'a':0},{'a':None},True,True,'ok',3,5,2)), None)
check('failed-write-retry-buffer scenario 6', solve('failed-write-retry-buffer', ({'a':N},{'a':N},False,False,'ok',2,9,2)), None)
check('timer-delay-remaining scenario 1', solve('timer-delay-remaining', ({'a':1},{'a':N+2},True,True,'ok',2,5,2)), 0)
check('timer-delay-remaining scenario 2', solve('timer-delay-remaining', ({'a':N},{'a':0},True,True,'quota',3,4,2)), 1)
check('timer-delay-remaining scenario 3', solve('timer-delay-remaining', ({}, {},False,True,'ok',None,5,2)), None)
check('timer-delay-remaining scenario 4', solve('timer-delay-remaining', ({'a':1},{'a':N},True,False,'denied',None,5,0)), None)
check('timer-delay-remaining scenario 5', solve('timer-delay-remaining', ({'a':0},{'a':None},True,True,'ok',3,5,2)), 0)
check('timer-delay-remaining scenario 6', solve('timer-delay-remaining', ({'a':N},{'a':N},False,False,'ok',2,9,2)), 0)
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:
Timer delay remaining.

A debounced local snapshot write commits saved data only after a permitted successful write. Failures retain dirty edits, no-op snapshots avoid writes, and timer deadlines include equality. Operation timer-delay-remaining 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):
    draft, server, dirty, saved_revision, server_revision, deleted = s
    if operation == 'restore-dirty-fields':
        return draft
    if operation == 'deletion-overlay':
        return {k:v for k,v in draft.items() if k not in deleted}
    if operation == 'conflict-fields':
        return [k for k in dirty if k in server and draft.get(k)!=server[k]]
    if operation == 'server-advance-warning':
        return server_revision>saved_revision and bool(dirty)
    if operation == 'clean-draft-expiry':
        return not dirty and not deleted
    if operation == 'restore-added-fields':
        return {k:v for k,v in draft.items() if k not in server}
    if operation == 'discard-restores-server':
        return dict(server)
    if operation == 'edited-field-export':
        return {k:draft[k] for k in dirty if k in draft and k not in deleted}
    if operation == 'restoration-review':
        return 'review' if dirty and server_revision>saved_revision else 'restore'
    if operation == 'known-deletion-list':
        return [k for k in deleted if k in server]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('restore-dirty-fields scenario 1', solve('restore-dirty-fields', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':N,'b':3})
check('restore-dirty-fields scenario 2', solve('restore-dirty-fields', ({}, {'a':N},[],2,2,[])), {'a':N})
check('restore-dirty-fields scenario 3', solve('restore-dirty-fields', ({'a':None},{'a':0},['a'],2,1,[])), {'a':None})
check('restore-dirty-fields scenario 4', solve('restore-dirty-fields', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':0,'b':N})
check('restore-dirty-fields scenario 5', solve('restore-dirty-fields', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('restore-dirty-fields scenario 6', solve('restore-dirty-fields', ({'a':N},{'a':N},[],1,1,['x'])), {'a':N})
check('deletion-overlay scenario 1', solve('deletion-overlay', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':N,'b':2})
check('deletion-overlay scenario 2', solve('deletion-overlay', ({}, {'a':N},[],2,2,[])), {})
check('deletion-overlay scenario 3', solve('deletion-overlay', ({'a':None},{'a':0},['a'],2,1,[])), {'a':None})
check('deletion-overlay scenario 4', solve('deletion-overlay', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':0})
check('deletion-overlay scenario 5', solve('deletion-overlay', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('deletion-overlay scenario 6', solve('deletion-overlay', ({'a':N},{'a':N},[],1,1,['x'])), {'a':N})
check('conflict-fields scenario 1', solve('conflict-fields', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), ['a'])
check('conflict-fields scenario 2', solve('conflict-fields', ({}, {'a':N},[],2,2,[])), [])
check('conflict-fields scenario 3', solve('conflict-fields', ({'a':None},{'a':0},['a'],2,1,[])), ['a'])
check('conflict-fields scenario 4', solve('conflict-fields', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), (['a'] if N==2 else ['a','b']))
check('conflict-fields scenario 5', solve('conflict-fields', ({'a':N},{},['a'],0,0,[])), [])
check('conflict-fields scenario 6', solve('conflict-fields', ({'a':N},{'a':N},[],1,1,['x'])), [])
check('server-advance-warning scenario 1', solve('server-advance-warning', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), True)
check('server-advance-warning scenario 2', solve('server-advance-warning', ({}, {'a':N},[],2,2,[])), False)
check('server-advance-warning scenario 3', solve('server-advance-warning', ({'a':None},{'a':0},['a'],2,1,[])), False)
check('server-advance-warning scenario 4', solve('server-advance-warning', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), True)
check('server-advance-warning scenario 5', solve('server-advance-warning', ({'a':N},{},['a'],0,0,[])), False)
check('server-advance-warning scenario 6', solve('server-advance-warning', ({'a':N},{'a':N},[],1,1,['x'])), False)
check('clean-draft-expiry scenario 1', solve('clean-draft-expiry', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), False)
check('clean-draft-expiry scenario 2', solve('clean-draft-expiry', ({}, {'a':N},[],2,2,[])), True)
check('clean-draft-expiry scenario 3', solve('clean-draft-expiry', ({'a':None},{'a':0},['a'],2,1,[])), False)
check('clean-draft-expiry scenario 4', solve('clean-draft-expiry', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), False)
check('clean-draft-expiry scenario 5', solve('clean-draft-expiry', ({'a':N},{},['a'],0,0,[])), False)
check('clean-draft-expiry scenario 6', solve('clean-draft-expiry', ({'a':N},{'a':N},[],1,1,['x'])), False)
check('restore-added-fields scenario 1', solve('restore-added-fields', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {})
check('restore-added-fields scenario 2', solve('restore-added-fields', ({}, {'a':N},[],2,2,[])), {})
check('restore-added-fields scenario 3', solve('restore-added-fields', ({'a':None},{'a':0},['a'],2,1,[])), {})
check('restore-added-fields scenario 4', solve('restore-added-fields', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {})
check('restore-added-fields scenario 5', solve('restore-added-fields', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('restore-added-fields scenario 6', solve('restore-added-fields', ({'a':N},{'a':N},[],1,1,['x'])), {})
check('discard-restores-server scenario 1', solve('discard-restores-server', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':0,'b':3})
check('discard-restores-server scenario 2', solve('discard-restores-server', ({}, {'a':N},[],2,2,[])), {'a':N})
check('discard-restores-server scenario 3', solve('discard-restores-server', ({'a':None},{'a':0},['a'],2,1,[])), {'a':0})
check('discard-restores-server scenario 4', solve('discard-restores-server', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':1,'b':2})
check('discard-restores-server scenario 5', solve('discard-restores-server', ({'a':N},{},['a'],0,0,[])), {})
check('discard-restores-server scenario 6', solve('discard-restores-server', ({'a':N},{'a':N},[],1,1,['x'])), {'a':N})
check('edited-field-export scenario 1', solve('edited-field-export', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':N})
check('edited-field-export scenario 2', solve('edited-field-export', ({}, {'a':N},[],2,2,[])), {})
check('edited-field-export scenario 3', solve('edited-field-export', ({'a':None},{'a':0},['a'],2,1,[])), {'a':None})
check('edited-field-export scenario 4', solve('edited-field-export', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':0})
check('edited-field-export scenario 5', solve('edited-field-export', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('edited-field-export scenario 6', solve('edited-field-export', ({'a':N},{'a':N},[],1,1,['x'])), {})
check('restoration-review scenario 1', solve('restoration-review', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), 'review')
check('restoration-review scenario 2', solve('restoration-review', ({}, {'a':N},[],2,2,[])), 'restore')
check('restoration-review scenario 3', solve('restoration-review', ({'a':None},{'a':0},['a'],2,1,[])), 'restore')
check('restoration-review scenario 4', solve('restoration-review', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), 'review')
check('restoration-review scenario 5', solve('restoration-review', ({'a':N},{},['a'],0,0,[])), 'restore')
check('restoration-review scenario 6', solve('restoration-review', ({'a':N},{'a':N},[],1,1,['x'])), 'restore')
check('known-deletion-list scenario 1', solve('known-deletion-list', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), [])
check('known-deletion-list scenario 2', solve('known-deletion-list', ({}, {'a':N},[],2,2,[])), [])
check('known-deletion-list scenario 3', solve('known-deletion-list', ({'a':None},{'a':0},['a'],2,1,[])), [])
check('known-deletion-list scenario 4', solve('known-deletion-list', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), ['b'])
check('known-deletion-list scenario 5', solve('known-deletion-list', ({'a':N},{},['a'],0,0,[])), [])
check('known-deletion-list scenario 6', solve('known-deletion-list', ({'a':N},{'a':N},[],1,1,['x'])), [])
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):
    draft, server, dirty, saved_revision, server_revision, deleted = s
    if operation == 'restore-dirty-fields':
        return {**draft,**server}
    if operation == 'deletion-overlay':
        return {k:v for k,v in draft.items() if k not in deleted}
    if operation == 'conflict-fields':
        return [k for k in dirty if k in server and draft.get(k)!=server[k]]
    if operation == 'server-advance-warning':
        return server_revision>saved_revision and bool(dirty)
    if operation == 'clean-draft-expiry':
        return not dirty and not deleted
    if operation == 'restore-added-fields':
        return {k:v for k,v in draft.items() if k not in server}
    if operation == 'discard-restores-server':
        return dict(server)
    if operation == 'edited-field-export':
        return {k:draft[k] for k in dirty if k in draft and k not in deleted}
    if operation == 'restoration-review':
        return 'review' if dirty and server_revision>saved_revision else 'restore'
    if operation == 'known-deletion-list':
        return [k for k in deleted if k in server]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('restore-dirty-fields scenario 1', solve('restore-dirty-fields', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':N,'b':3})
check('restore-dirty-fields scenario 2', solve('restore-dirty-fields', ({}, {'a':N},[],2,2,[])), {'a':N})
check('restore-dirty-fields scenario 3', solve('restore-dirty-fields', ({'a':None},{'a':0},['a'],2,1,[])), {'a':None})
check('restore-dirty-fields scenario 4', solve('restore-dirty-fields', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':0,'b':N})
check('restore-dirty-fields scenario 5', solve('restore-dirty-fields', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('restore-dirty-fields scenario 6', solve('restore-dirty-fields', ({'a':N},{'a':N},[],1,1,['x'])), {'a':N})
check('deletion-overlay scenario 1', solve('deletion-overlay', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':N,'b':2})
check('deletion-overlay scenario 2', solve('deletion-overlay', ({}, {'a':N},[],2,2,[])), {})
check('deletion-overlay scenario 3', solve('deletion-overlay', ({'a':None},{'a':0},['a'],2,1,[])), {'a':None})
check('deletion-overlay scenario 4', solve('deletion-overlay', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':0})
check('deletion-overlay scenario 5', solve('deletion-overlay', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('deletion-overlay scenario 6', solve('deletion-overlay', ({'a':N},{'a':N},[],1,1,['x'])), {'a':N})
check('conflict-fields scenario 1', solve('conflict-fields', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), ['a'])
check('conflict-fields scenario 2', solve('conflict-fields', ({}, {'a':N},[],2,2,[])), [])
check('conflict-fields scenario 3', solve('conflict-fields', ({'a':None},{'a':0},['a'],2,1,[])), ['a'])
check('conflict-fields scenario 4', solve('conflict-fields', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), (['a'] if N==2 else ['a','b']))
check('conflict-fields scenario 5', solve('conflict-fields', ({'a':N},{},['a'],0,0,[])), [])
check('conflict-fields scenario 6', solve('conflict-fields', ({'a':N},{'a':N},[],1,1,['x'])), [])
check('server-advance-warning scenario 1', solve('server-advance-warning', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), True)
check('server-advance-warning scenario 2', solve('server-advance-warning', ({}, {'a':N},[],2,2,[])), False)
check('server-advance-warning scenario 3', solve('server-advance-warning', ({'a':None},{'a':0},['a'],2,1,[])), False)
check('server-advance-warning scenario 4', solve('server-advance-warning', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), True)
check('server-advance-warning scenario 5', solve('server-advance-warning', ({'a':N},{},['a'],0,0,[])), False)
check('server-advance-warning scenario 6', solve('server-advance-warning', ({'a':N},{'a':N},[],1,1,['x'])), False)
check('clean-draft-expiry scenario 1', solve('clean-draft-expiry', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), False)
check('clean-draft-expiry scenario 2', solve('clean-draft-expiry', ({}, {'a':N},[],2,2,[])), True)
check('clean-draft-expiry scenario 3', solve('clean-draft-expiry', ({'a':None},{'a':0},['a'],2,1,[])), False)
check('clean-draft-expiry scenario 4', solve('clean-draft-expiry', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), False)
check('clean-draft-expiry scenario 5', solve('clean-draft-expiry', ({'a':N},{},['a'],0,0,[])), False)
check('clean-draft-expiry scenario 6', solve('clean-draft-expiry', ({'a':N},{'a':N},[],1,1,['x'])), False)
check('restore-added-fields scenario 1', solve('restore-added-fields', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {})
check('restore-added-fields scenario 2', solve('restore-added-fields', ({}, {'a':N},[],2,2,[])), {})
check('restore-added-fields scenario 3', solve('restore-added-fields', ({'a':None},{'a':0},['a'],2,1,[])), {})
check('restore-added-fields scenario 4', solve('restore-added-fields', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {})
check('restore-added-fields scenario 5', solve('restore-added-fields', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('restore-added-fields scenario 6', solve('restore-added-fields', ({'a':N},{'a':N},[],1,1,['x'])), {})
check('discard-restores-server scenario 1', solve('discard-restores-server', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':0,'b':3})
check('discard-restores-server scenario 2', solve('discard-restores-server', ({}, {'a':N},[],2,2,[])), {'a':N})
check('discard-restores-server scenario 3', solve('discard-restores-server', ({'a':None},{'a':0},['a'],2,1,[])), {'a':0})
check('discard-restores-server scenario 4', solve('discard-restores-server', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':1,'b':2})
check('discard-restores-server scenario 5', solve('discard-restores-server', ({'a':N},{},['a'],0,0,[])), {})
check('discard-restores-server scenario 6', solve('discard-restores-server', ({'a':N},{'a':N},[],1,1,['x'])), {'a':N})
check('edited-field-export scenario 1', solve('edited-field-export', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), {'a':N})
check('edited-field-export scenario 2', solve('edited-field-export', ({}, {'a':N},[],2,2,[])), {})
check('edited-field-export scenario 3', solve('edited-field-export', ({'a':None},{'a':0},['a'],2,1,[])), {'a':None})
check('edited-field-export scenario 4', solve('edited-field-export', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), {'a':0})
check('edited-field-export scenario 5', solve('edited-field-export', ({'a':N},{},['a'],0,0,[])), {'a':N})
check('edited-field-export scenario 6', solve('edited-field-export', ({'a':N},{'a':N},[],1,1,['x'])), {})
check('restoration-review scenario 1', solve('restoration-review', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), 'review')
check('restoration-review scenario 2', solve('restoration-review', ({}, {'a':N},[],2,2,[])), 'restore')
check('restoration-review scenario 3', solve('restoration-review', ({'a':None},{'a':0},['a'],2,1,[])), 'restore')
check('restoration-review scenario 4', solve('restoration-review', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), 'review')
check('restoration-review scenario 5', solve('restoration-review', ({'a':N},{},['a'],0,0,[])), 'restore')
check('restoration-review scenario 6', solve('restoration-review', ({'a':N},{'a':N},[],1,1,['x'])), 'restore')
check('known-deletion-list scenario 1', solve('known-deletion-list', ({'a':N,'b':2},{'a':0,'b':3},['a'],1,2,[])), [])
check('known-deletion-list scenario 2', solve('known-deletion-list', ({}, {'a':N},[],2,2,[])), [])
check('known-deletion-list scenario 3', solve('known-deletion-list', ({'a':None},{'a':0},['a'],2,1,[])), [])
check('known-deletion-list scenario 4', solve('known-deletion-list', ({'a':0,'b':N},{'a':1,'b':2},['a','b'],1,3,['b'])), ['b'])
check('known-deletion-list scenario 5', solve('known-deletion-list', ({'a':N},{},['a'],0,0,[])), [])
check('known-deletion-list scenario 6', solve('known-deletion-list', ({'a':N},{'a':N},[],1,1,['x'])), [])
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:
Restore dirty fields.

A saved draft holds explicit dirty fields and tombstones. Restore untouched server fields, retain local null values, flag dirty fields changed against newer server data, and export only surviving dirty fields. Operation restore-dirty-fields has the six explicit input/output oracles below.

split: open-access