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

N = 1
observations = []
def solve(operation, s):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored.get('a') or defaults.get('a')
    if operation == 'write-version-stamp':
        return max(version,current)
    if operation == 'schema-fallback-policy':
        return 'read-only' if version>current else ('migrate' if version<current else 'load')
    if operation == 'serialized-field-order':
        return sorted(k for k in stored if k in allowed and k not in transient)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored.get('a')
    if operation == 'write-version-stamp':
        return max(version,current)
    if operation == 'schema-fallback-policy':
        return 'read-only' if version>current else ('migrate' if version<current else 'load')
    if operation == 'serialized-field-order':
        return sorted(k for k in stored if k in allowed and k not in transient)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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:
Nullable persisted value.

Persist only declared nontransient keys. Missing defaults are filled without replacing null/falsy data. Older schema versions migrate through each intermediate step; future versions stay read-only and keep their version stamp. Operation nullable-persisted-value 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):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored['a'] if 'a' in stored else defaults.get('a')
    if operation == 'write-version-stamp':
        return version
    if operation == 'schema-fallback-policy':
        return 'read-only' if version>current else ('migrate' if version<current else 'load')
    if operation == 'serialized-field-order':
        return sorted(k for k in stored if k in allowed and k not in transient)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored['a'] if 'a' in stored else defaults.get('a')
    if operation == 'write-version-stamp':
        return current
    if operation == 'schema-fallback-policy':
        return 'read-only' if version>current else ('migrate' if version<current else 'load')
    if operation == 'serialized-field-order':
        return sorted(k for k in stored if k in allowed and k not in transient)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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 version stamp.

Persist only declared nontransient keys. Missing defaults are filled without replacing null/falsy data. Older schema versions migrate through each intermediate step; future versions stay read-only and keep their version stamp. Operation write-version-stamp 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):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored['a'] if 'a' in stored else defaults.get('a')
    if operation == 'write-version-stamp':
        return max(version,current)
    if operation == 'schema-fallback-policy':
        return 'load'
    if operation == 'serialized-field-order':
        return sorted(k for k in stored if k in allowed and k not in transient)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored['a'] if 'a' in stored else defaults.get('a')
    if operation == 'write-version-stamp':
        return max(version,current)
    if operation == 'schema-fallback-policy':
        return 'migrate' if version!=current else 'load'
    if operation == 'serialized-field-order':
        return sorted(k for k in stored if k in allowed and k not in transient)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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:
Schema fallback policy.

Persist only declared nontransient keys. Missing defaults are filled without replacing null/falsy data. Older schema versions migrate through each intermediate step; future versions stay read-only and keep their version stamp. Operation schema-fallback-policy 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):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored['a'] if 'a' in stored else defaults.get('a')
    if operation == 'write-version-stamp':
        return max(version,current)
    if operation == 'schema-fallback-policy':
        return 'read-only' if version>current else ('migrate' if version<current else 'load')
    if operation == 'serialized-field-order':
        return list(stored)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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):
    stored, version, current, allowed, defaults, transient = s
    if operation == 'unknown-field-projection':
        return {k:v for k,v in stored.items() if k in allowed}
    if operation == 'default-overlay-order':
        return {**defaults,**stored}
    if operation == 'future-version-readonly':
        return version>current
    if operation == 'migration-step-list':
        return list(range(version,current)) if version<=current else []
    if operation == 'transient-exclusion':
        return {k:v for k,v in stored.items() if k not in transient}
    if operation == 'missing-default-identification':
        return sorted(set(defaults)-set(stored))
    if operation == 'nullable-persisted-value':
        return stored['a'] if 'a' in stored else defaults.get('a')
    if operation == 'write-version-stamp':
        return max(version,current)
    if operation == 'schema-fallback-policy':
        return 'read-only' if version>current else ('migrate' if version<current else 'load')
    if operation == 'serialized-field-order':
        return sorted(k for k in allowed if k not in transient)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unknown-field-projection scenario 1', solve('unknown-field-projection', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('unknown-field-projection scenario 2', solve('unknown-field-projection', ({},2,2,['a'],{'a':N},[])), {})
