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

N = 1
observations = []
def solve(operation, s):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming if k not in dict(old)]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old if (k,t) not in incoming]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in incoming if (k,t) in old]
    if operation == 'render-order-follows-incoming':
        return [k for k,t in incoming]
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old if (k,t) not in incoming]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in incoming if (k,t) in old]
    if operation == 'render-order-follows-incoming':
        return [k for k,t in incoming]
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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:
New instance mounts.

A component instance is identified by sibling key plus component type. Reordering preserves its state, changing type remounts, removed keys lose state, and replacement cleanup happens before mount. Operation new-instance-mounts 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):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming if (k,t) not in old]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old if k not in dict(incoming)]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in incoming if (k,t) in old]
    if operation == 'render-order-follows-incoming':
        return [k for k,t in incoming]
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming if (k,t) not in old]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in incoming if (k,t) in old]
    if operation == 'render-order-follows-incoming':
        return [k for k,t in incoming]
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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:
Old instance unmounts.

A component instance is identified by sibling key plus component type. Reordering preserves its state, changing type remounts, removed keys lose state, and replacement cleanup happens before mount. Operation old-instance-unmounts 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):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming if (k,t) not in old]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old if (k,t) not in incoming]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in old if (k,t) in incoming]
    if operation == 'render-order-follows-incoming':
        return [k for k,t in incoming]
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming if (k,t) not in old]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old if (k,t) not in incoming]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in incoming]
    if operation == 'render-order-follows-incoming':
        return [k for k,t in incoming]
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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:
State follows key through reorder.

