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 False
    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+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 outcome=='quota'
    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+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:
Retain dirty on quota.

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 retain-dirty-on-quota 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 now+debounce
    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+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 scheduled if scheduled is not None else now+debounce
    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+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:
Schedule debounce.

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 schedule-debounce 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 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
    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+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:
Flush deadline inclusive.

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 flush-deadline-inclusive 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
    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+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 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+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:
Write permission gate.

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 write-permission-gate 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 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+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 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+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:
Success cancels timer.

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 success-cancels-timer has the six explicit input/output oracles below.

split: open-access