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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute', path[1:] if internal == '/' else path, external.rstrip('/') + '/' + path.lstrip('/'), ('/' + external.lstrip('/')) if external else '/', path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'relative', path[1:] if internal == '/' else path, external.rstrip('/') + '/' + path.lstrip('/'), ('/' + external.lstrip('/')) if external else '/', path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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:
Translate a redirect between internal and public application mounts: the absolute link mode branch emits an incorrect decision.

Translate a redirect between internal and public application mounts. 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path.lstrip('/'), external.rstrip('/') + '/' + path.lstrip('/'), ('/' + external.lstrip('/')) if external else '/', path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path, external.rstrip('/') + '/' + path.lstrip('/'), ('/' + external.lstrip('/')) if external else '/', path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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:
Translate a redirect between internal and public application mounts: the mount root special case branch emits an incorrect decision.

Translate a redirect between internal and public application mounts. 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path[1:] if internal == '/' else path, external + path, ('/' + external.lstrip('/')) if external else '/', path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path[1:] if internal == '/' else path, external + '/' + path, ('/' + external.lstrip('/')) if external else '/', path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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:
Translate a redirect between internal and public application mounts: the public prefix join branch emits an incorrect decision.

Translate a redirect between internal and public application mounts. 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path[1:] if internal == '/' else path, external.rstrip('/') + '/' + path.lstrip('/'), external, path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path[1:] if internal == '/' else path, external.rstrip('/') + '/' + path.lstrip('/'), external.lstrip('/'), path.startswith(internal.rstrip('/')+'/') or path == internal]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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:
Translate a redirect between internal and public application mounts: the relative output authority safety branch emits an incorrect decision.

