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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in dict.fromkeys(tuple(q) for q in queries):
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in sorted({tuple(q) for q in queries}):
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Repeated property requests lose their positional results.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or record[0] is None: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Defunct accessibility objects retain readable properties.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop == 'internal' or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Private backend properties are exposed through the batch API.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or False:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values and not values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Absent semantic properties are treated as successful nulls.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['unsupported',None] if values.get(prop) is None else ['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['unsupported',None] if not values.get(prop) else ['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Successful null properties are misreported as unsupported.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop) or None])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',None if values.get(prop) == '' else values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Empty semantic strings are coerced to null.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [expected,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['gone',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [min(expected,revision),results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Property batches report requested rather than current revision.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['unsupported',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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):
    objects,queries,revision,expected = data
    results = []
    for ident,prop in queries:
        if expected != revision: results.append(['stale',None]); continue
        record = objects.get(ident)
        if record is None or not record[0]: results.append(['ok',None]); continue
        values = record[1]
        if prop not in {'name','value','description','role'} or prop not in values:
            results.append(['unsupported',None]); continue
        results.append(['ok',values.get(prop)])
    return [revision,results]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([{'a':[True,{'name':'A'+str(N),'value':None,'description':'','role':'image'}]},[['a','name'],['a','value'],['a','description'],['a','name']],N,N],), [N,[['ok','A'+str(N)],['ok',None],['ok',''],['ok','A'+str(N)]]])
check('contract fixture 2', solve([{'a':[True,{'secret':'s','name':'A'}]},[['a','secret'],['a','role']],N,N],), [N,[['unsupported',None],['unsupported',None]]])
check('contract fixture 3', solve([{'dead':[False,{'name':'secret'}]},[['missing','name'],['dead','name']],N,N],), [N,[['gone',None],['gone',None]]])
check('contract fixture 4', solve([{'a':[True,{'name':'A'}]},[['a','name'],['missing','role']],N,N-1],), [N,[['stale',None],['stale',None]]])
check('contract fixture 5', solve([{'a':[True,{'name':'A'}]},[['a','name']],N,N+1],), [N,[['stale',None]]])
check('contract fixture 6', solve([{},[],N,N],), [N,[]])
check('contract fixture 7', solve([{'z':[True,{'name':'Z'}],'a':[True,{'name':'A'}]},[['z','name'],['a','name']],N,N],), [N,[['ok','Z'],['ok','A']]])
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:
Missing semantic objects are mislabeled as unsupported properties.

Input [objects,queries,revision,expected_revision]. objects map IDs to [alive,properties]; queries [id,property]. Allowed props name,value,description,role; a missing property is unsupported while an existing None is successful null. Results retain query order and duplicates, each [status,value]; status stale for every query when revisions differ, gone for missing/defunct object, unsupported for unknown/absent property, ok otherwise. Empty queries produce empty output. Return [revision,results], actual revision always. Values are returned as JSON-compatible content; object aliasing is outside this query-only model.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    offset = max(0,offset)
    if offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    offset = 0 if offset == -1 else offset
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Negative text offsets are clamped to the first visual line.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    offset = min(len(text),offset)
    if offset < 0: return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0: return None
    offset = min(offset,len(text))
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Out-of-range text offsets resolve to the final visual line.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start < offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start+1 <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Line starts are excluded from visual line membership.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (True)
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity in ('forward','backward'))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Forward queries include a previous line end in a gap.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' )
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text)-1)
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
A caret at document end has no visual line.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'forward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Backward affinity selects the following visual line.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or (boundary and len(text)>0): matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or (boundary and start != end): matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Empty documents omit their sole visual caret line.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:max(start,end-1)],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end+1],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Visual line content omits its final codepoint.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],True]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index,start,end,text[start:end],not hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Visual wrapping is reported as a hard text newline.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [index+1,start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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):
    text,lines,offset,affinity = data
    if offset < 0 or offset > len(text): return None
    matches = []
    for i,(start,end,hard) in enumerate(lines):
        inside = start <= offset < end
        boundary = offset == end and (affinity == 'backward' or offset == len(text))
        empty = start == end == offset and len(text) == 0
        if inside or boundary or empty: matches.append(i)
    if not matches: return None
    index = matches[0] if affinity == 'backward' else matches[-1]
    start,end,hard = lines[index]
    return [max(1,index),start,end,text[start:end],hard]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'forward'],), [1,N,N+2,'BC',True])
