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

N = 1
observations = []
def solve(operation, s):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**session,**workspace,**device,**defaults}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in locked}}
    if operation == 'session-only-reset':
        return {**defaults,**device,**workspace}
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in removed}}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':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):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**defaults,**device,**session,**workspace}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in locked}}
    if operation == 'session-only-reset':
        return {**defaults,**device,**workspace}
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in removed}}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':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:
Layer precedence.

Client preferences overlay defaults, device, workspace and session in that order. Workspace locks exclude session writes. Removing an override reveals the lower layer; serialization preserves its own layer and explicit null/falsy values. Operation layer-precedence 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):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**defaults,**device,**workspace,**session}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**workspace,**session}
    if operation == 'session-only-reset':
        return {**defaults,**device,**workspace}
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in removed}}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(operation, s):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**defaults,**device,**workspace,**session}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**{k:v for k,v in session.items() if k not in locked}}
    if operation == 'session-only-reset':
        return {**defaults,**device,**workspace}
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in removed}}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':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:
Locked workspace values.

Client preferences overlay defaults, device, workspace and session in that order. Workspace locks exclude session writes. Removing an override reveals the lower layer; serialization preserves its own layer and explicit null/falsy values. Operation locked-workspace-values 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):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**defaults,**device,**workspace,**session}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in locked}}
    if operation == 'session-only-reset':
        return defaults
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in removed}}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':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):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**defaults,**device,**workspace,**session}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in locked}}
    if operation == 'session-only-reset':
        return {**defaults,**device}
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in removed}}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':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:
Session only reset.