check('unknown-field-projection scenario 3', solve('unknown-field-projection', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('unknown-field-projection scenario 4', solve('unknown-field-projection', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('unknown-field-projection scenario 5', solve('unknown-field-projection', ({'a':'','b':True},2,2,[],{},[])), {})
check('unknown-field-projection scenario 6', solve('unknown-field-projection', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('default-overlay-order scenario 1', solve('default-overlay-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False,'temp':7})
check('default-overlay-order scenario 2', solve('default-overlay-order', ({},2,2,['a'],{'a':N},[])), {'a':N})
check('default-overlay-order scenario 3', solve('default-overlay-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None,'extra':1})
check('default-overlay-order scenario 4', solve('default-overlay-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N,'a':0})
check('default-overlay-order scenario 5', solve('default-overlay-order', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('default-overlay-order scenario 6', solve('default-overlay-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N,'temp':1})
check('future-version-readonly scenario 1', solve('future-version-readonly', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), False)
check('future-version-readonly scenario 2', solve('future-version-readonly', ({},2,2,['a'],{'a':N},[])), False)
check('future-version-readonly scenario 3', solve('future-version-readonly', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), True)
check('future-version-readonly scenario 4', solve('future-version-readonly', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), False)
check('future-version-readonly scenario 5', solve('future-version-readonly', ({'a':'','b':True},2,2,[],{},[])), False)
check('future-version-readonly scenario 6', solve('future-version-readonly', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), False)
check('migration-step-list scenario 1', solve('migration-step-list', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [1])
check('migration-step-list scenario 2', solve('migration-step-list', ({},2,2,['a'],{'a':N},[])), [])
check('migration-step-list scenario 3', solve('migration-step-list', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('migration-step-list scenario 4', solve('migration-step-list', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [0,1])
check('migration-step-list scenario 5', solve('migration-step-list', ({'a':'','b':True},2,2,[],{},[])), [])
check('migration-step-list scenario 6', solve('migration-step-list', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('transient-exclusion scenario 1', solve('transient-exclusion', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), {'a':N,'b':False})
check('transient-exclusion scenario 2', solve('transient-exclusion', ({},2,2,['a'],{'a':N},[])), {})
check('transient-exclusion scenario 3', solve('transient-exclusion', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), {'a':None})
check('transient-exclusion scenario 4', solve('transient-exclusion', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), {'b':N})
check('transient-exclusion scenario 5', solve('transient-exclusion', ({'a':'','b':True},2,2,[],{},[])), {'a':'','b':True})
check('transient-exclusion scenario 6', solve('transient-exclusion', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), {'a':N})
check('missing-default-identification scenario 1', solve('missing-default-identification', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), [])
check('missing-default-identification scenario 2', solve('missing-default-identification', ({},2,2,['a'],{'a':N},[])), ['a'])
check('missing-default-identification scenario 3', solve('missing-default-identification', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), [])
check('missing-default-identification scenario 4', solve('missing-default-identification', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), [])
check('missing-default-identification scenario 5', solve('missing-default-identification', ({'a':'','b':True},2,2,[],{},[])), [])
check('missing-default-identification scenario 6', solve('missing-default-identification', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), [])
check('nullable-persisted-value scenario 1', solve('nullable-persisted-value', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), N)
check('nullable-persisted-value scenario 2', solve('nullable-persisted-value', ({},2,2,['a'],{'a':N},[])), N)
check('nullable-persisted-value scenario 3', solve('nullable-persisted-value', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), None)
check('nullable-persisted-value scenario 4', solve('nullable-persisted-value', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 0)
check('nullable-persisted-value scenario 5', solve('nullable-persisted-value', ({'a':'','b':True},2,2,[],{},[])), '')
check('nullable-persisted-value scenario 6', solve('nullable-persisted-value', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), N)
check('write-version-stamp scenario 1', solve('write-version-stamp', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 2)
check('write-version-stamp scenario 2', solve('write-version-stamp', ({},2,2,['a'],{'a':N},[])), 2)
check('write-version-stamp scenario 3', solve('write-version-stamp', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 3)
check('write-version-stamp scenario 4', solve('write-version-stamp', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 2)
check('write-version-stamp scenario 5', solve('write-version-stamp', ({'a':'','b':True},2,2,[],{},[])), 2)
check('write-version-stamp scenario 6', solve('write-version-stamp', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 1)
check('schema-fallback-policy scenario 1', solve('schema-fallback-policy', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), 'migrate')
check('schema-fallback-policy scenario 2', solve('schema-fallback-policy', ({},2,2,['a'],{'a':N},[])), 'load')
check('schema-fallback-policy scenario 3', solve('schema-fallback-policy', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), 'read-only')
check('schema-fallback-policy scenario 4', solve('schema-fallback-policy', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), 'migrate')
check('schema-fallback-policy scenario 5', solve('schema-fallback-policy', ({'a':'','b':True},2,2,[],{},[])), 'load')
check('schema-fallback-policy scenario 6', solve('schema-fallback-policy', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), 'load')
check('serialized-field-order scenario 1', solve('serialized-field-order', ({'a':N,'b':False,'temp':7},1,2,['a','b'],{'a':0,'b':True},['temp'])), ['a','b'])
check('serialized-field-order scenario 2', solve('serialized-field-order', ({},2,2,['a'],{'a':N},[])), [])
check('serialized-field-order scenario 3', solve('serialized-field-order', ({'a':None,'extra':1},3,2,['a'],{'a':N},['extra'])), ['a'])
check('serialized-field-order scenario 4', solve('serialized-field-order', ({'a':0,'b':N},0,2,['b'],{'b':9},['a'])), ['b'])
check('serialized-field-order scenario 5', solve('serialized-field-order', ({'a':'','b':True},2,2,[],{},[])), [])
check('serialized-field-order scenario 6', solve('serialized-field-order', ({'a':N,'temp':1},1,1,['a'],{},['temp'])), ['a'])
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:
Serialized field order.

Persist only declared nontransient keys. Missing defaults are filled without replacing null/falsy data. Older schema versions migrate through each intermediate step; future versions stay read-only and keep their version stamp. Operation serialized-field-order 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 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 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)

prompt:
Commit only on success.

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 commit-only-on-success has the six explicit input/output oracles below.

split: open-access