FA-6786 / HTTP caching / Open access
Heuristic freshness never exceeds configured cap · case 01
Heuristic freshness never exceeds configured cap.
ROOT CAUSE
The faulty implementation uses `(date-modified)*0.1` for the heuristic-freshness-never-exceeds-configured-cap decision.
VERIFIED REPAIR
Apply the explicit heuristic-freshness-never-exceeds-configured-cap contract, including the tested boundary and negative cases.
Unsuccessful approach: The attempted repair uses `max(cap,max(0,date-modified)*0.1)` and still violates a separate fixture.
Case contract
Bounded offline decision model: heuristic freshness never exceeds configured cap. 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 heuristic-freshness-never-exceeds-configured-cap 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(date, modified, cap):
return (date-modified)*0.1
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(100, 0, 5), 5)", "check('fixture 2', solve(10, 20, 5), 0)", "check('fixture 3', solve(10, 0, 5), 1)", "check('fixture 4', solve(0, 0, 5), 0)"]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | -1.0 | 0 | Failed |
| fixture 3 | 1.0 | 1 | Passed |
| fixture 4 | 0.0 | 0 | Passed |
| fixture 1 | 10.0 | 5 | Failed |
SHA-256 / 4536ae41cc3b247c2fc529d594e8c6cc56d5f977e7e553d43d0320570a52dcb6
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(date, modified, cap):
return max(cap,max(0,date-modified)*0.1)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(100, 0, 5), 5)", "check('fixture 2', solve(10, 20, 5), 0)", "check('fixture 3', solve(10, 0, 5), 1)", "check('fixture 4', solve(0, 0, 5), 0)"]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | 5 | 0 | Failed |
| fixture 3 | 5 | 1 | Failed |
| fixture 4 | 5 | 0 | Failed |
| fixture 1 | 10.0 | 5 | Failed |
SHA-256 / aab31ca73d7e17cb049649b1f80bf1e102b4d8c1df3e610c0129e849b5841255
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(date, modified, cap):
return min(cap,max(0,date-modified)*0.1)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(100, 0, 5), 5)", "check('fixture 2', solve(10, 20, 5), 0)", "check('fixture 3', solve(10, 0, 5), 1)", "check('fixture 4', solve(0, 0, 5), 0)"]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 2 | 0.0 | 0 | Passed |
| fixture 3 | 1.0 | 1 | Passed |
| fixture 4 | 0.0 | 0 | Passed |
| fixture 1 | 5 | 5 | Passed |
SHA-256 / 7b1547a3c4528184c075c8f245009f8abdd031e35e39a41933e681d085412161
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.123736+00:00.
Case digest / 861f60f6e143200171785b390ec2409c45f71c44382fb173a15aed99a5e840ca