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

N = 1
observations = []
def solve(x):
    sizes=x['parts']
    total=sum(sizes)
    starts=[]
    acc=0
    for s in sizes:
        starts.append(acc)
        acc+=s
    q=x['query']
    if q[0]=='part':
        n=q[1]
        if not 1<=n<=len(sizes) or sizes[n-1]==0: return [416,'bytes */%d'%total]
        a=starts[n-1]
        return [206,'bytes %d-%d/%d'%(a,a+sizes[n-1]-1,total)]
    a,b=q[1],q[2]
    if not 0<=a<=b<total: return [416,'bytes */%d'%total]
    out=[]
    for i,s in enumerate(sizes):
        lo=max(a,starts[i])
        hi=min(b,starts[i]+s)
        if lo<=hi: out.append([i+1,lo-starts[i],hi-lo+1])
    return [206,out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overlap-upper-bound fixture 0', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',2]}))), json.loads(json.dumps([206,'bytes 5-7/12'])))
check('overlap-upper-bound fixture 1', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',3]}))), json.loads(json.dumps([206,'bytes 8-11/12'])))
check('overlap-upper-bound fixture 2', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',0]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 3', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',-1]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 4', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',4]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 5', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['part',2]}))), json.loads(json.dumps([416,'bytes */9'])))
check('overlap-upper-bound fixture 6', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',3,9]}))), json.loads(json.dumps([206,[[1,3,2],[2,0,3],[3,0,2]]])))
check('overlap-upper-bound fixture 7', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[2,0,1]]])))
check('overlap-upper-bound fixture 8', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',5,7]}))), json.loads(json.dumps([206,[[2,0,3]]])))
check('overlap-upper-bound fixture 9', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,12]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 10', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,11]}))), json.loads(json.dumps([206,[[1,0,5],[2,0,3],[3,0,4]]])))
check('overlap-upper-bound fixture 11', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[3,0,1]]])))
check('overlap-upper-bound fixture 12', json.loads(json.dumps(solve({'parts':[],'query':['part',1]}))), json.loads(json.dumps([416,'bytes */0'])))
check('overlap-upper-bound fixture 13', json.loads(json.dumps(solve({'parts':[N,N],'query':['part',2]}))), json.loads(json.dumps([206,"bytes %d-%d/%d"%(N,2*N-1,2*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(x):
    sizes=x['parts']
    total=sum(sizes)
    starts=[]
    acc=0
    for s in sizes:
        starts.append(acc)
        acc+=s
    q=x['query']
    if q[0]=='part':
        n=q[1]
        if not 1<=n<=len(sizes) or sizes[n-1]==0: return [416,'bytes */%d'%total]
        a=starts[n-1]
        return [206,'bytes %d-%d/%d'%(a,a+sizes[n-1]-1,total)]
    a,b=q[1],q[2]
    if not 0<=a<=b<total: return [416,'bytes */%d'%total]
    out=[]
    for i,s in enumerate(sizes):
        lo=max(a,starts[i])
        hi=min(b,s-1)
        if lo<=hi: out.append([i+1,lo-starts[i],hi-lo+1])
    return [206,out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('overlap-upper-bound fixture 0', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',2]}))), json.loads(json.dumps([206,'bytes 5-7/12'])))
check('overlap-upper-bound fixture 1', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',3]}))), json.loads(json.dumps([206,'bytes 8-11/12'])))
check('overlap-upper-bound fixture 2', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',0]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 3', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',-1]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 4', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',4]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 5', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['part',2]}))), json.loads(json.dumps([416,'bytes */9'])))
check('overlap-upper-bound fixture 6', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',3,9]}))), json.loads(json.dumps([206,[[1,3,2],[2,0,3],[3,0,2]]])))
check('overlap-upper-bound fixture 7', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[2,0,1]]])))
check('overlap-upper-bound fixture 8', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',5,7]}))), json.loads(json.dumps([206,[[2,0,3]]])))
check('overlap-upper-bound fixture 9', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,12]}))), json.loads(json.dumps([416,'bytes */12'])))
check('overlap-upper-bound fixture 10', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,11]}))), json.loads(json.dumps([206,[[1,0,5],[2,0,3],[3,0,4]]])))
check('overlap-upper-bound fixture 11', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[3,0,1]]])))
check('overlap-upper-bound fixture 12', json.loads(json.dumps(solve({'parts':[],'query':['part',1]}))), json.loads(json.dumps([416,'bytes */0'])))
check('overlap-upper-bound fixture 13', json.loads(json.dumps(solve({'parts':[N,N],'query':['part',2]}))), json.loads(json.dumps([206,"bytes %d-%d/%d"%(N,2*N-1,2*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:
An object store maps upload part numbers and byte ranges onto stored parts: a part intersection ends at the earlier of range end and part last byte.

x has stored part sizes in order and a query. ["part",n] (1-based) returns [206,bytes a-b/total] for that part, or [416,bytes */total] when n is outside 1..count or the part is empty. ["range",a,b] with inclusive bounds returns [416,bytes */total] unless 0<=a<=b<total; otherwise [206,rows] where each intersecting nonempty part yields [part-number,offset-within-part,count] in part order.

split: open-access


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

N = 1
observations = []
def solve(x):
    sizes=x['parts']
    total=sum(sizes)
    starts=[]
    acc=0
    for s in sizes:
        starts.append(acc)
        acc+=s
    q=x['query']
    if q[0]=='part':
        n=q[1]
        if not 1<=n<=len(sizes) or sizes[n-1]==0: return [416,'bytes */%d'%total]
        a=starts[n-1]
        return [206,'bytes %d-%d/%d'%(a,a+sizes[n-1]-1,total)]
    a,b=q[1],q[2]
    if not 0<=a<=b<total: return [416,'bytes */%d'%total]
    out=[]
    for i,s in enumerate(sizes):
        lo=max(a,starts[i])
        hi=min(b,starts[i]+s-1)
        if lo<=hi: out.append([i+1,lo,hi-lo+1])
    return [206,out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('part-relative-offset fixture 0', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',2]}))), json.loads(json.dumps([206,'bytes 5-7/12'])))
check('part-relative-offset fixture 1', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',3]}))), json.loads(json.dumps([206,'bytes 8-11/12'])))
check('part-relative-offset fixture 2', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',0]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 3', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',-1]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 4', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',4]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 5', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['part',2]}))), json.loads(json.dumps([416,'bytes */9'])))
check('part-relative-offset fixture 6', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',3,9]}))), json.loads(json.dumps([206,[[1,3,2],[2,0,3],[3,0,2]]])))
check('part-relative-offset fixture 7', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[2,0,1]]])))
check('part-relative-offset fixture 8', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',5,7]}))), json.loads(json.dumps([206,[[2,0,3]]])))
check('part-relative-offset fixture 9', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,12]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 10', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,11]}))), json.loads(json.dumps([206,[[1,0,5],[2,0,3],[3,0,4]]])))
check('part-relative-offset fixture 11', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[3,0,1]]])))
check('part-relative-offset fixture 12', json.loads(json.dumps(solve({'parts':[],'query':['part',1]}))), json.loads(json.dumps([416,'bytes */0'])))
check('part-relative-offset fixture 13', json.loads(json.dumps(solve({'parts':[N,N],'query':['part',2]}))), json.loads(json.dumps([206,"bytes %d-%d/%d"%(N,2*N-1,2*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)

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(x):
    sizes=x['parts']
    total=sum(sizes)
    starts=[]
    acc=0
    for s in sizes:
        starts.append(acc)
        acc+=s
    q=x['query']
    if q[0]=='part':
        n=q[1]
        if not 1<=n<=len(sizes) or sizes[n-1]==0: return [416,'bytes */%d'%total]
        a=starts[n-1]
        return [206,'bytes %d-%d/%d'%(a,a+sizes[n-1]-1,total)]
    a,b=q[1],q[2]
    if not 0<=a<=b<total: return [416,'bytes */%d'%total]
    out=[]
    for i,s in enumerate(sizes):
        lo=max(a,starts[i])
        hi=min(b,starts[i]+s-1)
        if lo<=hi: out.append([i+1,lo-a,hi-lo+1])
    return [206,out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('part-relative-offset fixture 0', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',2]}))), json.loads(json.dumps([206,'bytes 5-7/12'])))
check('part-relative-offset fixture 1', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',3]}))), json.loads(json.dumps([206,'bytes 8-11/12'])))
check('part-relative-offset fixture 2', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',0]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 3', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',-1]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 4', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',4]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 5', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['part',2]}))), json.loads(json.dumps([416,'bytes */9'])))
check('part-relative-offset fixture 6', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',3,9]}))), json.loads(json.dumps([206,[[1,3,2],[2,0,3],[3,0,2]]])))
check('part-relative-offset fixture 7', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[2,0,1]]])))
check('part-relative-offset fixture 8', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',5,7]}))), json.loads(json.dumps([206,[[2,0,3]]])))
check('part-relative-offset fixture 9', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,12]}))), json.loads(json.dumps([416,'bytes */12'])))
check('part-relative-offset fixture 10', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,11]}))), json.loads(json.dumps([206,[[1,0,5],[2,0,3],[3,0,4]]])))
check('part-relative-offset fixture 11', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[3,0,1]]])))
check('part-relative-offset fixture 12', json.loads(json.dumps(solve({'parts':[],'query':['part',1]}))), json.loads(json.dumps([416,'bytes */0'])))
check('part-relative-offset fixture 13', json.loads(json.dumps(solve({'parts':[N,N],'query':['part',2]}))), json.loads(json.dumps([206,"bytes %d-%d/%d"%(N,2*N-1,2*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:
An object store maps upload part numbers and byte ranges onto stored parts: intersection offsets are relative to the containing part.

x has stored part sizes in order and a query. ["part",n] (1-based) returns [206,bytes a-b/total] for that part, or [416,bytes */total] when n is outside 1..count or the part is empty. ["range",a,b] with inclusive bounds returns [416,bytes */total] unless 0<=a<=b<total; otherwise [206,rows] where each intersecting nonempty part yields [part-number,offset-within-part,count] in part order.

split: open-access


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

N = 1
observations = []
def solve(x):
    sizes=x['parts']
    total=sum(sizes)
    starts=[]
    acc=0
    for s in sizes:
        starts.append(acc)
        acc+=s
    q=x['query']
    if q[0]=='part':
        n=q[1]
        if not 1<=n<=len(sizes) or sizes[n-1]==0: return [416,'bytes */%d'%total]
        a=starts[n-1]
        return [206,'bytes %d-%d/%d'%(a,a+sizes[n-1]-1,total)]
    a,b=q[1],q[2]
    if not 0<=a<=b<total: return [416,'bytes */%d'%total]
    out=[]
    for i,s in enumerate(sizes):
        lo=max(a,starts[i])
        hi=min(b,starts[i]+s-1)
        if lo<hi: out.append([i+1,lo-starts[i],hi-lo+1])
    return [206,out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('single-byte-intersection fixture 0', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',2]}))), json.loads(json.dumps([206,'bytes 5-7/12'])))
check('single-byte-intersection fixture 1', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',3]}))), json.loads(json.dumps([206,'bytes 8-11/12'])))
check('single-byte-intersection fixture 2', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',0]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 3', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',-1]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 4', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',4]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 5', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['part',2]}))), json.loads(json.dumps([416,'bytes */9'])))
check('single-byte-intersection fixture 6', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',3,9]}))), json.loads(json.dumps([206,[[1,3,2],[2,0,3],[3,0,2]]])))
check('single-byte-intersection fixture 7', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[2,0,1]]])))
check('single-byte-intersection fixture 8', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',5,7]}))), json.loads(json.dumps([206,[[2,0,3]]])))
check('single-byte-intersection fixture 9', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,12]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 10', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,11]}))), json.loads(json.dumps([206,[[1,0,5],[2,0,3],[3,0,4]]])))
check('single-byte-intersection fixture 11', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[3,0,1]]])))
check('single-byte-intersection fixture 12', json.loads(json.dumps(solve({'parts':[],'query':['part',1]}))), json.loads(json.dumps([416,'bytes */0'])))
check('single-byte-intersection fixture 13', json.loads(json.dumps(solve({'parts':[N,N],'query':['part',2]}))), json.loads(json.dumps([206,"bytes %d-%d/%d"%(N,2*N-1,2*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(x):
    sizes=x['parts']
    total=sum(sizes)
    starts=[]
    acc=0
    for s in sizes:
        starts.append(acc)
        acc+=s
    q=x['query']
    if q[0]=='part':
        n=q[1]
        if not 1<=n<=len(sizes) or sizes[n-1]==0: return [416,'bytes */%d'%total]
        a=starts[n-1]
        return [206,'bytes %d-%d/%d'%(a,a+sizes[n-1]-1,total)]
    a,b=q[1],q[2]
    if not 0<=a<=b<total: return [416,'bytes */%d'%total]
    out=[]
    for i,s in enumerate(sizes):
        lo=max(a,starts[i])
        hi=min(b,starts[i]+s-1)
        if lo<=hi+1: out.append([i+1,lo-starts[i],hi-lo+1])
    return [206,out]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('single-byte-intersection fixture 0', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',2]}))), json.loads(json.dumps([206,'bytes 5-7/12'])))
check('single-byte-intersection fixture 1', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',3]}))), json.loads(json.dumps([206,'bytes 8-11/12'])))
check('single-byte-intersection fixture 2', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',0]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 3', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',-1]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 4', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['part',4]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 5', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['part',2]}))), json.loads(json.dumps([416,'bytes */9'])))
check('single-byte-intersection fixture 6', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',3,9]}))), json.loads(json.dumps([206,[[1,3,2],[2,0,3],[3,0,2]]])))
check('single-byte-intersection fixture 7', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[2,0,1]]])))
check('single-byte-intersection fixture 8', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',5,7]}))), json.loads(json.dumps([206,[[2,0,3]]])))
check('single-byte-intersection fixture 9', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,12]}))), json.loads(json.dumps([416,'bytes */12'])))
check('single-byte-intersection fixture 10', json.loads(json.dumps(solve({'parts':[5,3,4],'query':['range',0,11]}))), json.loads(json.dumps([206,[[1,0,5],[2,0,3],[3,0,4]]])))
check('single-byte-intersection fixture 11', json.loads(json.dumps(solve({'parts':[5,0,4],'query':['range',4,5]}))), json.loads(json.dumps([206,[[1,4,1],[3,0,1]]])))
check('single-byte-intersection fixture 12', json.loads(json.dumps(solve({'parts':[],'query':['part',1]}))), json.loads(json.dumps([416,'bytes */0'])))
check('single-byte-intersection fixture 13', json.loads(json.dumps(solve({'parts':[N,N],'query':['part',2]}))), json.loads(json.dumps([206,"bytes %d-%d/%d"%(N,2*N-1,2*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:
An object store maps upload part numbers and byte ranges onto stored parts: one-byte part intersections are retained while empty ones are not.

x has stored part sizes in order and a query. ["part",n] (1-based) returns [206,bytes a-b/total] for that part, or [416,bytes */total] when n is outside 1..count or the part is empty. ["range",a,b] with inclusive bounds returns [416,bytes */total] unless 0<=a<=b<total; otherwise [206,rows] where each intersecting nonempty part yields [part-number,offset-within-part,count] in part order.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k == 'Location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k == 'location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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:
Differently cased Location names are lost.

Select an unambiguous Location field without losing raw syntax. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], False, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], len(lines) > 1, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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:
Other headers are confused with duplicate redirect targets.

Select an unambiguous Location field without losing raw syntax. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v.replace(' ', '').replace('\t','') for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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:
Whitespace trimming corrupts internal target characters.

Select an unambiguous Location field without losing raw syntax. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v.split(',')[0] for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v.split(',')[-1] for k,v in lines if k.lower() == 'location'], 'missing' if not any(k.lower() == 'location' for k,v in lines) else 'present']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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 URI comma is treated as a header list separator.

Select an unambiguous Location field without losing raw syntax. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'present' if any(v for k,v in lines if k.lower() == 'location') else 'missing']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, lines):
    return {'request': request, 'decision': [[v for k,v in lines if k.lower() == 'location'], len([v for k,v in lines if k.lower() == 'location']) > 1, [v.strip(' \t') for k,v in lines if k.lower() == 'location'], [v for k,v in lines if k.lower() == 'location'], 'present' if lines else 'missing']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [('Location', ' /a,b '), ('X', 'z')]), {'request': '/requests/' + str(N) + '/0', 'decision': [[' /a,b '], False, ['/a,b'], [' /a,b '], 'present']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [('location', '/a b')]), {'request': '/requests/' + str(N) + '/1', 'decision': [['/a b'], False, ['/a b'], ['/a b'], 'present']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [('LOCATION', '')]), {'request': '/requests/' + str(N) + '/2', 'decision': [[''], False, [''], [''], 'present']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [('X', 'z')]), {'request': '/requests/' + str(N) + '/3', 'decision': [[], False, [], [], 'missing']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [('Location', '/a'), ('location', '/b')]), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], True, ['/a', '/b'], ['/a', '/b'], 'present']})
