Skip to content

refactor(cli): one HTTP entry point with a shared fake - #3786

Merged
dan-petty merged 3 commits into
mainfrom
refactor/1314-http-entry-point
Nov 6, 2026
Merged

dan-petty merged 3 commits into
mainfrom
refactor/1314-http-entry-point

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Every httpx2 client now comes from devops_cli.http.entry, pooled when the caller names a key. A client takes its transport from one seam, and a test replaces it with install_transport and the web fixture. This removes HttpClientBroker, the second place that kept clients. WebFake and a contract suite over the fake and the real transport replace the per-test patches of client classes. The older factories stay until the last caller moves (#1314).

Closes #3755

Change: openspec/changes/archive/2026-11-06-3755-http-entry-point/

…ared fake and its contract suite

Every httpx2 client comes from http_client or async_http_client in devops_cli.http.entry, pooled when the caller names a key. A client takes its transport from one seam: the transport that install_transport put in place, else the egress transport of its level. install_transport and remove_transport close the pooled clients first.

HttpClientBroker, get_broker and DEFAULT_HTTP_BROKER are deleted. Vault, the AI clients, the Kubernetes service reader, the status pages and the memory profiler build their clients through the entry point. create_retry_transport takes wrapped as a required argument.

WebFake and the web fixture promote StubWeb. The contract suite in tests/http runs each case over the fake and over the real egress transport against a loopback server.
…tests to the web fixture

The transport hook is process-wide state, so the floor resets it. The status page tests use the web fixture, and the route table names the renamed ARCHITECTURE.md section.
@dan-petty dan-petty added type/refactor Type refactor: a new structure, same behavior scope/cli Core CLI framework, Typer subcommands, options, and tables labels Nov 6, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test and check results

Full uv run devops ci --check ran once on the rebased branch (before the archive commit). Every row passed except test, coverage and test-tree. I fixed what this change caused, and ran the fixed rows again (lint, format, docs, startup-imports, test-tree: all pass; tests/http, tests/telemetry, tests/security, tests/invariants, Vault and step-rules tests: 2807 passed).

Fixed (caused by this change):

  • tests/telemetry/test_service_status.py patched new_http_client in service_status. It now uses the web fixture.
  • The transport hook is process-wide state. devops_cli.http.client.reset_transport_hook is now in the floor's reset list.
  • src/devops_cli/roadmap/step_rules.py named the old ARCHITECTURE.md heading with "Broker". It names the new heading.
  • One presence-only assertion in tests/http/test_entry.py now checks values.

Failed for a host reason, and fail the same way on origin/main (checked in a scratch checkout of main):

  • tests/commands/test_devcontainer_install_tools_dry_run.py::test_mark_only_commands_under_global_dry_run
  • tests/ai/test_tool_executor_contract.py::test_the_direct_executor_refuses_a_network_profile_before_it_starts_the_tool[direct] (reaches ~/.local/share/devops-cli/tools/popeye, which the shared home volume holds)

The web fixture requests the new dns fixture (DNS seam, #3773) and calls answer_every_name(). public_dns and scripted_resolver stay for the packages that have not moved. The old factories (new_http_client, new_async_http_client, get_shared_client, get_shared_async_client) and stub_web stay for item 3 of #1314. No caller of HttpClientBroker, get_broker or DEFAULT_HTTP_BROKER is left in src, tests, docs, k8s, .github or the knowledge base. tests/http/test_entry_contract.py runs each case over WebFake and over the real egress transport.

The full run took 6m 24s on a host under load average 30 (test row 5m 56s), over the 5-minute budget. The roadmap-step tests and test_local_ai_commands_run_cleanly (52 s) are the slowest. This change adds none of them.

@dan-petty
dan-petty marked this pull request as ready for review November 6, 2026 08:54
@dan-petty
dan-petty merged commit 0feeb8b into main Nov 6, 2026
24 checks passed
@dan-petty
dan-petty deleted the refactor/1314-http-entry-point branch November 6, 2026 09:06
dan-petty pushed a commit that referenced this pull request Nov 6, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.69.0](v0.68.0...v0.69.0)
(2026-11-06)


### Features

* **k8s:** post a GitHub deployment for each Argo CD deploy
([#3783](#3783))
([5515975](5515975))


### Bug Fixes

* **k8s:** the ebpf profiler skips the node hawk
([#3788](#3788))
([bd65ef6](bd65ef6))


### Code Refactoring

* **cli:** one HTTP entry point with a shared fake
([#3786](#3786))
([0feeb8b](0feeb8b)),
closes [#3755](#3755)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/cli Core CLI framework, Typer subcommands, options, and tables type/refactor Type refactor: a new structure, same behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(cli): one HTTP entry point with a transport hook

1 participant