A component instance is identified by sibling key plus component type. Reordering preserves its state, changing type remounts, removed keys lose state, and replacement cleanup happens before mount. Operation state-follows-key-through-reorder 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):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming if (k,t) not in old]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old if (k,t) not in incoming]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in incoming if (k,t) in old]
    if operation == 'render-order-follows-incoming':
        return [k for k,t in old]
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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):
    old, incoming, state = s
    if operation == 'type-and-key-reuse':
        return [k for k,t in incoming if (k,t) in old]
    if operation == 'new-instance-mounts':
        return [k for k,t in incoming if (k,t) not in old]
    if operation == 'old-instance-unmounts':
        return [k for k,t in old if (k,t) not in incoming]
    if operation == 'state-follows-key-through-reorder':
        return [state.get(k) for k,t in incoming if (k,t) in old]
    if operation == 'render-order-follows-incoming':
        return sorted(k for k,t in incoming)
    if operation == 'changed-type-state-reset':
        return {k:state.get(k) if (k,t) in old else None for k,t in incoming}
    if operation == 'cleanup-before-replacement-mount':
        return [(k,'cleanup') for k,t in old if k in dict(incoming) and (k,t) not in incoming]+[(k,'mount') for k,t in incoming if k in dict(old) and (k,t) not in old]
    if operation == 'removed-state-pruning':
        return {k:v for k,v in state.items() if k in dict(incoming)}
    if operation == 'insertion-position':
        return {k:i for i,(k,t) in enumerate(incoming)}
    if operation == 'retained-instance-moves':
        return [k for i,(k,t) in enumerate(incoming) if (k,t) in old and old.index((k,t))!=i]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('type-and-key-reuse scenario 1', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('type-and-key-reuse scenario 2', solve('type-and-key-reuse', ([], [('a','card')],{})), [])
check('type-and-key-reuse scenario 3', solve('type-and-key-reuse', ([('a','card')],[('a','panel')],{'a':0})), [])
check('type-and-key-reuse scenario 4', solve('type-and-key-reuse', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('type-and-key-reuse scenario 5', solve('type-and-key-reuse', ([('a','card')],[],{'a':N})), [])
check('type-and-key-reuse scenario 6', solve('type-and-key-reuse', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a'])
check('new-instance-mounts scenario 1', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('new-instance-mounts scenario 2', solve('new-instance-mounts', ([], [('a','card')],{})), ['a'])
check('new-instance-mounts scenario 3', solve('new-instance-mounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('new-instance-mounts scenario 4', solve('new-instance-mounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('new-instance-mounts scenario 5', solve('new-instance-mounts', ([('a','card')],[],{'a':N})), [])
check('new-instance-mounts scenario 6', solve('new-instance-mounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['b'])
check('old-instance-unmounts scenario 1', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('old-instance-unmounts scenario 2', solve('old-instance-unmounts', ([], [('a','card')],{})), [])
check('old-instance-unmounts scenario 3', solve('old-instance-unmounts', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('old-instance-unmounts scenario 4', solve('old-instance-unmounts', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['a'])
check('old-instance-unmounts scenario 5', solve('old-instance-unmounts', ([('a','card')],[],{'a':N})), ['a'])
check('old-instance-unmounts scenario 6', solve('old-instance-unmounts', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('state-follows-key-through-reorder scenario 1', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [2,N])
check('state-follows-key-through-reorder scenario 2', solve('state-follows-key-through-reorder', ([], [('a','card')],{})), [])
check('state-follows-key-through-reorder scenario 3', solve('state-follows-key-through-reorder', ([('a','card')],[('a','panel')],{'a':0})), [])
check('state-follows-key-through-reorder scenario 4', solve('state-follows-key-through-reorder', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [None])
check('state-follows-key-through-reorder scenario 5', solve('state-follows-key-through-reorder', ([('a','card')],[],{'a':N})), [])
check('state-follows-key-through-reorder scenario 6', solve('state-follows-key-through-reorder', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [False])
check('render-order-follows-incoming scenario 1', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('render-order-follows-incoming scenario 2', solve('render-order-follows-incoming', ([], [('a','card')],{})), ['a'])
check('render-order-follows-incoming scenario 3', solve('render-order-follows-incoming', ([('a','card')],[('a','panel')],{'a':0})), ['a'])
check('render-order-follows-incoming scenario 4', solve('render-order-follows-incoming', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('render-order-follows-incoming scenario 5', solve('render-order-follows-incoming', ([('a','card')],[],{'a':N})), [])
check('render-order-follows-incoming scenario 6', solve('render-order-follows-incoming', ([('a','card')],[('a','card'),('b','card')],{'a':False})), ['a','b'])
check('changed-type-state-reset scenario 1', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':2,'a':N})
check('changed-type-state-reset scenario 2', solve('changed-type-state-reset', ([], [('a','card')],{})), {'a':None})
check('changed-type-state-reset scenario 3', solve('changed-type-state-reset', ([('a','card')],[('a','panel')],{'a':0})), {'a':None})
check('changed-type-state-reset scenario 4', solve('changed-type-state-reset', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('changed-type-state-reset scenario 5', solve('changed-type-state-reset', ([('a','card')],[],{'a':N})), {})
check('changed-type-state-reset scenario 6', solve('changed-type-state-reset', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False,'b':None})
check('cleanup-before-replacement-mount scenario 1', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), [])
check('cleanup-before-replacement-mount scenario 2', solve('cleanup-before-replacement-mount', ([], [('a','card')],{})), [])
check('cleanup-before-replacement-mount scenario 3', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','panel')],{'a':0})), [('a','cleanup'),('a','mount')])
check('cleanup-before-replacement-mount scenario 4', solve('cleanup-before-replacement-mount', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), [])
check('cleanup-before-replacement-mount scenario 5', solve('cleanup-before-replacement-mount', ([('a','card')],[],{'a':N})), [])
check('cleanup-before-replacement-mount scenario 6', solve('cleanup-before-replacement-mount', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('removed-state-pruning scenario 1', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'a':N,'b':2})
check('removed-state-pruning scenario 2', solve('removed-state-pruning', ([], [('a','card')],{})), {})
check('removed-state-pruning scenario 3', solve('removed-state-pruning', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('removed-state-pruning scenario 4', solve('removed-state-pruning', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':None})
check('removed-state-pruning scenario 5', solve('removed-state-pruning', ([('a','card')],[],{'a':N})), {})
check('removed-state-pruning scenario 6', solve('removed-state-pruning', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':False})
check('insertion-position scenario 1', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), {'b':0,'a':1})
check('insertion-position scenario 2', solve('insertion-position', ([], [('a','card')],{})), {'a':0})
check('insertion-position scenario 3', solve('insertion-position', ([('a','card')],[('a','panel')],{'a':0})), {'a':0})
check('insertion-position scenario 4', solve('insertion-position', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), {'b':0})
check('insertion-position scenario 5', solve('insertion-position', ([('a','card')],[],{'a':N})), {})
check('insertion-position scenario 6', solve('insertion-position', ([('a','card')],[('a','card'),('b','card')],{'a':False})), {'a':0,'b':1})
check('retained-instance-moves scenario 1', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N,'b':2})), ['b','a'])
check('retained-instance-moves scenario 2', solve('retained-instance-moves', ([], [('a','card')],{})), [])
check('retained-instance-moves scenario 3', solve('retained-instance-moves', ([('a','card')],[('a','panel')],{'a':0})), [])
check('retained-instance-moves scenario 4', solve('retained-instance-moves', ([('a','card'),('b','panel')],[('b','panel')],{'a':1,'b':None})), ['b'])
check('retained-instance-moves scenario 5', solve('retained-instance-moves', ([('a','card')],[],{'a':N})), [])
check('retained-instance-moves scenario 6', solve('retained-instance-moves', ([('a','card')],[('a','card'),('b','card')],{'a':False})), [])
check('reordering distinct state values for every seed: type-and-key-reuse', solve('type-and-key-reuse', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: new-instance-mounts', solve('new-instance-mounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: old-instance-unmounts', solve('old-instance-unmounts', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: state-follows-key-through-reorder', solve('state-follows-key-through-reorder', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [2,N+10])
check('reordering distinct state values for every seed: render-order-follows-incoming', solve('render-order-follows-incoming', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','a'])
check('reordering distinct state values for every seed: changed-type-state-reset', solve('changed-type-state-reset', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':2,'a':N+10})
check('reordering distinct state values for every seed: cleanup-before-replacement-mount', solve('cleanup-before-replacement-mount', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), [])
check('reordering distinct state values for every seed: removed-state-pruning', solve('removed-state-pruning', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'a':N+10,'b':2})
check('reordering distinct state values for every seed: insertion-position', solve('insertion-position', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), {'b':0,'a':1})
check('reordering distinct state values for every seed: retained-instance-moves', solve('retained-instance-moves', ([('a','card'),('b','card')],[('b','card'),('a','card')],{'a':N+10,'b':2})), ['b','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:
Render order follows incoming.

A component instance is identified by sibling key plus component type. Reordering preserves its state, changing type remounts, removed keys lose state, and replacement cleanup happens before mount. Operation render-order-follows-incoming has the six explicit input/output oracles below.

split: open-access