broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    records,document = data
    chosen = {}
    for ident,level,text,visible,doc,order in records:
        if not visible or doc != document: continue
        if type(level) is not int or not 1 <= level <= 6: continue
        text = text.strip(' \t\r\n')
        if not text: continue
        if ident not in chosen or order < chosen[ident][0]: chosen[ident] = (order,level,text)
    stack = []
    result = []
    for ident,(order,level,text) in chosen.items():
        while stack and stack[-1][1] >= level: stack.pop()
        result.append([ident,level,text,stack[-1][0] if stack else None])
        stack.append((ident,level))
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('levels and sibling ancestry', solve([[['a',1,' '+'A'*N+' ',True,'d',0],['b',3,'B',True,'d',N],['c',3,'C',True,'d',N+1],['d',2,'D',True,'d',N+2],['e',1,'E',True,'d',N+3]],'d'],), [['a',1,'A'*N,None],['b',3,'B','a'],['c',3,'C','a'],['d',2,'D','a'],['e',1,'E',None]])
check('sort document order', solve([[['b',2,'B',True,'d',N+1],['a',1,'A',True,'d',N]],'d'],), [['a',1,'A',None],['b',2,'B','a']])
check('earliest duplicate', solve([[['a',2,'late',True,'d',N+1],['a',1,'first',True,'d',N],['a',3,'tie',True,'d',N]],'d'],), [['a',1,'first',None]])
check('visibility and document', solve([[['a',1,'A',False,'d',0],['b',1,'B',True,'e',1],['c',2,'C',True,'d',2]],'d'],), [['c',2,'C',None]])
check('level admission', solve([[['a',0,'A',True,'d',0],['b',7,'B',True,'d',1],['c',True,'C',True,'d',2],['z',6,'Z',True,'d',3]],'d'],), [['z',6,'Z',None]])
check('trim empty and NBSP', solve([[['a',1,' \t',True,'d',0],['b',2,'\u00a0',True,'d',1]],'d'],), [['b',2,'\u00a0',None]])
check('empty', solve([[],'d'],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    records,document = data
    chosen = {}
    for ident,level,text,visible,doc,order in records:
        if not visible or doc != document: continue
        if type(level) is not int or not 1 <= level <= 6: continue
        text = text.strip(' \t\r\n')
        if not text: continue
        if ident not in chosen or order < chosen[ident][0]: chosen[ident] = (order,level,text)
    stack = []
    result = []
    for ident,(order,level,text) in sorted(chosen.items(),key=lambda pair:pair[1][1]):
        while stack and stack[-1][1] >= level: stack.pop()
        result.append([ident,level,text,stack[-1][0] if stack else None])
        stack.append((ident,level))
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('levels and sibling ancestry', solve([[['a',1,' '+'A'*N+' ',True,'d',0],['b',3,'B',True,'d',N],['c',3,'C',True,'d',N+1],['d',2,'D',True,'d',N+2],['e',1,'E',True,'d',N+3]],'d'],), [['a',1,'A'*N,None],['b',3,'B','a'],['c',3,'C','a'],['d',2,'D','a'],['e',1,'E',None]])
check('sort document order', solve([[['b',2,'B',True,'d',N+1],['a',1,'A',True,'d',N]],'d'],), [['a',1,'A',None],['b',2,'B','a']])
check('earliest duplicate', solve([[['a',2,'late',True,'d',N+1],['a',1,'first',True,'d',N],['a',3,'tie',True,'d',N]],'d'],), [['a',1,'first',None]])
check('visibility and document', solve([[['a',1,'A',False,'d',0],['b',1,'B',True,'e',1],['c',2,'C',True,'d',2]],'d'],), [['c',2,'C',None]])
check('level admission', solve([[['a',0,'A',True,'d',0],['b',7,'B',True,'d',1],['c',True,'C',True,'d',2],['z',6,'Z',True,'d',3]],'d'],), [['z',6,'Z',None]])
check('trim empty and NBSP', solve([[['a',1,' \t',True,'d',0],['b',2,'\u00a0',True,'d',1]],'d'],), [['b',2,'\u00a0',None]])
check('empty', solve([[],'d'],), [])
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)

prompt:
Outline ancestry follows transport arrival order.

A document heading inventory receives records [id,level,text,exposed,document,order] and requested document. Admit exposed level integers 1..6 (booleans are not levels), nonempty text after ASCII trimming, exact document. For duplicate IDs retain the earliest order record; ties retain first input. Output sorted by order with each heading's nearest preceding lower-level heading ID as parent. Skipped levels do not create synthetic headings. Output [id,level,trimmed_text,parent].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative or not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
Interactive image loses all semantic representation.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption and not title: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption and not ocr: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
Caption text loses priority to tooltip text.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if False: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title and loaded: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
Images without an alt fail to expose a title fallback.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if (consent or not alt) and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
Image recognition labels bypass consent.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and (loaded or not broken) and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
OCR from an unfinished image is exposed.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and (not broken or ocr) and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
Recognition from a failed image is retained.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'alt',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'title',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
Machine inferred alternatives are labeled as authored.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'ready' if loaded else ('broken' if broken else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken and not loaded else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return ['',None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
Broken loaded images report a successful ready state.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return [filename,'filename',status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    decorative,interactive,alt,title,caption,ocr,consent,filename,loaded,broken = data
    if decorative and not interactive: return None
    status = 'broken' if broken else ('ready' if loaded else 'loading')
    if alt is not None: return [alt.strip(' '),'alt',status]
    if caption: return [caption.strip(' '),'caption',status]
    if title: return [title.strip(' '),'title',status]
    if consent and loaded and not broken and ocr: return [ocr.strip(' '),'inferred',status]
    return [filename.rsplit('/',1)[-1],None,status]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decorative inert', solve([True,False,None,'title','caption','ocr',True,'file',True,False],), None)
check('decorative interactive', solve([True,True,' Label '+str(N)+' ','title','caption','ocr',True,'file',True,False],), ['Label '+str(N),'alt','ready'])
check('intentional empty', solve([False,False,'','title','caption','ocr',True,'file',True,False],), ['','alt','ready'])
check('caption precedence', solve([False,False,None,'title',' caption ','ocr',True,'file',True,False],), ['caption','caption','ready'])
check('title only', solve([False,False,None,' title ','','ocr',True,'file',False,False],), ['title','title','loading'])
check('OCR inferred', solve([False,False,None,'','',' OCR '+str(N)+' ',True,'file',True,False],), ['OCR '+str(N),'inferred','ready'])
check('unconsented OCR', solve([False,False,None,'','','ocr',False,'file',True,False],), ['',None,'ready'])
check('loading OCR', solve([False,False,None,'','','ocr',True,'file',False,False],), ['',None,'loading'])
check('broken OCR', solve([False,False,None,'','','ocr',True,'file',True,True],), ['',None,'broken'])
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)

prompt:
File basenames become fallback accessible labels.

Input [decorative,interactive,alt,title,caption,ocr,ocr_consent,filename,loaded,broken]. None alt means absent; empty alt is intentional. Interactive decorative images retain semantics. Source priority is explicit alt (even empty), nonempty caption, title, consented OCR when loaded and not broken; filename is never spoken. Decorative noninteractive images return None. Return [text,source,status] where status is broken, loading, ready with broken highest priority. Normalization strips only surrounding ASCII spaces; OCR is marked inferred.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if False: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind == 'unknown': continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Undocumented action kinds are exposed to clients.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if False: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled and not exposed: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Disabled operations remain advertised as invokable.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if False: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed and not enabled: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Unexposed controls leak their action descriptors.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if False: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission and kind != 'invoke': continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Confirmation actions ignore permission constraints.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if False: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen and not label: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Duplicate action IDs create ambiguous invocation descriptors.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides.get(ident) or label or kind
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if overrides.get(ident) else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
An intentionally blank action translation falls back to authored text.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else kind
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (kind if kind == 'invoke' else label)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Action labels are replaced by internal operation names.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else '')
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Unlabeled actions become nameless descriptors.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0],reverse=True)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm]))
    return [row for priority,row in sorted(rows,key=lambda item:item[1][0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Priority values are sorted in the opposite direction.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,False]))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    actions,permission,overrides = data
    seen = set()
    rows = []
    for ident,label,enabled,exposed,confirm,kind,priority in actions:
        if kind not in {'invoke','expand','collapse','increment','decrement'}: continue
        if not enabled: continue
        if not exposed: continue
        if confirm and not permission: continue
        if ident in seen: continue
        seen.add(ident)
        name = overrides[ident] if ident in overrides else (label if label else kind)
        rows.append((priority,[ident,name,kind,confirm and kind != 'collapse']))
    return [row for priority,row in sorted(rows,key=lambda item:item[0])]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ordered descriptor set', solve([[['x','Open',True,True,False,'invoke',N+2],['y','',True,True,False,'expand',N],['z','Close',True,True,True,'collapse',N+1]],True,{'x':'Localized'+str(N)}],), [['y','expand','expand',False],['z','Close','collapse',True],['x','Localized'+str(N),'invoke',False]])
