{"abstract":"Graceful drain completes when active stream count reaches zero.","category":"Connection lifecycle","checks":4,"contract":"Given draining, active, expired, graceful drain completes when active stream count reaches zero. Return the protocol decision or transformed value; fields are validated and fixtures state boundary outcomes.","evaluation_group":"xh-graceful-drain-completes-when-active-stream-count-reaches-zero","failed_approach":"The attempted repair uses `\"idle\" if not draining else (\"complete\" if active == 0 else \"wait\")` and still violates a separate fixture.","family":"xh-graceful-drain-completes-when-active-stream-count-reaches-zero","id":"FA-7781","implementations":{"attempt":{"sha256":"d6e3981375727146d4d09e3e2ae8da6949ce27d7efd0128934e4d065fd68f4a5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport ipaddress\nimport re\nfrom urllib.parse import urlsplit, urljoin\nN = 1\nobservations = []\ndef solve(draining, active, expired):\n    return \"idle\" if not draining else (\"complete\" if active == 0 else \"wait\")\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_fixtures = [\"check('fixture 1', solve(False, 0, False), 'idle')\", \"check('fixture 2', solve(True, 1, True), 'force')\", \"check('fixture 3', solve(True, 0, False), 'complete')\", \"check('fixture 4', solve(True, 1, False), 'wait')\"]\nfor _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:\n    exec(_line)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"aea7037f080ccf11813abc2244c42f7ed67dc442ec2115f2ec943281bfdb91af","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport ipaddress\nimport re\nfrom urllib.parse import urlsplit, urljoin\nN = 1\nobservations = []\ndef solve(draining, active, expired):\n    return \"complete\" if active == 0 else \"wait\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_fixtures = [\"check('fixture 1', solve(False, 0, False), 'idle')\", \"check('fixture 2', solve(True, 1, True), 'force')\", \"check('fixture 3', solve(True, 0, False), 'complete')\", \"check('fixture 4', solve(True, 1, False), 'wait')\"]\nfor _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:\n    exec(_line)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"b29f5b82b1d121154c2be897f8b3c06d6a3eea35a93b6c86e86585a610dfcba6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport ipaddress\nimport re\nfrom urllib.parse import urlsplit, urljoin\nN = 1\nobservations = []\ndef solve(draining, active, expired):\n    return \"idle\" if not draining else (\"complete\" if active == 0 else (\"force\" if expired else \"wait\"))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\n_fixtures = [\"check('fixture 1', solve(False, 0, False), 'idle')\", \"check('fixture 2', solve(True, 1, True), 'force')\", \"check('fixture 3', solve(True, 0, False), 'complete')\", \"check('fixture 4', solve(True, 1, False), 'wait')\"]\nfor _line in _fixtures[N % len(_fixtures):] + _fixtures[:N % len(_fixtures)]:\n    exec(_line)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"xh-graceful-drain-completes-when-active-stream-count-reaches-zero","generated_at":"2026-09-29T14:38:15.237978+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"This deterministic connection lifecycle model isolates the graceful-drain-completes-when-active-stream-count-reaches-zero policy at a network component boundary.","repair":"Apply the explicit graceful-drain-completes-when-active-stream-count-reaches-zero contract, including the tested boundary and negative cases.","root_cause":"The faulty implementation uses `\"complete\" if active == 0 else \"wait\"` for the graceful-drain-completes-when-active-stream-count-reaches-zero decision.","sha256":"296233a7741d5c71b2a0fe8430390cab7847d3a3a963bf5ebb0fa14abfa8cebe","title":"Graceful drain completes when active stream count reaches zero · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.879,"exit_code":1,"observations":[{"actual":"wait","check":"fixture 2","expected":"force","passed":false},{"actual":"complete","check":"fixture 3","expected":"complete","passed":true},{"actual":"wait","check":"fixture 4","expected":"wait","passed":true},{"actual":"idle","check":"fixture 1","expected":"idle","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 2\", \"actual\": \"wait\", \"expected\": \"force\", \"passed\": false}, {\"check\": \"fixture 3\", \"actual\": \"complete\", \"expected\": \"complete\", \"passed\": true}, {\"check\": \"fixture 4\", \"actual\": \"wait\", \"expected\": \"wait\", \"passed\": true}, {\"check\": \"fixture 1\", \"actual\": \"idle\", \"expected\": \"idle\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.227,"exit_code":1,"observations":[{"actual":"wait","check":"fixture 2","expected":"force","passed":false},{"actual":"complete","check":"fixture 3","expected":"complete","passed":true},{"actual":"wait","check":"fixture 4","expected":"wait","passed":true},{"actual":"complete","check":"fixture 1","expected":"idle","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 2\", \"actual\": \"wait\", \"expected\": \"force\", \"passed\": false}, {\"check\": \"fixture 3\", \"actual\": \"complete\", \"expected\": \"complete\", \"passed\": true}, {\"check\": \"fixture 4\", \"actual\": \"wait\", \"expected\": \"wait\", \"passed\": true}, {\"check\": \"fixture 1\", \"actual\": \"complete\", \"expected\": \"idle\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":44.094,"exit_code":0,"observations":[{"actual":"force","check":"fixture 2","expected":"force","passed":true},{"actual":"complete","check":"fixture 3","expected":"complete","passed":true},{"actual":"wait","check":"fixture 4","expected":"wait","passed":true},{"actual":"idle","check":"fixture 1","expected":"idle","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"fixture 2\", \"actual\": \"force\", \"expected\": \"force\", \"passed\": true}, {\"check\": \"fixture 3\", \"actual\": \"complete\", \"expected\": \"complete\", \"passed\": true}, {\"check\": \"fixture 4\", \"actual\": \"wait\", \"expected\": \"wait\", \"passed\": true}, {\"check\": \"fixture 1\", \"actual\": \"idle\", \"expected\": \"idle\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}