FAILURE MAP
← Case archive

FA-32591 / Menu interactions / Open access

Command origin is rewritten while bubbling through menu owners · case 01

Command origin is rewritten while bubbling through menu owners.

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

ROOT CAUSE

The command-routing model applies `p['handler_owner']` at its origin operation instead of the stipulated transformation.

VERIFIED REPAIR

Apply `p['invocation_origin']` at origin.

Unsuccessful approach: The attempted repair `p['root_owner']` still violates the origin 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 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['handler_owner']
    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 contractpanelrow1Failed
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 / 72841b944c3d21c713a99bc025360d355525fdcd117216fd7341c34cf214bb23

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 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['root_owner']
    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 contractapprow1Failed
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 / adfe1655f16170a4174bbef2b828b08c31651636363c09fb22a4072cc07a6b4e

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

Case digest / 3f9170a558d19d92e6062760b573617eb16298c9b459b87973184a2e9437bd47