{"abstract":"Restored overflow commands lose their original source order.","category":"Menu interactions","checks":7,"contract":"A menu overflow container reserves its own trigger, preserves complete groups, and restores source order when room returns.","evaluation_group":"s3-menu-interactions-overflow-menu","failed_approach":"The attempted repair `sorted(p,key=lambda x:x['label'])` still violates the restore oracle.","family":"s3-menu-interactions-overflow-menu-restore","id":"FA-33021","implementations":{"attempt":{"sha256":"6afd33acc29944572ca1d288dcbc7410cf797d3d3ef74cb8a5efde74a039acaa","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 == 'reserve-trigger':\n        return p['capacity']-p['trigger']\n    if action == 'prefix-fit':\n        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))\n    if action == 'suffix':\n        return p['items'][p['fit']:]\n    if action == 'group-atomic':\n        return [g for g in p['groups'] if g['width']<=p['remaining']]\n    if action == 'restore':\n        return sorted(p,key=lambda x:x['label'])\n    if action == 'trigger-visible':\n        return bool(p['overflow'])\n    return {'error': 'unsupported menu operation'}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)\ncheck('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)\ncheck('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))\ncheck('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])\ncheck('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])\ncheck('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)\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":"145ff18e2bf1ff2f9b052f84436dee45cb77979364a75fcf262052503297d15e","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 == 'reserve-trigger':\n        return p['capacity']-p['trigger']\n    if action == 'prefix-fit':\n        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))\n    if action == 'suffix':\n        return p['items'][p['fit']:]\n    if action == 'group-atomic':\n        return [g for g in p['groups'] if g['width']<=p['remaining']]\n    if action == 'restore':\n        return p\n    if action == 'trigger-visible':\n        return bool(p['overflow'])\n    return {'error': 'unsupported menu operation'}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)\ncheck('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)\ncheck('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))\ncheck('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])\ncheck('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])\ncheck('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)\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":"67a96186ab1c75343719c34406eae59dbf9a088bfe25933eab78774fe3d44424","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 == 'reserve-trigger':\n        return p['capacity']-p['trigger']\n    if action == 'prefix-fit':\n        return next((i for i in range(len(p['widths'])+1) if sum(p['widths'][:i+1])>p['capacity']),len(p['widths']))\n    if action == 'suffix':\n        return p['items'][p['fit']:]\n    if action == 'group-atomic':\n        return [g for g in p['groups'] if g['width']<=p['remaining']]\n    if action == 'restore':\n        return sorted(p,key=lambda x:x['source'])\n    if action == 'trigger-visible':\n        return bool(p['overflow'])\n    return {'error': 'unsupported menu operation'}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('reserve-trigger contract', solve('reserve-trigger', {'capacity':N+10,'trigger':3}), N+7)\ncheck('prefix-fit contract', solve('prefix-fit', {'widths':[N+1,N+1,N+1],'capacity':2*(N+1)}), 2)\ncheck('suffix contract', solve('suffix', {'items':list(range(N+4)),'fit':2}), list(range(2,N+4)))\ncheck('group-atomic contract', solve('group-atomic', {'groups':[{'width':N+2,'id':'a'},{'width':N+3,'id':'b'}],'remaining':N+2}), [{'width':N+2,'id':'a'}])\ncheck('restore contract', solve('restore', [{'source':2,'label':'a'},{'source':N-N,'label':'z'}]), [{'source':0,'label':'z'},{'source':2,'label':'a'}])\ncheck('trigger-visible contract', solve('trigger-visible', {'overflow':[],'capacity':N,'main':list(range(N))}), False)\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-overflow-menu-restore","generated_at":"2026-09-29T14:42:18.183058+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 `sorted(p,key=lambda x:x['source'])` at restore.","root_cause":"The overflow-menu model applies `p` at its restore operation instead of the stipulated transformation.","sha256":"ca9deb6f75df91385149939ea39c5cc9bf9c821782b945ceb3d776bee2b35166","title":"Restored overflow commands lose their original source order · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":46.044,"exit_code":1,"observations":[{"actual":8,"check":"reserve-trigger contract","expected":8,"passed":true},{"actual":2,"check":"prefix-fit contract","expected":2,"passed":true},{"actual":[2,3,4],"check":"suffix contract","expected":[2,3,4],"passed":true},{"actual":[{"id":"a","width":3}],"check":"group-atomic contract","expected":[{"id":"a","width":3}],"passed":true},{"actual":[{"label":"a","source":2},{"label":"z","source":0}],"check":"restore contract","expected":[{"label":"z","source":0},{"label":"a","source":2}],"passed":false},{"actual":false,"check":"trigger-visible contract","expected":false,"passed":true},{"actual":{"error":"unsupported menu operation"},"check":"unknown operation","expected":{"error":"unsupported menu operation"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"reserve-trigger contract\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"prefix-fit contract\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"suffix contract\", \"actual\": [2, 3, 4], \"expected\": [2, 3, 4], \"passed\": true}, {\"check\": \"group-atomic contract\", \"actual\": [{\"width\": 3, \"id\": \"a\"}], \"expected\": [{\"width\": 3, \"id\": \"a\"}], \"passed\": true}, {\"check\": \"restore contract\", \"actual\": [{\"source\": 2, \"label\": \"a\"}, {\"source\": 0, \"label\": \"z\"}], \"expected\": [{\"source\": 0, \"label\": \"z\"}, {\"source\": 2, \"label\": \"a\"}], \"passed\": false}, {\"check\": \"trigger-visible contract\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"unknown operation\", \"actual\": {\"error\": \"unsupported menu operation\"}, \"expected\": {\"error\": \"unsupported menu operation\"}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.108,"exit_code":1,"observations":[{"actual":8,"check":"reserve-trigger contract","expected":8,"passed":true},{"actual":2,"check":"prefix-fit contract","expected":2,"passed":true},{"actual":[2,3,4],"check":"suffix contract","expected":[2,3,4],"passed":true},{"actual":[{"id":"a","width":3}],"check":"group-atomic contract","expected":[{"id":"a","width":3}],"passed":true},{"actual":[{"label":"a","source":2},{"label":"z","source":0}],"check":"restore contract","expected":[{"label":"z","source":0},{"label":"a","source":2}],"passed":false},{"actual":false,"check":"trigger-visible contract","expected":false,"passed":true},{"actual":{"error":"unsupported menu operation"},"check":"unknown operation","expected":{"error":"unsupported menu operation"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"reserve-trigger contract\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"prefix-fit contract\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"suffix contract\", \"actual\": [2, 3, 4], \"expected\": [2, 3, 4], \"passed\": true}, {\"check\": \"group-atomic contract\", \"actual\": [{\"width\": 3, \"id\": \"a\"}], \"expected\": [{\"width\": 3, \"id\": \"a\"}], \"passed\": true}, {\"check\": \"restore contract\", \"actual\": [{\"source\": 2, \"label\": \"a\"}, {\"source\": 0, \"label\": \"z\"}], \"expected\": [{\"source\": 0, \"label\": \"z\"}, {\"source\": 2, \"label\": \"a\"}], \"passed\": false}, {\"check\": \"trigger-visible contract\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"unknown operation\", \"actual\": {\"error\": \"unsupported menu operation\"}, \"expected\": {\"error\": \"unsupported menu operation\"}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":47.1,"exit_code":0,"observations":[{"actual":8,"check":"reserve-trigger contract","expected":8,"passed":true},{"actual":2,"check":"prefix-fit contract","expected":2,"passed":true},{"actual":[2,3,4],"check":"suffix contract","expected":[2,3,4],"passed":true},{"actual":[{"id":"a","width":3}],"check":"group-atomic contract","expected":[{"id":"a","width":3}],"passed":true},{"actual":[{"label":"z","source":0},{"label":"a","source":2}],"check":"restore contract","expected":[{"label":"z","source":0},{"label":"a","source":2}],"passed":true},{"actual":false,"check":"trigger-visible contract","expected":false,"passed":true},{"actual":{"error":"unsupported menu operation"},"check":"unknown operation","expected":{"error":"unsupported menu operation"},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"reserve-trigger contract\", \"actual\": 8, \"expected\": 8, \"passed\": true}, {\"check\": \"prefix-fit contract\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"suffix contract\", \"actual\": [2, 3, 4], \"expected\": [2, 3, 4], \"passed\": true}, {\"check\": \"group-atomic contract\", \"actual\": [{\"width\": 3, \"id\": \"a\"}], \"expected\": [{\"width\": 3, \"id\": \"a\"}], \"passed\": true}, {\"check\": \"restore contract\", \"actual\": [{\"source\": 0, \"label\": \"z\"}, {\"source\": 2, \"label\": \"a\"}], \"expected\": [{\"source\": 0, \"label\": \"z\"}, {\"source\": 2, \"label\": \"a\"}], \"passed\": true}, {\"check\": \"trigger-visible contract\", \"actual\": false, \"expected\": false, \"passed\": true}, {\"check\": \"unknown operation\", \"actual\": {\"error\": \"unsupported menu operation\"}, \"expected\": {\"error\": \"unsupported menu operation\"}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}