check('contract fixture 2', solve(['A'*N+'BC',[[0,N,False],[N,N+2,True]],N,'backward'],), [0,0,N,'A'*N,False])
check('contract fixture 3', solve(['abc',[[0,3,False]],3,'forward'],), [0,0,3,'abc',False])
check('contract fixture 4', solve(['a\nb',[[0,2,True],[2,3,False]],1,'forward'],), [0,0,2,'a\n',True])
check('contract fixture 5', solve(['abc',[[0,1,False],[2,3,False]],1,'forward'],), None)
check('contract fixture 6', solve(['abc',[[0,3,False]],-1,'backward'],), None)
check('contract fixture 7', solve(['abc',[[0,3,False]],4,'backward'],), None)
check('contract fixture 8', solve(['',[[0,0,False]],0,'forward'],), [0,0,0,'',False])
check('contract fixture 9', solve(['abc',[],0,'forward'],), None)
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:
Visual line indices are one-based in a zero-based API.

Input [text,lines,offset,affinity] lines ordered nonoverlapping [start,end,hard_break] in codepoint coordinates. Each line covers half-open text range; an offset on shared line boundary selects next line for forward affinity, previous for backward. Final document-end offset selects final line. Empty text with one empty line is valid. Return [index,start,end,text_segment,hard_break], or None for offsets outside text or gaps. Newline characters are included only if line bounds include them. No text wrapping is performed.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    url = x['url']
    fallback = url.split('#',1)[0].split('?',1)[0].rstrip('/').rsplit('/',1)[-1]
    actions = []
    if x['loaded'] and 'print' in x['permissions']: actions.append('print')
    if x['loaded'] and not x['private'] and 'copy' in x['permissions']: actions.append('copy')
    return {'name':fallback or x['title'],'address':None if x['private'] else url,'language':x['language'].replace('_','-'),'content_type':x['mime'].split(';',1)[0].strip().lower(),'loading':not x['loaded'],'progress':100 if x['loaded'] else max(0,min(99,x['percent'])),'secure':x['security']=='verified','actions':actions,'revision':x['revision']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(title='Title'+str(N),url='https://x/a?key=1#f',language='en_US',mime='Text/HTML; charset=utf8',loaded=True,percent=30,security='verified',private=False,permissions=['copy','print'],revision=N),), {'name':'Title'+str(N),'address':'https://x/a?key=1#f','language':'en-US','content_type':'text/html','loading':False,'progress':100,'secure':True,'actions':['print','copy'],'revision':N})
check('contract fixture 2', solve(dict(title='',url='https://x/a?key=1#f',language='ja',mime='text/plain',loaded=False,percent=150,security='unverified',private=False,permissions=['copy','print'],revision=N),), {'name':'a','address':'https://x/a?key=1#f','language':'ja','content_type':'text/plain','loading':True,'progress':99,'secure':False,'actions':[],'revision':N})
check('contract fixture 3', solve(dict(title='Secret',url='file:///secret',language='',mime='text/plain',loaded=True,percent=100,security='blocked',private=True,permissions=['copy','print'],revision=N),), {'name':'Secret','address':None,'language':'','content_type':'text/plain','loading':False,'progress':100,'secure':False,'actions':['print'],'revision':N})
check('contract fixture 4', solve(dict(title='',url='',language='en',mime='text/plain',loaded=False,percent=-5,security='unknown',private=False,permissions=[],revision=N),), {'name':'','address':'','language':'en','content_type':'text/plain','loading':True,'progress':0,'secure':False,'actions':[],'revision':N})
check('contract fixture 5', solve(dict(title='',url='https://x/path/#frag',language='en',mime=' TEXT/XML ',loaded=True,percent=0,security='verified',private=False,permissions=[],revision=N),), {'name':'path','address':'https://x/path/#frag','language':'en','content_type':'text/xml','loading':False,'progress':100,'secure':True,'actions':[],'revision':N})
check('contract fixture 6', solve(dict(title='',url='a',language='zh_Hant_TW',mime='text/plain',loaded=False,percent=N,security='verified',private=False,permissions=[],revision=N),), {'name':'a','address':'a','language':'zh-Hant-TW','content_type':'text/plain','loading':True,'progress':N,'secure':True,'actions':[],'revision':N})
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):
    x = data
    url = x['url']
    fallback = url.split('#',1)[0].split('?',1)[0].rstrip('/').rsplit('/',1)[-1]
    actions = []
    if x['loaded'] and 'print' in x['permissions']: actions.append('print')
    if x['loaded'] and not x['private'] and 'copy' in x['permissions']: actions.append('copy')
    return {'name':fallback,'address':None if x['private'] else url,'language':x['language'].replace('_','-'),'content_type':x['mime'].split(';',1)[0].strip().lower(),'loading':not x['loaded'],'progress':100 if x['loaded'] else max(0,min(99,x['percent'])),'secure':x['security']=='verified','actions':actions,'revision':x['revision']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(title='Title'+str(N),url='https://x/a?key=1#f',language='en_US',mime='Text/HTML; charset=utf8',loaded=True,percent=30,security='verified',private=False,permissions=['copy','print'],revision=N),), {'name':'Title'+str(N),'address':'https://x/a?key=1#f','language':'en-US','content_type':'text/html','loading':False,'progress':100,'secure':True,'actions':['print','copy'],'revision':N})
