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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+1
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('size-line-advance fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('size-line-advance fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('size-line-advance fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('size-line-advance fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('size-line-advance fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('size-line-advance fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('size-line-advance fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2 if size==0 else end+1
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('size-line-advance fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('size-line-advance fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('size-line-advance fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('size-line-advance fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('size-line-advance fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('size-line-advance fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('size-line-advance fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('size-line-advance fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: body data starts after both bytes of size-line CRLF.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0 and pos==len(data):
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero-terminator fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('zero-terminator fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('zero-terminator fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('zero-terminator fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('zero-terminator fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('zero-terminator fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('zero-terminator fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0 and data[pos:pos+2]=='\r\n':
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero-terminator fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('zero-terminator fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('zero-terminator fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('zero-terminator fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('zero-terminator fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('zero-terminator fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('zero-terminator fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('zero-terminator fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: the zero chunk starts trailer parsing without entering body accumulation.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if False: return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('body-crlf fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('body-crlf fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('body-crlf fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('body-crlf fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('body-crlf fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-crlf fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-crlf fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-crlf fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('body-crlf fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('body-crlf fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('body-crlf fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]=='': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('body-crlf fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('body-crlf fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('body-crlf fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('body-crlf fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('body-crlf fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-crlf fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-crlf fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-crlf fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('body-crlf fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('body-crlf fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('body-crlf fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: chunk payload lengths do not excuse invalid framing separators.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('body-cursor fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('body-cursor fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('body-cursor fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('body-cursor fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('body-cursor fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-cursor fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-cursor fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-cursor fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('body-cursor fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('body-cursor fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('body-cursor fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+1
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('body-cursor fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('body-cursor fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('body-cursor fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('body-cursor fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('body-cursor fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-cursor fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-cursor fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('body-cursor fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('body-cursor fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('body-cursor fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('body-cursor fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: each next size line begins after the payload framing CRLF.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [data[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decoded-slice fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('decoded-slice fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('decoded-slice fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('decoded-slice fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('decoded-slice fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('decoded-slice fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('decoded-slice fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[:x['stop']-x['start']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('decoded-slice fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('decoded-slice fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('decoded-slice fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('decoded-slice fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('decoded-slice fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('decoded-slice fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('decoded-slice fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('decoded-slice fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: range offsets address decoded payload rather than transfer framing.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if size>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cumulative-limit fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('cumulative-limit fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('cumulative-limit fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('cumulative-limit fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('cumulative-limit fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('cumulative-limit fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('cumulative-limit fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']+size: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('cumulative-limit fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('cumulative-limit fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('cumulative-limit fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('cumulative-limit fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('cumulative-limit fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('cumulative-limit fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('cumulative-limit fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('cumulative-limit fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: the decoded byte cap is enforced across all chunks.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if False: return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailer-termination fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('trailer-termination fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('trailer-termination fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('trailer-termination fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('trailer-termination fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('trailer-termination fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('trailer-termination fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.append(line)
            if pos>len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailer-termination fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('trailer-termination fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('trailer-termination fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('trailer-termination fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('trailer-termination fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('trailer-termination fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('trailer-termination fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('trailer-termination fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: bytes after the trailer terminator cannot extend this response.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers=[line]
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailer-sequence fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('trailer-sequence fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('trailer-sequence fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('trailer-sequence fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('trailer-sequence fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('trailer-sequence fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('trailer-sequence fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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):
    data=x['wire']
    pos=0
    body=''
    trailers=[]
    while True:
        end=data.find('\r\n',pos)
        if end<0: return None
        digits=data[pos:end].split(';',1)[0]
        if not 1<=len(digits)<=2 or any(c not in '0123456789abcdefABCDEF' for c in digits): return None
        size=int(digits,16)
        pos=end+2
        if size==0:
            while True:
                end=data.find('\r\n',pos)
                if end<0: return None
                line=data[pos:end]
                pos=end+2
                if not line: break
                if ':' not in line: return None
                trailers.insert(0,line)
            if pos!=len(data): return None
            return [body[x['start']:x['stop']],len(body),trailers]
        if pos+size+2>len(data): return None
        if data[pos+size:pos+size+2]!='\r\n': return None
        body+=data[pos:pos+size]
        if len(body)>x['limit']: return None
        pos+=size+2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('trailer-sequence fixture 0', json.loads(json.dumps(solve({'wire':'A;foo=bar\r\n0123456789\r\n0\r\nX:y\r\n\r\n','start':2,'stop':6,'limit':20}))), json.loads(json.dumps(['2345',10,['X:y']])))
check('trailer-sequence fixture 1', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n3\r\ncde\r\n0\r\n\r\n','start':1,'stop':4,'limit':5}))), json.loads(json.dumps(['bcd',5,[]])))
check('trailer-sequence fixture 2', json.loads(json.dumps(solve({'wire':'0\r\n\r\n','start':0,'stop':3,'limit':0}))), json.loads(json.dumps(['',0,[]])))
check('trailer-sequence fixture 3', json.loads(json.dumps(solve({'wire':'1;z=q\r\nx\r\n0\r\n\r\n','start':0,'stop':1,'limit':1}))), json.loads(json.dumps(['x',1,[]])))
check('trailer-sequence fixture 4', json.loads(json.dumps(solve({'wire':'1\r\nxXX0\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 5', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\n\r\nextra','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 6', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nBadTrailer\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 7', json.loads(json.dumps(solve({'wire':'2\r\nab\r\n2\r\ncd\r\n0\r\n\r\n','start':0,'stop':4,'limit':3}))), json.loads(json.dumps(None)))
check('trailer-sequence fixture 8', json.loads(json.dumps(solve({'wire':'1\r\nx\r\n0\r\nX:a\r\nY:b\r\n\r\n','start':0,'stop':1,'limit':2}))), json.loads(json.dumps(['x',1,['X:a','Y:b']])))
check('trailer-sequence fixture 9', json.loads(json.dumps(solve({'wire':format(N,"x")+"\r\n"+"p"*N+"\r\n0\r\n\r\n",'start':0,'stop':N,'limit':10}))), json.loads(json.dumps(["p"*N,N,[]])))
check('trailer-sequence fixture 10', json.loads(json.dumps(solve({'wire':'10\r\nabcdefghijklmnop\r\n0\r\n\r\n','start':12,'stop':16,'limit':16}))), json.loads(json.dumps(['mnop',16,[]])))
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 range client removes transfer framing before applying representation offsets: all parsed trailer fields retain their wire order.

Decode a complete bounded ASCII chunked origin body. Size lines use 1..2 hexadecimal digits with optional semicolon extensions, followed by exact CRLF; each data chunk has exact trailing CRLF. A zero chunk ends data and introduces colon-bearing trailer lines terminated by an empty CRLF line. No bytes may follow trailers. Enforce cumulative decoded-byte limit x.limit. Return [decoded[start:stop],decoded-length,trailer-lines] or None. This controlled framing model does not implement general HTTP headers.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[0]!=82: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('magic-signature fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('magic-signature fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('magic-signature fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('magic-signature fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('magic-signature fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('magic-signature fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('magic-signature fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('magic-signature fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('magic-signature fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('magic-signature fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[0]!=82 and wire[1]!=71: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('magic-signature fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('magic-signature fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('magic-signature fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('magic-signature fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('magic-signature fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('magic-signature fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('magic-signature fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('magic-signature fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('magic-signature fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('magic-signature fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: both magic bytes distinguish range records from unrelated cache files.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if False: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('format-version fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('format-version fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('format-version fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('format-version fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('format-version fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('format-version fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('format-version fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('format-version fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('format-version fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('format-version fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]<1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('format-version fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('format-version fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('format-version fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('format-version fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('format-version fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('format-version fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('format-version fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('format-version fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('format-version fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('format-version fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: unsupported record versions do not reuse the current fragment layout.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if False: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserved-flags fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('reserved-flags fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('reserved-flags fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('reserved-flags fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('reserved-flags fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]&128: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('reserved-flags fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('reserved-flags fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('reserved-flags fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('reserved-flags fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('reserved-flags fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('reserved-flags fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: unknown envelope flags cannot silently change fragment meaning.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if False: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('record-checksum fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('record-checksum fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('record-checksum fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('record-checksum fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('record-checksum fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('record-checksum fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('record-checksum fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('record-checksum fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('record-checksum fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('record-checksum fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[9:-1])%256!=wire[-1] and wire[8]>0: return None
    generation=wire[4]*256+wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('record-checksum fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('record-checksum fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('record-checksum fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('record-checksum fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('record-checksum fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('record-checksum fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('record-checksum fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('record-checksum fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('record-checksum fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('record-checksum fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: coverage metadata is verified along with cached payload bytes.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[5]*256+wire[4]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('revision-byte-order fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('revision-byte-order fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('revision-byte-order fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('revision-byte-order fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[5]
    total=wire[6]*256+wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('revision-byte-order fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('revision-byte-order fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('revision-byte-order fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('revision-byte-order fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('revision-byte-order fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: persisted generations retain their high byte.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access


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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[7]*256+wire[6]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('length-byte-order fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('length-byte-order fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('length-byte-order fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('length-byte-order fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('length-byte-order fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    wire=x
    if len(wire)<10 or any(not 0<=b<=255 for b in wire): return None
    if wire[:2]!=[82,71]: return None
    if wire[2]!=1: return None
    if wire[3]!=0: return None
    if sum(wire[:-1])%256!=wire[-1]: return None
    generation=wire[4]*256+wire[5]
    total=wire[7]
    count=wire[8]
    pos=9
    parts=[]
    owned=set()
    for _ in range(count):
        if pos+3>len(wire)-1: return None
        offset=wire[pos]*256+wire[pos+1]
        size=wire[pos+2]
        pos+=3
        if pos+size>len(wire)-1 or offset+size>total: return None
        if any(i in owned for i in range(offset,offset+size)): return None
        owned.update(range(offset,offset+size))
        parts.append([offset,''.join(chr(b) for b in wire[pos:pos+size])])
        pos+=size
    if pos!=len(wire)-1: return None
    return [generation,total,parts]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('length-byte-order fixture 0', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,1,N,1,2,2,0,0,2,97,98,1,0,2,99,100])))), json.loads(json.dumps([256+N,258,[[0,'ab'],[256,'cd']]])))
check('length-byte-order fixture 1', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0])))), json.loads(json.dumps([0,0,[]])))
check('length-byte-order fixture 2', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,1,0,3,1,0,1,2,98,99])))), json.loads(json.dumps([1,3,[[1,'bc']]])))
check('length-byte-order fixture 3', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,70,1,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 4', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,2,0,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 5', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,1,0,0,0,0,0])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 6', json.loads(json.dumps(solve([82,71,1,0,0,0,0,0,0,0]))), json.loads(json.dumps(None)))
check('length-byte-order fixture 7', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,1,1,0,0,2,97,98])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 8', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,2,2,0,0,1,97,0,0,1,97])))), json.loads(json.dumps(None)))
check('length-byte-order fixture 9', json.loads(json.dumps(solve((lambda w:w+[sum(w)%256])([82,71,1,0,0,0,0,0,0,99])))), json.loads(json.dumps(None)))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A persisted partial-response cache record keeps byte coverage and revision metadata intact: the complete representation length is decoded independently of fragment size.

Decode this stipulated local binary cache envelope: magic RG, version1, flags0, two-byte big-endian generation, two-byte big-endian complete length, one-byte fragment count, then fragments [two-byte big-endian offset,one-byte count,ASCII payload], followed by one checksum byte equal to sum of preceding bytes modulo256. Reject malformed envelopes, bytes outside0..255, trailing bytes, overlapping fragment ownership, or spans outside complete length. Return [generation,total,[[offset,payload],...]]. This is an invented bounded persistence format, not a public protocol.

split: open-access