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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, len(fresh)-1 if fresh and not fresh[-1] else None, all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the first stale entry branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), any(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), bool(fresh) and all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the all entries fresh branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), now-inserted, 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), now, 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the entry age clock rollback branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the cache provenance branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', not network, targets[0] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the blocked cache hit branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[-1] if targets else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[1] if len(targets)>1 else None, len(targets), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the lookup target branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(set(targets)), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, max(0,len(targets)-1), not targets, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the cached response count branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not fresh or not all(fresh), targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), network, targets[:next((i for i,f in enumerate(fresh) if not f),len(fresh))]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the empty chain identity branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, [t for t,f in zip(targets,fresh) if f]]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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, targets, fresh, network, blocked, now, inserted):
    return {'request': request, 'decision': [targets, next((i for i,f in enumerate(fresh) if not f),None), all(fresh), max(0,now-inserted), 'network' if network else 'cache', blocked and not network, targets[0] if targets else None, len(targets), not targets, targets if all(fresh) else []]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', ['/b', '/c'], [True, False], False, False, 20, 10), {'request': '/requests/' + str(N) + '/0', 'decision': [['/b', '/c'], 1, False, 10, 'cache', False, '/b', 2, False, ['/b']]})
check('fixture 2', solve('/requests/' + str(N) + '/1', ['/b'], [True], True, False, 10, 10), {'request': '/requests/' + str(N) + '/1', 'decision': [['/b'], None, True, 0, 'network', False, '/b', 1, False, ['/b']]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [], [], True, False, 0, 0), {'request': '/requests/' + str(N) + '/2', 'decision': [[], None, True, 0, 'network', False, None, 0, True, []]})
check('fixture 4', solve('/requests/' + str(N) + '/3', ['/z', '/a'], [True, True], False, True, 30, 5), {'request': '/requests/' + str(N) + '/3', 'decision': [['/z', '/a'], None, True, 25, 'cache', True, '/z', 2, False, ['/z', '/a']]})
check('fixture 5', solve('/requests/' + str(N) + '/4', ['/a', '/a'], [False, True], False, False, 8, 9), {'request': '/requests/' + str(N) + '/4', 'decision': [['/a', '/a'], 0, False, 0, 'cache', False, '/a', 2, False, []]})
check('fixture 6', solve('/requests/' + str(N) + '/5', ['/q'], [False], True, True, 100, 80), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], 0, False, 20, 'network', False, '/q', 1, 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:
Resolve stored redirect chains with per-entry freshness and provenance: the fresh prefix branch emits an incorrect decision.

Resolve stored redirect chains with per-entry freshness and provenance. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if path.startswith(r[0])], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if path.startswith(r[0]) and r[2]==method], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the path exactness branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]=='GET'], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the method filter branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1],reverse=True)], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in rules], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the lower priority first branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in reversed(rules)], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], sorted(r[3] for r in rules), next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the declaration tie order branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in rules if r[0]==path),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in reversed(rules) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the first winning target branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(set(r[0] for r in rules)), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(set(r[1] for r in rules)), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the rule count not target count branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path or r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the path method conjunction branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method in ('GET','HEAD'), [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), False, [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the head not get alias branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in rules][1:], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [], not any(r[0]==path and r[2]==method for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the shadowed match targets branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not rules]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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, rules, path, method):
    return {'request': request, 'decision': [[r[3] for r in rules if r[0]==path], [r[3] for r in rules if r[2]==method], [r[3] for r in sorted(rules,key=lambda r:r[1])], [r[3] for r in rules], next((r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method),None), len(rules), sum(r[0]==path and r[2]==method for r in rules), method == 'HEAD', [r[3] for r in sorted(rules,key=lambda r:r[1]) if r[0]==path and r[2]==method][1:], not any(r[0]==path for r in rules)]}
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', 3, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/0', 'decision': [['/x', '/y'], ['/x', '/y'], ['/y', '/x'], ['/x', '/y'], '/y', 2, 2, False, ['/x'], False]})
check('fixture 2', solve('/requests/' + str(N) + '/1', [['/a', 1, 'POST', '/p'], ['/a', 2, 'GET', '/g']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/1', 'decision': [['/p', '/g'], ['/g'], ['/p', '/g'], ['/p', '/g'], '/g', 2, 1, False, [], False]})
check('fixture 3', solve('/requests/' + str(N) + '/2', [['/b', 1, 'GET', '/b'], ['/a', 1, 'GET', '/a']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/2', 'decision': [['/a'], ['/b', '/a'], ['/b', '/a'], ['/b', '/a'], '/a', 2, 1, False, [], False]})
check('fixture 4', solve('/requests/' + str(N) + '/3', [['/a', 1, 'GET', '/x'], ['/a', 1, 'GET', '/y']], '/a', 'GET'), {'request': '/requests/' + str(N) + '/3', 'decision': [['/x', '/y'], ['/x', '/y'], ['/x', '/y'], ['/x', '/y'], '/x', 2, 2, False, ['/y'], False]})
check('fixture 5', solve('/requests/' + str(N) + '/4', [], '/a', 'GET'), {'request': '/requests/' + str(N) + '/4', 'decision': [[], [], [], [], None, 0, 0, False, [], True]})
check('fixture 6', solve('/requests/' + str(N) + '/5', [['/a', 1, 'HEAD', '/h'], ['/ab', 0, 'GET', '/q']], '/ab', 'HEAD'), {'request': '/requests/' + str(N) + '/5', 'decision': [['/q'], ['/h'], ['/q', '/h'], ['/h', '/q'], None, 2, 0, True, [], 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:
Select a redirect rule by explicit priority, specificity and declaration order: the no rule pass through branch emits an incorrect decision.

Select a redirect rule by explicit priority, specificity and declaration order. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.

split: open-access