{"abstract":"Recent menu merges different context-bound uses of one command.","category":"Menu interactions","checks":7,"contract":"Recent command menus key history by command and context, rank by descending last-use time with use-count tie break, and exclude retired commands from presentation.","evaluation_group":"s3-menu-interactions-recent-command-menu","failed_approach":"The attempted repair `list(dict.fromkeys(x['context'] for x in p))` still violates the dedupe-context oracle.","family":"s3-menu-interactions-recent-command-menu-dedupe-context","id":"FA-33031","implementations":{"attempt":{"sha256":"3bcc59c2a4c3fb8b684b6848d07ab58eda3d15264fc5ac5ad30e1296bd7d260f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport unicodedata\nN = 1\nobservations = []\ndef solve(action, p):\n    if action == 'dedupe-context':\n        return list(dict.fromkeys(x['context'] for x in p))\n    if action == 'promote':\n        return [p['id']]+[x for x in p['history'] if x!=p['id']]\n    if action == 'recent-rank':\n        return [x['id'] for x in sorted(p,key=lambda x:(-x['last_used'],-x['uses']))]\n    if action == 'retired':\n        return [x for x in p['history'] if x in p['commands']]\n    if action == 'limit':\n        return p['history'][:p['limit']]\n    if action == 'private-context':\n        return [x for x in p if not x['private']]\n    return {'error': 'unsupported menu operation'}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('dedupe-context contract', solve('dedupe-context', [{'command':'open','context':N},{'command':'open','context':N+1}]), [('open',N),('open',N+1)])\ncheck('promote contract', solve('promote', {'id':N,'history':[N+1,N]}), [N,N+1])\ncheck('recent-rank contract', solve('recent-rank', [{'id':'old','last_used':N,'uses':20},{'id':'new','last_used':N+5,'uses':1}]), ['new','old'])\ncheck('retired contract', solve('retired', {'history':[N,N+1],'commands':[N+1,N+2]}), [N+1])\ncheck('limit contract', solve('limit', {'history':list(range(N+4)),'limit':2}), [0,1])\ncheck('private-context contract', solve('private-context', [{'id':N,'private':True,'context':'secret'},{'id':N+1,'private':False,'context':'public'}]), [{'id':N+1,'private':False,'context':'public'}])\ncheck('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})\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":"7359b9b4c8d71739dc5f843369a5cabeca8941491cb9e90175efcf59b8482eb1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport unicodedata\nN = 1\nobservations = []\ndef solve(action, p):\n    if action == 'dedupe-context':\n        return list(dict.fromkeys(x['command'] for x in p))\n    if action == 'promote':\n        return [p['id']]+[x for x in p['history'] if x!=p['id']]\n    if action == 'recent-rank':\n        return [x['id'] for x in sorted(p,key=lambda x:(-x['last_used'],-x['uses']))]\n    if action == 'retired':\n        return [x for x in p['history'] if x in p['commands']]\n    if action == 'limit':\n        return p['history'][:p['limit']]\n    if action == 'private-context':\n        return [x for x in p if not x['private']]\n    return {'error': 'unsupported menu operation'}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('dedupe-context contract', solve('dedupe-context', [{'command':'open','context':N},{'command':'open','context':N+1}]), [('open',N),('open',N+1)])\ncheck('promote contract', solve('promote', {'id':N,'history':[N+1,N]}), [N,N+1])\ncheck('recent-rank contract', solve('recent-rank', [{'id':'old','last_used':N,'uses':20},{'id':'new','last_used':N+5,'uses':1}]), ['new','old'])\ncheck('retired contract', solve('retired', {'history':[N,N+1],'commands':[N+1,N+2]}), [N+1])\ncheck('limit contract', solve('limit', {'history':list(range(N+4)),'limit':2}), [0,1])\ncheck('private-context contract', solve('private-context', [{'id':N,'private':True,'context':'secret'},{'id':N+1,'private':False,'context':'public'}]), [{'id':N+1,'private':False,'context':'public'}])\ncheck('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})\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":"9d4a886f17cc19eefc5e44d7ee4e54519acec4424e257da023e108a99ce1e208","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport unicodedata\nN = 1\nobservations = []\ndef solve(action, p):\n    if action == 'dedupe-context':\n        return list(dict.fromkeys((x['command'],x['context']) for x in p))\n    if action == 'promote':\n        return [p['id']]+[x for x in p['history'] if x!=p['id']]\n    if action == 'recent-rank':\n        return [x['id'] for x in sorted(p,key=lambda x:(-x['last_used'],-x['uses']))]\n    if action == 'retired':\n        return [x for x in p['history'] if x in p['commands']]\n    if action == 'limit':\n        return p['history'][:p['limit']]\n    if action == 'private-context':\n        return [x for x in p if not x['private']]\n    return {'error': 'unsupported menu operation'}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('dedupe-context contract', solve('dedupe-context', [{'command':'open','context':N},{'command':'open','context':N+1}]), [('open',N),('open',N+1)])\ncheck('promote contract', solve('promote', {'id':N,'history':[N+1,N]}), [N,N+1])\ncheck('recent-rank contract', solve('recent-rank', [{'id':'old','last_used':N,'uses':20},{'id':'new','last_used':N+5,'uses':1}]), ['new','old'])\ncheck('retired contract', solve('retired', {'history':[N,N+1],'commands':[N+1,N+2]}), [N+1])\ncheck('limit contract', solve('limit', {'history':list(range(N+4)),'limit':2}), [0,1])\ncheck('private-context contract', solve('private-context', [{'id':N,'private':True,'context':'secret'},{'id':N+1,'private':False,'context':'public'}]), [{'id':N+1,'private':False,'context':'public'}])\ncheck('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})\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":"Offline supplied-valid-payload model; excludes DOM, keyboard, focus, selection, announcements and browser conformance. 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":"s3-menu-interactions-recent-command-menu-dedupe-context","generated_at":"2026-09-29T14:42:18.182644+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Cascading and context menus require coherent command and session state as content changes.","repair":"Apply `list(dict.fromkeys((x['command'],x['context']) for x in p))` at dedupe-context.","root_cause":"The recent-command-menu model applies `list(dict.fromkeys(x['command'] for x in p))` at its dedupe-context operation instead of the stipulated transformation.","sha256":"e5717dfac509e73db29e549a1ed4d35ddc2e3457a7324266c50883098ef6e446","title":"Recent menu merges different context-bound uses of one command · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.901,"exit_code":1,"observations":[{"actual":[1,2],"check":"dedupe-context contract","expected":[["open",1],["open",2]],"passed":false},{"actual":[1,2],"check":"promote contract","expected":[1,2],"passed":true},{"actual":["new","old"],"check":"recent-rank contract","expected":["new","old"],"passed":true},{"actual":[2],"check":"retired contract","expected":[2],"passed":true},{"actual":[0,1],"check":"limit contract","expected":[0,1],"passed":true},{"actual":[{"context":"public","id":2,"private":false}],"check":"private-context contract","expected":[{"context":"public","id":2,"private":false}],"passed":true},{"actual":{"error":"unsupported menu operation"},"check":"unknown operation","expected":{"error":"unsupported menu operation"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"dedupe-context contract\", \"actual\": [1, 2], \"expected\": [[\"open\", 1], [\"open\", 2]], \"passed\": false}, {\"check\": \"promote contract\", \"actual\": [1, 2], \"expected\": [1, 2], \"passed\": true}, {\"check\": \"recent-rank contract\", \"actual\": [\"new\", \"old\"], \"expected\": [\"new\", \"old\"], \"passed\": true}, {\"check\": \"retired contract\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"limit contract\", \"actual\": [0, 1], \"expected\": [0, 1], \"passed\": true}, {\"check\": \"private-context contract\", \"actual\": [{\"id\": 2, \"private\": false, \"context\": \"public\"}], \"expected\": [{\"id\": 2, \"private\": false, \"context\": \"public\"}], \"passed\": true}, {\"check\": \"unknown operation\", \"actual\": {\"error\": \"unsupported menu operation\"}, \"expected\": {\"error\": \"unsupported menu operation\"}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.94,"exit_code":1,"observations":[{"actual":["open"],"check":"dedupe-context contract","expected":[["open",1],["open",2]],"passed":false},{"actual":[1,2],"check":"promote contract","expected":[1,2],"passed":true},{"actual":["new","old"],"check":"recent-rank contract","expected":["new","old"],"passed":true},{"actual":[2],"check":"retired contract","expected":[2],"passed":true},{"actual":[0,1],"check":"limit contract","expected":[0,1],"passed":true},{"actual":[{"context":"public","id":2,"private":false}],"check":"private-context contract","expected":[{"context":"public","id":2,"private":false}],"passed":true},{"actual":{"error":"unsupported menu operation"},"check":"unknown operation","expected":{"error":"unsupported menu operation"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"dedupe-context contract\", \"actual\": [\"open\"], \"expected\": [[\"open\", 1], [\"open\", 2]], \"passed\": false}, {\"check\": \"promote contract\", \"actual\": [1, 2], \"expected\": [1, 2], \"passed\": true}, {\"check\": \"recent-rank contract\", \"actual\": [\"new\", \"old\"], \"expected\": [\"new\", \"old\"], \"passed\": true}, {\"check\": \"retired contract\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"limit contract\", \"actual\": [0, 1], \"expected\": [0, 1], \"passed\": true}, {\"check\": \"private-context contract\", \"actual\": [{\"id\": 2, \"private\": false, \"context\": \"public\"}], \"expected\": [{\"id\": 2, \"private\": false, \"context\": \"public\"}], \"passed\": true}, {\"check\": \"unknown operation\", \"actual\": {\"error\": \"unsupported menu operation\"}, \"expected\": {\"error\": \"unsupported menu operation\"}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.284,"exit_code":0,"observations":[{"actual":[["open",1],["open",2]],"check":"dedupe-context contract","expected":[["open",1],["open",2]],"passed":true},{"actual":[1,2],"check":"promote contract","expected":[1,2],"passed":true},{"actual":["new","old"],"check":"recent-rank contract","expected":["new","old"],"passed":true},{"actual":[2],"check":"retired contract","expected":[2],"passed":true},{"actual":[0,1],"check":"limit contract","expected":[0,1],"passed":true},{"actual":[{"context":"public","id":2,"private":false}],"check":"private-context contract","expected":[{"context":"public","id":2,"private":false}],"passed":true},{"actual":{"error":"unsupported menu operation"},"check":"unknown operation","expected":{"error":"unsupported menu operation"},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"dedupe-context contract\", \"actual\": [[\"open\", 1], [\"open\", 2]], \"expected\": [[\"open\", 1], [\"open\", 2]], \"passed\": true}, {\"check\": \"promote contract\", \"actual\": [1, 2], \"expected\": [1, 2], \"passed\": true}, {\"check\": \"recent-rank contract\", \"actual\": [\"new\", \"old\"], \"expected\": [\"new\", \"old\"], \"passed\": true}, {\"check\": \"retired contract\", \"actual\": [2], \"expected\": [2], \"passed\": true}, {\"check\": \"limit contract\", \"actual\": [0, 1], \"expected\": [0, 1], \"passed\": true}, {\"check\": \"private-context contract\", \"actual\": [{\"id\": 2, \"private\": false, \"context\": \"public\"}], \"expected\": [{\"id\": 2, \"private\": false, \"context\": \"public\"}], \"passed\": true}, {\"check\": \"unknown operation\", \"actual\": {\"error\": \"unsupported menu operation\"}, \"expected\": {\"error\": \"unsupported menu operation\"}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}