FA-7586 / WebSocket and browser transport policies / Open access
Websocket handshake response must be switching protocols · case 01
Websocket handshake response must be switching protocols.
ROOT CAUSE
The faulty implementation uses `upgrade_ok` for the websocket-handshake-response-must-be-switching-protocols decision.
VERIFIED REPAIR
Apply the explicit websocket-handshake-response-must-be-switching-protocols contract, including the tested boundary and negative cases.
Unsuccessful approach: The attempted repair uses `status == 101` and still violates a separate fixture.
Case contract
Bounded offline decision model: websocket handshake response must be switching protocols. Inputs are already validated protocol fields; the explicit fixtures define the supported policy, not a complete protocol implementation.
Why this case matters
This deterministic websocket and browser transport policies model isolates the websocket-handshake-response-must-be-switching-protocols 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(status, upgrade_ok):
return upgrade_ok
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(200, True), False)", "check('fixture 2', solve(101, False), False)", "check('fixture 3', solve(101, True), True)", "check('fixture 4', solve(500, False), False)"]
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 | False | False | Passed |
| fixture 3 | True | True | Passed |
| fixture 4 | False | False | Passed |
| fixture 1 | True | False | Failed |
SHA-256 / 837e06595c099ddfe1c45e0f267d0f654ac6f76237a1aecbdc6e369b817b8a9d
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(status, upgrade_ok):
return status == 101
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(200, True), False)", "check('fixture 2', solve(101, False), False)", "check('fixture 3', solve(101, True), True)", "check('fixture 4', solve(500, False), False)"]
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 | True | False | Failed |
| fixture 3 | True | True | Passed |
| fixture 4 | False | False | Passed |
| fixture 1 | False | False | Passed |
SHA-256 / fc167c09923b78805cc404ef118eef3bb7e9622aa6019cd6fb2bccdb5768b9d1
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(status, upgrade_ok):
return status == 101 and upgrade_ok
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(200, True), False)", "check('fixture 2', solve(101, False), False)", "check('fixture 3', solve(101, True), True)", "check('fixture 4', solve(500, False), False)"]
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 | False | False | Passed |
| fixture 3 | True | True | Passed |
| fixture 4 | False | False | Passed |
| fixture 1 | False | False | Passed |
SHA-256 / 37425ba79c9a9070d7c339039ebaa8fe3c5b964a6f3d7b45521ae73fcccfe7dc
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:13.526418+00:00.
Case digest / a3bcb776ad2a303c312ffdd81ecb67425c9e2f7185a72bf56cc6121540815e8e