FAILURE MAP
← Case archive

FA-32581 / Menu interactions / Open access

Root menu handler masks a nearer command handler · case 01

Root menu handler masks a nearer command handler.

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

ROOT CAUSE

The command-routing model applies `next((x['owner'] for x in p['chain'] if p['command'] in x['handles']),None)` at its nearest operation instead of the stipulated transformation.

VERIFIED REPAIR

Apply `next((x['owner'] for x in reversed(p['chain']) if p['command'] in x['handles']),None)` at nearest.

Unsuccessful approach: The attempted repair `p['chain'][0]['owner']` still violates the nearest oracle.

Case contract

Menu dispatch resolves the nearest ancestor handler accepting the command, preserving a command origin distinct from the handler owner.

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 == 'nearest':
        return next((x['owner'] for x in p['chain'] if p['command'] in x['handles']),None)
    if action == 'unsupported':
        return next((x['owner'] for x in reversed(p['chain']) if p['command'] in x['handles']),None)
    if action == 'origin':
        return p['invocation_origin']
    if action == 'args':
        return dict(p['defaults'],**p['invocation'])
    if action == 'stop':
        return p['handled'] or p['cancelled']
    if action == 'result-owner':
        return {'command':p['command'],'handler':p['handler'],'origin':p['origin']}
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', {'command':'c'+str(N),'chain':[{'owner':'root','handles':['c'+str(N)]},{'owner':'child','handles':['c'+str(N)]}]}), 'child')
check('unsupported contract', solve('unsupported', {'command':'missing'+str(N),'chain':[{'owner':'root','handles':['a']},{'owner':'child','handles':['b']}]}), None)
check('origin contract', solve('origin', {'invocation_origin':'row'+str(N),'handler_owner':'panel','root_owner':'app'}), 'row'+str(N))
check('args contract', solve('args', {'defaults':{'count':1,'mode':'copy'},'invocation':{'count':N+1}}), {'count':N+1,'mode':'copy'})
check('stop contract', solve('stop', {'handled':False,'cancelled':True,'serial':N}), True)
check('result-owner contract', solve('result-owner', {'command':str(N),'handler':'app','origin':'context'}), {'command':str(N),'handler':'app','origin':'context'})
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
nearest contractrootchildFailed
unsupported contractNoneNonePassed
origin contractrow1row1Passed
args contract{'count': 2, 'mode': 'copy'}{'count': 2, 'mode': 'copy'}Passed
stop contractTrueTruePassed
result-owner contract{'command': '1', 'handler': 'app', 'origin': 'context'}{'command': '1', 'handler': 'app', 'origin': 'context'}Passed
unknown operation{'error': 'unsupported menu operation'}{'error': 'unsupported menu operation'}Passed

SHA-256 / a2e0861ea57ab05c536120d49e447543002a118b088953370fb1b9decc99c40d

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 == 'nearest':
        return p['chain'][0]['owner']
    if action == 'unsupported':
        return next((x['owner'] for x in reversed(p['chain']) if p['command'] in x['handles']),None)
    if action == 'origin':
        return p['invocation_origin']
    if action == 'args':
        return dict(p['defaults'],**p['invocation'])
    if action == 'stop':
        return p['handled'] or p['cancelled']
    if action == 'result-owner':
        return {'command':p['command'],'handler':p['handler'],'origin':p['origin']}
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', {'command':'c'+str(N),'chain':[{'owner':'root','handles':['c'+str(N)]},{'owner':'child','handles':['c'+str(N)]}]}), 'child')
check('unsupported contract', solve('unsupported', {'command':'missing'+str(N),'chain':[{'owner':'root','handles':['a']},{'owner':'child','handles':['b']}]}), None)
check('origin contract', solve('origin', {'invocation_origin':'row'+str(N),'handler_owner':'panel','root_owner':'app'}), 'row'+str(N))
check('args contract', solve('args', {'defaults':{'count':1,'mode':'copy'},'invocation':{'count':N+1}}), {'count':N+1,'mode':'copy'})
check('stop contract', solve('stop', {'handled':False,'cancelled':True,'serial':N}), True)
check('result-owner contract', solve('result-owner', {'command':str(N),'handler':'app','origin':'context'}), {'command':str(N),'handler':'app','origin':'context'})
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
nearest contractrootchildFailed
unsupported contractNoneNonePassed
origin contractrow1row1Passed
args contract{'count': 2, 'mode': 'copy'}{'count': 2, 'mode': 'copy'}Passed
stop contractTrueTruePassed
result-owner contract{'command': '1', 'handler': 'app', 'origin': 'context'}{'command': '1', 'handler': 'app', 'origin': 'context'}Passed
unknown operation{'error': 'unsupported menu operation'}{'error': 'unsupported menu operation'}Passed

SHA-256 / 9b580194ac3f953022845004c6ce3ac2585156240a7e50b15aec472dbcab1122

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import unicodedata
N = 1
observations = []
def solve(action, p):
    if action == 'nearest':
        return next((x['owner'] for x in reversed(p['chain']) if p['command'] in x['handles']),None)
    if action == 'unsupported':
        return next((x['owner'] for x in reversed(p['chain']) if p['command'] in x['handles']),None)
    if action == 'origin':
        return p['invocation_origin']
    if action == 'args':
        return dict(p['defaults'],**p['invocation'])
    if action == 'stop':
        return p['handled'] or p['cancelled']
    if action == 'result-owner':
        return {'command':p['command'],'handler':p['handler'],'origin':p['origin']}
    return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nearest contract', solve('nearest', {'command':'c'+str(N),'chain':[{'owner':'root','handles':['c'+str(N)]},{'owner':'child','handles':['c'+str(N)]}]}), 'child')
check('unsupported contract', solve('unsupported', {'command':'missing'+str(N),'chain':[{'owner':'root','handles':['a']},{'owner':'child','handles':['b']}]}), None)
check('origin contract', solve('origin', {'invocation_origin':'row'+str(N),'handler_owner':'panel','root_owner':'app'}), 'row'+str(N))
check('args contract', solve('args', {'defaults':{'count':1,'mode':'copy'},'invocation':{'count':N+1}}), {'count':N+1,'mode':'copy'})
check('stop contract', solve('stop', {'handled':False,'cancelled':True,'serial':N}), True)
check('result-owner contract', solve('result-owner', {'command':str(N),'handler':'app','origin':'context'}), {'command':str(N),'handler':'app','origin':'context'})
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
nearest contractchildchildPassed
unsupported contractNoneNonePassed
origin contractrow1row1Passed
args contract{'count': 2, 'mode': 'copy'}{'count': 2, 'mode': 'copy'}Passed
stop contractTrueTruePassed
result-owner contract{'command': '1', 'handler': 'app', 'origin': 'context'}{'command': '1', 'handler': 'app', 'origin': 'context'}Passed
unknown operation{'error': 'unsupported menu operation'}{'error': 'unsupported menu operation'}Passed

SHA-256 / a074dadc309847fa86daf7c53729dc9f1d2f43608fa3d0e6829c711c5680dee8

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:13.629326+00:00.

Case digest / 8a4bbf992fcef1734ba37be507d8541e6e2da699c4cdbc21202a4311bc738e7e