check('fixture 6', solve('/requests/' + str(N) + '/5', []), {'request': '/requests/' + str(N) + '/5', 'decision': [[], False, [], [], 'missing']})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An empty field is confused with an absent field.

Select an unambiguous Location field without losing raw syntax. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [300 <= status < 400, not informational, not tunnel, mode == 'manual', location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,307,308), not informational, not tunnel, mode == 'manual', location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A non-followable status is followed or See Other is omitted.

Admit only actionable redirect responses. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), True, not tunnel, mode == 'manual', location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), status >= 300, not tunnel, mode == 'manual', location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An interim response is allowed to control the final redirect decision.

Admit only actionable redirect responses. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), not informational, True, mode == 'manual', location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), not informational, not tunnel and status != 307, mode == 'manual', location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A tunneled stream is mistakenly interpreted by the outer redirect controller.

Admit only actionable redirect responses. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), not informational, not tunnel, False, location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), not informational, not tunnel, mode != 'follow', location == '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Manual inspection is conflated with redirect-error policy.

Admit only actionable redirect responses. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), not informational, not tunnel, mode == 'manual', location is None]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, location, informational, tunnel, mode):
    return {'request': request, 'decision': [status in (301,302,303,307,308), not informational, not tunnel, mode == 'manual', not location]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 300, '/a', False, False, 'follow'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, True, True, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/b', True, True, 'manual'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, False, False, True, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '', False, False, 'error'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, True, True, False, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 304, None, False, True, 'follow'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, True, False, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 308, '/c', False, False, 'manual'), {'request': '/requests/' + str(N) + '/4', 'decision': [True, True, True, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 200, '/d', False, False, 'follow'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, True, True, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An absent target and an explicitly empty target receive the same diagnostic.

Admit only actionable redirect responses. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r\n' in raw, '\t' in raw.strip(' \t'), '\x00' in raw, bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\n' in raw, '\t' in raw.strip(' \t'), '\x00' in raw, bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A lone carriage return bypasses raw-field rejection.

Validate raw target text before any URL normalization. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, False, '\x00' in raw, bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, '\t' in raw, '\x00' in raw, bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Only outer optional whitespace may be stripped.

Validate raw target text before any URL normalization. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, '\t' in raw.strip(' \t'), raw.endswith('\x00'), bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, '\t' in raw.strip(' \t'), raw.startswith('\x00'), bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
An interior NUL evades validation.

Validate raw target text before any URL normalization. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, '\t' in raw.strip(' \t'), '\x00' in raw, raw.endswith('%'), '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, '\t' in raw.strip(' \t'), '\x00' in raw, '%' in raw, '\\' in raw]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A malformed escape is accepted or every encoded character is rejected.

Validate raw target text before any URL normalization. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, '\t' in raw.strip(' \t'), '\x00' in raw, bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), raw.startswith('\\')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, raw):
    return {'request': request, 'decision': ['\r' in raw or '\n' in raw, '\t' in raw.strip(' \t'), '\x00' in raw, bool(re.search(r'%(?![0-9A-Fa-f]{2})', raw)), raw.endswith('\\')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/a\rb\tc\x00d%G0\\e'), {'request': '/requests/' + str(N) + '/0', 'decision': [True, True, True, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '\t/a%20b\t'), {'request': '/requests/' + str(N) + '/1', 'decision': [False, False, False, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/a\nb'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, False, False, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/a%'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, False, False, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/normal'), {'request': '/requests/' + str(N) + '/4', 'decision': [False, False, False, False, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ''), {'request': '/requests/' + str(N) + '/5', 'decision': [False, False, False, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A backslash inside a redirect target reaches a different downstream parser.

Validate raw target text before any URL normalization. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme, bool(scheme) or allow_relative, scheme.lower() not in ('', 'http', 'https'), source == 'http' and scheme.lower() == 'https', 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme.upper(), bool(scheme) or allow_relative, scheme.lower() not in ('', 'http', 'https'), source == 'http' and scheme.lower() == 'https', 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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:
Mixed-case schemes do not compare against policy names.

Apply a configured HTTP redirect scheme policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme.lower(), bool(scheme), scheme.lower() not in ('', 'http', 'https'), source == 'http' and scheme.lower() == 'https', 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme.lower(), True, scheme.lower() not in ('', 'http', 'https'), source == 'http' and scheme.lower() == 'https', 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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:
Relative references disregard the caller policy.

Apply a configured HTTP redirect scheme policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme.lower(), bool(scheme) or allow_relative, scheme.lower() == 'file', source == 'http' and scheme.lower() == 'https', 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme.lower(), bool(scheme) or allow_relative, scheme.lower() not in ('http','https'), source == 'http' and scheme.lower() == 'https', 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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:
Non-network targets are not consistently rejected.

Apply a configured HTTP redirect scheme policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme.lower(), bool(scheme) or allow_relative, scheme.lower() not in ('', 'http', 'https'), scheme.lower() == 'https', 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, scheme, source, explicit, upgrades, allow_relative):
    return {'request': request, 'decision': [scheme.lower(), bool(scheme) or allow_relative, scheme.lower() not in ('', 'http', 'https'), source != scheme.lower(), 'https' if not explicit and source in upgrades else source]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'HtTpS', 'http', False, ['http'], False), {'request': '/requests/' + str(N) + '/0', 'decision': ['https', True, False, True, 'https']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'https', 'https', True, ['https'], True), {'request': '/requests/' + str(N) + '/1', 'decision': ['https', True, False, False, 'https']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '', 'http', True, ['http'], True), {'request': '/requests/' + str(N) + '/2', 'decision': ['', True, False, False, 'http']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', 'http', False, [], False), {'request': '/requests/' + str(N) + '/3', 'decision': ['', False, False, False, 'http']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'data', 'https', True, [], True), {'request': '/requests/' + str(N) + '/4', 'decision': ['data', True, True, False, 'https']})
check('fixture 6', solve('/requests/' + str(N) + '/5', 'http', 'https', False, [], False), {'request': '/requests/' + str(N) + '/5', 'decision': ['http', True, False, False, 'https']})
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:
Same-scheme and downgrade transitions are labeled upgrades.

Apply a configured HTTP redirect scheme policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access