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 [canonical if k==temporary else k for k in refs]
    if operation == 'optimistic-position':
        return 0
    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]
    if operation == 'optimistic-position':
        return next((i for i,(k,v) in enumerate(items) if k==canonical),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:
Optimistic position.

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 optimistic-position 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 [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 items
    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)

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):
    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]
    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!=temporary]
    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:
Duplicate canonical removal.

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 duplicate-canonical-removal 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 [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 bool(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]
    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 and v 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:
Temporary presence.

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 temporary-presence 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 [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 []
    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]
    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!=canonical]
    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:
Rollback remove only created.

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 rollback-remove-only-created 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 [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 []
    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]
    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!=temporary]
    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:
Orphan reference audit.

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 orphan-reference-audit has the six explicit input/output oracles below.

split: open-access