Translate a redirect between internal and public application mounts. 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path[1:] if internal == '/' else path, external.rstrip('/') + '/' + path.lstrip('/'), ('/' + external.lstrip('/')) if external else '/', internal in path]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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, path, internal, external, query, trailing, absolute):
    return {'request': request, 'decision': [path == internal or path.startswith(internal.rstrip('/')+'/'), path[len(internal):] if path == internal or path.startswith(internal.rstrip('/')+'/') else path, external or '/', ('?' + query) if query else '', path+'/' if trailing and not path.endswith('/') else path, 'absolute' if absolute else 'relative', path[1:] if internal == '/' else path, external.rstrip('/') + '/' + path.lstrip('/'), ('/' + external.lstrip('/')) if external else '/', not absolute]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/app/a', '/app', '/public', 'x=1', False, False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/a', '/public', '?x=1', '/app/a', 'relative', '/app/a', '/public/app/a', '/public', True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/apple/a', '/app', '/public', '', False, False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/apple/a', '/public', '', '/apple/a', 'relative', '/apple/a', '/public/apple/a', '/public', False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/app', '/app', '/public', 'q=', True, False), {'request': '/requests/' + str(N) + '/2', 'decision': [True, '', '/public', '?q=', '/app/', 'relative', '/app', '/public/app', '/public', True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/app/a/app', '/app', '/v2', 'k=1&k=2', True, True), {'request': '/requests/' + str(N) + '/3', 'decision': [True, '/a/app', '/v2', '?k=1&k=2', '/app/a/app/', 'absolute', '/app/a/app', '/v2/app/a/app', '/v2', True]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', '/', '/edge', '', False, True), {'request': '/requests/' + str(N) + '/4', 'decision': [True, '', '/edge', '', '/', 'absolute', '', '/edge/', '/edge', True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/app/a', '/app', '', 'x=2', False, True), {'request': '/requests/' + str(N) + '/5', 'decision': [True, '/a', '/', '?x=2', '/app/a', 'absolute', '/app/a', '/app/a', '/', True]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/app/a/', '/app', '/public/', '', True, False), {'request': '/requests/' + str(N) + '/6', 'decision': [True, '/a/', '/public/', '', '/app/a/', 'relative', '/app/a/', '/public/app/a/', '/public/', 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:
Translate a redirect between internal and public application mounts: the rewrite only internal target branch emits an incorrect decision.

Translate a redirect between internal and public application mounts. 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe='/'), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [value, template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the path segment escape branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value,1), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value).replace('//','/'), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the all placeholder occurrences branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index-1] if captures and 0<=index<=len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[0] if captures else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the capture zero based branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index > len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, not captures, quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the missing capture explicit branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe='&='), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), query_value.replace(' ','+'), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the query component escape branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal.replace('{id}',value), bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal.replace('{missing}',''), bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the literal placeholder not expanded branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, False, captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, '{' in template, captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the unresolved placeholder report branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), not (captures[index] if 0<=index<len(captures) else None), len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), False, len(value.encode('utf-8')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the empty capture distinct branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(quote(value,safe='')), template.count('{id}')]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the utf8 target byte length branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), int('{id}' in template)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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, template, value, captures, index, query_value, literal):
    return {'request': request, 'decision': [quote(value,safe=''), template.replace('{id}',value), captures[index] if 0<=index<len(captures) else None, index < 0 or index >= len(captures), quote(query_value,safe=''), literal, bool(re.search(r'\{[^{}]+\}',template.replace('{id}',value))), captures[index] == '' if 0<=index<len(captures) else False, len(value.encode('utf-8')), template.count('{')-1]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/item/{id}', 'a/b', ['zero', 'one'], 1, 'a&b', '{id}'), {'request': '/requests/' + str(N) + '/0', 'decision': ['a%2Fb', '/item/a/b', 'one', False, 'a%26b', '{id}', False, False, 3, 1]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/{id}/{id}', 'x y', ['only'], 0, 'a+b', 'plain'), {'request': '/requests/' + str(N) + '/1', 'decision': ['x%20y', '/x y/x y', 'only', False, 'a%2Bb', 'plain', False, False, 3, 2]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/fixed', 'z', [], 0, '', '{missing}'), {'request': '/requests/' + str(N) + '/2', 'decision': ['z', '/fixed', None, True, '', '{missing}', False, False, 1, 0]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/{id}', '%2F', ['a', 'b', 'c'], 2, 'x=y', '{id}'), {'request': '/requests/' + str(N) + '/3', 'decision': ['%252F', '/%2F', 'c', False, 'x%3Dy', '{id}', False, False, 3, 1]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/{id}', 'café', ['a'], 2, 'a b', '{{id}}'), {'request': '/requests/' + str(N) + '/4', 'decision': ['caf%C3%A9', '/café', None, True, 'a%20b', '{{id}}', False, False, 5, 1]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/{id}', '', [''], 0, '#frag', ''), {'request': '/requests/' + str(N) + '/5', 'decision': ['', '/', '', False, '%23frag', '', False, True, 0, 1]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/{other}/{id}', '/a//b', ['x'], 0, 'a/b', 'literal'), {'request': '/requests/' + str(N) + '/6', 'decision': ['%2Fa%2F%2Fb', '/{other}//a//b', 'x', False, 'a%2Fb', 'literal', True, False, 5, 1]})
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:
Expand redirect templates with context-specific escaping and missing-variable policy: the placeholder occurrence count branch emits an incorrect decision.

Expand redirect templates with context-specific escaping and missing-variable 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, removed, additions, replace, anchor):
    return {'request': request, 'decision': [pairs, pairs+additions, ([p for p in pairs if p[0] not in {a[0] for a in additions}] if replace else pairs)+additions, [p[0] if p[1] is None else p[0]+'='+p[1] for p in pairs], '' if anchor is None else '#'+anchor, [p[0] for p in pairs], [p for p in pairs if p[1] is not None], len(additions), [x for x in removed if x not in {p[0] for p in pairs}], '?' if pairs or additions else '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['a', '1'], ['b', '2'], ['a', '3']], ['b'], [['a', '4']], False, 'section'), {'request': '/requests/' + str(N) + '/0', 'decision': [[['a', '1'], ['a', '3']], [['a', '1'], ['b', '2'], ['a', '3'], ['a', '4']], [['a', '1'], ['b', '2'], ['a', '3'], ['a', '4']], ['a=1', 'b=2', 'a=3'], '#section', ['a', 'b', 'a'], [['a', '1'], ['b', '2'], ['a', '3']], 1, [], '?']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['a', '1'], ['a', '2']], [], [['a', '3']], True, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [[['a', '1'], ['a', '2']], [['a', '1'], ['a', '2'], ['a', '3']], [['a', '3']], ['a=1', 'a=2'], '#', ['a', 'a'], [['a', '1'], ['a', '2']], 1, [], '?']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], [['q', '']], False, None), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [['q', '']], [['q', '']], [], '', [], [], 1, [], '?']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['x', ''], ['flag', None]], ['x'], [], True, 'z'), {'request': '/requests/' + str(N) + '/3', 'decision': [[['flag', None]], [['x', ''], ['flag', None]], [['x', ''], ['flag', None]], ['x=', 'flag'], '#z', ['x', 'flag'], [['x', '']], 0, [], '?']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['b', '2'], ['a', '1']], ['absent'], [['c', '3'], ['c', '4']], False, '#x'), {'request': '/requests/' + str(N) + '/4', 'decision': [[['b', '2'], ['a', '1']], [['b', '2'], ['a', '1'], ['c', '3'], ['c', '4']], [['b', '2'], ['a', '1'], ['c', '3'], ['c', '4']], ['b=2', 'a=1'], '##x', ['b', 'a'], [['b', '2'], ['a', '1']], 2, ['absent'], '?']})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['a', '1']], ['a'], [['a', '2']], True, None), {'request': '/requests/' + str(N) + '/5', 'decision': [[], [['a', '1'], ['a', '2']], [['a', '2']], ['a=1'], '', ['a'], [['a', '1']], 1, [], '?']})
check('fixture 7', solve('/requests/' + str(N) + '/6', [], [], [], False, None), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], [], [], '', [], [], 0, [], '']})
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, removed, additions, replace, anchor):
    return {'request': request, 'decision': [[p for p in pairs if p not in removed], pairs+additions, ([p for p in pairs if p[0] not in {a[0] for a in additions}] if replace else pairs)+additions, [p[0] if p[1] is None else p[0]+'='+p[1] for p in pairs], '' if anchor is None else '#'+anchor, [p[0] for p in pairs], [p for p in pairs if p[1] is not None], len(additions), [x for x in removed if x not in {p[0] for p in pairs}], '?' if pairs or additions else '']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['a', '1'], ['b', '2'], ['a', '3']], ['b'], [['a', '4']], False, 'section'), {'request': '/requests/' + str(N) + '/0', 'decision': [[['a', '1'], ['a', '3']], [['a', '1'], ['b', '2'], ['a', '3'], ['a', '4']], [['a', '1'], ['b', '2'], ['a', '3'], ['a', '4']], ['a=1', 'b=2', 'a=3'], '#section', ['a', 'b', 'a'], [['a', '1'], ['b', '2'], ['a', '3']], 1, [], '?']})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['a', '1'], ['a', '2']], [], [['a', '3']], True, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [[['a', '1'], ['a', '2']], [['a', '1'], ['a', '2'], ['a', '3']], [['a', '3']], ['a=1', 'a=2'], '#', ['a', 'a'], [['a', '1'], ['a', '2']], 1, [], '?']})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], [['q', '']], False, None), {'request': '/requests/' + str(N) + '/2', 'decision': [[], [['q', '']], [['q', '']], [], '', [], [], 1, [], '?']})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['x', ''], ['flag', None]], ['x'], [], True, 'z'), {'request': '/requests/' + str(N) + '/3', 'decision': [[['flag', None]], [['x', ''], ['flag', None]], [['x', ''], ['flag', None]], ['x=', 'flag'], '#z', ['x', 'flag'], [['x', '']], 0, [], '?']})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['b', '2'], ['a', '1']], ['absent'], [['c', '3'], ['c', '4']], False, '#x'), {'request': '/requests/' + str(N) + '/4', 'decision': [[['b', '2'], ['a', '1']], [['b', '2'], ['a', '1'], ['c', '3'], ['c', '4']], [['b', '2'], ['a', '1'], ['c', '3'], ['c', '4']], ['b=2', 'a=1'], '##x', ['b', 'a'], [['b', '2'], ['a', '1']], 2, ['absent'], '?']})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['a', '1']], ['a'], [['a', '2']], True, None), {'request': '/requests/' + str(N) + '/5', 'decision': [[], [['a', '1'], ['a', '2']], [['a', '2']], ['a=1'], '', ['a'], [['a', '1']], 1, [], '?']})
check('fixture 7', solve('/requests/' + str(N) + '/6', [], [], [], False, None), {'request': '/requests/' + str(N) + '/6', 'decision': [[], [], [], [], '', [], [], 0, [], '']})
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 a configured redirect query transformation without changing retained value order: the drop all matching names branch emits an incorrect decision.

Apply a configured redirect query transformation without changing retained value order. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access