Client preferences overlay defaults, device, workspace and session in that order. Workspace locks exclude session writes. Removing an override reveals the lower layer; serialization preserves its own layer and explicit null/falsy values. Operation session-only-reset 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):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**defaults,**device,**workspace,**session}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in locked}}
    if operation == 'session-only-reset':
        return {**defaults,**device,**workspace}
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {k:v for k,v in {**defaults,**device,**workspace,**session}.items() if k not in removed}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':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):
    defaults, device, workspace, session, locked, removed = s
    if operation == 'layer-precedence':
        return {**defaults,**device,**workspace,**session}
    if operation == 'locked-workspace-values':
        return {**defaults,**device,**workspace,**{k:v for k,v in session.items() if k not in locked}}
    if operation == 'session-only-reset':
        return {**defaults,**device,**workspace}
    if operation == 'device-layer-serialization':
        return dict(device)
    if operation == 'explicit-session-keys':
        return list(session)
    if operation == 'session-key-removal-falls-through':
        return {**defaults,**device,**workspace,**session}
    if operation == 'writable-preference-projection':
        return {k:v for k,v in session.items() if k not in locked}
    if operation == 'preference-source-attribution':
        return {k:next(layer for layer,values in [('session',session),('workspace',workspace),('device',device),('default',defaults)] if k in values) for k in sorted(set(defaults)|set(device)|set(workspace)|set(session))}
    if operation == 'redundant-device-override-pruning':
        return {k:v for k,v in device.items() if k not in defaults or defaults[k]!=v}
    if operation == 'workspace-lock-report':
        return [k for k in locked if k in workspace]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('layer-precedence scenario 1', solve('layer-precedence', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('layer-precedence scenario 2', solve('layer-precedence', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('layer-precedence scenario 3', solve('layer-precedence', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':4})
check('layer-precedence scenario 4', solve('layer-precedence', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('layer-precedence scenario 5', solve('layer-precedence', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('layer-precedence scenario 6', solve('layer-precedence', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('locked-workspace-values scenario 1', solve('locked-workspace-values', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('locked-workspace-values scenario 2', solve('locked-workspace-values', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('locked-workspace-values scenario 3', solve('locked-workspace-values', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('locked-workspace-values scenario 4', solve('locked-workspace-values', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('locked-workspace-values scenario 5', solve('locked-workspace-values', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('locked-workspace-values scenario 6', solve('locked-workspace-values', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('session-only-reset scenario 1', solve('session-only-reset', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark','size':N})
check('session-only-reset scenario 2', solve('session-only-reset', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-only-reset scenario 3', solve('session-only-reset', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-only-reset scenario 4', solve('session-only-reset', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-only-reset scenario 5', solve('session-only-reset', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-only-reset scenario 6', solve('session-only-reset', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':3})
check('device-layer-serialization scenario 1', solve('device-layer-serialization', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('device-layer-serialization scenario 2', solve('device-layer-serialization', ({'theme':'light'}, {},{}, {},[],[])), {})
check('device-layer-serialization scenario 3', solve('device-layer-serialization', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('device-layer-serialization scenario 4', solve('device-layer-serialization', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('device-layer-serialization scenario 5', solve('device-layer-serialization', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('device-layer-serialization scenario 6', solve('device-layer-serialization', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('explicit-session-keys scenario 1', solve('explicit-session-keys', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['theme'])
check('explicit-session-keys scenario 2', solve('explicit-session-keys', ({'theme':'light'}, {},{}, {},[],[])), [])
check('explicit-session-keys scenario 3', solve('explicit-session-keys', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('explicit-session-keys scenario 4', solve('explicit-session-keys', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('explicit-session-keys scenario 5', solve('explicit-session-keys', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), ['theme'])
check('explicit-session-keys scenario 6', solve('explicit-session-keys', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), ['size'])
check('session-key-removal-falls-through scenario 1', solve('session-key-removal-falls-through', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'','size':N})
check('session-key-removal-falls-through scenario 2', solve('session-key-removal-falls-through', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'light'})
check('session-key-removal-falls-through scenario 3', solve('session-key-removal-falls-through', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':3})
check('session-key-removal-falls-through scenario 4', solve('session-key-removal-falls-through', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('session-key-removal-falls-through scenario 5', solve('session-key-removal-falls-through', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'light'})
check('session-key-removal-falls-through scenario 6', solve('session-key-removal-falls-through', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('writable-preference-projection scenario 1', solve('writable-preference-projection', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':''})
check('writable-preference-projection scenario 2', solve('writable-preference-projection', ({'theme':'light'}, {},{}, {},[],[])), {})
check('writable-preference-projection scenario 3', solve('writable-preference-projection', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {})
check('writable-preference-projection scenario 4', solve('writable-preference-projection', ({'theme':'light'},{'theme':None},{},{},[],[])), {})
check('writable-preference-projection scenario 5', solve('writable-preference-projection', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'blue'})
check('writable-preference-projection scenario 6', solve('writable-preference-projection', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':0})
check('preference-source-attribution scenario 1', solve('preference-source-attribution', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'size':'workspace','theme':'session'})
check('preference-source-attribution scenario 2', solve('preference-source-attribution', ({'theme':'light'}, {},{}, {},[],[])), {'theme':'default'})
check('preference-source-attribution scenario 3', solve('preference-source-attribution', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':'session'})
check('preference-source-attribution scenario 4', solve('preference-source-attribution', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':'device'})
check('preference-source-attribution scenario 5', solve('preference-source-attribution', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'session'})
check('preference-source-attribution scenario 6', solve('preference-source-attribution', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':'session'})
check('redundant-device-override-pruning scenario 1', solve('redundant-device-override-pruning', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 2', solve('redundant-device-override-pruning', ({'theme':'light'}, {},{}, {},[],[])), {})
check('redundant-device-override-pruning scenario 3', solve('redundant-device-override-pruning', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), {'size':0})
check('redundant-device-override-pruning scenario 4', solve('redundant-device-override-pruning', ({'theme':'light'},{'theme':None},{},{},[],[])), {'theme':None})
check('redundant-device-override-pruning scenario 5', solve('redundant-device-override-pruning', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), {'theme':'dark'})
check('redundant-device-override-pruning scenario 6', solve('redundant-device-override-pruning', ({'size':1}, {'size':2},{'size':3},{'size':0},[],[])), {'size':2})
check('workspace-lock-report scenario 1', solve('workspace-lock-report', ({'theme':'light','size':1},{'theme':'dark'},{'size':N},{'theme':''},['size'],[])), ['size'])
check('workspace-lock-report scenario 2', solve('workspace-lock-report', ({'theme':'light'}, {},{}, {},[],[])), [])
check('workspace-lock-report scenario 3', solve('workspace-lock-report', ({'size':2},{'size':0},{'size':3},{'size':4},['size'],['size'])), ['size'])
check('workspace-lock-report scenario 4', solve('workspace-lock-report', ({'theme':'light'},{'theme':None},{},{},[],[])), [])
check('workspace-lock-report scenario 5', solve('workspace-lock-report', ({}, {'theme':'dark'},{'theme':'light'},{'theme':'blue'},[],['theme'])), [])
check('workspace-lock-report scenario 6', solve('workspace-lock-report', ({'size':1}, {'size':2},{'size':3},{'size':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:
Session key removal falls through.

Client preferences overlay defaults, device, workspace and session in that order. Workspace locks exclude session writes. Removing an override reveals the lower layer; serialization preserves its own layer and explicit null/falsy values. Operation session-key-removal-falls-through has the six explicit input/output oracles below.

split: open-access