From 49e8821c257bf6c6be2781ae79975225b8e320c0 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Sun, 16 Aug 2026 00:46:27 -0500 Subject: [PATCH] environment contract: wait past the startup gate before probing the auth layer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fourth and final test file carrying the pre-listener-first assumption (port answers => fully started); the whole tests/ tree is now audited — all 19 gate suites pass locally against the new startup ordering. Co-Authored-By: Claude Fable 5 --- tests/environment_contract.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/environment_contract.py b/tests/environment_contract.py index d94566d..10639dc 100644 --- a/tests/environment_contract.py +++ b/tests/environment_contract.py @@ -109,8 +109,14 @@ def wait_ready(process: subprocess.Popen[str], port: int) -> None: if process.poll() is not None: raise AssertionError(process.stderr.read() if process.stderr else "stream exited") try: - urllib.request.urlopen(f"http://127.0.0.1:{port}/", timeout=0.2).read() - return + # listener-first startup: wait past the startup gate, not just + # for an answering socket — xrpc paths 503 as "starting" until + # storage is published, and this contract asserts on the auth + # layer behind that gate + body = urllib.request.urlopen(f"http://127.0.0.1:{port}/status", timeout=0.2).read() + if b"state starting" not in body: + return + time.sleep(0.025) except OSError: time.sleep(0.025) raise AssertionError(f"listener {port} did not become ready") -- 2.51.2