FA-33031 / Menu interactions / Open access
Recent menu merges different context-bound uses of one command · case 01
Recent menu merges different context-bound uses of one command.
ROOT CAUSE
The recent-command-menu model applies `list(dict.fromkeys(x['command'] for x in p))` at its dedupe-context operation instead of the stipulated transformation.
VERIFIED REPAIR
Apply `list(dict.fromkeys((x['command'],x['context']) for x in p))` at dedupe-context.
Unsuccessful approach: The attempted repair `list(dict.fromkeys(x['context'] for x in p))` still violates the dedupe-context oracle.
Case 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.
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 == 'dedupe-context':
return list(dict.fromkeys(x['command'] for x in p))
if action == 'promote':
return [p['id']]+[x for x in p['history'] if x!=p['id']]
if action == 'recent-rank':
return [x['id'] for x in sorted(p,key=lambda x:(-x['last_used'],-x['uses']))]
if action == 'retired':
return [x for x in p['history'] if x in p['commands']]
if action == 'limit':
return p['history'][:p['limit']]
if action == 'private-context':
return [x for x in p if not x['private']]
return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dedupe-context contract', solve('dedupe-context', [{'command':'open','context':N},{'command':'open','context':N+1}]), [('open',N),('open',N+1)])
check('promote contract', solve('promote', {'id':N,'history':[N+1,N]}), [N,N+1])
check('recent-rank contract', solve('recent-rank', [{'id':'old','last_used':N,'uses':20},{'id':'new','last_used':N+5,'uses':1}]), ['new','old'])
check('retired contract', solve('retired', {'history':[N,N+1],'commands':[N+1,N+2]}), [N+1])
check('limit contract', solve('limit', {'history':list(range(N+4)),'limit':2}), [0,1])
check('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'}])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| dedupe-context contract | ['open'] | [['open', 1], ['open', 2]] | Failed |
| promote contract | [1, 2] | [1, 2] | Passed |
| recent-rank contract | ['new', 'old'] | ['new', 'old'] | Passed |
| retired contract | [2] | [2] | Passed |
| limit contract | [0, 1] | [0, 1] | Passed |
| private-context contract | [{'context': 'public', 'id': 2, 'private': False}] | [{'context': 'public', 'id': 2, 'private': False}] | Passed |
| unknown operation | {'error': 'unsupported menu operation'} | {'error': 'unsupported menu operation'} | Passed |
SHA-256 / 7359b9b4c8d71739dc5f843369a5cabeca8941491cb9e90175efcf59b8482eb1
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 == 'dedupe-context':
return list(dict.fromkeys(x['context'] for x in p))
if action == 'promote':
return [p['id']]+[x for x in p['history'] if x!=p['id']]
if action == 'recent-rank':
return [x['id'] for x in sorted(p,key=lambda x:(-x['last_used'],-x['uses']))]
if action == 'retired':
return [x for x in p['history'] if x in p['commands']]
if action == 'limit':
return p['history'][:p['limit']]
if action == 'private-context':
return [x for x in p if not x['private']]
return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dedupe-context contract', solve('dedupe-context', [{'command':'open','context':N},{'command':'open','context':N+1}]), [('open',N),('open',N+1)])
check('promote contract', solve('promote', {'id':N,'history':[N+1,N]}), [N,N+1])
check('recent-rank contract', solve('recent-rank', [{'id':'old','last_used':N,'uses':20},{'id':'new','last_used':N+5,'uses':1}]), ['new','old'])
check('retired contract', solve('retired', {'history':[N,N+1],'commands':[N+1,N+2]}), [N+1])
check('limit contract', solve('limit', {'history':list(range(N+4)),'limit':2}), [0,1])
check('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'}])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| dedupe-context contract | [1, 2] | [['open', 1], ['open', 2]] | Failed |
| promote contract | [1, 2] | [1, 2] | Passed |
| recent-rank contract | ['new', 'old'] | ['new', 'old'] | Passed |
| retired contract | [2] | [2] | Passed |
| limit contract | [0, 1] | [0, 1] | Passed |
| private-context contract | [{'context': 'public', 'id': 2, 'private': False}] | [{'context': 'public', 'id': 2, 'private': False}] | Passed |
| unknown operation | {'error': 'unsupported menu operation'} | {'error': 'unsupported menu operation'} | Passed |
SHA-256 / 3bcc59c2a4c3fb8b684b6848d07ab58eda3d15264fc5ac5ad30e1296bd7d260f
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 == 'dedupe-context':
return list(dict.fromkeys((x['command'],x['context']) for x in p))
if action == 'promote':
return [p['id']]+[x for x in p['history'] if x!=p['id']]
if action == 'recent-rank':
return [x['id'] for x in sorted(p,key=lambda x:(-x['last_used'],-x['uses']))]
if action == 'retired':
return [x for x in p['history'] if x in p['commands']]
if action == 'limit':
return p['history'][:p['limit']]
if action == 'private-context':
return [x for x in p if not x['private']]
return {'error': 'unsupported menu operation'}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('dedupe-context contract', solve('dedupe-context', [{'command':'open','context':N},{'command':'open','context':N+1}]), [('open',N),('open',N+1)])
check('promote contract', solve('promote', {'id':N,'history':[N+1,N]}), [N,N+1])
check('recent-rank contract', solve('recent-rank', [{'id':'old','last_used':N,'uses':20},{'id':'new','last_used':N+5,'uses':1}]), ['new','old'])
check('retired contract', solve('retired', {'history':[N,N+1],'commands':[N+1,N+2]}), [N+1])
check('limit contract', solve('limit', {'history':list(range(N+4)),'limit':2}), [0,1])
check('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'}])
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| dedupe-context contract | [['open', 1], ['open', 2]] | [['open', 1], ['open', 2]] | Passed |
| promote contract | [1, 2] | [1, 2] | Passed |
| recent-rank contract | ['new', 'old'] | ['new', 'old'] | Passed |
| retired contract | [2] | [2] | Passed |
| limit contract | [0, 1] | [0, 1] | Passed |
| private-context contract | [{'context': 'public', 'id': 2, 'private': False}] | [{'context': 'public', 'id': 2, 'private': False}] | Passed |
| unknown operation | {'error': 'unsupported menu operation'} | {'error': 'unsupported menu operation'} | Passed |
SHA-256 / 9d4a886f17cc19eefc5e44d7ee4e54519acec4424e257da023e108a99ce1e208
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:18.182644+00:00.
Case digest / e5717dfac509e73db29e549a1ed4d35ddc2e3457a7324266c50883098ef6e446