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, trusted, chain, proto, direct_host, direct_scheme, prefix):
    return {'request': request, 'decision': [chain[0] if trusted and chain else direct_host, proto.lower() if trusted and proto else direct_scheme, chain, bool(chain), '/' + prefix.lstrip('/') if prefix else '', prefix if trusted else '', direct_host, prefix.rstrip('/')+'/' if prefix else '/', proto in ('http','https'), 'forwarded' if trusted and chain else 'direct']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', True, ['client.test', 'edge.test'], 'https', 'internal:8080', 'http', '/app'), {'request': '/requests/' + str(N) + '/0', 'decision': ['client.test', 'https', ['client.test', 'edge.test'], True, '/app', '/app', 'internal:8080', '/app/', True, 'forwarded']})
check('fixture 2', solve('/requests/' + str(N) + '/1', False, ['attacker.test'], 'https', 'public.test', 'http', '/'), {'request': '/requests/' + str(N) + '/1', 'decision': ['public.test', 'http', ['attacker.test'], True, '/', '', 'public.test', '/', True, 'direct']})
check('fixture 3', solve('/requests/' + str(N) + '/2', True, [], '', 'fallback.test', 'https', ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['fallback.test', 'https', [], False, '', '', 'fallback.test', '/', True, 'direct']})
check('fixture 4', solve('/requests/' + str(N) + '/3', True, ['one.test', 'two.test', 'three.test'], 'http', 'internal', 'https', '/v2/'), {'request': '/requests/' + str(N) + '/3', 'decision': ['one.test', 'http', ['one.test', 'two.test', 'three.test'], True, '/v2/', '/v2/', 'internal', '/v2/', True, 'forwarded']})
check('fixture 5', solve('/requests/' + str(N) + '/4', True, ['public.test'], 'HTTPS', 'internal', 'http', '//evil.test'), {'request': '/requests/' + str(N) + '/4', 'decision': ['public.test', 'https', ['public.test'], True, '/evil.test', '//evil.test', 'internal', '//evil.test/', True, 'forwarded']})
check('fixture 6', solve('/requests/' + str(N) + '/5', False, [], 'http', 'actual.test', 'https', '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['actual.test', 'https', [], False, '/x', '', 'actual.test', '/x/', True, 'direct']})
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, trusted, chain, proto, direct_host, direct_scheme, prefix):
    return {'request': request, 'decision': [chain[0] if trusted and chain else direct_host, proto.lower() if trusted and proto else direct_scheme, chain, bool(chain), '/' + prefix.lstrip('/') if prefix else '', prefix if trusted else '', direct_host, prefix.rstrip('/')+'/' if prefix else '/', bool(proto), 'forwarded' if trusted and chain else 'direct']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', True, ['client.test', 'edge.test'], 'https', 'internal:8080', 'http', '/app'), {'request': '/requests/' + str(N) + '/0', 'decision': ['client.test', 'https', ['client.test', 'edge.test'], True, '/app', '/app', 'internal:8080', '/app/', True, 'forwarded']})
check('fixture 2', solve('/requests/' + str(N) + '/1', False, ['attacker.test'], 'https', 'public.test', 'http', '/'), {'request': '/requests/' + str(N) + '/1', 'decision': ['public.test', 'http', ['attacker.test'], True, '/', '', 'public.test', '/', True, 'direct']})
check('fixture 3', solve('/requests/' + str(N) + '/2', True, [], '', 'fallback.test', 'https', ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['fallback.test', 'https', [], False, '', '', 'fallback.test', '/', True, 'direct']})
check('fixture 4', solve('/requests/' + str(N) + '/3', True, ['one.test', 'two.test', 'three.test'], 'http', 'internal', 'https', '/v2/'), {'request': '/requests/' + str(N) + '/3', 'decision': ['one.test', 'http', ['one.test', 'two.test', 'three.test'], True, '/v2/', '/v2/', 'internal', '/v2/', True, 'forwarded']})
check('fixture 5', solve('/requests/' + str(N) + '/4', True, ['public.test'], 'HTTPS', 'internal', 'http', '//evil.test'), {'request': '/requests/' + str(N) + '/4', 'decision': ['public.test', 'https', ['public.test'], True, '/evil.test', '//evil.test', 'internal', '//evil.test/', True, 'forwarded']})
check('fixture 6', solve('/requests/' + str(N) + '/5', False, [], 'http', 'actual.test', 'https', '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['actual.test', 'https', [], False, '/x', '', 'actual.test', '/x/', True, 'direct']})
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:
Build public redirect origins from explicitly trusted proxy metadata: the scheme syntax validation branch emits an incorrect decision.

Build public redirect origins from explicitly trusted proxy metadata. 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, trusted, chain, proto, direct_host, direct_scheme, prefix):
    return {'request': request, 'decision': [chain[0] if trusted and chain else direct_host, proto.lower() if trusted and proto else direct_scheme, chain, bool(chain), '/' + prefix.lstrip('/') if prefix else '', prefix if trusted else '', direct_host, prefix.rstrip('/')+'/' if prefix else '/', not proto or proto.lower() in ('http','https'), 'forwarded' if trusted else 'direct']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', True, ['client.test', 'edge.test'], 'https', 'internal:8080', 'http', '/app'), {'request': '/requests/' + str(N) + '/0', 'decision': ['client.test', 'https', ['client.test', 'edge.test'], True, '/app', '/app', 'internal:8080', '/app/', True, 'forwarded']})
check('fixture 2', solve('/requests/' + str(N) + '/1', False, ['attacker.test'], 'https', 'public.test', 'http', '/'), {'request': '/requests/' + str(N) + '/1', 'decision': ['public.test', 'http', ['attacker.test'], True, '/', '', 'public.test', '/', True, 'direct']})
check('fixture 3', solve('/requests/' + str(N) + '/2', True, [], '', 'fallback.test', 'https', ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['fallback.test', 'https', [], False, '', '', 'fallback.test', '/', True, 'direct']})
check('fixture 4', solve('/requests/' + str(N) + '/3', True, ['one.test', 'two.test', 'three.test'], 'http', 'internal', 'https', '/v2/'), {'request': '/requests/' + str(N) + '/3', 'decision': ['one.test', 'http', ['one.test', 'two.test', 'three.test'], True, '/v2/', '/v2/', 'internal', '/v2/', True, 'forwarded']})
check('fixture 5', solve('/requests/' + str(N) + '/4', True, ['public.test'], 'HTTPS', 'internal', 'http', '//evil.test'), {'request': '/requests/' + str(N) + '/4', 'decision': ['public.test', 'https', ['public.test'], True, '/evil.test', '//evil.test', 'internal', '//evil.test/', True, 'forwarded']})
check('fixture 6', solve('/requests/' + str(N) + '/5', False, [], 'http', 'actual.test', 'https', '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['actual.test', 'https', [], False, '/x', '', 'actual.test', '/x/', True, 'direct']})
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, trusted, chain, proto, direct_host, direct_scheme, prefix):
    return {'request': request, 'decision': [chain[0] if trusted and chain else direct_host, proto.lower() if trusted and proto else direct_scheme, chain, bool(chain), '/' + prefix.lstrip('/') if prefix else '', prefix if trusted else '', direct_host, prefix.rstrip('/')+'/' if prefix else '/', not proto or proto.lower() in ('http','https'), 'forwarded' if chain else 'direct']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', True, ['client.test', 'edge.test'], 'https', 'internal:8080', 'http', '/app'), {'request': '/requests/' + str(N) + '/0', 'decision': ['client.test', 'https', ['client.test', 'edge.test'], True, '/app', '/app', 'internal:8080', '/app/', True, 'forwarded']})
check('fixture 2', solve('/requests/' + str(N) + '/1', False, ['attacker.test'], 'https', 'public.test', 'http', '/'), {'request': '/requests/' + str(N) + '/1', 'decision': ['public.test', 'http', ['attacker.test'], True, '/', '', 'public.test', '/', True, 'direct']})
check('fixture 3', solve('/requests/' + str(N) + '/2', True, [], '', 'fallback.test', 'https', ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['fallback.test', 'https', [], False, '', '', 'fallback.test', '/', True, 'direct']})
check('fixture 4', solve('/requests/' + str(N) + '/3', True, ['one.test', 'two.test', 'three.test'], 'http', 'internal', 'https', '/v2/'), {'request': '/requests/' + str(N) + '/3', 'decision': ['one.test', 'http', ['one.test', 'two.test', 'three.test'], True, '/v2/', '/v2/', 'internal', '/v2/', True, 'forwarded']})
check('fixture 5', solve('/requests/' + str(N) + '/4', True, ['public.test'], 'HTTPS', 'internal', 'http', '//evil.test'), {'request': '/requests/' + str(N) + '/4', 'decision': ['public.test', 'https', ['public.test'], True, '/evil.test', '//evil.test', 'internal', '//evil.test/', True, 'forwarded']})
check('fixture 6', solve('/requests/' + str(N) + '/5', False, [], 'http', 'actual.test', 'https', '/x'), {'request': '/requests/' + str(N) + '/5', 'decision': ['actual.test', 'https', [], False, '/x', '', 'actual.test', '/x/', True, 'direct']})
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:
Build public redirect origins from explicitly trusted proxy metadata: the proxy metadata provenance branch emits an incorrect decision.

Build public redirect origins from explicitly trusted proxy metadata. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the directory only slash branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path.rstrip('/'), path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the single slash target branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path, path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+'?'+query, path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the query survives directory redirect branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), index_name in path, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.endswith('.html'), path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the index filename match branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.replace(index_name,''), not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.split('/')[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the parent for index removal branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', True, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not exists, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the already served no redirect branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, directory, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists or directory, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the lookup before canonicalization branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path.strip('/'), path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path.rstrip('/'), path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the root directory not empty branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1].split('.')[0], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.split('/')[0], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the basename preserves extension branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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, directory, exists, query, index_name, served):
    return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path+'/'+index_name]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
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:
Canonicalize a directory URL after resource lookup without redirecting regular files: the index path join branch emits an incorrect decision.

Canonicalize a directory URL after resource lookup without redirecting regular files. 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, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path.replace(prefix,''), segments[1] if len(segments)>1 else None, '/'.join(segments[1:]) if greedy else (segments[1] if len(segments)>1 else ''), path.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path[len(prefix):], segments[1] if len(segments)>1 else None, '/'.join(segments[1:]) if greedy else (segments[1] if len(segments)>1 else ''), path.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Extract redirect route captures under an explicit segment-matching grammar: the capture after prefix branch emits an incorrect decision.

Extract redirect route captures under an explicit segment-matching grammar. 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, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path[len(prefix):] if path.startswith(prefix) else None, '/'.join(segments[1:]), '/'.join(segments[1:]) if greedy else (segments[1] if len(segments)>1 else ''), path.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path[len(prefix):] if path.startswith(prefix) else None, segments[-1] if segments else None, '/'.join(segments[1:]) if greedy else (segments[1] if len(segments)>1 else ''), path.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Extract redirect route captures under an explicit segment-matching grammar: the segment wildcard not slash branch emits an incorrect decision.

Extract redirect route captures under an explicit segment-matching grammar. 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, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path[len(prefix):] if path.startswith(prefix) else None, segments[1] if len(segments)>1 else None, segments[1] if len(segments)>1 else '', path.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path[len(prefix):] if path.startswith(prefix) else None, segments[1] if len(segments)>1 else None, '/'.join(s for s in segments[1:] if s), path.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Extract redirect route captures under an explicit segment-matching grammar: the greedy tail retains slashes branch emits an incorrect decision.

Extract redirect route captures under an explicit segment-matching grammar. 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, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path[len(prefix):] if path.startswith(prefix) else None, segments[1] if len(segments)>1 else None, '/'.join(segments[1:]) if greedy else (segments[1] if len(segments)>1 else ''), path.startswith(prefix), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, prefix, segments, greedy, case_sensitive, suffix):
    return {'request': request, 'decision': [path[len(prefix):] if path.startswith(prefix) else None, segments[1] if len(segments)>1 else None, '/'.join(segments[1:]) if greedy else (segments[1] if len(segments)>1 else ''), path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, segments[1:], len(segments), greedy and len(segments)>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', '/api/a/b', '/api', ['api', 'a', 'b'], True, True, '.json'), {'request': '/requests/' + str(N) + '/0', 'decision': ['/a/b', 'a', 'a/b', True, ['api', 'a', 'b'], '/api/a/b', False, ['a', 'b'], 3, True]})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/API/a', '/api', ['API', 'a'], False, False, ''), {'request': '/requests/' + str(N) + '/1', 'decision': [None, 'a', 'a', True, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/api', '/api', ['api'], True, True, ''), {'request': '/requests/' + str(N) + '/2', 'decision': ['', None, '', True, ['api'], '/api', False, [], 1, False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/apix/a', '/api', ['apix', 'a'], False, True, '.txt'), {'request': '/requests/' + str(N) + '/3', 'decision': ['x/a', 'a', 'a', True, ['apix', 'a'], '/apix/a', False, ['a'], 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/api/a//b/', '/api', ['api', 'a', '', 'b', ''], True, True, '/'), {'request': '/requests/' + str(N) + '/4', 'decision': ['/a//b/', 'a', 'a//b/', True, ['api', 'a', '', 'b', ''], '/api/a//b', False, ['a', '', 'b', ''], 5, True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/api/a.json', '/api', ['api', 'a.json'], False, True, '.json'), {'request': '/requests/' + str(N) + '/5', 'decision': ['/a.json', 'a.json', 'a.json', True, ['api', 'a.json'], '/api/a', True, ['a.json'], 2, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/API/a', '/api', ['API', 'a'], False, True, ''), {'request': '/requests/' + str(N) + '/6', 'decision': [None, 'a', 'a', False, ['API', 'a'], '/API/a', False, ['a'], 2, False]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Extract redirect route captures under an explicit segment-matching grammar: the case setting prefix branch emits an incorrect decision.

Extract redirect route captures under an explicit segment-matching grammar. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access