{"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. Removing one identity preserves all other listeners, including listeners for the same event.","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. Removing one identity preserves all other listeners, including listeners for the same event. 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-removal-by-identity","id":"FA-4511","implementations":{"attempt":{"sha256":"72d386cd9faf7e674d61947d1882e341ae302a3073eb131b7fd0a9b466a58605","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={k:v for k,v in listeners.items() if v[0]!=event[1]}\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"},"broken":{"sha256":"9c08a78b25d5904b0db7b8dcbbf59bc1bad8237d0a25f9bfa8b7546fd06b7964","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.clear()\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"},"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-removal-by-identity","generated_at":"2026-09-29T14:37:39.951030+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. Removing one identity preserves all other listeners, including listeners for the same event.","root_cause":"Removing one identity preserves all other listeners, including listeners for the same event. The broken transition violates that invariant.","sha256":"63f17618514460bed712a558487a196faa0ce57581ccc2bca6c8ab2790ac8286","title":"Listener removal by identity · 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":40.454,"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","b","c","c",["c"]],"check":"snapshot removal and once lifetime","expected":["a","b","c","c",["c"]],"passed":true},{"actual":["a","c",["a","b","c"]],"check":"explicit identity removal and event filtering","expected":["c",["b","c"]],"passed":false},{"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\", \"b\", \"c\", \"c\", [\"c\"]], \"expected\": [\"a\", \"b\", \"c\", \"c\", [\"c\"]], \"passed\": true}, {\"check\": \"explicit identity removal and event filtering\", \"actual\": [\"a\", \"c\", [\"a\", \"b\", \"c\"]], \"expected\": [\"c\", [\"b\", \"c\"]], \"passed\": false}, {\"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.031,"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","b","c","c",["c"]],"check":"snapshot removal and once lifetime","expected":["a","b","c","c",["c"]],"passed":true},{"actual":[[]],"check":"explicit identity removal and event filtering","expected":["c",["b","c"]],"passed":false},{"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\", \"b\", \"c\", \"c\", [\"c\"]], \"expected\": [\"a\", \"b\", \"c\", \"c\", [\"c\"]], \"passed\": true}, {\"check\": \"explicit identity removal and event filtering\", \"actual\": [[]], \"expected\": [\"c\", [\"b\", \"c\"]], \"passed\": false}, {\"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":43.83,"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"}