#!/usr/bin/env python3 """Check the alleged >4 KiB TLS-flight failure using real local dev binaries.""" import importlib.util import json from pathlib import Path ROOT = Path(__file__).resolve().parents[1] spec = importlib.util.spec_from_file_location("objective_fixture", ROOT / "tests/test_v2_e2e.py") fixture = importlib.util.module_from_spec(spec) spec.loader.exec_module(fixture) def main(): runtime = fixture.Runtime.__new__(fixture.Runtime) try: runtime.__init__() runtime.ready() calls = [] transport = runtime.relay._stream.transport original_exchange = transport.exchange def observed_exchange(payload=b"", *, send=True): calls.append({"payload_bytes": len(payload), "send": send}) return original_exchange(payload, send=send) transport.exchange = observed_exchange path = "/" + "x" * 12000 response = runtime.relay.get("https://fixture.example" + path) assert response.status_code == 200 and response.content == fixture.BODY assert runtime.events == [path] chunks = [call for call in calls if call["payload_bytes"]] assert len(chunks) >= 3 assert all(not call["send"] for call in chunks[:-1]) assert chunks[-1]["send"] result = { "passed": True, "request_path_bytes": len(path), "response_bytes": len(response.content), "transport_calls": calls, "scope": "Real Python client and dev Rust host/enclave with synthetic local TLS upstream; no production calls or Nitro claim.", "fixtures_retained_at": str(runtime.dir), } (runtime.dir / "objective-tls-flight-evidence.json").write_text(json.dumps(result, indent=2) + "\n") print(json.dumps(result, indent=2)) finally: runtime.close() if __name__ == "__main__": main()