Replace deprecated Starlette TestClient HTTPX integration #682

Open
opened 2026-07-12 09:32:36 -05:00 by jcwalker3 · 1 comment
Owner

Problem

The Web UI test suite imports starlette.testclient.TestClient, which currently uses the deprecated httpx compatibility path.

Starlette emits:

StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.

The warning currently appears from (first reported site):

tests/test_webui_audit.py:8

Observed during full suite (2026-07-12)

During PR #680 validation the full suite produced this warning summary:

tests/test_webui_audit.py:8
  .../tests/test_webui_audit.py:8:
  StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
    from starlette.testclient import TestClient

Preliminary inventory (repo scan at master 22698c1)

Direct starlette.testclient.TestClient imports (not exhaustive forever — re-scan at implementation time):

  • tests/test_webui_audit.py
  • tests/test_webui_runtime_health.py
  • tests/test_webui_gated_actions.py
  • tests/test_webui_worktree_hygiene.py
  • tests/test_webui_deployment_boundary.py
  • tests/test_webui_mvp_suite.py
  • tests/test_webui_project_registry.py
  • tests/test_webui_lease_visibility.py
  • tests/test_webui_skeleton.py
  • tests/test_webui_prompt_library.py
  • tests/test_webui_queue_dashboard.py

Dependencies (pinned in requirements.txt as of filing):

  • starlette==1.3.1
  • httpx==0.28.1
  • httpx-sse==0.4.3
  • sse-starlette==3.4.5
  • httpx2 not declared / not installed in the local venv used for inventory

The full scope must still be determined by searching the repository for all uses of:

  • starlette.testclient
  • TestClient
  • httpx
  • httpx2
  • related test dependency declarations
  • warning filters that may be hiding the same deprecation elsewhere

Impact

Leaving this unresolved creates several risks:

  • A future Starlette or HTTPX upgrade may turn the warning into a test failure.
  • Web UI tests may become incompatible with the supported Starlette test-client implementation.
  • Warning output obscures new and potentially more important test warnings.
  • CI may become dependent on deprecated compatibility behavior.
  • Different local and CI dependency resolutions may produce inconsistent test results.

Required investigation

Determine:

  • Which installed Starlette version emits the warning (currently observed: 1.3.1).
  • Whether httpx2 is the intended dependency for the repository’s current Starlette version (confirm against official Starlette/HTTPX release notes).
  • Whether the project directly pins httpx, inherits it transitively, or relies on an optional Starlette test dependency (currently direct pin httpx==0.28.1 in requirements.txt).
  • Whether httpx2 can coexist with current runtime or test dependencies (including MCP/FastMCP stacks that also use httpx).
  • Whether all Web UI tests use the same test-client path (preliminary: many modules construct TestClient(create_app()) independently).
  • Whether any helper or fixture should centralize Web UI client construction.
  • Whether dependency lock files, requirements files, packaging metadata, CI images, or installation scripts require updates.
  • Whether the migration changes test behavior, request semantics, ASGI handling, cookies, redirects, exception propagation, or lifespan execution.

Use official Starlette and HTTPX documentation or release information when confirming the supported migration path.

Scope

The implementation issue should cover:

  • Updating the appropriate test dependency from the deprecated HTTPX path to the supported httpx2 path.
  • Updating dependency declarations and lock files.
  • Updating imports, fixtures, or test-client construction only where required.
  • Centralizing Web UI test-client setup if several tests currently duplicate it.
  • Removing the deprecation warning without suppressing it.
  • Verifying that all Web UI routes and APIs continue to behave as expected.

Non-goals

  • Do not silence the warning with a global warning filter.
  • Do not broadly upgrade unrelated production dependencies without evidence.
  • Do not replace the Web UI framework as part of this issue.
  • Do not weaken tests to accommodate changed client behavior.
  • Do not add parallel dependency declarations that leave the active client path ambiguous.
  • Do not implement during this filing session — implementation is a separate author claim.

Acceptance criteria

  1. The repository no longer emits the reported StarletteDeprecationWarning.
  2. The supported Starlette test-client dependency is explicitly declared.
  3. All occurrences of starlette.testclient.TestClient are reviewed.
  4. Web UI test fixtures use one intentional and documented client setup (if multi-module duplication remains, document why).
  5. tests/test_webui_audit.py passes.
  6. All focused Web UI tests pass (tests/test_webui_*.py).
  7. The Web UI CI smoke gate passes (repository smoke script / CI job as applicable).
  8. The complete test suite passes.
  9. Dependency installation succeeds in a clean environment.
  10. No warning filter is used merely to hide the deprecation.
  11. The issue or PR records the dependency versions before and after the fix.
  12. The final proof includes confirmation that no additional Starlette or HTTPX deprecation warnings remain from Web UI tests.