check('disabled entry does not reserve ID', solve([[['x','Bad',False,True,False,'invoke',0],['x','Good',True,True,False,'invoke',1]],False,{}],), [['x','Good','invoke',False]])
check('hidden and unknown', solve([[['x','X',True,False,False,'invoke',0],['y','Y',True,True,False,'erase',1]],True,{}],), [])
check('confirmation unavailable', solve([[['x','Delete',True,True,True,'invoke',0]],False,{}],), [])
check('empty override intentional', solve([[['x','Original',True,True,False,'invoke',0]],False,{'x':''}],), [['x','','invoke',False]])
check('dedupe first and stable ties', solve([[['x','First',True,True,False,'invoke',N],['y','Second',True,True,False,'expand',N],['x','Third',True,True,False,'collapse',0]],False,{}],), [['x','First','invoke',False],['y','Second','expand',False]])
check('empty', solve([[],False,{}],), [])
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)

prompt:
Clients lose the confirmation requirement flag.

Input actions [id,label,enabled,exposed,requires_confirmation,kind,priority], plus permission and locale label overrides. Omit unknown kinds (only invoke, expand, collapse, increment, decrement), disabled or unexposed entries. Destructive confirmation-requiring actions need permission. First eligible occurrence of an ID wins; sort by ascending priority preserving ties. Label is override if key exists (including empty), else authored label, else kind. Return [id,label,kind,requires_confirmation]. This only describes platform actions and never activates them.

split: open-access