FAILURE MAP
← Case archive

FA-6801 / HTTP caching / Open access

If none match selects 304 only for safe retrieval · case 01

If none match selects 304 only for safe retrieval.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The faulty implementation uses `304 if matches else 200` for the if-none-match-selects-304-only-for-safe-retrieval decision.

VERIFIED REPAIR

Apply the explicit if-none-match-selects-304-only-for-safe-retrieval contract, including the tested boundary and negative cases.

Unsuccessful approach: The attempted repair uses `412 if matches else 200` and still violates a separate fixture.

Case contract

Bounded offline decision model: if none match selects 304 only for safe retrieval. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.

Why this case matters

This deterministic http caching model isolates the if-none-match-selects-304-only-for-safe-retrieval policy at a network component boundary.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method, matches):
    return 304 if matches else 200
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('GET', True), 304)", "check('fixture 2', solve('PUT', True), 412)", "check('fixture 3', solve('HEAD', True), 304)", "check('fixture 4', solve('POST', False), 200)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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 fixtureActualExpectedOutcome
fixture 2304412Failed
fixture 3304304Passed
fixture 4200200Passed
fixture 1304304Passed

SHA-256 / 94c948651b4d658497dd62752cc9a5d405f213556002d96cf1983b1a82861412

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method, matches):
    return 412 if matches else 200
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('GET', True), 304)", "check('fixture 2', solve('PUT', True), 412)", "check('fixture 3', solve('HEAD', True), 304)", "check('fixture 4', solve('POST', False), 200)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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 fixtureActualExpectedOutcome
fixture 2412412Passed
fixture 3412304Failed
fixture 4200200Passed
fixture 1412304Failed

SHA-256 / cf624f344116134cc0b910c2f61c4e7a6849b3b8c41358cc241eb1e2fdf74caf

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import ipaddress
import re
from urllib.parse import urlsplit, urljoin
N = 1
observations = []
def solve(method, matches):
    return (304 if method in ('GET','HEAD') else 412) if matches else 200
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve('GET', True), 304)", "check('fixture 2', solve('PUT', True), 412)", "check('fixture 3', solve('HEAD', True), 304)", "check('fixture 4', solve('POST', False), 200)"]
for _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:
    exec(_line)
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 fixtureActualExpectedOutcome
fixture 2412412Passed
fixture 3304304Passed
fixture 4200200Passed
fixture 1304304Passed

SHA-256 / 4346baa755d7391e749d1bc0b8cbbdd7fa6680751e784dc6145675c4d53728c7

Verification & scope

Bounded deterministic policy model over validated inputs; not a complete protocol stack or an interoperability claim. The five variants rotate the same explicit fixture set. 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:38:05.300174+00:00.

Case digest / add426fb46b418bf2b9858f5fe79eb6f41f4935e4da5c0bed27738ddabf84f03