Required tests

At minimum run:

pytest tests/test_webui_audit.py -q
pytest tests/test_webui_*.py -q

Also run:

  • the repository’s Web UI smoke script (if present under scripts/ / CI)
  • dependency installation or lock-file validation
  • the complete test suite
  • git diff --check
  • any configured dependency or packaging validation

Observability and maintenance

Document in the implementing PR / completion comment:

  • The final Starlette version
  • The final HTTPX or httpx2 version
  • Where the test dependency is declared
  • Whether future dependency updates are automated
  • Whether deprecation warnings are treated as CI failures or surfaced clearly

Consider adding a focused CI check that fails on newly introduced Starlette deprecation warnings, provided it does not fail on unrelated third-party warning noise outside the repository’s control.

Linkage

  • Web console vision/roadmap: #652 (product vision), #653 (roadmap), #631 (epic MCP Control Plane Web Console)
  • Full-suite regression surface: warning observed during PR #680 full-suite validation (Closes path for #604)
  • Related dependency / test hygiene: re-scan for umbrella dep-cleanup issues at implementation time; no exact open duplicate found at filing for Starlette/httpx2/TestClient
  • Implementing PR: TBD (link when opened)

Any dependency conflict, installation failure, CI mismatch, or undocumented environment dependency discovered during this work must be captured as durable issue-backed work (do not bury in chat).

Canonical issue state

STATE: ready for independent implementation
WHO_IS_NEXT: author
NEXT_ACTION: claim this issue, branch under branches/, migrate Web UI TestClient to supported httpx2 path without warning filters
NEXT_PROMPT: see Ready-to-run author prompt below

Ready-to-run author prompt

Role: AUTHOR
Repo: prgs / Scaled-Tech-Consulting / Gitea-Tools
Issue: Replace deprecated Starlette TestClient HTTPX integration (this issue)

1. Verify prgs-author identity, master parity, clean isolated branches/ worktree.
2. Re-scan for starlette.testclient / TestClient / httpx / httpx2 / warning filters.
3. Confirm Starlette’s supported migration (httpx2) against official docs for the pinned Starlette version.
4. Update requirements/lock/CI as needed; centralize TestClient fixture if warranted.
5. Remove the StarletteDeprecationWarning without filters; keep full Web UI suite green + full suite.
6. Record before/after dependency versions; open PR; stop (no self-review/merge).

Required completion comment (author handoff)

At completion, leave a canonical issue comment containing:

  • root cause
  • selected migration path
  • dependency changes
  • files changed
  • focused test evidence
  • full-suite evidence
  • remaining risks
  • exact next valid action
  • a ready-to-paste prompt for the next role (reviewer)
