Repository navigation
Description
Problem
- Three parallel HTTP seams, none injectable.
new_http_clientandnew_async_http_clientbuild plain clients [code: src/devops_cli/http/client.py:55, :66].get_shared_clientandget_shared_async_clientcache pooled clients per key [code: http/pool.py:63, :81] and hand back an open one without building a new client [code: http/pool.py:74-75].HttpClientBrokeradds SSRF validation and trace headers;DEFAULT_HTTP_BROKERis built at import and readsDEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORKthen [code: http/broker.py:34, :186]. Eight modules outsidehttp/call them: ai/client/base.py, ai/common_tools.py, ai/harness/docs.py, k8s/service_http.py, security/vault_broker.py, security/vault_lease.py, telemetry/service_status.py and telemetry/memory_profiler.py, which sets its broker client's private_transport(:263-266) [measured: grep at 5c45b1e]. - Most clients bypass all three. 27 modules outside
http/constructhttpx2.ClientorAsyncClient, or callhttpx2.get/post, inline: ai/client/base.py, ai/gateway.py, ai/library/docs_ingester.py, ai/pool_load.py, ai/providers/{anthropic,ollama,openai}.py, ai/rag/embeddings.py, ai/spend/pricing.py, argo/{fleet,gitops,rollouts}.py, cloudflare/client.py, commands/{ai_gateway,argo,grafana,install_tools,prometheus}.py, github/{client,ssh}.py, k8s/{credentials,logql}.py, sandbox/{metrics,probe}.py, security/vulnerability_lookup.py and telemetry/{tracer,waterfall}.py [measured: grep at 5c45b1e]. Three more sites build a network transport themselves [code:ai/retries/__init__.py:132, :164; ai/client/base.py:62]. - Tests patch the library. About 77 test patches target httpx2 itself and 44 target devops_cli HTTP wrappers [measured: census of 2026-10-07]; 19 patch lines in 7 test files target the factories above [measured: grep at 5c45b1e]. The only shared double,
StubWebbehindstub_web, swaps thehttpx2.ClientandAsyncClientclasses andDEFAULT_HTTP_BROKER[code: tests/conftest.py:231-234], so a pooled client built before it keeps its real transport. 2 test files callclose_shared_clients[measured: grep]. - DNS has a private seam and five bypasses. The bounded lookup is the private
_resolve_host_ips[code: core/validation.py:192]; telemetry/waterfall.py:142, sandbox/probe.py:59, sandbox/models.py:157 and :194, and valkey/client.py:105 callsocket.getaddrinfodirectly.public_dnspatchessocket.getaddrinfoitself [code: tests/conftest.py:173], test_validation.py hand-builds address tuples [measured: census], and tests/test_pydantic_ai_ollama.py:96 patches_resolve_host_ips. - SDKs that bring their own HTTP stack are out of this seam's reach:
AsyncOpenAI(ai/models/ollama.py:9), pydantic-ai's providers and qdrant-client over plain httpx (whichai/settings/__init__.py:11also imports), kubernetes over urllib3, and docker and PyGithub over requests. Their edges are faked at their own seams: refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001, refactor(ai): Valkey, Qdrant and the embedder each have one seam, with shared fakes and contract suites #1317, refactor(k8s): KubernetesService is the Kubernetes API seam, with a shared fake cluster and its contract suite #1315, refactor(infra): DockerEngineService is the Docker engine seam, with a shared in-memory engine fake and its contract suite #1316, and refactor(github): the github session owns transport, ledger, error classes and link pagination #983's GitHub session once refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 moves the PyGithub calls onto it.
Acceptance criteria
HTTP seam
- One entry point in
http/builds httpx2 clients, sync and async, pooled and unpooled.new_http_client,new_async_http_client,get_shared_client,get_shared_async_client,HttpClientBroker,get_brokerandDEFAULT_HTTP_BROKERare deleted, and the eight modules above build their clients through the entry point, each keeping the timeouts, connection limits, redirect rules, SSRF validation andtraceparentheader it has today. memory_profiler.py hands its ASGI transport to the entry point instead of setting_transport. - The seam's Protocol is httpx2's transport interface (
httpx2.BaseTransport,httpx2.AsyncBaseTransport). Every client the entry point builds takes its transport from the seam, pooled clients included, and the three sites that build a network transport themselves (ai/retries/__init__.py:132, :164; ai/client/base.py:62) wrap the seam's transport instead. - A hook installs a transport for a test. Installing or removing one closes the pooled clients first, so no client built earlier keeps the old transport. The pool keeps a public reset and its
atexitclose [code: http/pool.py:104, :257]. - Nothing in
http/builds a client or reads a setting at import: the private-network setting is read when a client is built. - ARCHITECTURE.md (:193) describes the one seam instead of the broker and the pool.
DNS seam
- One public resolver replaces
_resolve_host_ips: a Protocol that resolves a host and port to addresses within a timeout, one place that supplies the realsocket.getaddrinfolookup, and a hook that installs another. core/validation.py resolves through it.
Fakes and fixtures
-
tests/support/fakes/http.pypromotesStubWeb[code: tests/web_fakes.py:13]. 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, and records each request (method, URL, headers, body), so tests compare the recorded requests as one value. -
tests/support/fakes/dns.pymaps names to addresses, can answer every name with one public address aspublic_dnsdoes, and fails an unknown name with thesocket.gaierrorthe real lookup raises. - Two fixtures install the fakes through the seams' hooks, remove them at teardown and return them; both are registered once from the root conftest. Until the five bypassing lookups are routed, the DNS fixture also answers
socket.getaddrinfofrom the same fake, the stdlib fallback Q24 allows. It replacespublic_dns, whose 5 files request it instead. - The 4
stub_webfiles whose code builds its clients through the seam (tests/test_common_tools.py, test_native_common_tools.py, test_http_broker.py, test_runtime_security_and_ssrf_hardening.py) request the HTTP fixture instead, changing only the fixture they request, their imports and their calls to the fake.stub_webstays, answering from the HTTP fake, only for the 2 files whose code builds httpx2 clients inline: tests/test_github_client.py, which test(github): github/ is tested through its public interface over the gh process and session fakes, with no internal patches or private imports #1321 switches, and test_embedding_benchmark.py, which test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331 switches. Whichever of the two lands second deletesstub_web.tests/web_fakes.pyis deleted.
Contract suites
- The HTTP suite runs each case against the fake and against the real transport, the real side talking to a loopback server the test owns, which the floor lets a test reach [code: tests/conftest.py:86]. Cases: status, headers and body round trip; JSON; redirects and the redirect limit; connection refused and read timeout, raising the same httpx2 exception types on both sides; and a destination that SSRF validation refuses, failing before any request is sent.
- The DNS suite runs against the fake and the real resolver, the real side resolving only
localhostand IP literals, which the floor lets through [code: tests/conftest.py:125]. Cases: a loopback name, an IP literal, an unknown name and a timeout.
Migration
- The tests of
http/(tests/test_http.py, test_http_async_client.py, test_http_broker.py and test_http_connection_pool.py; paths before test(cli): every test file sits in the directory mirroring the package it tests or in tests/invariants/, and the root conftest holds only the hermetic floor #1313's move) and of the resolver use the fakes or the contract suites, and patch no devops_cli name, no httpx2 class and notsocket.getaddrinfo. The 19 patch lines that target the deleted factories, and the patch of_resolve_host_ipsat tests/test_pydantic_ai_ollama.py:96, use the fakes. - If test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310 introduced its interim
unreachable(...)marker, every marker that names an HTTP service no other phase D item owns, or a DNS name, in a test whose code reaches the edge through these seams, gives way to the fixtures, in the fake's refusing state where the test relies on the refusal. Markers on code that bypasses the seams go with the package item that routes that code. - The 27 inline builders and the five direct
getaddrinfocalls are left to the package items that own them; the lookups go to test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334 (telemetry/waterfall.py:142) and test(infra): infrastructure tests run on edge fakes #1335 (sandbox/probe.py:59, sandbox/models.py:157 and :194, valkey/client.py:105). - Tests run offline; each new test runs under 1 s.
- If test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309 has landed, its ceilings drop by the sites this PR removes (the 19 patch lines that target the deleted factories and the patch of
_resolve_host_ipsamong them). -
uv run devops cipasses.
Key questions
- Why httpx2's transport as the Protocol? Decided 2026-10-07: the HTTP fake runs on httpx2's
MockTransport. (proposed) The Protocol is therefore httpx2's own transport interface, whichMockTransportimplements andStubWebanswers through today; a Protocol of devops-cli's own would restate httpx2's API. - Who routes the inline builders and the DNS bypasses? Decided 2026-10-07: each package's migration item (Q24).
- What about SDKs with their own HTTP stack? Decided 2026-10-07: they are faked at their own seams; patching the stdlib or an SDK object is a fallback for stdlib edges only (Q23, Q24).
- What about model traffic? (proposed) refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's adapters take their transport from this seam like every other client. Tests of model behaviour use refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's fake at the model seam, not this one.
- Where do the resolver and the suites live? (proposed) The resolver in
core/dns.py; the suites intests/http/andtests/core/, the mirror directories of their seams. - Fixture names? (proposed)
webanddns, avoiding the Avoid words of TESTING.md such as stub.
Strategic alignment
- Depends on: test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312. Blocks: test(k8s): k8s/ is tested through its public interface over the Kubernetes API, process, HTTP and keyring fakes, with no internal patches or private imports #1322, test(ci): devops ci, test, devcontainer, workspace, install-tools, uv, branches and pipeline are tested over edge fakes, with no lazy patch targets or PYTEST_CURRENT_TEST checks #1325, test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326, test(cli): the infra commands are thin adapters tested over edge fakes, with no internal patches or private imports #1327, test(review): ai/review and review/ are tested through one public interface over the model, tool-executor and process fakes, with no mock detection in src #1328, test(ai): Wire rag once in ai/rag, test with edge fakes #1329, test(mcp): mcp, agent and tool tests run on edge fakes #1330, test(ai): the remaining ai modules are tested through their public interfaces on edge fakes, and the legacy provider layer leaves src #1331, test(security): scanner, secret and crypto tests run on the executor, process, http and keyring fakes, and scanners stop looking for mocks #1332, test(cli): Use edge fakes and real git; drop test rebind hooks #1333, test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334, test(infra): infrastructure tests run on edge fakes #1335. Related: refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001 (model seam), refactor(github): the github session owns transport, ledger, error classes and link pagination #983 (GitHub session over the shared pool), refactor(github): pull request, repository and ssh key calls move from pygithub onto the github session #891 (PyGithub calls move onto the GitHub session), test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310 (default deny, interim markers and state resets), test(cli): ratchets hold internal patches, private imports and test accommodations in src at today's counts and name each site that would raise one #1309 (ratchets).
- Parent: test(cli): tests double only process edges and mirror the source tree #1307 (phase D).
Update 2026-10-08: refinement
#898 changed http/: the factories take a required level and dial through VettingBackend (http/client.py:142, :172; http/egress.py:152), and the import-time criterion already holds. The HTTP fake vets hosts with vet_addresses, as StubWeb does; the DNS seam serves the egress lookups (:131, :144).
-
create_retry_transporttakeswrappedas required, and noimport httpxfallback remains (http/broker.py:8-11,telemetry/memory_profiler.py:247-250). - (proposed, owner open) The user agent uses the package version (
broker.py:44).
Split into parts (2026-11-06)
This item is the parent of three parts, each one pull request or more. It closes when all three are done.
- refactor(cli): one DNS seam under vet_addresses, with a fake #3752, the DNS seam: the DNS seam criterion, the
dnsfixture andtests/support/fakes/dns.py, and the DNS contract suite. - refactor(cli): one HTTP entry point with a transport hook #3755, the HTTP entry point and fake: the HTTP seam criteria, the
tests/support/fakes/http.pyfake with thewebfixture, the HTTP contract suite, the criteria of the refinement of 2026-10-08, and the tests ofhttp/. The old factory functions stay until part 3. - refactor(cli): callers use the HTTP entry point, old factories go #3758, the caller migration by package: the 27 inline builders, the migration of the
stub_web,public_dnsandscripted_resolverusers to the fixtures, and the deletion of the four factory functions,stub_webandtests/web_fakes.py.
The criteria below stay as the full target. A part closes the criteria that its issue lists.
Alternatives check of 2026-10-29: not-applicable.
Tool: none found.
Proposed design
Problem statement
The HTTP clients come from three factory and broker names, and tests patch httpx2 directly. The DNS lookup is not injectable. This item replaces the names with one entry point, adds a resolver seam, and adds shared fakes and contract suites. The measured scope is too large for one pull request, so it splits into three parts.
Acceptance criteria
Requirement: single-http-entry-point
The http package SHALL expose one entry point that builds sync and async httpx2 clients, pooled and unpooled.
Scenario: factory-names-absent
- WHEN A search of the source tree looks for new_http_client, new_async_http_client, get_shared_client, get_shared_async_client, HttpClientBroker, get_broker and DEFAULT_HTTP_BROKER.
- THEN The search finds none of those names in src/devops_cli/.
Requirement: transport-seam
The entry point MUST accept a transport typed as httpx2.BaseTransport or httpx2.AsyncBaseTransport, and every client it builds MUST use that transport.
Scenario: retry-transport-wraps-seam
- WHEN ai/retries/init.py builds a retry transport.
- THEN It wraps the transport from the seam and does not build httpx2.HTTPTransport.
Requirement: test-hook
A hook SHALL install or remove a test transport and SHALL close pooled clients before the swap.
Scenario: pool-closed-before-swap
- WHEN The hook installs a transport after a pooled client exists.
- THEN close_shared_clients is called before the new transport is installed, and the pool keeps its public reset and atexit close.
Requirement: no-import-time-build
No module in http/ SHALL build a client or read a setting at import time.
Scenario: import-time-clean
- WHEN A search of src/devops_cli/http/ looks for module-scope client construction or DEVOPS_CLI_AI_ALLOW_PRIVATE_NETWORK reads.
- THEN The search finds no such hit, and the private-network setting is read only when a client is built.
Requirement: retry-transport-required
create_retry_transport SHALL take wrapped as a required argument with no default.
Scenario: wrapped-required
- WHEN create_retry_transport is called without a wrapped argument.
- THEN A TypeError is raised, and no import httpx fallback remains in http/ or telemetry/memory_profiler.py.
Requirement: user-agent-metadata
The user agent SHALL be built from importlib.metadata.version('devops-cli').
Scenario: version-from-metadata
- WHEN The user agent string is built.
- THEN It contains the installed package version and no hard-coded version string.
Requirement: http-callers-migrated
The eight calling modules outside http/ SHALL use the entry point and SHALL keep their timeouts, limits, redirects, SSRF validation and traceparent header.
Scenario: memory-profiler-transport
- WHEN telemetry/memory_profiler.py builds its client.
- THEN It passes its ASGI transport to the entry point and does not set the client's private _transport.
Requirement: dns-resolver-seam
One public resolver under vet_addresses SHALL replace the private resolver and SHALL expose a Protocol, a real lookup and an install hook.
Scenario: resolver-protocol
- WHEN A search of core/validation.py and http/egress.py looks for _resolve_host_ips.
- THEN The search finds none, and http/egress.py exposes the resolver Protocol, the real lookup and the install hook.
Requirement: http-fake
tests/support/fakes/http.py SHALL provide a fake that answers by method and URL, follows redirects, raises httpx2 errors, records requests and vets hosts with vet_addresses.
Scenario: fake-records-request
- WHEN A request with a known method and URL is sent to the fake.
- THEN The fake returns the configured status, headers and body, and the recorded request equals the expected value.
Requirement: dns-fake
tests/support/fakes/dns.py SHALL map names to addresses, answer every name with one public address on demand, and raise socket.gaierror for an unknown name.
Scenario: unknown-name-fails
- WHEN The DNS fake resolves a name it does not map.
- THEN socket.gaierror is raised.
Requirement: fixtures
The web and dns fixtures SHALL install and remove the fakes through the seam hooks, and the root conftest SHALL register both once.
Scenario: fixture-teardown
- WHEN A test requests the web or dns fixture and finishes.
- THEN The fixture's teardown removes the installed fake, and the test received the fixture object.
Requirement: dns-stdlib-fallback
Until the five bypassing lookups are routed, the DNS fixture SHALL answer socket.getaddrinfo from the same fake and SHALL replace public_dns.
Scenario: stdlib-fallback
- WHEN Code under test calls socket.getaddrinfo for a mapped name.
- THEN The DNS fixture returns the fake's address.
Requirement: stub-web-limited
The four seam-using test files SHALL request the web fixture, and stub_web SHALL remain only for the two files that #1321 and #1331 switch.
Scenario: stub-web-only-two
- WHEN A search of the test files looks for stub_web requests.
- THEN Only tests/test_github_client.py and tests/ai/benchmark/test_embedding_benchmark.py request it.
Requirement: http-contract-suite
The HTTP contract suite SHALL run each case against the fake and a real loopback transport, covering response, JSON, redirects, refusal, timeout and SSRF.
Scenario: ssrf-refusal
- WHEN A request targets a destination that SSRF validation refuses.
- THEN The request fails before any network I/O, and both sides raise the same httpx2 exception type.
Requirement: dns-contract-suite
The DNS contract suite SHALL run against the fake and the real resolver, covering a loopback name, an IP literal, an unknown name and a timeout.
Scenario: unknown-name
- WHEN The real resolver resolves an unknown name.
- THEN socket.gaierror is raised, and the fake raises the same error.
Requirement: no-library-patching
The migrated http/ tests and resolver tests SHALL patch no devops_cli name, no httpx2 class and not socket.getaddrinfo.
Scenario: no-patch-hits
- WHEN A search of the migrated test files looks for mock.patch or monkeypatch targets.
- THEN The search finds no target in httpx2, devops_cli.http or socket.getaddrinfo.
Requirement: architecture-doc
ARCHITECTURE.md SHALL describe the one HTTP seam and the DNS resolver seam instead of the broker and the pool.
Scenario: architecture-updated
- WHEN ARCHITECTURE.md is read.
- THEN It names the entry point and the resolver and does not describe HttpClientBroker or DEFAULT_HTTP_BROKER.
Requirement: bypasses-left-to-owners
This item SHALL leave the 27 inline httpx2 builders and the five direct getaddrinfo calls to their package items.
Scenario: bypasses-untouched
- WHEN A reviewer inspects this item's diff.
- THEN The diff changes no inline builder outside http/ and no direct getaddrinfo call.
Requirement: offline-fast
Each new test SHALL run offline and SHALL complete in under 1 second.
Scenario: timeout-guard
- WHEN The new test files run with a 1 second timeout and no network.
- THEN All tests pass.
Requirement: ci-passes
uv run devops ci SHALL pass on the pull request head.
Scenario: ci-green
- WHEN uv run devops ci runs on the pull request head.
- THEN All checks pass.
Existing Tool Considered
The alternatives check of 2026-10-29 returned not-applicable and found no applicable open, maintained tool or library. The project builds its own egress-checked transport over httpcore2 and VettingBackend. The written cost is about 120,000 tokens to build, keep and fix the seam, fakes and contract suites, and about 4 engineer-days.
Key questions
- Why use httpx2's transport interface as the Protocol?: Use httpx2.BaseTransport and httpx2.AsyncBaseTransport. httpx2.MockTransport implements this interface, and StubWeb already answers through it. A devops-cli Protocol would restate httpx2's API. (best practice) [sources: src/devops_cli/http/client.py, tests/conftest.py, tests/web_fakes.py]
- Chosen: httpx2.BaseTransport and httpx2.AsyncBaseTransport. MockTransport implements this interface, and StubWeb already answers through it.
- Rejected: A devops-cli Protocol. It would restate httpx2's transport API and add a layer that MockTransport does not implement.
- Where does the DNS seam live?: The seam lives in http/egress.py under vet_addresses. After fix(security): the pre-flight resolve paths go, the kept pre-flight checks call vet_addresses, and the docs say every http client is checked at the connect #2437, every lookup goes through vet_addresses or avet_addresses. The seam belongs where the lookup happens. (best practice) [sources: src/devops_cli/http/egress.py, src/devops_cli/core/validation.py]
- Chosen: http/egress.py under vet_addresses. Every lookup goes through vet_addresses, so the seam belongs where the lookup happens.
- Rejected: core/dns.py. fix(security): the pre-flight resolve paths go, the kept pre-flight checks call vet_addresses, and the docs say every http client is checked at the connect #2437 deletes the DNS branches of core/validation.py, so the original target is gone.
- Who routes the inline builders and the DNS bypasses?: Each package migration item owns its inline builders and DNS bypasses. This item leaves them to test(telemetry): telemetry, server, ui, output and docs tests run on edge fakes, and the dashboard suite splits by behaviour #1334 and test(infra): infrastructure tests run on edge fakes #1335. (best practice) [sources: src/devops_cli/security/vulnerability_lookup.py, src/devops_cli/telemetry/tracer.py, src/devops_cli/telemetry/waterfall.py]
- Chosen: Package migration items. Each package knows its callers and can route them in its own pull request.
- Rejected: This item routes all inline builders. It would make this item too large and conflict with the package items.
- How are SDKs with their own HTTP stack faked?: Fake each SDK at its own seam. AsyncOpenAI, pydantic-ai, kubernetes, docker and PyGithub keep their own HTTP stacks. Their edges are the stable test seams. (best practice) [sources: src/devops_cli/ai/models/ollama.py, docs/adr/0006-github-session-requests-go-through-gidgethub.md]
- Chosen: Fake at each SDK's own seam. Each SDK owns its HTTP stack, so its edge is the stable test seam.
- Rejected: Route all SDK traffic through this seam. It would require changing SDK internals or wrapping their clients.
- What about model traffic?: refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's adapters take their transport from this seam like every other client. Tests of model behaviour use refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001's fake at the model seam. (best practice) [sources: src/devops_cli/ai/models/ollama.py, src/devops_cli/ai/retries/init.py]
- Chosen: Model adapters use this seam's transport. create_ollama_provider already builds a client through the factory, so it can use the entry point.
- Rejected: Model traffic bypasses this seam. It would leave model clients untestable through the shared fake and contract suite.
- Where do the contract suites live?: The HTTP suite lives in tests/http/ and the DNS suite lives in tests/core/. These are the mirror directories of their seams. (best practice) [sources: tests/conftest.py, tests/http/test_http_async_client.py]
- Chosen: tests/http/ and tests/core/. These are the mirror directories of the seams and match the existing test layout.
- Rejected: A single tests/contract/ directory. It would separate the suites from the code they test.
- What are the fixture names?: The fixture names are web and dns. They avoid the Avoid words of TESTING.md such as stub. (best practice) [sources: tests/conftest.py, tests/web_fakes.py]
- Chosen: web and dns. They avoid the Avoid words in TESTING.md and are short and descriptive.
- Rejected: stub_web and public_dns. stub is an Avoid word in TESTING.md, and public_dns is too specific.
- Should create_retry_transport take wrapped as required?: Yes. A default httpx2.HTTPTransport() bypasses egress checks. A required wrapped forces every retry transport to wrap a vetted transport. (best practice) [sources: src/devops_cli/ai/retries/init.py, src/devops_cli/http/client.py]
- Chosen: wrapped is required. A plain default transport bypasses egress checks, so a required wrapped forces a vetted transport.
- Rejected: Keep the default. It allows a retry transport with no egress check.
- Should the user agent come from package metadata?: Yes. Build the user agent from importlib.metadata.version('devops-cli'). It always matches the installed version and needs no manual update. (best practice) [sources: src/devops_cli/http/client.py, src/devops_cli/http/broker.py]
- Chosen: importlib.metadata.version('devops-cli'). It always matches the installed version and needs no manual update.
- Rejected: A hard-coded version string. It goes stale on every release, and broker.py still has one.
- Does this item fit in one pull request, and what must merge before it can start?: No. The reply of 2026-11-05 measured about 130 changed files across 20 packages. The item splits into refactor(cli): one DNS seam under vet_addresses, with a fake #3752, refactor(cli): one HTTP entry point with a transport hook #3755 and refactor(cli): callers use the HTTP entry point, old factories go #3758. Nothing must merge first: fix(security): the osv, internetdb, radar and cloudflare api clients dial through the egress-checked factory at the public level #2430, fix(sandbox): the metrics scrape loses its pre-flight address check, and the sandbox address-range builders resolve with vet_addresses #2431, fix(security): the pre-flight resolve paths go, the kept pre-flight checks call vet_addresses, and the docs say every http client is checked at the connect #2437, refactor(telemetry): OTLP export goes through one exporter seam, and tests read exported spans and metrics from a shared fake #1319 and test(cli): tests find the repository root and fixtures from any depth, import no other test module and build test data with shared builders, and devops test maps a change to its mirror directory #1312 are closed, and _resolve_host_ips is gone. (best practice) [sources: src/devops_cli/http/client.py, tests/conftest.py, src/devops_cli/core/validation.py]
- Chosen: Three-part split: refactor(cli): one DNS seam under vet_addresses, with a fake #3752, refactor(cli): one HTTP entry point with a transport hook #3755 and refactor(cli): callers use the HTTP entry point, old factories go #3758. The reply measured about 130 changed files across 20 packages, and one reviewer cannot check that.
- Rejected: One pull request. It would change about 130 files across 20 packages and a reviewer cannot check it.
- Which open, maintained tool or library covers the need?: None. The alternatives check of 2026-10-29 returned not-applicable. The project builds its own egress-checked transport over httpcore2 and VettingBackend. (best practice) [sources: src/devops_cli/http/client.py, src/devops_cli/http/egress.py]
- Chosen: Build the seam. The check found no applicable tool, and the existing code already wraps httpcore2 with VettingBackend.
- Rejected: Adopt an existing tool. The alternatives check found no tool that covers the need.
Fit
Needs splitting into 3 items:
- refactor(cli): one DNS seam under vet_addresses, with a fake #3752: the DNS seam. It delivers the DNS seam criterion, the dns fixture, tests/support/fakes/dns.py, and the DNS contract suite.
- refactor(cli): one HTTP entry point with a transport hook #3755: the HTTP entry point and fake. It delivers the HTTP seam criteria, tests/support/fakes/http.py, the web fixture, the HTTP contract suite, the refinement criteria of 2026-10-08, and the tests of http/.
- refactor(cli): callers use the HTTP entry point, old factories go #3758: the caller migration by package. It delivers the 27 inline builders, the migration of stub_web, public_dns and scripted_resolver users, and the deletion of the four factory functions, stub_web and tests/web_fakes.py.
Suspected block
None.
Dependencies
None.
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
19 remaining items
refactor(security): read legacy numeric hosts with getaddrinfo (#3128)
dan-petty commentedon Nov 5, 2026
Return: the item is unblocked, but it is too large for one pull request
Checked at origin/main 83f8b3d, 2026-11-05. No code was written.
The premise now holds
_resolve_host_ipsis gone. The only lookups arevet_addressesandavet_addresses(http/egress.py:133,:146), plus one numeric-host check incore/validation.py:230.create_retry_transportand the user agent details from the 2026-10-08 audit still need the changes in this item.vet_addresses, as the refine round says.Measured scope (origin/main 83f8b3d)
http/name the seven factory symbols, at 180 sites.stub_web,public_dnsorscripted_resolver(39, 44 and 29 files, with overlap).httpx2and 124 lines mentiongetaddrinfo.One pull request that meets every criterion would change about 130 files across 20 packages. A reviewer cannot check that, and it conflicts with every parallel package item.
Proposed split (each part is one reviewable pull request)
socket.getaddrinfo,anyio.getaddrinfo) and the install hook undervet_addresses.tests/support/fakes/dns.py, thednsfixture, and the DNS contract suite intests/core/. The fixture replacespublic_dnsandscripted_resolver(73 files, fixture rename only). Needs no HTTP change.http/with the transport hook (closes pooled clients first), requiredwrappedforcreate_retry_transport, the user agent from package metadata, and no import-time broker.tests/support/fakes/http.py, thewebfixture and the HTTP contract suite intests/http/. Moves only the 8http/-adjacent callers named in the body. The old names stay until part 3 finishes, so this part adds the entry point and deletesHttpClientBroker,get_brokerandDEFAULT_HTTP_BROKERonly.stub_webtests to the entry point andweb. The last one deletesnew_http_client,new_async_http_client,get_shared_client,get_shared_async_clientandstub_web.Part 2 keeps old factory names until part 3 ends. This is a planned order, not a shim: each name has callers that the later parts remove.
A person decides the split and files the parts. Parts 1 and 2 can start now.
devops-cli-service commentedon Nov 5, 2026
The proposal at e38c8f3 needs splitting into 3 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.
dan-petty commentedon Nov 6, 2026
Answer from project standards, under the owner's instruction of 2026-11-05.
Question: Does this item fit in one pull request? What must merge before it can start?
Answer: No. The comment of 2026-11-05 measured about 130 changed files across 20 packages, and the names cannot be removed in part. Nothing must merge first: #2430, #2431, #2437, #1319 and #1312 are closed, and
_resolve_host_ipsis gone.The split is routine work, so I filed the parts as the refine round lists them and linked them as sub-issues of this item:
I edited the body of this item to list the parts. This item stays open as the parent, and the pull request of part 1 closes #3752, not this item.
Rule: AGENTS.md rule 1 (one issue, one pull request) and the "Partial work" rule: a name cannot be removed in part, because the project keeps no shim before 1.0.
devops-cli-service commentedon Nov 6, 2026
The proposal at 56f1520 needs splitting into 3 items. A person splits the item into the items below, or replies in a comment or edits the body to keep one item, and the next refine round looks at the item again.
refactor(cli): one HTTP entry point with a shared fake (#3786)
[-]refactor(cli): one HTTP seam replaces the three client factories and one DNS seam the private resolver, each with a shared fake and its contract suite[/-][+]refactor(cli): Unify HTTP and DNS seams with shared fakes[/+]dan-petty commentedon Nov 6, 2026
The job shortened the title of this item. The summary had 135 characters, and the limit is 60. The type and the scope stay.
refactor(cli): one HTTP seam replaces the three client factories and one DNS seam the private resolver, each with a shared fake and its contract suiterefactor(cli): Unify HTTP and DNS seams with shared fakesdan-petty commentedon Nov 9, 2026
This issue was superseded by three completed issues and their merged pull requests:
vet_addresses, shared fake and contract suite.devops_cli.http.entry, transport hook, shared fake and contract suite.All acceptance criteria of this item are met on
main. Under AGENTS.md Rule 2, this superseded item closes as rejected.