FA-29091 / HTTP redirects / Open access
Canonicalize a directory URL after resource lookup without redirecting regular files: directory only slash · case 01
Canonicalize a directory URL after resource lookup without redirecting regular files: the directory only slash branch emits an incorrect decision.
ROOT CAUSE
The directory-only-slash decision uses "not path.endswith('/')"; this violates the stipulated controller policy.
VERIFIED REPAIR
At this decision use "directory and exists and not path.endswith('/')", preserving the other controller outputs.
Unsuccessful approach: The partial repair uses "directory and not path.endswith('/')" and still fails an explicit boundary or control.
Case contract
Canonicalize a directory URL after resource lookup without redirecting regular files. The explicit fixture inputs and outputs define a bounded offline policy; request identity must accompany the decision.
Why this case matters
Models a redirect controller decision before following a target or exposing a redirect result.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, directory, exists, query, index_name, served):
return {'request': request, 'decision': [not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | {'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html'], 'request': '/requests/1/0'} | {'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html'], 'request': '/requests/1/0'} | Passed |
| fixture 2 | {'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html'], 'request': '/requests/1/1'} | {'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html'], 'request': '/requests/1/1'} | Passed |
| fixture 3 | {'decision': [True, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html'], 'request': '/requests/1/2'} | {'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html'], 'request': '/requests/1/2'} | Failed |
| fixture 4 | {'decision': [True, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html'], 'request': '/requests/1/3'} | {'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html'], 'request': '/requests/1/3'} | Failed |
| fixture 5 | {'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html'], 'request': '/requests/1/4'} | {'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html'], 'request': '/requests/1/4'} | Passed |
| fixture 6 | {'decision': [True, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html'], 'request': '/requests/1/5'} | {'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html'], 'request': '/requests/1/5'} | Failed |
| fixture 7 | {'decision': [True, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html'], 'request': '/requests/1/6'} | {'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html'], 'request': '/requests/1/6'} | Failed |
SHA-256 / b9a05ff6699e19467cc2dccf58dc94944299e6285946fd25b3665e5c2480e804
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, directory, exists, query, index_name, served):
return {'request': request, 'decision': [directory and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | {'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html'], 'request': '/requests/1/0'} | {'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html'], 'request': '/requests/1/0'} | Passed |
| fixture 2 | {'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html'], 'request': '/requests/1/1'} | {'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html'], 'request': '/requests/1/1'} | Passed |
| fixture 3 | {'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html'], 'request': '/requests/1/2'} | {'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html'], 'request': '/requests/1/2'} | Passed |
| fixture 4 | {'decision': [True, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html'], 'request': '/requests/1/3'} | {'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html'], 'request': '/requests/1/3'} | Failed |
| fixture 5 | {'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html'], 'request': '/requests/1/4'} | {'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html'], 'request': '/requests/1/4'} | Passed |
| fixture 6 | {'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html'], 'request': '/requests/1/5'} | {'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html'], 'request': '/requests/1/5'} | Passed |
| fixture 7 | {'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html'], 'request': '/requests/1/6'} | {'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html'], 'request': '/requests/1/6'} | Passed |
SHA-256 / c6a26650bbde9aa802eb7d9f07faf311c84911f8c4ce86cfb10e3df0fb09a5b3
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from urllib.parse import urlsplit, unquote, quote
import posixpath
import re
N = 1
observations = []
def solve(request, path, directory, exists, query, index_name, served):
return {'request': request, 'decision': [directory and exists and not path.endswith('/'), path if path.endswith('/') else path+'/', path+('?' + query if query else ''), path.rsplit('/',1)[-1] == index_name, path.rsplit('/',1)[0]+'/', not served, exists, path or '/', path.rsplit('/',1)[-1], path.rstrip('/')+'/'+index_name]}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve('/requests/' + str(N) + '/0', '/docs', True, True, 'lang=en', 'index.html', False), {'request': '/requests/' + str(N) + '/0', 'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html']})
check('fixture 2', solve('/requests/' + str(N) + '/1', '/docs/', True, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/1', 'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html']})
check('fixture 3', solve('/requests/' + str(N) + '/2', '/file.txt', False, True, 'v=1', 'index.html', True), {'request': '/requests/' + str(N) + '/2', 'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html']})
check('fixture 4', solve('/requests/' + str(N) + '/3', '/missing', True, False, 'x=', 'home.html', False), {'request': '/requests/' + str(N) + '/3', 'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html']})
check('fixture 5', solve('/requests/' + str(N) + '/4', '/', True, True, '', 'index.html', True), {'request': '/requests/' + str(N) + '/4', 'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html']})
check('fixture 6', solve('/requests/' + str(N) + '/5', '/docs/index.html', False, True, 'q=1', 'index.html', False), {'request': '/requests/' + str(N) + '/5', 'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html']})
check('fixture 7', solve('/requests/' + str(N) + '/6', '/index.html/other.html', False, True, '', 'index.html', False), {'request': '/requests/' + str(N) + '/6', 'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html']})
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1 | {'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html'], 'request': '/requests/1/0'} | {'decision': [True, '/docs/', '/docs?lang=en', False, '/', True, True, '/docs', 'docs', '/docs/index.html'], 'request': '/requests/1/0'} | Passed |
| fixture 2 | {'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html'], 'request': '/requests/1/1'} | {'decision': [False, '/docs/', '/docs/', False, '/docs/', True, True, '/docs/', '', '/docs/index.html'], 'request': '/requests/1/1'} | Passed |
| fixture 3 | {'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html'], 'request': '/requests/1/2'} | {'decision': [False, '/file.txt/', '/file.txt?v=1', False, '/', False, True, '/file.txt', 'file.txt', '/file.txt/index.html'], 'request': '/requests/1/2'} | Passed |
| fixture 4 | {'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html'], 'request': '/requests/1/3'} | {'decision': [False, '/missing/', '/missing?x=', False, '/', True, False, '/missing', 'missing', '/missing/home.html'], 'request': '/requests/1/3'} | Passed |
| fixture 5 | {'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html'], 'request': '/requests/1/4'} | {'decision': [False, '/', '/', False, '/', False, True, '/', '', '/index.html'], 'request': '/requests/1/4'} | Passed |
| fixture 6 | {'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html'], 'request': '/requests/1/5'} | {'decision': [False, '/docs/index.html/', '/docs/index.html?q=1', True, '/docs/', True, True, '/docs/index.html', 'index.html', '/docs/index.html/index.html'], 'request': '/requests/1/5'} | Passed |
| fixture 7 | {'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html'], 'request': '/requests/1/6'} | {'decision': [False, '/index.html/other.html/', '/index.html/other.html', False, '/index.html/', True, True, '/index.html/other.html', 'other.html', '/index.html/other.html/index.html'], 'request': '/requests/1/6'} | Passed |
SHA-256 / f2e38354b2e7233a75f60b20c87130bef7a7bd509170d30182b32ed933514754
Verification & scope
Stipulated offline redirect policy, not a complete HTTP, browser, URL, cache, or security implementation. Numbered variants vary request correlation identity. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:41:39.878241+00:00.
Case digest / 490a19611b3d260c93a0a91ec13e6c7d5254d278c690b3f0ba5dce948a82d915