## Problem The Web UI test suite imports `starlette.testclient.TestClient`, which currently uses the deprecated `httpx` compatibility path. Starlette emits: ```text StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead. ``` The warning currently appears from (first reported site): ```text tests/test_webui_audit.py:8 ``` ### Observed during full suite (2026-07-12) During PR #680 validation the full suite produced this warning summary: ```text tests/test_webui_audit.py:8 .../tests/test_webui_audit.py:8: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead. from starlette.testclient import TestClient ``` ### Preliminary inventory (repo scan at master `22698c1`) **Direct `starlette.testclient.TestClient` imports (not exhaustive forever — re-scan at implementation time):** * `tests/test_webui_audit.py` * `tests/test_webui_runtime_health.py` * `tests/test_webui_gated_actions.py` * `tests/test_webui_worktree_hygiene.py` * `tests/test_webui_deployment_boundary.py` * `tests/test_webui_mvp_suite.py` * `tests/test_webui_project_registry.py` * `tests/test_webui_lease_visibility.py` * `tests/test_webui_skeleton.py` * `tests/test_webui_prompt_library.py` * `tests/test_webui_queue_dashboard.py` **Dependencies (pinned in `requirements.txt` as of filing):** * `starlette==1.3.1` * `httpx==0.28.1` * `httpx-sse==0.4.3` * `sse-starlette==3.4.5` * `httpx2` **not** declared / not installed in the local venv used for inventory The full scope must still be determined by searching the repository for all uses of: * `starlette.testclient` * `TestClient` * `httpx` * `httpx2` * related test dependency declarations * warning filters that may be hiding the same deprecation elsewhere ## Impact Leaving this unresolved creates several risks: * A future Starlette or HTTPX upgrade may turn the warning into a test failure. * Web UI tests may become incompatible with the supported Starlette test-client implementation. * Warning output obscures new and potentially more important test warnings. * CI may become dependent on deprecated compatibility behavior. * Different local and CI dependency resolutions may produce inconsistent test results. ## Required investigation Determine: * Which installed Starlette version emits the warning (currently observed: **1.3.1**). * Whether `httpx2` is the intended dependency for the repository’s current Starlette version (confirm against official Starlette/HTTPX release notes). * Whether the project directly pins `httpx`, inherits it transitively, or relies on an optional Starlette test dependency (currently **direct pin** `httpx==0.28.1` in `requirements.txt`). * Whether `httpx2` can coexist with current runtime or test dependencies (including MCP/FastMCP stacks that also use `httpx`). * Whether all Web UI tests use the same test-client path (preliminary: many modules construct `TestClient(create_app())` independently). * Whether any helper or fixture should centralize Web UI client construction. * Whether dependency lock files, requirements files, packaging metadata, CI images, or installation scripts require updates. * Whether the migration changes test behavior, request semantics, ASGI handling, cookies, redirects, exception propagation, or lifespan execution. Use official Starlette and HTTPX documentation or release information when confirming the supported migration path. ## Scope The implementation issue should cover: * Updating the appropriate test dependency from the deprecated HTTPX path to the supported `httpx2` path. * Updating dependency declarations and lock files. * Updating imports, fixtures, or test-client construction only where required. * Centralizing Web UI test-client setup if several tests currently duplicate it. * Removing the deprecation warning without suppressing it. * Verifying that all Web UI routes and APIs continue to behave as expected. ## Non-goals * Do not silence the warning with a global warning filter. * Do not broadly upgrade unrelated production dependencies without evidence. * Do not replace the Web UI framework as part of this issue. * Do not weaken tests to accommodate changed client behavior. * Do not add parallel dependency declarations that leave the active client path ambiguous. * Do not implement during this filing session — implementation is a separate author claim. ## Acceptance criteria 1. The repository no longer emits the reported `StarletteDeprecationWarning`. 2. The supported Starlette test-client dependency is explicitly declared. 3. All occurrences of `starlette.testclient.TestClient` are reviewed. 4. Web UI test fixtures use one intentional and documented client setup (if multi-module duplication remains, document why). 5. `tests/test_webui_audit.py` passes. 6. All focused Web UI tests pass (`tests/test_webui_*.py`). 7. The Web UI CI smoke gate passes (repository smoke script / CI job as applicable). 8. The complete test suite passes. 9. Dependency installation succeeds in a clean environment. 10. No warning filter is used merely to hide the deprecation. 11. The issue or PR records the dependency versions before and after the fix. 12. The final proof includes confirmation that no additional Starlette or HTTPX deprecation warnings remain from Web UI tests. ## Required tests At minimum run: ```text pytest tests/test_webui_audit.py -q pytest tests/test_webui_*.py -q ``` Also run: * the repository’s Web UI smoke script (if present under `scripts/` / CI) * dependency installation or lock-file validation * the complete test suite * `git diff --check` * any configured dependency or packaging validation ## Observability and maintenance Document in the implementing PR / completion comment: * The final Starlette version * The final HTTPX or `httpx2` version * Where the test dependency is declared * Whether future dependency updates are automated * Whether deprecation warnings are treated as CI failures or surfaced clearly Consider adding a focused CI check that fails on newly introduced Starlette deprecation warnings, provided it does not fail on unrelated third-party warning noise outside the repository’s control. ## Linkage * **Web console vision/roadmap:** #652 (product vision), #653 (roadmap), #631 (epic MCP Control Plane Web Console) * **Full-suite regression surface:** warning observed during PR #680 full-suite validation (Closes path for #604) * **Related dependency / test hygiene:** re-scan for umbrella dep-cleanup issues at implementation time; no exact open duplicate found at filing for Starlette/`httpx2`/`TestClient` * **Implementing PR:** TBD (link when opened) Any dependency conflict, installation failure, CI mismatch, or undocumented environment dependency discovered during this work must be captured as durable issue-backed work (do not bury in chat). ## Canonical issue state ```text STATE: ready for independent implementation WHO_IS_NEXT: author NEXT_ACTION: claim this issue, branch under branches/, migrate Web UI TestClient to supported httpx2 path without warning filters NEXT_PROMPT: see Ready-to-run author prompt below ``` ## Ready-to-run author prompt ```text Role: AUTHOR Repo: prgs / Scaled-Tech-Consulting / Gitea-Tools Issue: Replace deprecated Starlette TestClient HTTPX integration (this issue) 1. Verify prgs-author identity, master parity, clean isolated branches/ worktree. 2. Re-scan for starlette.testclient / TestClient / httpx / httpx2 / warning filters. 3. Confirm Starlette’s supported migration (httpx2) against official docs for the pinned Starlette version. 4. Update requirements/lock/CI as needed; centralize TestClient fixture if warranted. 5. Remove the StarletteDeprecationWarning without filters; keep full Web UI suite green + full suite. 6. Record before/after dependency versions; open PR; stop (no self-review/merge). ``` ## Required completion comment (author handoff) At completion, leave a canonical issue comment containing: * root cause * selected migration path * dependency changes * files changed * focused test evidence * full-suite evidence * remaining risks * exact next valid action * a ready-to-paste prompt for the next role (reviewer)
jcwalker3 added the status:readyworkflow-hardeningdashboardtype:bug labels 2026-07-12 09:32:36 -05:00
Author
Owner

