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

N = 1
observations = []
def solve(operation, s):
    base, patches, rejected, confirmed = s
    if operation == 'rejected-rebase':
        return base+sum(v for k,v in patches if k not in rejected)
    if operation == 'confirmed-base':
        return base+sum(v for k,v in patches if k in confirmed)
    if operation == 'pending-retention':
        return [(k,v) for k,v in patches if k not in confirmed and k not in rejected]
    if operation == 'rollback-delta':
        return sum(v for k,v in patches if k in rejected)
    if operation == 'journal-order':
        return [k for k,v in patches]
    if operation == 'visible-total':
        return base+sum(v for k,v in patches)
    if operation == 'acknowledged-identities':
        return [k for k,v in patches if k in confirmed]
    if operation == 'failure-identities':
        return [k for k,v in patches if k in rejected]
    if operation == 'pending-flag':
        return bool(patches)
    if operation == 'next-compensating-actions':
        return [(k,-v) for k,v in reversed(patches) if k in rejected]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected-rebase scenario 1', solve('rejected-rebase', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('rejected-rebase scenario 2', solve('rejected-rebase', (0, [('p',N)], [], [])), N)
check('rejected-rebase scenario 3', solve('rejected-rebase', (N, [], [], [])), N)
check('rejected-rebase scenario 4', solve('rejected-rebase', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 3)
check('rejected-rebase scenario 5', solve('rejected-rebase', (N, [('p',0)], ['x'], ['p'])), N)
check('rejected-rebase scenario 6', solve('rejected-rebase', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('confirmed-base scenario 1', solve('confirmed-base', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('confirmed-base scenario 2', solve('confirmed-base', (0, [('p',N)], [], [])), 0)
check('confirmed-base scenario 3', solve('confirmed-base', (N, [], [], [])), N)
check('confirmed-base scenario 4', solve('confirmed-base', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 2)
check('confirmed-base scenario 5', solve('confirmed-base', (N, [('p',0)], ['x'], ['p'])), N)
check('confirmed-base scenario 6', solve('confirmed-base', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('pending-retention scenario 1', solve('pending-retention', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [])
check('pending-retention scenario 2', solve('pending-retention', (0, [('p',N)], [], [])), [('p',N)])
check('pending-retention scenario 3', solve('pending-retention', (N, [], [], [])), [])
check('pending-retention scenario 4', solve('pending-retention', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('r',1)])
check('pending-retention scenario 5', solve('pending-retention', (N, [('p',0)], ['x'], ['p'])), [])
check('pending-retention scenario 6', solve('pending-retention', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('rollback-delta scenario 1', solve('rollback-delta', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 2)
check('rollback-delta scenario 2', solve('rollback-delta', (0, [('p',N)], [], [])), 0)
check('rollback-delta scenario 3', solve('rollback-delta', (N, [], [], [])), 0)
check('rollback-delta scenario 4', solve('rollback-delta', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 4)
check('rollback-delta scenario 5', solve('rollback-delta', (N, [('p',0)], ['x'], ['p'])), 0)
check('rollback-delta scenario 6', solve('rollback-delta', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('journal-order scenario 1', solve('journal-order', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p','q'])
check('journal-order scenario 2', solve('journal-order', (0, [('p',N)], [], [])), ['p'])
check('journal-order scenario 3', solve('journal-order', (N, [], [], [])), [])
check('journal-order scenario 4', solve('journal-order', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p','q','r'])
check('journal-order scenario 5', solve('journal-order', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('journal-order scenario 6', solve('journal-order', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('visible-total scenario 1', solve('visible-total', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N+1)
check('visible-total scenario 2', solve('visible-total', (0, [('p',N)], [], [])), N)
check('visible-total scenario 3', solve('visible-total', (N, [], [], [])), N)
check('visible-total scenario 4', solve('visible-total', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 7)
check('visible-total scenario 5', solve('visible-total', (N, [('p',0)], ['x'], ['p'])), N)
check('visible-total scenario 6', solve('visible-total', (2, [('p',1),('q',1)], ['p','q'], [])), 4)
check('acknowledged-identities scenario 1', solve('acknowledged-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['q'])
check('acknowledged-identities scenario 2', solve('acknowledged-identities', (0, [('p',N)], [], [])), [])
check('acknowledged-identities scenario 3', solve('acknowledged-identities', (N, [], [], [])), [])
check('acknowledged-identities scenario 4', solve('acknowledged-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p'])
check('acknowledged-identities scenario 5', solve('acknowledged-identities', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('acknowledged-identities scenario 6', solve('acknowledged-identities', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('failure-identities scenario 1', solve('failure-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p'])
check('failure-identities scenario 2', solve('failure-identities', (0, [('p',N)], [], [])), [])
check('failure-identities scenario 3', solve('failure-identities', (N, [], [], [])), [])
check('failure-identities scenario 4', solve('failure-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['q'])
check('failure-identities scenario 5', solve('failure-identities', (N, [('p',0)], ['x'], ['p'])), [])
check('failure-identities scenario 6', solve('failure-identities', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('pending-flag scenario 1', solve('pending-flag', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), False)
check('pending-flag scenario 2', solve('pending-flag', (0, [('p',N)], [], [])), True)
check('pending-flag scenario 3', solve('pending-flag', (N, [], [], [])), False)
check('pending-flag scenario 4', solve('pending-flag', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), True)
check('pending-flag scenario 5', solve('pending-flag', (N, [('p',0)], ['x'], ['p'])), False)
check('pending-flag scenario 6', solve('pending-flag', (2, [('p',1),('q',1)], ['p','q'], [])), False)
check('next-compensating-actions scenario 1', solve('next-compensating-actions', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [('p',-2)])
check('next-compensating-actions scenario 2', solve('next-compensating-actions', (0, [('p',N)], [], [])), [])
check('next-compensating-actions scenario 3', solve('next-compensating-actions', (N, [], [], [])), [])
check('next-compensating-actions scenario 4', solve('next-compensating-actions', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('q',-4)])
check('next-compensating-actions scenario 5', solve('next-compensating-actions', (N, [('p',0)], ['x'], ['p'])), [])
check('next-compensating-actions scenario 6', solve('next-compensating-actions', (2, [('p',1),('q',1)], ['p','q'], [])), [('q',-1),('p',-1)])
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):
    base, patches, rejected, confirmed = s
    if operation == 'rejected-rebase':
        return base+sum(v for k,v in patches if k not in rejected)
    if operation == 'confirmed-base':
        return base+sum(v for k,v in patches if k in confirmed)
    if operation == 'pending-retention':
        return [(k,v) for k,v in patches if k not in confirmed and k not in rejected]
    if operation == 'rollback-delta':
        return sum(v for k,v in patches if k in rejected)
    if operation == 'journal-order':
        return [k for k,v in patches]
    if operation == 'visible-total':
        return base+sum(v for k,v in patches)
    if operation == 'acknowledged-identities':
        return [k for k,v in patches if k in confirmed]
    if operation == 'failure-identities':
        return [k for k,v in patches if k in rejected]
    if operation == 'pending-flag':
        return any(v and k not in confirmed for k,v in patches)
    if operation == 'next-compensating-actions':
        return [(k,-v) for k,v in reversed(patches) if k in rejected]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected-rebase scenario 1', solve('rejected-rebase', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('rejected-rebase scenario 2', solve('rejected-rebase', (0, [('p',N)], [], [])), N)
check('rejected-rebase scenario 3', solve('rejected-rebase', (N, [], [], [])), N)
check('rejected-rebase scenario 4', solve('rejected-rebase', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 3)
check('rejected-rebase scenario 5', solve('rejected-rebase', (N, [('p',0)], ['x'], ['p'])), N)
check('rejected-rebase scenario 6', solve('rejected-rebase', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('confirmed-base scenario 1', solve('confirmed-base', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('confirmed-base scenario 2', solve('confirmed-base', (0, [('p',N)], [], [])), 0)
check('confirmed-base scenario 3', solve('confirmed-base', (N, [], [], [])), N)
check('confirmed-base scenario 4', solve('confirmed-base', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 2)
check('confirmed-base scenario 5', solve('confirmed-base', (N, [('p',0)], ['x'], ['p'])), N)
check('confirmed-base scenario 6', solve('confirmed-base', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('pending-retention scenario 1', solve('pending-retention', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [])
check('pending-retention scenario 2', solve('pending-retention', (0, [('p',N)], [], [])), [('p',N)])
check('pending-retention scenario 3', solve('pending-retention', (N, [], [], [])), [])
check('pending-retention scenario 4', solve('pending-retention', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('r',1)])
check('pending-retention scenario 5', solve('pending-retention', (N, [('p',0)], ['x'], ['p'])), [])
check('pending-retention scenario 6', solve('pending-retention', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('rollback-delta scenario 1', solve('rollback-delta', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 2)
check('rollback-delta scenario 2', solve('rollback-delta', (0, [('p',N)], [], [])), 0)
check('rollback-delta scenario 3', solve('rollback-delta', (N, [], [], [])), 0)
check('rollback-delta scenario 4', solve('rollback-delta', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 4)
check('rollback-delta scenario 5', solve('rollback-delta', (N, [('p',0)], ['x'], ['p'])), 0)
check('rollback-delta scenario 6', solve('rollback-delta', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('journal-order scenario 1', solve('journal-order', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p','q'])
check('journal-order scenario 2', solve('journal-order', (0, [('p',N)], [], [])), ['p'])
check('journal-order scenario 3', solve('journal-order', (N, [], [], [])), [])
check('journal-order scenario 4', solve('journal-order', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p','q','r'])
check('journal-order scenario 5', solve('journal-order', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('journal-order scenario 6', solve('journal-order', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('visible-total scenario 1', solve('visible-total', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N+1)
check('visible-total scenario 2', solve('visible-total', (0, [('p',N)], [], [])), N)
check('visible-total scenario 3', solve('visible-total', (N, [], [], [])), N)
check('visible-total scenario 4', solve('visible-total', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 7)
check('visible-total scenario 5', solve('visible-total', (N, [('p',0)], ['x'], ['p'])), N)
check('visible-total scenario 6', solve('visible-total', (2, [('p',1),('q',1)], ['p','q'], [])), 4)
check('acknowledged-identities scenario 1', solve('acknowledged-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['q'])
check('acknowledged-identities scenario 2', solve('acknowledged-identities', (0, [('p',N)], [], [])), [])
check('acknowledged-identities scenario 3', solve('acknowledged-identities', (N, [], [], [])), [])
check('acknowledged-identities scenario 4', solve('acknowledged-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p'])
check('acknowledged-identities scenario 5', solve('acknowledged-identities', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('acknowledged-identities scenario 6', solve('acknowledged-identities', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('failure-identities scenario 1', solve('failure-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p'])
check('failure-identities scenario 2', solve('failure-identities', (0, [('p',N)], [], [])), [])
check('failure-identities scenario 3', solve('failure-identities', (N, [], [], [])), [])
check('failure-identities scenario 4', solve('failure-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['q'])
check('failure-identities scenario 5', solve('failure-identities', (N, [('p',0)], ['x'], ['p'])), [])
check('failure-identities scenario 6', solve('failure-identities', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('pending-flag scenario 1', solve('pending-flag', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), False)
check('pending-flag scenario 2', solve('pending-flag', (0, [('p',N)], [], [])), True)
check('pending-flag scenario 3', solve('pending-flag', (N, [], [], [])), False)
check('pending-flag scenario 4', solve('pending-flag', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), True)
check('pending-flag scenario 5', solve('pending-flag', (N, [('p',0)], ['x'], ['p'])), False)
check('pending-flag scenario 6', solve('pending-flag', (2, [('p',1),('q',1)], ['p','q'], [])), False)
check('next-compensating-actions scenario 1', solve('next-compensating-actions', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [('p',-2)])
check('next-compensating-actions scenario 2', solve('next-compensating-actions', (0, [('p',N)], [], [])), [])
check('next-compensating-actions scenario 3', solve('next-compensating-actions', (N, [], [], [])), [])
check('next-compensating-actions scenario 4', solve('next-compensating-actions', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('q',-4)])
check('next-compensating-actions scenario 5', solve('next-compensating-actions', (N, [('p',0)], ['x'], ['p'])), [])
check('next-compensating-actions scenario 6', solve('next-compensating-actions', (2, [('p',1),('q',1)], ['p','q'], [])), [('q',-1),('p',-1)])
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:
Pending flag.

A client numeric patch journal retains insertion order. Accepted patches move to the base; rejected patches are removed and compensate in reverse order; pending patches remain visible. Identity and zero-valued patches are significant. Operation pending-flag 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):
    base, patches, rejected, confirmed = s
    if operation == 'rejected-rebase':
        return base+sum(v for k,v in patches if k not in rejected)
    if operation == 'confirmed-base':
        return base+sum(v for k,v in patches if k in confirmed)
    if operation == 'pending-retention':
        return [(k,v) for k,v in patches if k not in confirmed and k not in rejected]
    if operation == 'rollback-delta':
        return sum(v for k,v in patches if k in rejected)
    if operation == 'journal-order':
        return [k for k,v in patches]
    if operation == 'visible-total':
        return base+sum(v for k,v in patches)
    if operation == 'acknowledged-identities':
        return [k for k,v in patches if k in confirmed]
    if operation == 'failure-identities':
        return [k for k,v in patches if k in rejected]
    if operation == 'pending-flag':
        return any(k not in confirmed and k not in rejected for k,v in patches)
    if operation == 'next-compensating-actions':
        return [(k,v) for k,v in patches if k in rejected]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected-rebase scenario 1', solve('rejected-rebase', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('rejected-rebase scenario 2', solve('rejected-rebase', (0, [('p',N)], [], [])), N)
check('rejected-rebase scenario 3', solve('rejected-rebase', (N, [], [], [])), N)
check('rejected-rebase scenario 4', solve('rejected-rebase', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 3)
check('rejected-rebase scenario 5', solve('rejected-rebase', (N, [('p',0)], ['x'], ['p'])), N)
check('rejected-rebase scenario 6', solve('rejected-rebase', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('confirmed-base scenario 1', solve('confirmed-base', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('confirmed-base scenario 2', solve('confirmed-base', (0, [('p',N)], [], [])), 0)
check('confirmed-base scenario 3', solve('confirmed-base', (N, [], [], [])), N)
check('confirmed-base scenario 4', solve('confirmed-base', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 2)
check('confirmed-base scenario 5', solve('confirmed-base', (N, [('p',0)], ['x'], ['p'])), N)
check('confirmed-base scenario 6', solve('confirmed-base', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('pending-retention scenario 1', solve('pending-retention', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [])
check('pending-retention scenario 2', solve('pending-retention', (0, [('p',N)], [], [])), [('p',N)])
check('pending-retention scenario 3', solve('pending-retention', (N, [], [], [])), [])
check('pending-retention scenario 4', solve('pending-retention', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('r',1)])
check('pending-retention scenario 5', solve('pending-retention', (N, [('p',0)], ['x'], ['p'])), [])
check('pending-retention scenario 6', solve('pending-retention', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('rollback-delta scenario 1', solve('rollback-delta', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 2)
check('rollback-delta scenario 2', solve('rollback-delta', (0, [('p',N)], [], [])), 0)
check('rollback-delta scenario 3', solve('rollback-delta', (N, [], [], [])), 0)
check('rollback-delta scenario 4', solve('rollback-delta', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 4)
check('rollback-delta scenario 5', solve('rollback-delta', (N, [('p',0)], ['x'], ['p'])), 0)
check('rollback-delta scenario 6', solve('rollback-delta', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('journal-order scenario 1', solve('journal-order', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p','q'])
check('journal-order scenario 2', solve('journal-order', (0, [('p',N)], [], [])), ['p'])
check('journal-order scenario 3', solve('journal-order', (N, [], [], [])), [])
check('journal-order scenario 4', solve('journal-order', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p','q','r'])
check('journal-order scenario 5', solve('journal-order', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('journal-order scenario 6', solve('journal-order', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('visible-total scenario 1', solve('visible-total', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N+1)
check('visible-total scenario 2', solve('visible-total', (0, [('p',N)], [], [])), N)
check('visible-total scenario 3', solve('visible-total', (N, [], [], [])), N)
check('visible-total scenario 4', solve('visible-total', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 7)
check('visible-total scenario 5', solve('visible-total', (N, [('p',0)], ['x'], ['p'])), N)
check('visible-total scenario 6', solve('visible-total', (2, [('p',1),('q',1)], ['p','q'], [])), 4)
check('acknowledged-identities scenario 1', solve('acknowledged-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['q'])
check('acknowledged-identities scenario 2', solve('acknowledged-identities', (0, [('p',N)], [], [])), [])
check('acknowledged-identities scenario 3', solve('acknowledged-identities', (N, [], [], [])), [])
check('acknowledged-identities scenario 4', solve('acknowledged-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p'])
check('acknowledged-identities scenario 5', solve('acknowledged-identities', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('acknowledged-identities scenario 6', solve('acknowledged-identities', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('failure-identities scenario 1', solve('failure-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p'])
check('failure-identities scenario 2', solve('failure-identities', (0, [('p',N)], [], [])), [])
check('failure-identities scenario 3', solve('failure-identities', (N, [], [], [])), [])
check('failure-identities scenario 4', solve('failure-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['q'])
check('failure-identities scenario 5', solve('failure-identities', (N, [('p',0)], ['x'], ['p'])), [])
check('failure-identities scenario 6', solve('failure-identities', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('pending-flag scenario 1', solve('pending-flag', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), False)
check('pending-flag scenario 2', solve('pending-flag', (0, [('p',N)], [], [])), True)
check('pending-flag scenario 3', solve('pending-flag', (N, [], [], [])), False)
check('pending-flag scenario 4', solve('pending-flag', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), True)
check('pending-flag scenario 5', solve('pending-flag', (N, [('p',0)], ['x'], ['p'])), False)
check('pending-flag scenario 6', solve('pending-flag', (2, [('p',1),('q',1)], ['p','q'], [])), False)
check('next-compensating-actions scenario 1', solve('next-compensating-actions', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [('p',-2)])
check('next-compensating-actions scenario 2', solve('next-compensating-actions', (0, [('p',N)], [], [])), [])
check('next-compensating-actions scenario 3', solve('next-compensating-actions', (N, [], [], [])), [])
check('next-compensating-actions scenario 4', solve('next-compensating-actions', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('q',-4)])
check('next-compensating-actions scenario 5', solve('next-compensating-actions', (N, [('p',0)], ['x'], ['p'])), [])
check('next-compensating-actions scenario 6', solve('next-compensating-actions', (2, [('p',1),('q',1)], ['p','q'], [])), [('q',-1),('p',-1)])
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):
    base, patches, rejected, confirmed = s
    if operation == 'rejected-rebase':
        return base+sum(v for k,v in patches if k not in rejected)
    if operation == 'confirmed-base':
        return base+sum(v for k,v in patches if k in confirmed)
    if operation == 'pending-retention':
        return [(k,v) for k,v in patches if k not in confirmed and k not in rejected]
    if operation == 'rollback-delta':
        return sum(v for k,v in patches if k in rejected)
    if operation == 'journal-order':
        return [k for k,v in patches]
    if operation == 'visible-total':
        return base+sum(v for k,v in patches)
    if operation == 'acknowledged-identities':
        return [k for k,v in patches if k in confirmed]
    if operation == 'failure-identities':
        return [k for k,v in patches if k in rejected]
    if operation == 'pending-flag':
        return any(k not in confirmed and k not in rejected for k,v in patches)
    if operation == 'next-compensating-actions':
        return [(k,-v) for k,v in patches if k in rejected]
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rejected-rebase scenario 1', solve('rejected-rebase', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('rejected-rebase scenario 2', solve('rejected-rebase', (0, [('p',N)], [], [])), N)
check('rejected-rebase scenario 3', solve('rejected-rebase', (N, [], [], [])), N)
check('rejected-rebase scenario 4', solve('rejected-rebase', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 3)
check('rejected-rebase scenario 5', solve('rejected-rebase', (N, [('p',0)], ['x'], ['p'])), N)
check('rejected-rebase scenario 6', solve('rejected-rebase', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('confirmed-base scenario 1', solve('confirmed-base', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N-1)
check('confirmed-base scenario 2', solve('confirmed-base', (0, [('p',N)], [], [])), 0)
check('confirmed-base scenario 3', solve('confirmed-base', (N, [], [], [])), N)
check('confirmed-base scenario 4', solve('confirmed-base', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 2)
check('confirmed-base scenario 5', solve('confirmed-base', (N, [('p',0)], ['x'], ['p'])), N)
check('confirmed-base scenario 6', solve('confirmed-base', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('pending-retention scenario 1', solve('pending-retention', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [])
check('pending-retention scenario 2', solve('pending-retention', (0, [('p',N)], [], [])), [('p',N)])
check('pending-retention scenario 3', solve('pending-retention', (N, [], [], [])), [])
check('pending-retention scenario 4', solve('pending-retention', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('r',1)])
check('pending-retention scenario 5', solve('pending-retention', (N, [('p',0)], ['x'], ['p'])), [])
check('pending-retention scenario 6', solve('pending-retention', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('rollback-delta scenario 1', solve('rollback-delta', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 2)
check('rollback-delta scenario 2', solve('rollback-delta', (0, [('p',N)], [], [])), 0)
check('rollback-delta scenario 3', solve('rollback-delta', (N, [], [], [])), 0)
check('rollback-delta scenario 4', solve('rollback-delta', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 4)
check('rollback-delta scenario 5', solve('rollback-delta', (N, [('p',0)], ['x'], ['p'])), 0)
check('rollback-delta scenario 6', solve('rollback-delta', (2, [('p',1),('q',1)], ['p','q'], [])), 2)
check('journal-order scenario 1', solve('journal-order', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p','q'])
check('journal-order scenario 2', solve('journal-order', (0, [('p',N)], [], [])), ['p'])
check('journal-order scenario 3', solve('journal-order', (N, [], [], [])), [])
check('journal-order scenario 4', solve('journal-order', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p','q','r'])
check('journal-order scenario 5', solve('journal-order', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('journal-order scenario 6', solve('journal-order', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('visible-total scenario 1', solve('visible-total', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), 10*N+1)
check('visible-total scenario 2', solve('visible-total', (0, [('p',N)], [], [])), N)
check('visible-total scenario 3', solve('visible-total', (N, [], [], [])), N)
check('visible-total scenario 4', solve('visible-total', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), 7)
check('visible-total scenario 5', solve('visible-total', (N, [('p',0)], ['x'], ['p'])), N)
check('visible-total scenario 6', solve('visible-total', (2, [('p',1),('q',1)], ['p','q'], [])), 4)
check('acknowledged-identities scenario 1', solve('acknowledged-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['q'])
check('acknowledged-identities scenario 2', solve('acknowledged-identities', (0, [('p',N)], [], [])), [])
check('acknowledged-identities scenario 3', solve('acknowledged-identities', (N, [], [], [])), [])
check('acknowledged-identities scenario 4', solve('acknowledged-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['p'])
check('acknowledged-identities scenario 5', solve('acknowledged-identities', (N, [('p',0)], ['x'], ['p'])), ['p'])
check('acknowledged-identities scenario 6', solve('acknowledged-identities', (2, [('p',1),('q',1)], ['p','q'], [])), [])
check('failure-identities scenario 1', solve('failure-identities', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), ['p'])
check('failure-identities scenario 2', solve('failure-identities', (0, [('p',N)], [], [])), [])
check('failure-identities scenario 3', solve('failure-identities', (N, [], [], [])), [])
check('failure-identities scenario 4', solve('failure-identities', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), ['q'])
check('failure-identities scenario 5', solve('failure-identities', (N, [('p',0)], ['x'], ['p'])), [])
check('failure-identities scenario 6', solve('failure-identities', (2, [('p',1),('q',1)], ['p','q'], [])), ['p','q'])
check('pending-flag scenario 1', solve('pending-flag', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), False)
check('pending-flag scenario 2', solve('pending-flag', (0, [('p',N)], [], [])), True)
check('pending-flag scenario 3', solve('pending-flag', (N, [], [], [])), False)
check('pending-flag scenario 4', solve('pending-flag', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), True)
check('pending-flag scenario 5', solve('pending-flag', (N, [('p',0)], ['x'], ['p'])), False)
check('pending-flag scenario 6', solve('pending-flag', (2, [('p',1),('q',1)], ['p','q'], [])), False)
check('next-compensating-actions scenario 1', solve('next-compensating-actions', (10*N, [('p',2),('q',-1)], ['p'], ['q'])), [('p',-2)])
check('next-compensating-actions scenario 2', solve('next-compensating-actions', (0, [('p',N)], [], [])), [])
check('next-compensating-actions scenario 3', solve('next-compensating-actions', (N, [], [], [])), [])
check('next-compensating-actions scenario 4', solve('next-compensating-actions', (5, [('p',-3),('q',4),('r',1)], ['q'], ['p'])), [('q',-4)])
check('next-compensating-actions scenario 5', solve('next-compensating-actions', (N, [('p',0)], ['x'], ['p'])), [])
check('next-compensating-actions scenario 6', solve('next-compensating-actions', (2, [('p',1),('q',1)], ['p','q'], [])), [('q',-1),('p',-1)])
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:
Next compensating actions.

A client numeric patch journal retains insertion order. Accepted patches move to the base; rejected patches are removed and compensate in reverse order; pending patches remain visible. Identity and zero-valued patches are significant. Operation next-compensating-actions 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):
    items, temporary, canonical, payload, refs = s
    if operation == 'canonical-id-rewrite':
        return items
    if operation == 'server-value-merge':
        return [(k,payload if k==temporary else v) for k,v in items]
    if operation == 'reference-remap':
        return [canonical if k==temporary else k for k in refs]
    if operation == 'optimistic-position':
        return next((i for i,(k,v) in enumerate(items) if k==temporary),None)
    if operation == 'duplicate-canonical-removal':
        return [(k,v) for k,v in items if k!=canonical]
    if operation == 'temporary-presence':
        return any(k==temporary for k,v in items)
    if operation == 'rollback-remove-only-created':
        return [(k,v) for k,v in items if k!=temporary]
    if operation == 'orphan-reference-audit':
        return [k for k in refs if k not in {i for i,v in items}]
    if operation == 'reference-multiplicity':
        return refs.count(temporary)
    if operation == 'missing-entity-ack':
        return 'replace' if any(k==temporary for k,v in items) else 'ignore'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical-id-rewrite scenario 1', solve('canonical-id-rewrite', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('real',N),('old',2)])
check('canonical-id-rewrite scenario 2', solve('canonical-id-rewrite', ([], 'tmp','real',N,[])), [])
check('canonical-id-rewrite scenario 3', solve('canonical-id-rewrite', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('real',4)])
check('canonical-id-rewrite scenario 4', solve('canonical-id-rewrite', ([('tmp',0)],'tmp','real',0,['tmp'])), [('real',0)])
check('canonical-id-rewrite scenario 5', solve('canonical-id-rewrite', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('canonical-id-rewrite scenario 6', solve('canonical-id-rewrite', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('real',2),('tail',3)])
check('server-value-merge scenario 1', solve('server-value-merge', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',9),('old',2)])
check('server-value-merge scenario 2', solve('server-value-merge', ([], 'tmp','real',N,[])), [])
check('server-value-merge scenario 3', solve('server-value-merge', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('tmp',N)])
check('server-value-merge scenario 4', solve('server-value-merge', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('server-value-merge scenario 5', solve('server-value-merge', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('server-value-merge scenario 6', solve('server-value-merge', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',None),('tail',3)])
check('reference-remap scenario 1', solve('reference-remap', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), ['real','old','real'])
check('reference-remap scenario 2', solve('reference-remap', ([], 'tmp','real',N,[])), [])
check('reference-remap scenario 3', solve('reference-remap', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), ['real','real'])
check('reference-remap scenario 4', solve('reference-remap', ([('tmp',0)],'tmp','real',0,['tmp'])), ['real'])
check('reference-remap scenario 5', solve('reference-remap', ([('other',N)],'tmp','real',7,['other'])), ['other'])
check('reference-remap scenario 6', solve('reference-remap', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['real','missing'])
check('optimistic-position scenario 1', solve('optimistic-position', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 0)
check('optimistic-position scenario 2', solve('optimistic-position', ([], 'tmp','real',N,[])), None)
check('optimistic-position scenario 3', solve('optimistic-position', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('optimistic-position scenario 4', solve('optimistic-position', ([('tmp',0)],'tmp','real',0,['tmp'])), 0)
check('optimistic-position scenario 5', solve('optimistic-position', ([('other',N)],'tmp','real',7,['other'])), None)
check('optimistic-position scenario 6', solve('optimistic-position', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 0)
check('duplicate-canonical-removal scenario 1', solve('duplicate-canonical-removal', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',N),('old',2)])
check('duplicate-canonical-removal scenario 2', solve('duplicate-canonical-removal', ([], 'tmp','real',N,[])), [])
check('duplicate-canonical-removal scenario 3', solve('duplicate-canonical-removal', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('tmp',4)])
check('duplicate-canonical-removal scenario 4', solve('duplicate-canonical-removal', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('duplicate-canonical-removal scenario 5', solve('duplicate-canonical-removal', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('duplicate-canonical-removal scenario 6', solve('duplicate-canonical-removal', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',2),('tail',3)])
check('temporary-presence scenario 1', solve('temporary-presence', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), True)
check('temporary-presence scenario 2', solve('temporary-presence', ([], 'tmp','real',N,[])), False)
check('temporary-presence scenario 3', solve('temporary-presence', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), True)
check('temporary-presence scenario 4', solve('temporary-presence', ([('tmp',0)],'tmp','real',0,['tmp'])), True)
check('temporary-presence scenario 5', solve('temporary-presence', ([('other',N)],'tmp','real',7,['other'])), False)
check('temporary-presence scenario 6', solve('temporary-presence', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), True)
check('rollback-remove-only-created scenario 1', solve('rollback-remove-only-created', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('old',2)])
check('rollback-remove-only-created scenario 2', solve('rollback-remove-only-created', ([], 'tmp','real',N,[])), [])
check('rollback-remove-only-created scenario 3', solve('rollback-remove-only-created', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3)])
check('rollback-remove-only-created scenario 4', solve('rollback-remove-only-created', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('rollback-remove-only-created scenario 5', solve('rollback-remove-only-created', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('rollback-remove-only-created scenario 6', solve('rollback-remove-only-created', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tail',3)])
check('orphan-reference-audit scenario 1', solve('orphan-reference-audit', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [])
check('orphan-reference-audit scenario 2', solve('orphan-reference-audit', ([], 'tmp','real',N,[])), [])
check('orphan-reference-audit scenario 3', solve('orphan-reference-audit', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [])
check('orphan-reference-audit scenario 4', solve('orphan-reference-audit', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('orphan-reference-audit scenario 5', solve('orphan-reference-audit', ([('other',N)],'tmp','real',7,['other'])), [])
check('orphan-reference-audit scenario 6', solve('orphan-reference-audit', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['missing'])
check('reference-multiplicity scenario 1', solve('reference-multiplicity', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 2)
check('reference-multiplicity scenario 2', solve('reference-multiplicity', ([], 'tmp','real',N,[])), 0)
check('reference-multiplicity scenario 3', solve('reference-multiplicity', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('reference-multiplicity scenario 4', solve('reference-multiplicity', ([('tmp',0)],'tmp','real',0,['tmp'])), 1)
check('reference-multiplicity scenario 5', solve('reference-multiplicity', ([('other',N)],'tmp','real',7,['other'])), 0)
check('reference-multiplicity scenario 6', solve('reference-multiplicity', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 1)
check('missing-entity-ack scenario 1', solve('missing-entity-ack', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 'replace')
check('missing-entity-ack scenario 2', solve('missing-entity-ack', ([], 'tmp','real',N,[])), 'ignore')
check('missing-entity-ack scenario 3', solve('missing-entity-ack', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 'replace')
check('missing-entity-ack scenario 4', solve('missing-entity-ack', ([('tmp',0)],'tmp','real',0,['tmp'])), 'replace')
check('missing-entity-ack scenario 5', solve('missing-entity-ack', ([('other',N)],'tmp','real',7,['other'])), 'ignore')
check('missing-entity-ack scenario 6', solve('missing-entity-ack', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 'replace')
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):
    items, temporary, canonical, payload, refs = s
    if operation == 'canonical-id-rewrite':
        return [(canonical,v) for k,v in items]
    if operation == 'server-value-merge':
        return [(k,payload if k==temporary else v) for k,v in items]
    if operation == 'reference-remap':
        return [canonical if k==temporary else k for k in refs]
    if operation == 'optimistic-position':
        return next((i for i,(k,v) in enumerate(items) if k==temporary),None)
    if operation == 'duplicate-canonical-removal':
        return [(k,v) for k,v in items if k!=canonical]
    if operation == 'temporary-presence':
        return any(k==temporary for k,v in items)
    if operation == 'rollback-remove-only-created':
        return [(k,v) for k,v in items if k!=temporary]
    if operation == 'orphan-reference-audit':
        return [k for k in refs if k not in {i for i,v in items}]
    if operation == 'reference-multiplicity':
        return refs.count(temporary)
    if operation == 'missing-entity-ack':
        return 'replace' if any(k==temporary for k,v in items) else 'ignore'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical-id-rewrite scenario 1', solve('canonical-id-rewrite', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('real',N),('old',2)])
check('canonical-id-rewrite scenario 2', solve('canonical-id-rewrite', ([], 'tmp','real',N,[])), [])
check('canonical-id-rewrite scenario 3', solve('canonical-id-rewrite', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('real',4)])
check('canonical-id-rewrite scenario 4', solve('canonical-id-rewrite', ([('tmp',0)],'tmp','real',0,['tmp'])), [('real',0)])
check('canonical-id-rewrite scenario 5', solve('canonical-id-rewrite', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('canonical-id-rewrite scenario 6', solve('canonical-id-rewrite', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('real',2),('tail',3)])
check('server-value-merge scenario 1', solve('server-value-merge', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',9),('old',2)])
check('server-value-merge scenario 2', solve('server-value-merge', ([], 'tmp','real',N,[])), [])
check('server-value-merge scenario 3', solve('server-value-merge', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('tmp',N)])
check('server-value-merge scenario 4', solve('server-value-merge', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('server-value-merge scenario 5', solve('server-value-merge', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('server-value-merge scenario 6', solve('server-value-merge', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',None),('tail',3)])
check('reference-remap scenario 1', solve('reference-remap', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), ['real','old','real'])
check('reference-remap scenario 2', solve('reference-remap', ([], 'tmp','real',N,[])), [])
check('reference-remap scenario 3', solve('reference-remap', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), ['real','real'])
check('reference-remap scenario 4', solve('reference-remap', ([('tmp',0)],'tmp','real',0,['tmp'])), ['real'])
check('reference-remap scenario 5', solve('reference-remap', ([('other',N)],'tmp','real',7,['other'])), ['other'])
check('reference-remap scenario 6', solve('reference-remap', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['real','missing'])
check('optimistic-position scenario 1', solve('optimistic-position', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 0)
check('optimistic-position scenario 2', solve('optimistic-position', ([], 'tmp','real',N,[])), None)
check('optimistic-position scenario 3', solve('optimistic-position', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('optimistic-position scenario 4', solve('optimistic-position', ([('tmp',0)],'tmp','real',0,['tmp'])), 0)
check('optimistic-position scenario 5', solve('optimistic-position', ([('other',N)],'tmp','real',7,['other'])), None)
check('optimistic-position scenario 6', solve('optimistic-position', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 0)
check('duplicate-canonical-removal scenario 1', solve('duplicate-canonical-removal', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',N),('old',2)])
check('duplicate-canonical-removal scenario 2', solve('duplicate-canonical-removal', ([], 'tmp','real',N,[])), [])
check('duplicate-canonical-removal scenario 3', solve('duplicate-canonical-removal', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('tmp',4)])
check('duplicate-canonical-removal scenario 4', solve('duplicate-canonical-removal', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('duplicate-canonical-removal scenario 5', solve('duplicate-canonical-removal', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('duplicate-canonical-removal scenario 6', solve('duplicate-canonical-removal', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',2),('tail',3)])
check('temporary-presence scenario 1', solve('temporary-presence', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), True)
check('temporary-presence scenario 2', solve('temporary-presence', ([], 'tmp','real',N,[])), False)
check('temporary-presence scenario 3', solve('temporary-presence', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), True)
check('temporary-presence scenario 4', solve('temporary-presence', ([('tmp',0)],'tmp','real',0,['tmp'])), True)
check('temporary-presence scenario 5', solve('temporary-presence', ([('other',N)],'tmp','real',7,['other'])), False)
check('temporary-presence scenario 6', solve('temporary-presence', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), True)
check('rollback-remove-only-created scenario 1', solve('rollback-remove-only-created', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('old',2)])
check('rollback-remove-only-created scenario 2', solve('rollback-remove-only-created', ([], 'tmp','real',N,[])), [])
check('rollback-remove-only-created scenario 3', solve('rollback-remove-only-created', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3)])
check('rollback-remove-only-created scenario 4', solve('rollback-remove-only-created', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('rollback-remove-only-created scenario 5', solve('rollback-remove-only-created', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('rollback-remove-only-created scenario 6', solve('rollback-remove-only-created', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tail',3)])
check('orphan-reference-audit scenario 1', solve('orphan-reference-audit', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [])
check('orphan-reference-audit scenario 2', solve('orphan-reference-audit', ([], 'tmp','real',N,[])), [])
check('orphan-reference-audit scenario 3', solve('orphan-reference-audit', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [])
check('orphan-reference-audit scenario 4', solve('orphan-reference-audit', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('orphan-reference-audit scenario 5', solve('orphan-reference-audit', ([('other',N)],'tmp','real',7,['other'])), [])
check('orphan-reference-audit scenario 6', solve('orphan-reference-audit', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['missing'])
check('reference-multiplicity scenario 1', solve('reference-multiplicity', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 2)
check('reference-multiplicity scenario 2', solve('reference-multiplicity', ([], 'tmp','real',N,[])), 0)
check('reference-multiplicity scenario 3', solve('reference-multiplicity', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('reference-multiplicity scenario 4', solve('reference-multiplicity', ([('tmp',0)],'tmp','real',0,['tmp'])), 1)
check('reference-multiplicity scenario 5', solve('reference-multiplicity', ([('other',N)],'tmp','real',7,['other'])), 0)
check('reference-multiplicity scenario 6', solve('reference-multiplicity', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 1)
check('missing-entity-ack scenario 1', solve('missing-entity-ack', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 'replace')
check('missing-entity-ack scenario 2', solve('missing-entity-ack', ([], 'tmp','real',N,[])), 'ignore')
check('missing-entity-ack scenario 3', solve('missing-entity-ack', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 'replace')
check('missing-entity-ack scenario 4', solve('missing-entity-ack', ([('tmp',0)],'tmp','real',0,['tmp'])), 'replace')
check('missing-entity-ack scenario 5', solve('missing-entity-ack', ([('other',N)],'tmp','real',7,['other'])), 'ignore')
check('missing-entity-ack scenario 6', solve('missing-entity-ack', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 'replace')
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:
Canonical id rewrite.

The acknowledgment model reconciles one temporary entity. Keep unrelated rows and reference multiplicity, prefer the server value including null, and ignore acknowledgments whose temporary entity no longer exists. Operation canonical-id-rewrite 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):
    items, temporary, canonical, payload, refs = s
    if operation == 'canonical-id-rewrite':
        return [(canonical if k==temporary else k,v) for k,v in items]
    if operation == 'server-value-merge':
        return items
    if operation == 'reference-remap':
        return [canonical if k==temporary else k for k in refs]
    if operation == 'optimistic-position':
        return next((i for i,(k,v) in enumerate(items) if k==temporary),None)
    if operation == 'duplicate-canonical-removal':
        return [(k,v) for k,v in items if k!=canonical]
    if operation == 'temporary-presence':
        return any(k==temporary for k,v in items)
    if operation == 'rollback-remove-only-created':
        return [(k,v) for k,v in items if k!=temporary]
    if operation == 'orphan-reference-audit':
        return [k for k in refs if k not in {i for i,v in items}]
    if operation == 'reference-multiplicity':
        return refs.count(temporary)
    if operation == 'missing-entity-ack':
        return 'replace' if any(k==temporary for k,v in items) else 'ignore'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical-id-rewrite scenario 1', solve('canonical-id-rewrite', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('real',N),('old',2)])
check('canonical-id-rewrite scenario 2', solve('canonical-id-rewrite', ([], 'tmp','real',N,[])), [])
check('canonical-id-rewrite scenario 3', solve('canonical-id-rewrite', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('real',4)])
check('canonical-id-rewrite scenario 4', solve('canonical-id-rewrite', ([('tmp',0)],'tmp','real',0,['tmp'])), [('real',0)])
check('canonical-id-rewrite scenario 5', solve('canonical-id-rewrite', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('canonical-id-rewrite scenario 6', solve('canonical-id-rewrite', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('real',2),('tail',3)])
check('server-value-merge scenario 1', solve('server-value-merge', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',9),('old',2)])
check('server-value-merge scenario 2', solve('server-value-merge', ([], 'tmp','real',N,[])), [])
check('server-value-merge scenario 3', solve('server-value-merge', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('tmp',N)])
check('server-value-merge scenario 4', solve('server-value-merge', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('server-value-merge scenario 5', solve('server-value-merge', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('server-value-merge scenario 6', solve('server-value-merge', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',None),('tail',3)])
check('reference-remap scenario 1', solve('reference-remap', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), ['real','old','real'])
check('reference-remap scenario 2', solve('reference-remap', ([], 'tmp','real',N,[])), [])
check('reference-remap scenario 3', solve('reference-remap', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), ['real','real'])
check('reference-remap scenario 4', solve('reference-remap', ([('tmp',0)],'tmp','real',0,['tmp'])), ['real'])
check('reference-remap scenario 5', solve('reference-remap', ([('other',N)],'tmp','real',7,['other'])), ['other'])
check('reference-remap scenario 6', solve('reference-remap', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['real','missing'])
check('optimistic-position scenario 1', solve('optimistic-position', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 0)
check('optimistic-position scenario 2', solve('optimistic-position', ([], 'tmp','real',N,[])), None)
check('optimistic-position scenario 3', solve('optimistic-position', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('optimistic-position scenario 4', solve('optimistic-position', ([('tmp',0)],'tmp','real',0,['tmp'])), 0)
check('optimistic-position scenario 5', solve('optimistic-position', ([('other',N)],'tmp','real',7,['other'])), None)
check('optimistic-position scenario 6', solve('optimistic-position', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 0)
check('duplicate-canonical-removal scenario 1', solve('duplicate-canonical-removal', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',N),('old',2)])
check('duplicate-canonical-removal scenario 2', solve('duplicate-canonical-removal', ([], 'tmp','real',N,[])), [])
check('duplicate-canonical-removal scenario 3', solve('duplicate-canonical-removal', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('tmp',4)])
check('duplicate-canonical-removal scenario 4', solve('duplicate-canonical-removal', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('duplicate-canonical-removal scenario 5', solve('duplicate-canonical-removal', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('duplicate-canonical-removal scenario 6', solve('duplicate-canonical-removal', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',2),('tail',3)])
check('temporary-presence scenario 1', solve('temporary-presence', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), True)
check('temporary-presence scenario 2', solve('temporary-presence', ([], 'tmp','real',N,[])), False)
check('temporary-presence scenario 3', solve('temporary-presence', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), True)
check('temporary-presence scenario 4', solve('temporary-presence', ([('tmp',0)],'tmp','real',0,['tmp'])), True)
check('temporary-presence scenario 5', solve('temporary-presence', ([('other',N)],'tmp','real',7,['other'])), False)
check('temporary-presence scenario 6', solve('temporary-presence', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), True)
check('rollback-remove-only-created scenario 1', solve('rollback-remove-only-created', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('old',2)])
check('rollback-remove-only-created scenario 2', solve('rollback-remove-only-created', ([], 'tmp','real',N,[])), [])
check('rollback-remove-only-created scenario 3', solve('rollback-remove-only-created', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3)])
check('rollback-remove-only-created scenario 4', solve('rollback-remove-only-created', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('rollback-remove-only-created scenario 5', solve('rollback-remove-only-created', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('rollback-remove-only-created scenario 6', solve('rollback-remove-only-created', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tail',3)])
check('orphan-reference-audit scenario 1', solve('orphan-reference-audit', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [])
check('orphan-reference-audit scenario 2', solve('orphan-reference-audit', ([], 'tmp','real',N,[])), [])
check('orphan-reference-audit scenario 3', solve('orphan-reference-audit', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [])
check('orphan-reference-audit scenario 4', solve('orphan-reference-audit', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('orphan-reference-audit scenario 5', solve('orphan-reference-audit', ([('other',N)],'tmp','real',7,['other'])), [])
check('orphan-reference-audit scenario 6', solve('orphan-reference-audit', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['missing'])
check('reference-multiplicity scenario 1', solve('reference-multiplicity', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 2)
check('reference-multiplicity scenario 2', solve('reference-multiplicity', ([], 'tmp','real',N,[])), 0)
check('reference-multiplicity scenario 3', solve('reference-multiplicity', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('reference-multiplicity scenario 4', solve('reference-multiplicity', ([('tmp',0)],'tmp','real',0,['tmp'])), 1)
check('reference-multiplicity scenario 5', solve('reference-multiplicity', ([('other',N)],'tmp','real',7,['other'])), 0)
check('reference-multiplicity scenario 6', solve('reference-multiplicity', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 1)
check('missing-entity-ack scenario 1', solve('missing-entity-ack', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 'replace')
check('missing-entity-ack scenario 2', solve('missing-entity-ack', ([], 'tmp','real',N,[])), 'ignore')
check('missing-entity-ack scenario 3', solve('missing-entity-ack', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 'replace')
check('missing-entity-ack scenario 4', solve('missing-entity-ack', ([('tmp',0)],'tmp','real',0,['tmp'])), 'replace')
check('missing-entity-ack scenario 5', solve('missing-entity-ack', ([('other',N)],'tmp','real',7,['other'])), 'ignore')
check('missing-entity-ack scenario 6', solve('missing-entity-ack', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 'replace')
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):
    items, temporary, canonical, payload, refs = s
    if operation == 'canonical-id-rewrite':
        return [(canonical if k==temporary else k,v) for k,v in items]
    if operation == 'server-value-merge':
        return [(k,payload or v if k==temporary else v) for k,v in items]
    if operation == 'reference-remap':
        return [canonical if k==temporary else k for k in refs]
    if operation == 'optimistic-position':
        return next((i for i,(k,v) in enumerate(items) if k==temporary),None)
    if operation == 'duplicate-canonical-removal':
        return [(k,v) for k,v in items if k!=canonical]
    if operation == 'temporary-presence':
        return any(k==temporary for k,v in items)
    if operation == 'rollback-remove-only-created':
        return [(k,v) for k,v in items if k!=temporary]
    if operation == 'orphan-reference-audit':
        return [k for k in refs if k not in {i for i,v in items}]
    if operation == 'reference-multiplicity':
        return refs.count(temporary)
    if operation == 'missing-entity-ack':
        return 'replace' if any(k==temporary for k,v in items) else 'ignore'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical-id-rewrite scenario 1', solve('canonical-id-rewrite', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('real',N),('old',2)])
check('canonical-id-rewrite scenario 2', solve('canonical-id-rewrite', ([], 'tmp','real',N,[])), [])
check('canonical-id-rewrite scenario 3', solve('canonical-id-rewrite', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('real',4)])
check('canonical-id-rewrite scenario 4', solve('canonical-id-rewrite', ([('tmp',0)],'tmp','real',0,['tmp'])), [('real',0)])
check('canonical-id-rewrite scenario 5', solve('canonical-id-rewrite', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('canonical-id-rewrite scenario 6', solve('canonical-id-rewrite', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('real',2),('tail',3)])
check('server-value-merge scenario 1', solve('server-value-merge', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',9),('old',2)])
check('server-value-merge scenario 2', solve('server-value-merge', ([], 'tmp','real',N,[])), [])
check('server-value-merge scenario 3', solve('server-value-merge', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('tmp',N)])
check('server-value-merge scenario 4', solve('server-value-merge', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('server-value-merge scenario 5', solve('server-value-merge', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('server-value-merge scenario 6', solve('server-value-merge', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',None),('tail',3)])
check('reference-remap scenario 1', solve('reference-remap', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), ['real','old','real'])
check('reference-remap scenario 2', solve('reference-remap', ([], 'tmp','real',N,[])), [])
check('reference-remap scenario 3', solve('reference-remap', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), ['real','real'])
check('reference-remap scenario 4', solve('reference-remap', ([('tmp',0)],'tmp','real',0,['tmp'])), ['real'])
check('reference-remap scenario 5', solve('reference-remap', ([('other',N)],'tmp','real',7,['other'])), ['other'])
check('reference-remap scenario 6', solve('reference-remap', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['real','missing'])
check('optimistic-position scenario 1', solve('optimistic-position', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 0)
check('optimistic-position scenario 2', solve('optimistic-position', ([], 'tmp','real',N,[])), None)
check('optimistic-position scenario 3', solve('optimistic-position', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('optimistic-position scenario 4', solve('optimistic-position', ([('tmp',0)],'tmp','real',0,['tmp'])), 0)
check('optimistic-position scenario 5', solve('optimistic-position', ([('other',N)],'tmp','real',7,['other'])), None)
check('optimistic-position scenario 6', solve('optimistic-position', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 0)
check('duplicate-canonical-removal scenario 1', solve('duplicate-canonical-removal', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',N),('old',2)])
check('duplicate-canonical-removal scenario 2', solve('duplicate-canonical-removal', ([], 'tmp','real',N,[])), [])
check('duplicate-canonical-removal scenario 3', solve('duplicate-canonical-removal', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('tmp',4)])
check('duplicate-canonical-removal scenario 4', solve('duplicate-canonical-removal', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('duplicate-canonical-removal scenario 5', solve('duplicate-canonical-removal', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('duplicate-canonical-removal scenario 6', solve('duplicate-canonical-removal', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',2),('tail',3)])
check('temporary-presence scenario 1', solve('temporary-presence', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), True)
check('temporary-presence scenario 2', solve('temporary-presence', ([], 'tmp','real',N,[])), False)
check('temporary-presence scenario 3', solve('temporary-presence', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), True)
check('temporary-presence scenario 4', solve('temporary-presence', ([('tmp',0)],'tmp','real',0,['tmp'])), True)
check('temporary-presence scenario 5', solve('temporary-presence', ([('other',N)],'tmp','real',7,['other'])), False)
check('temporary-presence scenario 6', solve('temporary-presence', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), True)
check('rollback-remove-only-created scenario 1', solve('rollback-remove-only-created', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('old',2)])
check('rollback-remove-only-created scenario 2', solve('rollback-remove-only-created', ([], 'tmp','real',N,[])), [])
check('rollback-remove-only-created scenario 3', solve('rollback-remove-only-created', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3)])
check('rollback-remove-only-created scenario 4', solve('rollback-remove-only-created', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('rollback-remove-only-created scenario 5', solve('rollback-remove-only-created', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('rollback-remove-only-created scenario 6', solve('rollback-remove-only-created', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tail',3)])
check('orphan-reference-audit scenario 1', solve('orphan-reference-audit', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [])
check('orphan-reference-audit scenario 2', solve('orphan-reference-audit', ([], 'tmp','real',N,[])), [])
check('orphan-reference-audit scenario 3', solve('orphan-reference-audit', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [])
check('orphan-reference-audit scenario 4', solve('orphan-reference-audit', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('orphan-reference-audit scenario 5', solve('orphan-reference-audit', ([('other',N)],'tmp','real',7,['other'])), [])
check('orphan-reference-audit scenario 6', solve('orphan-reference-audit', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['missing'])
check('reference-multiplicity scenario 1', solve('reference-multiplicity', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 2)
check('reference-multiplicity scenario 2', solve('reference-multiplicity', ([], 'tmp','real',N,[])), 0)
check('reference-multiplicity scenario 3', solve('reference-multiplicity', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('reference-multiplicity scenario 4', solve('reference-multiplicity', ([('tmp',0)],'tmp','real',0,['tmp'])), 1)
check('reference-multiplicity scenario 5', solve('reference-multiplicity', ([('other',N)],'tmp','real',7,['other'])), 0)
check('reference-multiplicity scenario 6', solve('reference-multiplicity', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 1)
check('missing-entity-ack scenario 1', solve('missing-entity-ack', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 'replace')
check('missing-entity-ack scenario 2', solve('missing-entity-ack', ([], 'tmp','real',N,[])), 'ignore')
check('missing-entity-ack scenario 3', solve('missing-entity-ack', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 'replace')
check('missing-entity-ack scenario 4', solve('missing-entity-ack', ([('tmp',0)],'tmp','real',0,['tmp'])), 'replace')
check('missing-entity-ack scenario 5', solve('missing-entity-ack', ([('other',N)],'tmp','real',7,['other'])), 'ignore')
check('missing-entity-ack scenario 6', solve('missing-entity-ack', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 'replace')
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:
Server value merge.

The acknowledgment model reconciles one temporary entity. Keep unrelated rows and reference multiplicity, prefer the server value including null, and ignore acknowledgments whose temporary entity no longer exists. Operation server-value-merge 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):
    items, temporary, canonical, payload, refs = s
    if operation == 'canonical-id-rewrite':
        return [(canonical if k==temporary else k,v) for k,v in items]
    if operation == 'server-value-merge':
        return [(k,payload if k==temporary else v) for k,v in items]
    if operation == 'reference-remap':
        return refs
    if operation == 'optimistic-position':
        return next((i for i,(k,v) in enumerate(items) if k==temporary),None)
    if operation == 'duplicate-canonical-removal':
        return [(k,v) for k,v in items if k!=canonical]
    if operation == 'temporary-presence':
        return any(k==temporary for k,v in items)
    if operation == 'rollback-remove-only-created':
        return [(k,v) for k,v in items if k!=temporary]
    if operation == 'orphan-reference-audit':
        return [k for k in refs if k not in {i for i,v in items}]
    if operation == 'reference-multiplicity':
        return refs.count(temporary)
    if operation == 'missing-entity-ack':
        return 'replace' if any(k==temporary for k,v in items) else 'ignore'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical-id-rewrite scenario 1', solve('canonical-id-rewrite', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('real',N),('old',2)])
check('canonical-id-rewrite scenario 2', solve('canonical-id-rewrite', ([], 'tmp','real',N,[])), [])
check('canonical-id-rewrite scenario 3', solve('canonical-id-rewrite', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('real',4)])
check('canonical-id-rewrite scenario 4', solve('canonical-id-rewrite', ([('tmp',0)],'tmp','real',0,['tmp'])), [('real',0)])
check('canonical-id-rewrite scenario 5', solve('canonical-id-rewrite', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('canonical-id-rewrite scenario 6', solve('canonical-id-rewrite', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('real',2),('tail',3)])
check('server-value-merge scenario 1', solve('server-value-merge', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',9),('old',2)])
check('server-value-merge scenario 2', solve('server-value-merge', ([], 'tmp','real',N,[])), [])
check('server-value-merge scenario 3', solve('server-value-merge', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('tmp',N)])
check('server-value-merge scenario 4', solve('server-value-merge', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('server-value-merge scenario 5', solve('server-value-merge', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('server-value-merge scenario 6', solve('server-value-merge', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',None),('tail',3)])
check('reference-remap scenario 1', solve('reference-remap', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), ['real','old','real'])
check('reference-remap scenario 2', solve('reference-remap', ([], 'tmp','real',N,[])), [])
check('reference-remap scenario 3', solve('reference-remap', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), ['real','real'])
check('reference-remap scenario 4', solve('reference-remap', ([('tmp',0)],'tmp','real',0,['tmp'])), ['real'])
check('reference-remap scenario 5', solve('reference-remap', ([('other',N)],'tmp','real',7,['other'])), ['other'])
check('reference-remap scenario 6', solve('reference-remap', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['real','missing'])
check('optimistic-position scenario 1', solve('optimistic-position', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 0)
check('optimistic-position scenario 2', solve('optimistic-position', ([], 'tmp','real',N,[])), None)
check('optimistic-position scenario 3', solve('optimistic-position', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('optimistic-position scenario 4', solve('optimistic-position', ([('tmp',0)],'tmp','real',0,['tmp'])), 0)
check('optimistic-position scenario 5', solve('optimistic-position', ([('other',N)],'tmp','real',7,['other'])), None)
check('optimistic-position scenario 6', solve('optimistic-position', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 0)
check('duplicate-canonical-removal scenario 1', solve('duplicate-canonical-removal', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',N),('old',2)])
check('duplicate-canonical-removal scenario 2', solve('duplicate-canonical-removal', ([], 'tmp','real',N,[])), [])
check('duplicate-canonical-removal scenario 3', solve('duplicate-canonical-removal', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('tmp',4)])
check('duplicate-canonical-removal scenario 4', solve('duplicate-canonical-removal', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('duplicate-canonical-removal scenario 5', solve('duplicate-canonical-removal', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('duplicate-canonical-removal scenario 6', solve('duplicate-canonical-removal', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',2),('tail',3)])
check('temporary-presence scenario 1', solve('temporary-presence', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), True)
check('temporary-presence scenario 2', solve('temporary-presence', ([], 'tmp','real',N,[])), False)
check('temporary-presence scenario 3', solve('temporary-presence', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), True)
check('temporary-presence scenario 4', solve('temporary-presence', ([('tmp',0)],'tmp','real',0,['tmp'])), True)
check('temporary-presence scenario 5', solve('temporary-presence', ([('other',N)],'tmp','real',7,['other'])), False)
check('temporary-presence scenario 6', solve('temporary-presence', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), True)
check('rollback-remove-only-created scenario 1', solve('rollback-remove-only-created', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('old',2)])
check('rollback-remove-only-created scenario 2', solve('rollback-remove-only-created', ([], 'tmp','real',N,[])), [])
check('rollback-remove-only-created scenario 3', solve('rollback-remove-only-created', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3)])
check('rollback-remove-only-created scenario 4', solve('rollback-remove-only-created', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('rollback-remove-only-created scenario 5', solve('rollback-remove-only-created', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('rollback-remove-only-created scenario 6', solve('rollback-remove-only-created', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tail',3)])
check('orphan-reference-audit scenario 1', solve('orphan-reference-audit', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [])
check('orphan-reference-audit scenario 2', solve('orphan-reference-audit', ([], 'tmp','real',N,[])), [])
check('orphan-reference-audit scenario 3', solve('orphan-reference-audit', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [])
check('orphan-reference-audit scenario 4', solve('orphan-reference-audit', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('orphan-reference-audit scenario 5', solve('orphan-reference-audit', ([('other',N)],'tmp','real',7,['other'])), [])
check('orphan-reference-audit scenario 6', solve('orphan-reference-audit', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['missing'])
check('reference-multiplicity scenario 1', solve('reference-multiplicity', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 2)
check('reference-multiplicity scenario 2', solve('reference-multiplicity', ([], 'tmp','real',N,[])), 0)
check('reference-multiplicity scenario 3', solve('reference-multiplicity', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('reference-multiplicity scenario 4', solve('reference-multiplicity', ([('tmp',0)],'tmp','real',0,['tmp'])), 1)
check('reference-multiplicity scenario 5', solve('reference-multiplicity', ([('other',N)],'tmp','real',7,['other'])), 0)
check('reference-multiplicity scenario 6', solve('reference-multiplicity', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 1)
check('missing-entity-ack scenario 1', solve('missing-entity-ack', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 'replace')
check('missing-entity-ack scenario 2', solve('missing-entity-ack', ([], 'tmp','real',N,[])), 'ignore')
check('missing-entity-ack scenario 3', solve('missing-entity-ack', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 'replace')
check('missing-entity-ack scenario 4', solve('missing-entity-ack', ([('tmp',0)],'tmp','real',0,['tmp'])), 'replace')
check('missing-entity-ack scenario 5', solve('missing-entity-ack', ([('other',N)],'tmp','real',7,['other'])), 'ignore')
check('missing-entity-ack scenario 6', solve('missing-entity-ack', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 'replace')
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):
    items, temporary, canonical, payload, refs = s
    if operation == 'canonical-id-rewrite':
        return [(canonical if k==temporary else k,v) for k,v in items]
    if operation == 'server-value-merge':
        return [(k,payload if k==temporary else v) for k,v in items]
    if operation == 'reference-remap':
        return [canonical if k==temporary else k for k in refs[:1]]
    if operation == 'optimistic-position':
        return next((i for i,(k,v) in enumerate(items) if k==temporary),None)
    if operation == 'duplicate-canonical-removal':
        return [(k,v) for k,v in items if k!=canonical]
    if operation == 'temporary-presence':
        return any(k==temporary for k,v in items)
    if operation == 'rollback-remove-only-created':
        return [(k,v) for k,v in items if k!=temporary]
    if operation == 'orphan-reference-audit':
        return [k for k in refs if k not in {i for i,v in items}]
    if operation == 'reference-multiplicity':
        return refs.count(temporary)
    if operation == 'missing-entity-ack':
        return 'replace' if any(k==temporary for k,v in items) else 'ignore'
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('canonical-id-rewrite scenario 1', solve('canonical-id-rewrite', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('real',N),('old',2)])
check('canonical-id-rewrite scenario 2', solve('canonical-id-rewrite', ([], 'tmp','real',N,[])), [])
check('canonical-id-rewrite scenario 3', solve('canonical-id-rewrite', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('real',4)])
check('canonical-id-rewrite scenario 4', solve('canonical-id-rewrite', ([('tmp',0)],'tmp','real',0,['tmp'])), [('real',0)])
check('canonical-id-rewrite scenario 5', solve('canonical-id-rewrite', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('canonical-id-rewrite scenario 6', solve('canonical-id-rewrite', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('real',2),('tail',3)])
check('server-value-merge scenario 1', solve('server-value-merge', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',9),('old',2)])
check('server-value-merge scenario 2', solve('server-value-merge', ([], 'tmp','real',N,[])), [])
check('server-value-merge scenario 3', solve('server-value-merge', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3),('tmp',N)])
check('server-value-merge scenario 4', solve('server-value-merge', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('server-value-merge scenario 5', solve('server-value-merge', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('server-value-merge scenario 6', solve('server-value-merge', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',None),('tail',3)])
check('reference-remap scenario 1', solve('reference-remap', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), ['real','old','real'])
check('reference-remap scenario 2', solve('reference-remap', ([], 'tmp','real',N,[])), [])
check('reference-remap scenario 3', solve('reference-remap', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), ['real','real'])
check('reference-remap scenario 4', solve('reference-remap', ([('tmp',0)],'tmp','real',0,['tmp'])), ['real'])
check('reference-remap scenario 5', solve('reference-remap', ([('other',N)],'tmp','real',7,['other'])), ['other'])
check('reference-remap scenario 6', solve('reference-remap', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['real','missing'])
check('optimistic-position scenario 1', solve('optimistic-position', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 0)
check('optimistic-position scenario 2', solve('optimistic-position', ([], 'tmp','real',N,[])), None)
check('optimistic-position scenario 3', solve('optimistic-position', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('optimistic-position scenario 4', solve('optimistic-position', ([('tmp',0)],'tmp','real',0,['tmp'])), 0)
check('optimistic-position scenario 5', solve('optimistic-position', ([('other',N)],'tmp','real',7,['other'])), None)
check('optimistic-position scenario 6', solve('optimistic-position', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 0)
check('duplicate-canonical-removal scenario 1', solve('duplicate-canonical-removal', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('tmp',N),('old',2)])
check('duplicate-canonical-removal scenario 2', solve('duplicate-canonical-removal', ([], 'tmp','real',N,[])), [])
check('duplicate-canonical-removal scenario 3', solve('duplicate-canonical-removal', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('tmp',4)])
check('duplicate-canonical-removal scenario 4', solve('duplicate-canonical-removal', ([('tmp',0)],'tmp','real',0,['tmp'])), [('tmp',0)])
check('duplicate-canonical-removal scenario 5', solve('duplicate-canonical-removal', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('duplicate-canonical-removal scenario 6', solve('duplicate-canonical-removal', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tmp',2),('tail',3)])
check('temporary-presence scenario 1', solve('temporary-presence', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), True)
check('temporary-presence scenario 2', solve('temporary-presence', ([], 'tmp','real',N,[])), False)
check('temporary-presence scenario 3', solve('temporary-presence', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), True)
check('temporary-presence scenario 4', solve('temporary-presence', ([('tmp',0)],'tmp','real',0,['tmp'])), True)
check('temporary-presence scenario 5', solve('temporary-presence', ([('other',N)],'tmp','real',7,['other'])), False)
check('temporary-presence scenario 6', solve('temporary-presence', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), True)
check('rollback-remove-only-created scenario 1', solve('rollback-remove-only-created', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [('old',2)])
check('rollback-remove-only-created scenario 2', solve('rollback-remove-only-created', ([], 'tmp','real',N,[])), [])
check('rollback-remove-only-created scenario 3', solve('rollback-remove-only-created', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [('real',3)])
check('rollback-remove-only-created scenario 4', solve('rollback-remove-only-created', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('rollback-remove-only-created scenario 5', solve('rollback-remove-only-created', ([('other',N)],'tmp','real',7,['other'])), [('other',N)])
check('rollback-remove-only-created scenario 6', solve('rollback-remove-only-created', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), [('tail',3)])
check('orphan-reference-audit scenario 1', solve('orphan-reference-audit', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), [])
check('orphan-reference-audit scenario 2', solve('orphan-reference-audit', ([], 'tmp','real',N,[])), [])
check('orphan-reference-audit scenario 3', solve('orphan-reference-audit', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), [])
check('orphan-reference-audit scenario 4', solve('orphan-reference-audit', ([('tmp',0)],'tmp','real',0,['tmp'])), [])
check('orphan-reference-audit scenario 5', solve('orphan-reference-audit', ([('other',N)],'tmp','real',7,['other'])), [])
check('orphan-reference-audit scenario 6', solve('orphan-reference-audit', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), ['missing'])
check('reference-multiplicity scenario 1', solve('reference-multiplicity', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 2)
check('reference-multiplicity scenario 2', solve('reference-multiplicity', ([], 'tmp','real',N,[])), 0)
check('reference-multiplicity scenario 3', solve('reference-multiplicity', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 1)
check('reference-multiplicity scenario 4', solve('reference-multiplicity', ([('tmp',0)],'tmp','real',0,['tmp'])), 1)
check('reference-multiplicity scenario 5', solve('reference-multiplicity', ([('other',N)],'tmp','real',7,['other'])), 0)
check('reference-multiplicity scenario 6', solve('reference-multiplicity', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 1)
check('missing-entity-ack scenario 1', solve('missing-entity-ack', ([('tmp',N),('old',2)], 'tmp','real',9,['tmp','old','tmp'])), 'replace')
check('missing-entity-ack scenario 2', solve('missing-entity-ack', ([], 'tmp','real',N,[])), 'ignore')
check('missing-entity-ack scenario 3', solve('missing-entity-ack', ([('real',3),('tmp',4)],'tmp','real',N,['real','tmp'])), 'replace')
check('missing-entity-ack scenario 4', solve('missing-entity-ack', ([('tmp',0)],'tmp','real',0,['tmp'])), 'replace')
check('missing-entity-ack scenario 5', solve('missing-entity-ack', ([('other',N)],'tmp','real',7,['other'])), 'ignore')
check('missing-entity-ack scenario 6', solve('missing-entity-ack', ([('tmp',2),('tail',3)],'tmp','real',None,['tmp','missing'])), 'replace')
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:
Reference remap.

The acknowledgment model reconciles one temporary entity. Keep unrelated rows and reference multiplicity, prefer the server value including null, and ignore acknowledgments whose temporary entity no longer exists. Operation reference-remap has the six explicit input/output oracles below.

split: open-access