{"abstract":"The operation returns a result or retained state that violates this contract: Listeners have identity, event name, once flag, and registration order. Dispatch uses a snapshot; listener actions remove another listener or add a new one. Return callback identities in invocation order. Dispatch membership is captured before callbacks; removals during dispatch do not skip captured callbacks.","category":"Listener lifecycle","checks":5,"contract":"Listeners have identity, event name, once flag, and registration order. Dispatch uses a snapshot; listener actions remove another listener or add a new one. Return callback identities in invocation order. Dispatch membership is captured before callbacks; removals during dispatch do not skip captured callbacks. Inputs are the finite Python values shown by the executable fixtures; no concurrent execution is assumed.","evaluation_group":"xr-suite-listener-registration-replaces-identity","failed_approach":"The attempted transition changes the behavior but still violates the same invariant in at least one independent regression fixture.","family":"xr-listener-dispatch-snapshot","id":"FA-4516","implementations":{"attempt":{"sha256":"540b304a24787c4f92ce8ae88e08136378fae4cbe25f28e710e6db245032e7d2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x, y=None):\n    listeners={}; out=[]\n    for event in x:\n        op=event[0]\n        if op=='on':\n            _,k,name,once,action=event\n            if True: listeners[k]=[name,once,action]\n        elif op=='off':\n            listeners.pop(event[1],None)\n        elif op=='emit':\n            name=event[1]\n            batch=[(k,v) for k,v in listeners.items() if not any(e[2] and e[2][0]==\"off\" and e[2][1]==k for e in listeners.values())]\n            for k,entry in batch:\n                if entry[0]==name:\n                    if entry[1]:\n                        listeners.pop(k,None)\n                    out.append(k)\n                    action=entry[2]\n                    if action and action[0]=='off':\n                        listeners.pop(action[1],None)\n                    elif action and action[0]=='on':\n                        listeners[action[1]]=[action[2],False,None]\n        elif op=='names': out.append(list(listeners))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement changes event but preserves order', solve([['on', 'a', 'old', False, None], ['on', 'b', 'new', False, None], ['on', 'a', 'new', False, None], ['emit', 'new'], ['names']]), ['a', 'b', ['a', 'b']])\ncheck('snapshot removal and once lifetime', solve([['on', 'a', 'e', True, ['off', 'b']], ['on', 'b', 'e', False, None], ['on', 'c', 'e', False, None], ['emit', 'e'], ['emit', 'e'], ['names']]), ['a', 'b', 'c', 'c', ['c']])\ncheck('explicit identity removal and event filtering', solve([['on', 'a', 'e', False, None], ['on', 'b', '*', False, None], ['on', 'c', 'e', False, None], ['off', 'a'], ['emit', 'e'], ['names']]), ['c', ['b', 'c']])\ncheck('callback replaces existing target event', solve([['on', 'a', 'e', True, ['on', 'b', 'later']], ['on', 'b', 'old', False, None], ['emit', 'e'], ['emit', 'later'], ['emit', 'old'], ['names']]), ['a', 'b', ['b']])\ncheck('callback replaces metadata rather than setdefault', solve([['on','a','e',True,['on','b','later']],['on','b','old',False,None],['emit','e'],['emit','later'],['emit','later'],['emit','old']]), ['a','b','b'])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"6b89661a81eb9efb875a76021bf4cfb9f275c31e76074cf14865f463b22012d2","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x, y=None):\n    listeners={}; out=[]\n    for event in x:\n        op=event[0]\n        if op=='on':\n            _,k,name,once,action=event\n            if True: listeners[k]=[name,once,action]\n        elif op=='off':\n            listeners.pop(event[1],None)\n        elif op=='emit':\n            name=event[1]\n            batch=[(k,listeners[k]) for k in reversed(listeners)]\n            for k,entry in batch:\n                if entry[0]==name:\n                    if entry[1]:\n                        listeners.pop(k,None)\n                    out.append(k)\n                    action=entry[2]\n                    if action and action[0]=='off':\n                        listeners.pop(action[1],None)\n                    elif action and action[0]=='on':\n                        listeners[action[1]]=[action[2],False,None]\n        elif op=='names': out.append(list(listeners))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement changes event but preserves order', solve([['on', 'a', 'old', False, None], ['on', 'b', 'new', False, None], ['on', 'a', 'new', False, None], ['emit', 'new'], ['names']]), ['a', 'b', ['a', 'b']])\ncheck('snapshot removal and once lifetime', solve([['on', 'a', 'e', True, ['off', 'b']], ['on', 'b', 'e', False, None], ['on', 'c', 'e', False, None], ['emit', 'e'], ['emit', 'e'], ['names']]), ['a', 'b', 'c', 'c', ['c']])\ncheck('explicit identity removal and event filtering', solve([['on', 'a', 'e', False, None], ['on', 'b', '*', False, None], ['on', 'c', 'e', False, None], ['off', 'a'], ['emit', 'e'], ['names']]), ['c', ['b', 'c']])\ncheck('callback replaces existing target event', solve([['on', 'a', 'e', True, ['on', 'b', 'later']], ['on', 'b', 'old', False, None], ['emit', 'e'], ['emit', 'later'], ['emit', 'old'], ['names']]), ['a', 'b', ['b']])\ncheck('callback replaces metadata rather than setdefault', solve([['on','a','e',True,['on','b','later']],['on','b','old',False,None],['emit','e'],['emit','later'],['emit','later'],['emit','old']]), ['a','b','b'])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"0935085c19d93738649b6d9ccffd7369a704e5b24acd1f60e71a44e5d457e3d4","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x, y=None):\n    listeners={}; out=[]\n    for event in x:\n        op=event[0]\n        if op=='on':\n            _,k,name,once,action=event\n            if True: listeners[k]=[name,once,action]\n        elif op=='off':\n            listeners.pop(event[1],None)\n        elif op=='emit':\n            name=event[1]\n            batch=list(listeners.items())\n            for k,entry in batch:\n                if entry[0]==name:\n                    if entry[1]:\n                        listeners.pop(k,None)\n                    out.append(k)\n                    action=entry[2]\n                    if action and action[0]=='off':\n                        listeners.pop(action[1],None)\n                    elif action and action[0]=='on':\n                        listeners[action[1]]=[action[2],False,None]\n        elif op=='names': out.append(list(listeners))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('replacement changes event but preserves order', solve([['on', 'a', 'old', False, None], ['on', 'b', 'new', False, None], ['on', 'a', 'new', False, None], ['emit', 'new'], ['names']]), ['a', 'b', ['a', 'b']])\ncheck('snapshot removal and once lifetime', solve([['on', 'a', 'e', True, ['off', 'b']], ['on', 'b', 'e', False, None], ['on', 'c', 'e', False, None], ['emit', 'e'], ['emit', 'e'], ['names']]), ['a', 'b', 'c', 'c', ['c']])\ncheck('explicit identity removal and event filtering', solve([['on', 'a', 'e', False, None], ['on', 'b', '*', False, None], ['on', 'c', 'e', False, None], ['off', 'a'], ['emit', 'e'], ['names']]), ['c', ['b', 'c']])\ncheck('callback replaces existing target event', solve([['on', 'a', 'e', True, ['on', 'b', 'later']], ['on', 'b', 'old', False, None], ['emit', 'e'], ['emit', 'later'], ['emit', 'old'], ['names']]), ['a', 'b', ['b']])\ncheck('callback replaces metadata rather than setdefault', solve([['on','a','e',True,['on','b','later']],['on','b','old',False,None],['emit','e'],['emit','later'],['emit','later'],['emit','old']]), ['a','b','b'])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":" This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"xr-listener-dispatch-snapshot","generated_at":"2026-09-29T14:37:40.039584+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A controlled local-runtime regression for collection APIs, language semantics, or ownership wrappers. Fixtures include boundary and interaction cases.","repair":"Listeners have identity, event name, once flag, and registration order. Dispatch uses a snapshot; listener actions remove another listener or add a new one. Return callback identities in invocation order. Dispatch membership is captured before callbacks; removals during dispatch do not skip captured callbacks.","root_cause":"Dispatch membership is captured before callbacks; removals during dispatch do not skip captured callbacks. The broken transition violates that invariant.","sha256":"f99eaf1762f0abbb75f5d9866536ff51bc156f946e75ee908d8644494c895fca","title":"Listener dispatch snapshot · case 01","variant":1,"variant_policy":"Five execution reruns of a fixed adversarial fixture suite; variant number does not alter semantic inputs.","verification":{"attempt":{"elapsed_ms":38.942,"exit_code":1,"observations":[{"actual":["a","b",["a","b"]],"check":"replacement changes event but preserves order","expected":["a","b",["a","b"]],"passed":true},{"actual":["a","c","c",["c"]],"check":"snapshot removal and once lifetime","expected":["a","b","c","c",["c"]],"passed":false},{"actual":["c",["b","c"]],"check":"explicit identity removal and event filtering","expected":["c",["b","c"]],"passed":true},{"actual":["a","b",["b"]],"check":"callback replaces existing target event","expected":["a","b",["b"]],"passed":true},{"actual":["a","b","b"],"check":"callback replaces metadata rather than setdefault","expected":["a","b","b"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement changes event but preserves order\", \"actual\": [\"a\", \"b\", [\"a\", \"b\"]], \"expected\": [\"a\", \"b\", [\"a\", \"b\"]], \"passed\": true}, {\"check\": \"snapshot removal and once lifetime\", \"actual\": [\"a\", \"c\", \"c\", [\"c\"]], \"expected\": [\"a\", \"b\", \"c\", \"c\", [\"c\"]], \"passed\": false}, {\"check\": \"explicit identity removal and event filtering\", \"actual\": [\"c\", [\"b\", \"c\"]], \"expected\": [\"c\", [\"b\", \"c\"]], \"passed\": true}, {\"check\": \"callback replaces existing target event\", \"actual\": [\"a\", \"b\", [\"b\"]], \"expected\": [\"a\", \"b\", [\"b\"]], \"passed\": true}, {\"check\": \"callback replaces metadata rather than setdefault\", \"actual\": [\"a\", \"b\", \"b\"], \"expected\": [\"a\", \"b\", \"b\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.376,"exit_code":1,"observations":[{"actual":["b","a",["a","b"]],"check":"replacement changes event but preserves order","expected":["a","b",["a","b"]],"passed":false},{"actual":["c","b","a","c",["c"]],"check":"snapshot removal and once lifetime","expected":["a","b","c","c",["c"]],"passed":false},{"actual":["c",["b","c"]],"check":"explicit identity removal and event filtering","expected":["c",["b","c"]],"passed":true},{"actual":["a","b",["b"]],"check":"callback replaces existing target event","expected":["a","b",["b"]],"passed":true},{"actual":["a","b","b"],"check":"callback replaces metadata rather than setdefault","expected":["a","b","b"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement changes event but preserves order\", \"actual\": [\"b\", \"a\", [\"a\", \"b\"]], \"expected\": [\"a\", \"b\", [\"a\", \"b\"]], \"passed\": false}, {\"check\": \"snapshot removal and once lifetime\", \"actual\": [\"c\", \"b\", \"a\", \"c\", [\"c\"]], \"expected\": [\"a\", \"b\", \"c\", \"c\", [\"c\"]], \"passed\": false}, {\"check\": \"explicit identity removal and event filtering\", \"actual\": [\"c\", [\"b\", \"c\"]], \"expected\": [\"c\", [\"b\", \"c\"]], \"passed\": true}, {\"check\": \"callback replaces existing target event\", \"actual\": [\"a\", \"b\", [\"b\"]], \"expected\": [\"a\", \"b\", [\"b\"]], \"passed\": true}, {\"check\": \"callback replaces metadata rather than setdefault\", \"actual\": [\"a\", \"b\", \"b\"], \"expected\": [\"a\", \"b\", \"b\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":99.706,"exit_code":0,"observations":[{"actual":["a","b",["a","b"]],"check":"replacement changes event but preserves order","expected":["a","b",["a","b"]],"passed":true},{"actual":["a","b","c","c",["c"]],"check":"snapshot removal and once lifetime","expected":["a","b","c","c",["c"]],"passed":true},{"actual":["c",["b","c"]],"check":"explicit identity removal and event filtering","expected":["c",["b","c"]],"passed":true},{"actual":["a","b",["b"]],"check":"callback replaces existing target event","expected":["a","b",["b"]],"passed":true},{"actual":["a","b","b"],"check":"callback replaces metadata rather than setdefault","expected":["a","b","b"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"replacement changes event but preserves order\", \"actual\": [\"a\", \"b\", [\"a\", \"b\"]], \"expected\": [\"a\", \"b\", [\"a\", \"b\"]], \"passed\": true}, {\"check\": \"snapshot removal and once lifetime\", \"actual\": [\"a\", \"b\", \"c\", \"c\", [\"c\"]], \"expected\": [\"a\", \"b\", \"c\", \"c\", [\"c\"]], \"passed\": true}, {\"check\": \"explicit identity removal and event filtering\", \"actual\": [\"c\", [\"b\", \"c\"]], \"expected\": [\"c\", [\"b\", \"c\"]], \"passed\": true}, {\"check\": \"callback replaces existing target event\", \"actual\": [\"a\", \"b\", [\"b\"]], \"expected\": [\"a\", \"b\", [\"b\"]], \"passed\": true}, {\"check\": \"callback replaces metadata rather than setdefault\", \"actual\": [\"a\", \"b\", \"b\"], \"expected\": [\"a\", \"b\", \"b\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}