Canonical Issue State

STATE: ready for independent implementation
WHO_IS_NEXT: author
NEXT_ACTION: claim this issue and migrate Web UI tests off deprecated Starlette TestClient+httpx path onto supported httpx2 without warning filters
NEXT_PROMPT:

Role: AUTHOR
Repo: prgs / Scaled-Tech-Consulting / Gitea-Tools
Issue: #682 — Replace deprecated Starlette TestClient HTTPX integration

1. Verify prgs-author identity, master parity, clean isolated branches/ worktree (do not touch control-checkout dirt #681).
2. Re-scan starlette.testclient / TestClient / httpx / httpx2 / warning filters; re-check requirements/CI.
3. Confirm Starlette-supported httpx2 migration for pinned starlette==1.3.1 via official docs/releases.
4. Implement dependency + fixture/import updates only as needed; remove StarletteDeprecationWarning without filters.
5. Run pytest tests/test_webui_audit.py -q; pytest tests/test_webui_*.py -q; Web UI smoke; full suite; git diff --check.
6. Record before/after versions; open PR linking #682; stop (no self-review/merge).

WHAT_HAPPENED: Filed #682 after inventory found no open Gitea issue matching Starlette TestClient/httpx2 deprecation. Warning observed during PR #680 full-suite validation. Preliminary scan: ≥11 test_webui_* modules use starlette.testclient.TestClient; requirements pin starlette==1.3.1 and httpx==0.28.1; httpx2 not declared. Implementation deferred.
WHY: Deprecation risk on Web UI suite / CI noise / future hard-fail on upgrade.
RELATED_PRS: none yet; context PR #680 (warning surface); vision links #631 #652 #653
BLOCKERS: none
VALIDATION: issue create with type:bug status:ready labels dashboard,workflow-hardening; local inventory only (no code change)
LAST_UPDATED_BY: jcwalker3 (prgs-author)

## Canonical Issue State STATE: ready for independent implementation WHO_IS_NEXT: author NEXT_ACTION: claim this issue and migrate Web UI tests off deprecated Starlette TestClient+httpx path onto supported httpx2 without warning filters NEXT_PROMPT: ```text Role: AUTHOR Repo: prgs / Scaled-Tech-Consulting / Gitea-Tools Issue: #682 — Replace deprecated Starlette TestClient HTTPX integration 1. Verify prgs-author identity, master parity, clean isolated branches/ worktree (do not touch control-checkout dirt #681). 2. Re-scan starlette.testclient / TestClient / httpx / httpx2 / warning filters; re-check requirements/CI. 3. Confirm Starlette-supported httpx2 migration for pinned starlette==1.3.1 via official docs/releases. 4. Implement dependency + fixture/import updates only as needed; remove StarletteDeprecationWarning without filters. 5. Run pytest tests/test_webui_audit.py -q; pytest tests/test_webui_*.py -q; Web UI smoke; full suite; git diff --check. 6. Record before/after versions; open PR linking #682; stop (no self-review/merge). ``` WHAT_HAPPENED: Filed #682 after inventory found no open Gitea issue matching Starlette TestClient/httpx2 deprecation. Warning observed during PR #680 full-suite validation. Preliminary scan: ≥11 test_webui_* modules use starlette.testclient.TestClient; requirements pin starlette==1.3.1 and httpx==0.28.1; httpx2 not declared. Implementation deferred. WHY: Deprecation risk on Web UI suite / CI noise / future hard-fail on upgrade. RELATED_PRS: none yet; context PR #680 (warning surface); vision links #631 #652 #653 BLOCKERS: none VALIDATION: issue create with type:bug status:ready labels dashboard,workflow-hardening; local inventory only (no code change) LAST_UPDATED_BY: jcwalker3 (prgs-author)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#682