check('contract fixture 2', solve(dict(title='',url='https://x/a?key=1#f',language='ja',mime='text/plain',loaded=False,percent=150,security='unverified',private=False,permissions=['copy','print'],revision=N),), {'name':'a','address':'https://x/a?key=1#f','language':'ja','content_type':'text/plain','loading':True,'progress':99,'secure':False,'actions':[],'revision':N})
check('contract fixture 3', solve(dict(title='Secret',url='file:///secret',language='',mime='text/plain',loaded=True,percent=100,security='blocked',private=True,permissions=['copy','print'],revision=N),), {'name':'Secret','address':None,'language':'','content_type':'text/plain','loading':False,'progress':100,'secure':False,'actions':['print'],'revision':N})
check('contract fixture 4', solve(dict(title='',url='',language='en',mime='text/plain',loaded=False,percent=-5,security='unknown',private=False,permissions=[],revision=N),), {'name':'','address':'','language':'en','content_type':'text/plain','loading':True,'progress':0,'secure':False,'actions':[],'revision':N})
check('contract fixture 5', solve(dict(title='',url='https://x/path/#frag',language='en',mime=' TEXT/XML ',loaded=True,percent=0,security='verified',private=False,permissions=[],revision=N),), {'name':'path','address':'https://x/path/#frag','language':'en','content_type':'text/xml','loading':False,'progress':100,'secure':True,'actions':[],'revision':N})
check('contract fixture 6', solve(dict(title='',url='a',language='zh_Hant_TW',mime='text/plain',loaded=False,percent=N,security='verified',private=False,permissions=[],revision=N),), {'name':'a','address':'a','language':'zh-Hant-TW','content_type':'text/plain','loading':True,'progress':N,'secure':True,'actions':[],'revision':N})
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:
Document title loses priority to its URL basename.

Input document record title,url,language,mime,loaded,percent,security,private,permissions,revision. Return name (title else URL basename stripping query and fragment), address (None if private), language (replace underscore with hyphen), content_type (lowercase MIME before semicolon), loading (not loaded), progress (100 if loaded otherwise clamp integer percent0..99), secure (security exactly verified), actions (print then copy only when each permission and loaded; copy also forbidden in private), revision. Empty URL fallback is empty name. This policy is deliberately stipulated for a document accessibility bridge.

split: open-access


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

N = 1
observations = []
def solve(data):
    x = data
    url = x['url']
    fallback = url.split('#',1)[0].split('?',1)[0].rstrip('/').rsplit('/',1)[-1]
    actions = []
    if x['loaded'] and 'print' in x['permissions']: actions.append('print')
    if x['loaded'] and not x['private'] and 'copy' in x['permissions']: actions.append('copy')
    return {'name':x['title'] or fallback,'address':url,'language':x['language'].replace('_','-'),'content_type':x['mime'].split(';',1)[0].strip().lower(),'loading':not x['loaded'],'progress':100 if x['loaded'] else max(0,min(99,x['percent'])),'secure':x['security']=='verified','actions':actions,'revision':x['revision']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(title='Title'+str(N),url='https://x/a?key=1#f',language='en_US',mime='Text/HTML; charset=utf8',loaded=True,percent=30,security='verified',private=False,permissions=['copy','print'],revision=N),), {'name':'Title'+str(N),'address':'https://x/a?key=1#f','language':'en-US','content_type':'text/html','loading':False,'progress':100,'secure':True,'actions':['print','copy'],'revision':N})
