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

N = 1
observations = []
def solve(operation, s):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return []
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(operation, s):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if t!=event]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Unsubscribe by registration.

Registration handles differ from topic names. Removing a handle removes all its registrations while preserving other handles and topic reference counts; unmounted consumers receive nothing and discard buffered events. Operation unsubscribe-by-registration 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):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(operation, s):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event][:1]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Topic recipient routing.

Registration handles differ from topic names. Removing a handle removes all its registrations while preserving other handles and topic reference counts; unmounted consumers receive nothing and discard buffered events. Operation topic-recipient-routing 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):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event]
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(operation, s):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event and k!=removed] if mounted else []
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Unmounted event delivery.

Registration handles differ from topic names. Removing a handle removes all its registrations while preserving other handles and topic reference counts; unmounted consumers receive nothing and discard buffered events. Operation unmounted-event-delivery 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):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return not registrations
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(operation, s):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return len(registrations)==1
    if operation == 'registration-topic-index':
        return sorted({t for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Last listener resource close.

Registration handles differ from topic names. Removing a handle removes all its registrations while preserving other handles and topic reference counts; unmounted consumers receive nothing and discard buffered events. Operation last-listener-resource-close 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):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return [t for k,t in registrations]
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(operation, s):
    registrations, removed, event, mounted, buffered = s
    if operation == 'unsubscribe-by-registration':
        return [(k,t) for k,t in registrations if k!=removed]
    if operation == 'topic-recipient-routing':
        return [k for k,t in registrations if t==event]
    if operation == 'unmounted-event-delivery':
        return [k for k,t in registrations if t==event] if mounted else []
    if operation == 'last-listener-resource-close':
        return not any(k!=removed for k,t in registrations)
    if operation == 'registration-topic-index':
        return sorted({k for k,t in registrations})
    if operation == 'unmount-buffer-discard':
        return buffered if mounted else []
    if operation == 'buffered-delivery-order':
        return buffered+[event]
    if operation == 'unknown-unsubscribe-noop':
        return removed not in [k for k,t in registrations]
    if operation == 'registration-removal-count':
        return sum(k==removed for k,t in registrations)
    if operation == 'remaining-topic-reference-count':
        return sum(t==event and k!=removed for k,t in registrations)
    raise ValueError('unknown modeled operation')
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unsubscribe-by-registration scenario 1', solve('unsubscribe-by-registration', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), [('b','x'),('c','y')])
check('unsubscribe-by-registration scenario 2', solve('unsubscribe-by-registration', ([],'a','x',True,[])), [])
check('unsubscribe-by-registration scenario 3', solve('unsubscribe-by-registration', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unsubscribe-by-registration scenario 4', solve('unsubscribe-by-registration', ([('a','x')],'z','x',True,[])), [('a','x')])
check('unsubscribe-by-registration scenario 5', solve('unsubscribe-by-registration', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [('a','x')])
check('unsubscribe-by-registration scenario 6', solve('unsubscribe-by-registration', ([('a','x'),('b','x')],'b','x',False,[])), [('a','x')])
check('topic-recipient-routing scenario 1', solve('topic-recipient-routing', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('topic-recipient-routing scenario 2', solve('topic-recipient-routing', ([],'a','x',True,[])), [])
check('topic-recipient-routing scenario 3', solve('topic-recipient-routing', ([('a','x'),('a','y')],'a','y',False,['old'])), ['a'])
check('topic-recipient-routing scenario 4', solve('topic-recipient-routing', ([('a','x')],'z','x',True,[])), ['a'])
check('topic-recipient-routing scenario 5', solve('topic-recipient-routing', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('topic-recipient-routing scenario 6', solve('topic-recipient-routing', ([('a','x'),('b','x')],'b','x',False,[])), ['a','b'])
check('unmounted-event-delivery scenario 1', solve('unmounted-event-delivery', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['a','b'])
check('unmounted-event-delivery scenario 2', solve('unmounted-event-delivery', ([],'a','x',True,[])), [])
check('unmounted-event-delivery scenario 3', solve('unmounted-event-delivery', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmounted-event-delivery scenario 4', solve('unmounted-event-delivery', ([('a','x')],'z','x',True,[])), ['a'])
check('unmounted-event-delivery scenario 5', solve('unmounted-event-delivery', ([('a','x'),('b','y')],'b','z',True,['a','b'])), [])
check('unmounted-event-delivery scenario 6', solve('unmounted-event-delivery', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('last-listener-resource-close scenario 1', solve('last-listener-resource-close', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('last-listener-resource-close scenario 2', solve('last-listener-resource-close', ([],'a','x',True,[])), True)
check('last-listener-resource-close scenario 3', solve('last-listener-resource-close', ([('a','x'),('a','y')],'a','y',False,['old'])), True)
check('last-listener-resource-close scenario 4', solve('last-listener-resource-close', ([('a','x')],'z','x',True,[])), False)
check('last-listener-resource-close scenario 5', solve('last-listener-resource-close', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('last-listener-resource-close scenario 6', solve('last-listener-resource-close', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-topic-index scenario 1', solve('registration-topic-index', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['x','y'])
check('registration-topic-index scenario 2', solve('registration-topic-index', ([],'a','x',True,[])), [])
check('registration-topic-index scenario 3', solve('registration-topic-index', ([('a','x'),('a','y')],'a','y',False,['old'])), ['x','y'])
check('registration-topic-index scenario 4', solve('registration-topic-index', ([('a','x')],'z','x',True,[])), ['x'])
check('registration-topic-index scenario 5', solve('registration-topic-index', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['x','y'])
check('registration-topic-index scenario 6', solve('registration-topic-index', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unmount-buffer-discard scenario 1', solve('unmount-buffer-discard', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N)])
check('unmount-buffer-discard scenario 2', solve('unmount-buffer-discard', ([],'a','x',True,[])), [])
check('unmount-buffer-discard scenario 3', solve('unmount-buffer-discard', ([('a','x'),('a','y')],'a','y',False,['old'])), [])
check('unmount-buffer-discard scenario 4', solve('unmount-buffer-discard', ([('a','x')],'z','x',True,[])), [])
check('unmount-buffer-discard scenario 5', solve('unmount-buffer-discard', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b'])
check('unmount-buffer-discard scenario 6', solve('unmount-buffer-discard', ([('a','x'),('b','x')],'b','x',False,[])), [])
check('buffered-delivery-order scenario 1', solve('buffered-delivery-order', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), ['old'+str(N),'x'])
check('buffered-delivery-order scenario 2', solve('buffered-delivery-order', ([],'a','x',True,[])), ['x'])
check('buffered-delivery-order scenario 3', solve('buffered-delivery-order', ([('a','x'),('a','y')],'a','y',False,['old'])), ['old','y'])
check('buffered-delivery-order scenario 4', solve('buffered-delivery-order', ([('a','x')],'z','x',True,[])), ['x'])
check('buffered-delivery-order scenario 5', solve('buffered-delivery-order', ([('a','x'),('b','y')],'b','z',True,['a','b'])), ['a','b','z'])
check('buffered-delivery-order scenario 6', solve('buffered-delivery-order', ([('a','x'),('b','x')],'b','x',False,[])), ['x'])
check('unknown-unsubscribe-noop scenario 1', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), False)
check('unknown-unsubscribe-noop scenario 2', solve('unknown-unsubscribe-noop', ([],'a','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 3', solve('unknown-unsubscribe-noop', ([('a','x'),('a','y')],'a','y',False,['old'])), False)
check('unknown-unsubscribe-noop scenario 4', solve('unknown-unsubscribe-noop', ([('a','x')],'z','x',True,[])), True)
check('unknown-unsubscribe-noop scenario 5', solve('unknown-unsubscribe-noop', ([('a','x'),('b','y')],'b','z',True,['a','b'])), False)
check('unknown-unsubscribe-noop scenario 6', solve('unknown-unsubscribe-noop', ([('a','x'),('b','x')],'b','x',False,[])), False)
check('registration-removal-count scenario 1', solve('registration-removal-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('registration-removal-count scenario 2', solve('registration-removal-count', ([],'a','x',True,[])), 0)
check('registration-removal-count scenario 3', solve('registration-removal-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 2)
check('registration-removal-count scenario 4', solve('registration-removal-count', ([('a','x')],'z','x',True,[])), 0)
check('registration-removal-count scenario 5', solve('registration-removal-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 1)
check('registration-removal-count scenario 6', solve('registration-removal-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
check('remaining-topic-reference-count scenario 1', solve('remaining-topic-reference-count', ([('a','x'),('b','x'),('c','y')],'a','x',True,['old'+str(N)])), 1)
check('remaining-topic-reference-count scenario 2', solve('remaining-topic-reference-count', ([],'a','x',True,[])), 0)
check('remaining-topic-reference-count scenario 3', solve('remaining-topic-reference-count', ([('a','x'),('a','y')],'a','y',False,['old'])), 0)
check('remaining-topic-reference-count scenario 4', solve('remaining-topic-reference-count', ([('a','x')],'z','x',True,[])), 1)
check('remaining-topic-reference-count scenario 5', solve('remaining-topic-reference-count', ([('a','x'),('b','y')],'b','z',True,['a','b'])), 0)
check('remaining-topic-reference-count scenario 6', solve('remaining-topic-reference-count', ([('a','x'),('b','x')],'b','x',False,[])), 1)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Registration topic index.

Registration handles differ from topic names. Removing a handle removes all its registrations while preserving other handles and topic reference counts; unmounted consumers receive nothing and discard buffered events. Operation registration-topic-index has the six explicit input/output oracles below.

split: open-access