broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, fragment, ids, saved_scroll, restore, decoded, directive):
    return {'request': request, 'decision': [next((i for i,v in enumerate(ids) if v==fragment),None), unquote(fragment) if decoded else fragment, restore, saved_scroll if restore else 0, fragment == '', directive and fragment.startswith(":~:"), '', (unquote(fragment) if decoded else fragment) in ids, saved_scroll if fragment not in ids else 0, fragment]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'section', ['top', 'section', 'section'], 25, False, True, False), {'request': '/requests/' + str(N) + '/0', 'decision': [1, 'section', False, 0, False, False, '', True, 0, 'section']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'a%20b', ['a b', 'a%20b'], 40, False, True, False), {'request': '/requests/' + str(N) + '/1', 'decision': [1, 'a b', False, 0, False, False, '', True, 0, 'a%20b']})
check('fixture 3', solve('/requests/' + str(N) + '/2', 'missing', ['top'], 15, True, False, False), {'request': '/requests/' + str(N) + '/2', 'decision': [None, 'missing', True, 15, False, False, '', False, 15, 'missing']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', [], 0, False, True, False), {'request': '/requests/' + str(N) + '/3', 'decision': [None, '', False, 0, True, False, '', False, 0, '']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'top', ['x', 'top'], 80, False, False, False), {'request': '/requests/' + str(N) + '/4', 'decision': [1, 'top', False, 0, False, False, '', True, 0, 'top']})
check('fixture 6', solve('/requests/' + str(N) + '/5', ':~:text=hello', [':~:text=hello'], 5, False, False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [0, ':~:text=hello', False, 0, False, True, '', True, 0, None]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 'a%20b', ['a b'], 5, False, True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a b', False, 0, False, False, '', True, 5, 'a%20b']})
check('fixture 8', solve('/requests/' + str(N) + '/7', 'x%20y', [], 6, False, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [None, 'x%20y', False, 0, False, False, '', False, 6, 'x%20y']})
check('fixture 9', solve('/requests/' + str(N) + '/8', ':~:text=no', [], 8, False, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [None, ':~:text=no', False, 0, False, False, '', False, 8, ':~:text=no']})
check('fixture 10', solve('/requests/' + str(N) + '/9', '', ['top'], 9, False, False, False), {'request': '/requests/' + str(N) + '/9', 'decision': [None, '', False, 0, True, False, '', False, 9, '']})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, fragment, ids, saved_scroll, restore, decoded, directive):
    return {'request': request, 'decision': [next((i for i,v in enumerate(ids) if v==fragment),None), unquote(fragment) if decoded else fragment, restore, saved_scroll if restore else 0, fragment == '', directive and fragment.startswith(":~:"), '', (unquote(fragment) if decoded else fragment) in ids, saved_scroll if fragment not in ids else 0, None if ':' in fragment else fragment]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 'section', ['top', 'section', 'section'], 25, False, True, False), {'request': '/requests/' + str(N) + '/0', 'decision': [1, 'section', False, 0, False, False, '', True, 0, 'section']})
check('fixture 2', solve('/requests/' + str(N) + '/1', 'a%20b', ['a b', 'a%20b'], 40, False, True, False), {'request': '/requests/' + str(N) + '/1', 'decision': [1, 'a b', False, 0, False, False, '', True, 0, 'a%20b']})
check('fixture 3', solve('/requests/' + str(N) + '/2', 'missing', ['top'], 15, True, False, False), {'request': '/requests/' + str(N) + '/2', 'decision': [None, 'missing', True, 15, False, False, '', False, 15, 'missing']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '', [], 0, False, True, False), {'request': '/requests/' + str(N) + '/3', 'decision': [None, '', False, 0, True, False, '', False, 0, '']})
check('fixture 5', solve('/requests/' + str(N) + '/4', 'top', ['x', 'top'], 80, False, False, False), {'request': '/requests/' + str(N) + '/4', 'decision': [1, 'top', False, 0, False, False, '', True, 0, 'top']})
check('fixture 6', solve('/requests/' + str(N) + '/5', ':~:text=hello', [':~:text=hello'], 5, False, False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [0, ':~:text=hello', False, 0, False, True, '', True, 0, None]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 'a%20b', ['a b'], 5, False, True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a b', False, 0, False, False, '', True, 5, 'a%20b']})
check('fixture 8', solve('/requests/' + str(N) + '/7', 'x%20y', [], 6, False, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [None, 'x%20y', False, 0, False, False, '', False, 6, 'x%20y']})
check('fixture 9', solve('/requests/' + str(N) + '/8', ':~:text=no', [], 8, False, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [None, ':~:text=no', False, 0, False, False, '', False, 8, ':~:text=no']})
check('fixture 10', solve('/requests/' + str(N) + '/9', '', ['top'], 9, False, False, False), {'request': '/requests/' + str(N) + '/9', 'decision': [None, '', False, 0, True, False, '', False, 9, '']})
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:
Apply post-redirect fragment navigation without altering request routing: the directive hidden from dom anchor branch emits an incorrect decision.

Apply post-redirect fragment navigation without altering request routing. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict({'Location':target}, **custom_headers), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [custom_headers, '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the location overwrites stale branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if method == 'HEAD' else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the head body suppression branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, 0 if head else len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the utf8 content length branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), 302, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), 301 if status in (301,308) else 302, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the status preserved branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target, target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the html target ampersand branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target, target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),''), target, custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the html target quote branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target.split('#')[0], custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target.split('?')[0], custom_headers, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the fragment location preserved branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, {}, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, {k:v for k,v in custom_headers.items() if k.startswith('Content-')}, body == "", status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the custom response fields retained branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, head, status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, not custom_headers, status == 303]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the bodyless length zero branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", method == "POST"]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, status, target, method, body, head, custom_headers):
    return {'request': request, 'decision': [dict(custom_headers, Location=target), '' if head else body, len(body.encode('utf-8')), status, target.replace('&','&'), target.replace(chr(34),'"'), target, custom_headers, body == "", status in (302,303)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', 302, '/a?x=1&y=2', 'GET', 'move', False, {'X': 'v'}), {'request': '/requests/' + str(N) + '/0', 'decision': [{'X': 'v', 'Location': '/a?x=1&y=2'}, 'move', 4, 302, '/a?x=1&y=2', '/a?x=1&y=2', '/a?x=1&y=2', {'X': 'v'}, False, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', 303, '/a#part', 'POST', 'next', False, {}), {'request': '/requests/' + str(N) + '/1', 'decision': [{'Location': '/a#part'}, 'next', 4, 303, '/a#part', '/a#part', '/a#part', {}, False, True]})
check('fixture 3', solve('/requests/' + str(N) + '/2', 307, '/unicode/é', 'PUT', 'café', True, {'Content-Length': '999'}), {'request': '/requests/' + str(N) + '/2', 'decision': [{'Content-Length': '999', 'Location': '/unicode/é'}, '', 5, 307, '/unicode/é', '/unicode/é', '/unicode/é', {'Content-Length': '999'}, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', 308, '/', 'HEAD', 'moved', True, {}), {'request': '/requests/' + str(N) + '/3', 'decision': [{'Location': '/'}, '', 5, 308, '/', '/', '/', {}, False, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', 301, '/b', 'GET', '', False, {'Location': '/stale'}), {'request': '/requests/' + str(N) + '/4', 'decision': [{'Location': '/b'}, '', 0, 301, '/b', '/b', '/b', {'Location': '/stale'}, True, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', 302, '/a"b', 'GET', 'x', False, {'Content-Type': 'custom'}), {'request': '/requests/' + str(N) + '/5', 'decision': [{'Content-Type': 'custom', 'Location': '/a"b'}, 'x', 1, 302, '/a"b', '/a"b', '/a"b', {'Content-Type': 'custom'}, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', 303, '/e', 'GET', 'abc', False, {}), {'request': '/requests/' + str(N) + '/6', 'decision': [{'Location': '/e'}, 'abc', 3, 303, '/e', '/e', '/e', {}, False, True]})
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:
Serialize a redirect response under an explicit server-side response policy: the method independent status branch emits an incorrect decision.

Serialize a redirect response under an explicit server-side response policy. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key][:1], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(unquote(v)==required for k,v in pairs if k==key), any(k==key for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key][-1:], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(unquote(v)==required for k,v in pairs if k==key), any(k==key for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Match query-aware redirect rules against repeated decoded query fields: the all values selected branch emits an incorrect decision.

Match query-aware redirect rules against repeated decoded query fields. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if k==key], any(unquote(v)==required for k,v in pairs if k==key), any(k==key for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if k.lower()==key.lower()], any(unquote(v)==required for k,v in pairs if k==key), any(k==key for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Match query-aware redirect rules against repeated decoded query fields: the case option key branch emits an incorrect decision.

Match query-aware redirect rules against repeated decoded query fields. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(v==required for k,v in pairs if k==key), any(k==key for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(unquote(v).replace('+',' ')==required for k,v in pairs), any(k==key for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Match query-aware redirect rules against repeated decoded query fields: the decoded value match branch emits an incorrect decision.

Match query-aware redirect rules against repeated decoded query fields. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(unquote(v)==required for k,v in pairs if k==key), any(k==key and v for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(unquote(v)==required for k,v in pairs if k==key), not pairs or any(k==key for k,v in pairs), bool([v for k,v in pairs if k==key]) and all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Match query-aware redirect rules against repeated decoded query fields: the missing is not empty branch emits an incorrect decision.

Match query-aware redirect rules against repeated decoded query fields. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(unquote(v)==required for k,v in pairs if k==key), any(k==key for k,v in pairs), all(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, pairs, key, required, case_sensitive, negate, require_all):
    return {'request': request, 'decision': [[v for k,v in pairs if k==key], [v for k,v in pairs if (k==key if case_sensitive else k.lower()==key.lower())], any(unquote(v)==required for k,v in pairs if k==key), any(k==key for k,v in pairs), any(v==required for k,v in pairs if k==key), not any(v==required for k,v in pairs if k==key) if negate else any(v==required for k,v in pairs if k==key), any(v==required for k,v in pairs if k==key), sum(k==key for k,v in pairs), any(k==key and v==required for k,v in pairs), (bool(pairs) and all(v==required for k,v in pairs)) if require_all else any(v==required for k,v in pairs)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['q', 'a'], ['q', 'b']], 'q', 'b', True, False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [['a', 'b'], ['a', 'b'], True, True, False, True, True, 2, True, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['Q', 'A']], 'q', 'a', False, False, True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], ['A'], False, False, False, False, False, 0, False, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'q', '', True, True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [], False, False, False, True, False, 0, False, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['q', ''], ['q', 'x']], 'q', '', True, False, True), {'request': '/requests/' + str(N) + '/3', 'decision': [['', 'x'], ['', 'x'], True, True, False, True, True, 2, True, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['q', 'a'], ['q', 'a']], 'q', 'a', True, True, True), {'request': '/requests/' + str(N) + '/4', 'decision': [['a', 'a'], ['a', 'a'], True, True, True, False, True, 2, True, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['q', 'a%20b']], 'q', 'a b', True, False, False), {'request': '/requests/' + str(N) + '/5', 'decision': [['a%20b'], ['a%20b'], True, True, False, False, False, 1, False, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['Q', 'a']], 'q', 'a', True, False, False), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], False, False, False, False, False, 0, False, True]})
check('fixture 8', solve('/requests/' + str(N) + '/7', [['q', '']], 'q', '', True, False, False), {'request': '/requests/' + str(N) + '/7', 'decision': [[''], [''], True, True, True, True, True, 1, True, True]})
check('fixture 9', solve('/requests/' + str(N) + '/8', [['q', 'prefix']], 'q', 'pre', True, False, False), {'request': '/requests/' + str(N) + '/8', 'decision': [['prefix'], ['prefix'], False, True, False, False, False, 1, False, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Match query-aware redirect rules against repeated decoded query fields: the all match requires presence branch emits an incorrect decision.

Match query-aware redirect rules against repeated decoded query fields. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access