{"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. A listener installed by a callback starts participating on the next dispatch and uses the action-specified event name.","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. A listener installed by a callback starts participating on the next dispatch and uses the action-specified event name. 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-callback-registration","id":"FA-4531","implementations":{"attempt":{"sha256":"e1b1a9615df98f68648c362df2db481853551ad1cbc2222df32864fcaf330593","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.setdefault(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":"92397ce2dee402ee9ee6327de083f54abb8f00f99b34eab1a3c1e3a9b2185e60","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]]=[name,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-callback-registration","generated_at":"2026-09-29T14:37:40.080052+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. A listener installed by a callback starts participating on the next dispatch and uses the action-specified event name.","root_cause":"A listener installed by a callback starts participating on the next dispatch and uses the action-specified event name. The broken transition violates that invariant.","sha256":"7d17e5568e376ecbc12a3912e3527912af5034cce2a6767bca6378c8b45a1e97","title":"Listener callback registration · 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":31.47,"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":["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"],"check":"callback replaces metadata rather than setdefault","expected":["a","b","b"],"passed":false}],"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\": [\"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\"], \"expected\": [\"a\", \"b\", \"b\"], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.25,"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":["c",["b","c"]],"check":"explicit identity removal and event filtering","expected":["c",["b","c"]],"passed":true},{"actual":["a",["b"]],"check":"callback replaces existing target event","expected":["a","b",["b"]],"passed":false},{"actual":["a"],"check":"callback replaces metadata rather than setdefault","expected":["a","b","b"],"passed":false}],"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\": [\"c\", [\"b\", \"c\"]], \"expected\": [\"c\", [\"b\", \"c\"]], \"passed\": true}, {\"check\": \"callback replaces existing target event\", \"actual\": [\"a\", [\"b\"]], \"expected\": [\"a\", \"b\", [\"b\"]], \"passed\": false}, {\"check\": \"callback replaces metadata rather than setdefault\", \"actual\": [\"a\"], \"expected\": [\"a\", \"b\", \"b\"], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":110.427,"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"}