{"abstract":"Recent menu promotion leaves duplicate history entries.","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.","contract_signature":"action, p","evaluation_group":"s3-menu-interactions-recent-command-menu","failed_approach":"The attempted repair `[p['id']]+p['history']` still violates the promote oracle.","family":"s3-menu-interactions-recent-command-menu-promote","id":"FA-33036","implementations":{"attempt":{"sha256":"a970eb8d652c235368d50167f9c3f9f8ca4610ac4901252a1e520380fcf01f5a","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']]+p['history']\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":"74017f18ecf3dc1a8baf6be2e1ce2282b4964cbec65414e7ae99aeb5f51f5aa3","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['history']+[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-promote","generated_at":"2026-09-29T14:42:18.504239+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.","root_cause":"The recent-command-menu model applies `p['history']+[p['id']]` at its promote operation instead of the stipulated transformation.","sha256":"43647cbb3c2dabd118c33d078f783f701c2da84ab00f98565365b4bec28465eb","title":"Recent menu promotion leaves duplicate history entries · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":43.958,"exit_code":1,"observations":[{"actual":[["open",1],["open",2]],"check":"dedupe-context contract","expected":[["open",1],["open",2]],"passed":true},{"actual":[1,2,1],"check":"promote contract","expected":[1,2],"passed":false},{"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\", 1], [\"open\", 2]], \"expected\": [[\"open\", 1], [\"open\", 2]], \"passed\": true}, {\"check\": \"promote contract\", \"actual\": [1, 2, 1], \"expected\": [1, 2], \"passed\": false}, {\"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":43.513,"exit_code":1,"observations":[{"actual":[["open",1],["open",2]],"check":"dedupe-context contract","expected":[["open",1],["open",2]],"passed":true},{"actual":[2,1,1],"check":"promote contract","expected":[1,2],"passed":false},{"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\", 1], [\"open\", 2]], \"expected\": [[\"open\", 1], [\"open\", 2]], \"passed\": true}, {\"check\": \"promote contract\", \"actual\": [2, 1, 1], \"expected\": [1, 2], \"passed\": false}, {\"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"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}