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) if case_sensitive else path.lower().startswith(prefix.lower()), [s for s in segments if s], 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.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments[:-1], 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 terminal empty segment kept 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) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if 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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, 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) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path.replace(suffix,'') if 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 suffix empty means no strip 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) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, bool(re.search('.',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.startswith(prefix) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, path.endswith('.'), 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 literal period not wildcard 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) if case_sensitive else path.lower().startswith(prefix.lower()), segments, path[:-len(suffix)] if suffix and path.endswith(suffix) else path, '.' in path, [s for s in segments[1:] if s], 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.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:2], 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 preserves empty tail 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) 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([s for s in segments if s]), 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.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(set(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 route depth count 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) 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]}
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.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), 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 capture availability 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [any(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [bool(decisions) and all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the all policy conjunction branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in reversed(decisions) if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the first rejection reason branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v][:1], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the all veto reasons branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow', override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the inspection required before follow branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override, mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the override does not enable error mode branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual' and all(v for k,v in decisions), [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode != 'follow', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the manual veto still visible branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', sorted(k for k,v in decisions), target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in reversed(decisions)], target is not None and override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the decision reasons ordered branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], override, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None, sum(not v for k,v in decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the missing target preempts override branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, len(decisions), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, int(not all(v for k,v in decisions)), inspected and all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the veto count branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), inspected]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, decisions, mode, inspected, override, target):
    return {'request': request, 'decision': [all(v for k,v in decisions), next((k for k,v in decisions if not v),None), [k for k,v in decisions if not v], mode == 'follow' and inspected, override and mode != 'error', mode == 'manual', [k for k,v in decisions], target is not None and override, sum(not v for k,v in decisions), all(v for k,v in decisions)]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['scheme', True], ['host', False], ['port', True]], 'follow', True, False, '/b'), {'request': '/requests/' + str(N) + '/0', 'decision': [False, 'host', ['host'], True, False, False, ['scheme', 'host', 'port'], False, 1, False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['scheme', True], ['host', True]], 'manual', False, False, '/c'), {'request': '/requests/' + str(N) + '/1', 'decision': [True, None, [], False, False, True, ['scheme', 'host'], False, 0, False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], 'error', True, True, '/d'), {'request': '/requests/' + str(N) + '/2', 'decision': [True, None, [], False, False, False, [], True, 0, True]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['host', False], ['port', False]], 'follow', True, True, '/e'), {'request': '/requests/' + str(N) + '/3', 'decision': [False, 'host', ['host', 'port'], True, True, False, ['host', 'port'], True, 2, False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['scheme', True]], 'follow', False, False, None), {'request': '/requests/' + str(N) + '/4', 'decision': [True, None, [], False, False, False, ['scheme'], False, 0, False]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['scheme', False], ['host', True]], 'manual', True, True, '/f'), {'request': '/requests/' + str(N) + '/5', 'decision': [False, 'scheme', ['scheme'], False, True, True, ['scheme', 'host'], True, 1, False]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['x', True]], 'follow', True, True, None), {'request': '/requests/' + str(N) + '/6', 'decision': [True, None, [], True, True, False, ['x'], False, 0, True]})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Compose explicit redirect policy decisions with veto precedence and reason retention: the inspection state not success branch emits an incorrect decision.

Compose explicit redirect policy decisions with veto precedence and reason retention. 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, edges, original, terminal, success):
    return {'request': request, 'decision': [[e[1] for e in edges], [e[1] for e in edges], all(edges[i-1][1]==edges[i][0] for i in range(1,len(edges))), not edges or edges[0][0]==original, not edges or edges[-1][1]==terminal, sum(e[3]=='cache' for e in edges), sum(e[3]=='network' for e in edges), bool(edges) and all(e[2] in (301,308) for e in edges), success, [e[2] for e in edges]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['/a', '/b', 301, 'cache'], ['/b', '/c', 302, 'network']], '/a', '/c', True), {'request': '/requests/' + str(N) + '/0', 'decision': [['/a', '/b'], ['/b', '/c'], True, True, True, 1, 1, False, True, [301, 302]]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [], '/x', '/x', True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], [], True, True, True, 0, 0, False, True, []]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/x', '/y', 307, 'network']], '/x', '/y', False), {'request': '/requests/' + str(N) + '/2', 'decision': [['/x'], ['/y'], True, True, True, 0, 1, False, False, [307]]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/z', '/a', 308, 'cache'], ['/a', '/z', 308, 'cache']], '/z', '/z', False), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], ['/a', '/z'], True, True, True, 2, 0, True, False, [308, 308]]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['/a', '/b', 303, 'network'], ['/b', '/c', 307, 'network']], '/a', '/c', True), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], ['/b', '/c'], True, True, True, 0, 2, False, True, [303, 307]]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', '/b', 301, 'network'], ['/x', '/c', 302, 'cache']], '/a', '/c', False), {'request': '/requests/' + str(N) + '/5', 'decision': [['/a', '/x'], ['/b', '/c'], False, True, True, 1, 1, False, False, [301, 302]]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['/a', '/b', 308, 'network'], ['/b', '/c', 301, 'network']], '/a', '/c', True), {'request': '/requests/' + str(N) + '/6', 'decision': [['/a', '/b'], ['/b', '/c'], True, True, True, 0, 2, True, True, [308, 301]]})
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, edges, original, terminal, success):
    return {'request': request, 'decision': [sorted(e[0] for e in edges), [e[1] for e in edges], all(edges[i-1][1]==edges[i][0] for i in range(1,len(edges))), not edges or edges[0][0]==original, not edges or edges[-1][1]==terminal, sum(e[3]=='cache' for e in edges), sum(e[3]=='network' for e in edges), bool(edges) and all(e[2] in (301,308) for e in edges), success, [e[2] for e in edges]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', [['/a', '/b', 301, 'cache'], ['/b', '/c', 302, 'network']], '/a', '/c', True), {'request': '/requests/' + str(N) + '/0', 'decision': [['/a', '/b'], ['/b', '/c'], True, True, True, 1, 1, False, True, [301, 302]]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [], '/x', '/x', True), {'request': '/requests/' + str(N) + '/1', 'decision': [[], [], True, True, True, 0, 0, False, True, []]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/x', '/y', 307, 'network']], '/x', '/y', False), {'request': '/requests/' + str(N) + '/2', 'decision': [['/x'], ['/y'], True, True, True, 0, 1, False, False, [307]]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/z', '/a', 308, 'cache'], ['/a', '/z', 308, 'cache']], '/z', '/z', False), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], ['/a', '/z'], True, True, True, 2, 0, True, False, [308, 308]]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [['/a', '/b', 303, 'network'], ['/b', '/c', 307, 'network']], '/a', '/c', True), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/b'], ['/b', '/c'], True, True, True, 0, 2, False, True, [303, 307]]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', '/b', 301, 'network'], ['/x', '/c', 302, 'cache']], '/a', '/c', False), {'request': '/requests/' + str(N) + '/5', 'decision': [['/a', '/x'], ['/b', '/c'], False, True, True, 1, 1, False, False, [301, 302]]})
check('fixture 7', solve('/requests/' + str(N) + '/6', [['/a', '/b', 308, 'network'], ['/b', '/c', 301, 'network']], '/a', '/c', True), {'request': '/requests/' + str(N) + '/6', 'decision': [['/a', '/b'], ['/b', '/c'], True, True, True, 0, 2, True, True, [308, 301]]})
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:
Retain redirect-edge provenance when materializing a chain audit record: the edge source sequence branch emits an incorrect decision.

Retain redirect-edge provenance when materializing a chain audit record. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access