Repository navigation
Description
Problem
Part 2 of #1314, which is too large for one pull request (comment of 2026-11-05).
The HTTP clients come from seven factory and broker names: new_http_client, new_async_http_client, get_shared_client, get_shared_async_client, HttpClientBroker, get_broker and DEFAULT_HTTP_BROKER. Tests patch httpx2 itself, and the only shared double, StubWeb, swaps the httpx2 client classes. create_retry_transport defaults wrapped to a plain httpx2.HTTPTransport(), which has no egress check [code: ai/retries/init.py]. The user agent is a fixed devops-cli/0.2.9 [code: http/broker.py].
Expected
One entry point in http/ builds httpx2 clients, and its transport is the seam. A hook, a fake, a fixture and a contract suite let a test replace the transport with no patch.
Acceptance criteria
- One entry point in
http/builds httpx2 clients, sync and async, pooled and unpooled. Every client it builds takes its transport from the seam, typedhttpx2.BaseTransportandhttpx2.AsyncBaseTransport.HttpClientBroker,get_brokerandDEFAULT_HTTP_BROKERare deleted, and the eight modules that call them build their clients through the entry point. Each keeps its timeouts, limits, redirect rules, SSRF validation andtraceparentheader.telemetry/memory_profiler.pyhands its ASGI transport to the entry point and sets no private_transport. The four factory functions stay until part 3 deletes them, because their callers are still there. - A hook installs a transport for a test. Installing or removing one closes the pooled clients first. The pool keeps its public reset and its
atexitclose. -
create_retry_transporttakeswrappedas a required argument. Noimport httpxfallback remains inhttp/ortelemetry/memory_profiler.py. The sites that build a network transport themselves wrap the seam's transport. - The user agent comes from
importlib.metadata.version("devops-cli"). - Nothing in
http/builds a client or reads a setting at import. -
tests/support/fakes/http.pypromotesStubWeb. It answers by method and URL with status, headers and body (JSON included), lets the client follow redirects by its own rules, raises httpx2's connect and timeout errors when told to, vets hosts withvet_addresses, and records each request. Awebfixture installs it through the hook, removes it at teardown and returns it. The root conftest registers it once. - The HTTP contract suite in
tests/http/runs each case against the fake and the real transport, the real side talking to a loopback server the test owns. Cases: status, headers and body; JSON; redirects and the redirect limit; connection refused; read timeout; and a destination that SSRF validation refuses, failing before any request is sent. - The tests of
http/use the fake or the contract suite, and patch no devops_cli name, no httpx2 class and notsocket.getaddrinfo. - ARCHITECTURE.md describes the one seam instead of the broker and the pool.
- Each new test runs offline in under 1 s.
uv run devops cipasses.
Existing tool considered
Alternatives check of #1314 (2026-10-29): not-applicable. httpx2.MockTransport implements the transport interface, so the fake runs on it.
Related
Parent: #1314. Part 1 is the DNS seam (it gives the fake its dns fixture). Part 3 is the caller migration. The old names stay until part 3 ends: each has callers that the later pull requests remove. This is a planned order, not a shim.
Activity
dan-petty commentedon Nov 6, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
refactorprefix of the title gives the type.(cli)scope of the title gives the scope.Planned architecture work with no production incident or security gap it closes directly.Reduces test fragility and simplifies the HTTP layer, but the current system still functions.Seven acceptance criteria span multiple modules, a new fake, a contract suite, and deletion of the broker.Both redesign the HTTP client seam; the candidate covers only the transport hook and fake, while #1314 spans the full HTTP and DNS seam.chore(main): release 0.69.0 (#3787)
devops-cli-service commentedon Nov 6, 2026
Released in v0.69.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.69.0
devops-cli-service commentedon Nov 6, 2026
Live since 2026-11-06 13:25 UTC