FAILURE MAP
← Case archive

FA-32731 / Menu interactions / Open access

Menu hit routing chooses the oldest surface instead of the topmost · case 01

Menu hit routing chooses the oldest surface instead of the topmost.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The menu-surface-stack model applies `p[0] if p else None` at its top operation instead of the stipulated transformation.

THE FAILURE

The menu-surface-stack model applies `p[0] if p else None` at its top operation instead of the stipulated transformation.

Unsuccessful approach: The attempted repair `None` still violates the top oracle.

Case contract

Menu surfaces form an ownership stack independent of document overlays; operations preserve unrelated roots and remove owned descendants.

Why this case matters

Cascading and context menus require coherent command and session state as content changes.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'top':
        return p[0] if p else None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
top contractrootchild1Failed
raise contract['b1', 'a']['b1', 'a']Passed
remove-subtree contract[{'ancestors': [], 'id': 1}][{'ancestors': [], 'id': 1}]Passed
root-of contractrrPassed
depth-z contract108108Passed
detach contract[{'id': 1, 'parent': None}, {'id': 2, 'parent': 'other'}][{'id': 1, 'parent': None}, {'id': 2, 'parent': 'other'}]Passed
unknown operation{'error': 'unsupported menu operation'}{'error': 'unsupported menu operation'}Passed

SHA-256 / 3686e4f5f966043452e95a43bc9537cc19afb76fa9dea4cdef340252d0d01779

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'top':
        return None
    if action == 'raise':
        return [x for x in p['stack'] if x!=p['id']]+[p['id']]
    if action == 'remove-subtree':
        return [x for x in p['stack'] if p['owner'] not in x['ancestors'] and x['id']!=p['owner']]
    if action == 'root-of':
        return p['ancestors'][0] if p['ancestors'] else p['id']
    if action == 'depth-z':
        return p['base']+p['depth']*p['stride']
    if action == 'detach':
        return [dict(x,parent=None) if x['parent']==p['removed'] else x for x in p['rows']]
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('top contract', solve('top', ['root','child'+str(N)]), 'child'+str(N))
check('raise contract', solve('raise', {'stack':['a','b'+str(N)],'id':'a'}), ['b'+str(N),'a'])
check('remove-subtree contract', solve('remove-subtree', {'owner':'a','stack':[{'id':'a','ancestors':[]},{'id':'b','ancestors':['a']},{'id':N,'ancestors':[]}]}), [{'id':N,'ancestors':[]}])
check('root-of contract', solve('root-of', {'id':N,'ancestors':['r','a']}), 'r')
check('depth-z contract', solve('depth-z', {'base':100,'depth':N+1,'stride':4}), 100+(N+1)*4)
check('detach contract', solve('detach', {'removed':'host','rows':[{'id':N,'parent':'host'},{'id':N+1,'parent':'other'}]}), [{'id':N,'parent':None},{'id':N+1,'parent':'other'}])
check('unknown operation', solve('unknown', {}), {'error': 'unsupported menu operation'})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
top contractNonechild1Failed
raise contract['b1', 'a']['b1', 'a']Passed
remove-subtree contract[{'ancestors': [], 'id': 1}][{'ancestors': [], 'id': 1}]Passed
root-of contractrrPassed
depth-z contract108108Passed
detach contract[{'id': 1, 'parent': None}, {'id': 2, 'parent': 'other'}][{'id': 1, 'parent': None}, {'id': 2, 'parent': 'other'}]Passed
unknown operation{'error': 'unsupported menu operation'}{'error': 'unsupported menu operation'}Passed

SHA-256 / 1958041c6a394498a746e9f10f38e34f74e9603087f569cf29b51b137d64ec98

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:42:15.409922+00:00.

Case digest / c2a978f6edb7124d977fa4fc7482a2acde13a654c0d1b202407b77697e24fa75