Skip to content

test: isolate HTTP session manager fixtures - #569

Merged
delete-cloud merged 1 commit into
mainfrom
fix/http-test-fenced-manager-fixture
Jun 12, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
fix/http-test-fenced-manager-fixture

Conversation

@delete-cloud

@delete-cloud delete-cloud commented Jun 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add shared isolated_http_session_manager fixture for HTTP tests that still use synchronous session cleanup
  • migrate the fix: fail loud on unfenced durable config #568-affected HTTP/UI/integration test modules to the shared unfenced test manager
  • explicitly install an unfenced manager in the live-server subprocess test, which cannot inherit pytest fixtures
  • update the developer console smoke assertion to the current Display Events label exposed by the page

Verification

  • uv run pytest tests/ui/test_developer_console.py tests/ui/test_security.py tests/integration/test_wire_http_integration.py tests/ui/test_http_server_workspace_transfer.py tests/integration/test_durable_runtime_smoke.py tests/ui/test_http_server.py tests/ui/test_http_server_failover.py -q (387 passed, 1 skipped)
  • uv run ruff check tests/conftest.py tests/ui/test_http_server.py tests/ui/test_http_server_failover.py tests/ui/test_security.py tests/ui/test_developer_console.py tests/integration/test_wire_http_integration.py tests/ui/test_http_server_workspace_transfer.py tests/integration/test_durable_runtime_smoke.py
  • uv run ruff format --check tests/conftest.py tests/ui/test_http_server.py tests/ui/test_http_server_failover.py tests/ui/test_security.py tests/ui/test_developer_console.py tests/integration/test_wire_http_integration.py tests/ui/test_http_server_workspace_transfer.py tests/integration/test_durable_runtime_smoke.py
  • git diff --check
  • uv run pytest tests/ -q (33 failed, 3622 passed, 4 skipped, 0 errors; remaining failures match pre-existing old-debt areas, while the fix: fail loud on unfenced durable config #568 setup ERROR regression is cleared)

Summary by CodeRabbit

  • Tests

    • Improved test infrastructure for session isolation and cleanup across integration and unit test suites.
  • Chores

    • Refactored internal test fixtures to enhance reliability and maintainability.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR consolidates HTTP session manager isolation logic into a single centralized pytest fixture and updates all test modules across the integration and UI test suites to use it. Previously, each test module manually managed global session state; now they delegate to a shared isolated_http_session_manager fixture that guarantees consistent setup, teardown, and cleanup behavior.

Changes

Test Session Isolation Refactoring

Layer / File(s) Summary
Core isolation fixture creation
coding-agent/tests/conftest.py
Introduces isolated_http_session_manager async fixture that creates temporary SQLite-backed SessionManager, replaces global http_server.session_manager, resets Prometheus metrics and HTTP rate limiter, configures owner/workspace/runtime stores to None, clears sessions, and performs comprehensive cleanup (reset metrics/limiter, close manager, restore original globals) on teardown.
Integration test module adoption
coding-agent/tests/integration/test_durable_runtime_smoke.py, coding-agent/tests/integration/test_wire_http_integration.py
Updates _clean_http_server_state fixture in durable runtime tests to accept isolated_http_session_manager, reconfigure leases/stores, and reset limiter; refactors clear_sessions in wire integration tests to use the new fixture and updates subprocess server script to create its own isolated SessionManager(storage_config={"runtime_backend": "none"}) and assign it to http_server.session_manager.
UI test module fixture consolidation
coding-agent/tests/ui/test_developer_console.py, coding-agent/tests/ui/test_http_server.py, coding-agent/tests/ui/test_http_server_failover.py, coding-agent/tests/ui/test_http_server_workspace_transfer.py, coding-agent/tests/ui/test_security.py
Refactors all UI test modules to depend on isolated_http_session_manager instead of manually clearing sessions; imports SessionManager type; removes explicit session_manager.clear_sessions() calls and prior session-reset-only test assertions; updates console state fixture to reset metrics before and after yield; updates workspace transfer fixture to reset owner leases and limiter before and after yield; changes one UI text label from "Runtime Events" to "Display Events".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#380: Main PR's session-manager fixture refactoring depends on canonical SessionManager sourcing from coding_agent.server.session_manager via http_server.
  • delete-cloud/Coding-Agent-Loop#81: Main PR refactors clear_sessions autouse fixture in tests/ui/test_http_server_failover.py to use new isolated_http_session_manager, directly aligning failover/SSE tests with updated session-isolation setup.
  • delete-cloud/Coding-Agent-Loop#118: Both PRs touch tests/ui/test_http_server_workspace_transfer.py; main PR refactors clear_sessions/owner-lease setup to work with isolated SessionManager, aligning test fencing for workspace-export 409/conflict tests.

Poem

🐰 Sessions now isolated, pure and clean,
Each test gets its own SQLite dream,
Fixtures centralized, logic set free,
No more state chaos—just harmony! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: introducing an isolated HTTP session manager fixture pattern across test files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/http-test-fenced-manager-fixture

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@delete-cloud
delete-cloud merged commit 95106b1 into main Jun 12, 2026
1 check was pending
@delete-cloud
delete-cloud deleted the fix/http-test-fenced-manager-fixture branch June 12, 2026 03:25
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