FA-7631 / WebSocket and browser transport policies / Open access
Websocket close handshake completes after both close directions · case 01
Websocket close handshake completes after both close directions.
ROOT CAUSE
The faulty implementation uses `"complete" if sent or received else "pending"` for the websocket-close-handshake-completes-after-both-close-directions decision.
VERIFIED REPAIR
Apply the explicit websocket-close-handshake-completes-after-both-close-directions contract, including the tested boundary and negative cases.
Unsuccessful approach: The attempted repair uses `"complete" if sent and received else "pending"` and still violates a separate fixture.
Case contract
Given sent, received, transport_closed, websocket close handshake completes after both close directions. Return the protocol decision or transformed value; fields are validated and fixtures state boundary outcomes.
Why this case matters
This deterministic websocket and browser transport policies model isolates the websocket-close-handshake-completes-after-both-close-directions 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(sent, received, transport_closed):
return "complete" if sent or received else "pending"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(True, False, False), 'pending')", "check('fixture 2', solve(False, False, True), 'abnormal')", "check('fixture 3', solve(True, True, False), 'complete')", "check('fixture 4', solve(False, False, False), 'pending')"]
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 | pending | abnormal | Failed |
| fixture 3 | complete | complete | Passed |
| fixture 4 | pending | pending | Passed |
| fixture 1 | complete | pending | Failed |
SHA-256 / bf37986ae201bb6e849f3ab74a6f7e4b39e3a462163ee8f79d12917b56015749
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(sent, received, transport_closed):
return "complete" if sent and received else "pending"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(True, False, False), 'pending')", "check('fixture 2', solve(False, False, True), 'abnormal')", "check('fixture 3', solve(True, True, False), 'complete')", "check('fixture 4', solve(False, False, False), 'pending')"]
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 | pending | abnormal | Failed |
| fixture 3 | complete | complete | Passed |
| fixture 4 | pending | pending | Passed |
| fixture 1 | pending | pending | Passed |
SHA-256 / e5d54b439500444a821c063fabdefbcdfe5e3b1b6795e4f935167079a336eb32
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(sent, received, transport_closed):
return "complete" if sent and received else ("abnormal" if transport_closed else "pending")
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
_fixtures = ["check('fixture 1', solve(True, False, False), 'pending')", "check('fixture 2', solve(False, False, True), 'abnormal')", "check('fixture 3', solve(True, True, False), 'complete')", "check('fixture 4', solve(False, False, False), 'pending')"]
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 | abnormal | abnormal | Passed |
| fixture 3 | complete | complete | Passed |
| fixture 4 | pending | pending | Passed |
| fixture 1 | pending | pending | Passed |
SHA-256 / 3ba03fa1f199d652287218bfc14aa98b6f6972accf7ee418b6d071dbc5168f2a
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.832763+00:00.
Case digest / 8f7cbc05de6076d03b9ab249746d1c80f54507e6dddf3382e5bc9f0c3549944c