check('contract fixture 2', solve(dict(title='',url='https://x/a?key=1#f',language='ja',mime='text/plain',loaded=False,percent=150,security='unverified',private=False,permissions=['copy','print'],revision=N),), {'name':'a','address':'https://x/a?key=1#f','language':'ja','content_type':'text/plain','loading':True,'progress':99,'secure':False,'actions':[],'revision':N})
check('contract fixture 3', solve(dict(title='Secret',url='file:///secret',language='',mime='text/plain',loaded=True,percent=100,security='blocked',private=True,permissions=['copy','print'],revision=N),), {'name':'Secret','address':None,'language':'','content_type':'text/plain','loading':False,'progress':100,'secure':False,'actions':['print'],'revision':N})
check('contract fixture 4', solve(dict(title='',url='',language='en',mime='text/plain',loaded=False,percent=-5,security='unknown',private=False,permissions=[],revision=N),), {'name':'','address':'','language':'en','content_type':'text/plain','loading':True,'progress':0,'secure':False,'actions':[],'revision':N})
check('contract fixture 5', solve(dict(title='',url='https://x/path/#frag',language='en',mime=' TEXT/XML ',loaded=True,percent=0,security='verified',private=False,permissions=[],revision=N),), {'name':'path','address':'https://x/path/#frag','language':'en','content_type':'text/xml','loading':False,'progress':100,'secure':True,'actions':[],'revision':N})
check('contract fixture 6', solve(dict(title='',url='a',language='zh_Hant_TW',mime='text/plain',loaded=False,percent=N,security='verified',private=False,permissions=[],revision=N),), {'name':'a','address':'a','language':'zh-Hant-TW','content_type':'text/plain','loading':True,'progress':N,'secure':True,'actions':[],'revision':N})
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):
    x = data
    url = x['url']
    fallback = url.split('#',1)[0].split('?',1)[0].rstrip('/').rsplit('/',1)[-1]
    actions = []
    if x['loaded'] and 'print' in x['permissions']: actions.append('print')
    if x['loaded'] and not x['private'] and 'copy' in x['permissions']: actions.append('copy')
    return {'name':x['title'] or fallback,'address':url if x['loaded'] else None,'language':x['language'].replace('_','-'),'content_type':x['mime'].split(';',1)[0].strip().lower(),'loading':not x['loaded'],'progress':100 if x['loaded'] else max(0,min(99,x['percent'])),'secure':x['security']=='verified','actions':actions,'revision':x['revision']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve(dict(title='Title'+str(N),url='https://x/a?key=1#f',language='en_US',mime='Text/HTML; charset=utf8',loaded=True,percent=30,security='verified',private=False,permissions=['copy','print'],revision=N),), {'name':'Title'+str(N),'address':'https://x/a?key=1#f','language':'en-US','content_type':'text/html','loading':False,'progress':100,'secure':True,'actions':['print','copy'],'revision':N})
check('contract fixture 2', solve(dict(title='',url='https://x/a?key=1#f',language='ja',mime='text/plain',loaded=False,percent=150,security='unverified',private=False,permissions=['copy','print'],revision=N),), {'name':'a','address':'https://x/a?key=1#f','language':'ja','content_type':'text/plain','loading':True,'progress':99,'secure':False,'actions':[],'revision':N})
check('contract fixture 3', solve(dict(title='Secret',url='file:///secret',language='',mime='text/plain',loaded=True,percent=100,security='blocked',private=True,permissions=['copy','print'],revision=N),), {'name':'Secret','address':None,'language':'','content_type':'text/plain','loading':False,'progress':100,'secure':False,'actions':['print'],'revision':N})
check('contract fixture 4', solve(dict(title='',url='',language='en',mime='text/plain',loaded=False,percent=-5,security='unknown',private=False,permissions=[],revision=N),), {'name':'','address':'','language':'en','content_type':'text/plain','loading':True,'progress':0,'secure':False,'actions':[],'revision':N})
check('contract fixture 5', solve(dict(title='',url='https://x/path/#frag',language='en',mime=' TEXT/XML ',loaded=True,percent=0,security='verified',private=False,permissions=[],revision=N),), {'name':'path','address':'https://x/path/#frag','language':'en','content_type':'text/xml','loading':False,'progress':100,'secure':True,'actions':[],'revision':N})
check('contract fixture 6', solve(dict(title='',url='a',language='zh_Hant_TW',mime='text/plain',loaded=False,percent=N,security='verified',private=False,permissions=[],revision=N),), {'name':'a','address':'a','language':'zh-Hant-TW','content_type':'text/plain','loading':True,'progress':N,'secure':True,'actions':[],'revision':N})
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:
Private document addresses leak into semantic metadata.

Input document record title,url,language,mime,loaded,percent,security,private,permissions,revision. Return name (title else URL basename stripping query and fragment), address (None if private), language (replace underscore with hyphen), content_type (lowercase MIME before semicolon), loading (not loaded), progress (100 if loaded otherwise clamp integer percent0..99), secure (security exactly verified), actions (print then copy only when each permission and loaded; copy also forbidden in private), revision. Empty URL fallback is empty name. This policy is deliberately stipulated for a document accessibility bridge.

split: open-access