Skip to content

Run client stacks under simulation - #19

Merged
dhruvl merged 14 commits into
mainfrom
client-sockets
Aug 1, 2026
Merged

Run client stacks under simulation#19
dhruvl merged 14 commits into
mainfrom
client-sockets

Conversation

@dhruvl

@dhruvl dhruvl commented Aug 1, 2026

Copy link
Copy Markdown
Owner

aiohttp's client and httpx now complete real requests under a SimLoop; both compatibility rows flip to works, probe-verified.

  • Stream transports answer get_extra_info("socket") with a stand-in socket: synthetic-IP address tuples, inert option calls, and a fileno() backed by a parked descriptor pair whose readability mirrors the peer's EOF — so httpcore's liveness poll keeps pooled connections alive exactly while the simulated connection is. A reset or teardown reads as -1. Descriptors are reclaimed with the transport and at loop close.
  • sock_connect accepts AF_INET stream sockets: it vets the address shape, resolves the target against the host table, and parks it; create_connection(sock=...) claims the entry, closes the real descriptor, and runs the ordinary simulated handshake, so the upgrade pays the same round trip a direct connect pays and refusal surfaces the same way. Datagram and raw variants still fence.
  • A resolver pin keeps getaddrinfo at one row per socket kind, which is what keeps both stacks' happy-eyeballs machinery dormant.
  • Docs tell the measured story: refreshed compatibility table and prose, the supported-api contract for the new surface, and a TLS section scoped to what was actually observed - aiohttp fences on create_connection(ssl=...), httpx drives an in-process handshake that reaches no fence and times out against a plaintext peer.

Suite green including a determinism case that drives the whole client path; no new runtime dependencies; ResourceWarning footprint identical to main.

dhruvl added 14 commits August 1, 2026 11:10
Every connection the tests open now gets closed and settled before the
loop goes down, so the file runs clean under -W error::ResourceWarning.
Adds the reset path, the descriptors a run leaves behind, the malformed
connect addresses, and a trace-hash pair over the whole client sequence.
The descriptor only turns readable on the peer's EOF; a reset, a local
close or the end of the run closes it and fileno() reports -1, which a
readability poll reads as dead just the same. Also notes that the
number is OS-assigned and outside the determinism guarantee.
@dhruvl
dhruvl merged commit 219999d into main Aug 1, 2026
4 checks passed
@dhruvl
dhruvl deleted the client-sockets branch August 1, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant