Skip to content

refactor(tests): use server import paths - #386

Merged
delete-cloud merged 2 commits into
mainfrom
refactor/test-server-imports
May 29, 2026
Merged

delete-cloud merged 2 commits into
mainfrom
refactor/test-server-imports

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • switch HTTP/session-related tests to canonical server import paths
  • keep UI compatibility imports covered with a focused compatibility test
  • preserve existing behavior while reducing reliance on legacy UI module paths

Tests

  • not run in this step; branch contains import-path-only test refactor

Summary by CodeRabbit

Release Notes

  • Refactor
    • Reorganized internal module structure to consolidate server-side implementations and improve code organization.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c85bd5aa-cd85-4e40-8cdd-946c5b96ccd6

📥 Commits

Reviewing files that changed from the base of the PR and between 04c72d5 and 452fa34.

📒 Files selected for processing (34)
  • coding-agent/src/coding_agent/ui/__init__.py
  • coding-agent/src/coding_agent/ui/http_server.py
  • coding-agent/tests/coding_agent/environment/test_docker_workspace_provider.py
  • coding-agent/tests/coding_agent/plugins/test_parallel_executor.py
  • coding-agent/tests/coding_agent/test_approval_runtime_messages.py
  • coding-agent/tests/coding_agent/test_bee_command_bridge.py
  • coding-agent/tests/coding_agent/test_bee_runtime.py
  • coding-agent/tests/coding_agent/test_bee_template_pack_smoke.py
  • coding-agent/tests/coding_agent/test_bee_workspace.py
  • coding-agent/tests/coding_agent/test_cross_topic_memory_smoke.py
  • coding-agent/tests/coding_agent/test_external_executor_smoke.py
  • coding-agent/tests/coding_agent/test_observability_platform_smoke.py
  • coding-agent/tests/coding_agent/test_pipeline_adapter.py
  • coding-agent/tests/coding_agent/test_scheduled_runs.py
  • coding-agent/tests/coding_agent/test_topic_layer_smoke.py
  • coding-agent/tests/coding_agent/test_workspace_action_routing.py
  • coding-agent/tests/coding_agent/tools/test_subagent.py
  • coding-agent/tests/dogfood/test_local_dogfood_run.py
  • coding-agent/tests/dogfood/test_workspace_provider_demo.py
  • coding-agent/tests/integration/test_durable_runtime_smoke.py
  • coding-agent/tests/integration/test_wire_http_integration.py
  • coding-agent/tests/ui/test_developer_console.py
  • coding-agent/tests/ui/test_execution_binding.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
  • coding-agent/tests/ui/test_server_compat_imports.py
  • coding-agent/tests/ui/test_session_manager_approval_runtime.py
  • coding-agent/tests/ui/test_session_manager_owner_checks.py
  • coding-agent/tests/ui/test_session_manager_public_api.py
  • coding-agent/tests/ui/test_session_manager_runtime.py
  • coding-agent/tests/ui/test_session_owner_store.py
  • coding-agent/tests/ui/test_session_persistence.py

📝 Walkthrough

Walkthrough

This PR consolidates the coding_agent.ui layer into a thin compatibility shim that forwards all exports to coding_agent.server. The HTTP server module and package __getattr__ are rewritten to alias from the server implementation, and all 40+ test files are updated to import from server modules directly.

Changes

UI Layer Consolidation

Layer / File(s) Summary
UI compatibility alias implementation
coding_agent/src/coding_agent/ui/__init__.py, coding_agent/src/coding_agent/ui/http_server.py
UI package __getattr__ and HTTP server module are rewritten as compatibility aliases; app and wait_for_approval import from coding_agent.server.http_server, and the HTTP server module copies server module attributes into globals() and registers itself in sys.modules under both module names.
UI-to-server alias verification tests
coding_agent/tests/ui/test_server_compat_imports.py
New test file with two functions verifying that legacy UI module imports resolve to canonical server modules and that selected UI symbols (verify_api_key, AuthContext, CreateSessionRequest, ApprovalResponseSchema) are identical to server counterparts.
HTTP server tests migrated to server implementation
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, coding_agent/tests/coding_agent/test_observability_platform_smoke.py
Imports and monkeypatch targets updated to reference coding_agent.server.http_server instead of UI module; all test logic for cloud workspace config, GC, lifespan, SSE streaming, publication, and retention helpers remains unchanged.
Session manager and store tests migrated to server implementation
coding_agent/tests/ui/test_session_manager_*.py, coding_agent/tests/ui/test_session_persistence.py, coding_agent/tests/ui/test_session_owner_store.py
Session manager, ownership conflict, and persistence tests now import from coding_agent.server.session_manager, coding_agent.server.stores.session_owner_store, and coding_agent.server.stores.session_store; monkeypatch targets for PipelineAdapter, storage loaders, and async helpers updated to server module paths.
Developer console and binding resolver tests migrated to server implementation
coding_agent/tests/coding_agent/test_bee_*.py, coding_agent/tests/coding_agent/test_*_smoke.py, coding_agent/tests/ui/test_execution_binding.py
Imports for render_console_*, console page/summary types, and binding resolver symbols updated to source from coding_agent.server.developer_console and coding_agent.server.binding_resolver instead of UI modules.
Session ownership error and execution binding tests migrated to server implementation
coding_agent/tests/coding_agent/plugins/test_parallel_executor.py, coding_agent/tests/coding_agent/test_pipeline_adapter.py, coding_agent/tests/coding_agent/tools/test_subagent.py, coding_agent/tests/coding_agent/test_workspace_action_routing.py
Session ownership error and execution binding imports updated to source from coding_agent.server.stores.session_owner_store and coding_agent.server.execution_binding.
Integration and dogfood tests migrated to server implementation
coding_agent/tests/integration/test_durable_runtime_smoke.py, coding_agent/tests/integration/test_wire_http_integration.py, coding_agent/tests/dogfood/test_*.py, coding_agent/tests/ui/test_developer_console.py
HTTP app, session manager, and session store imports updated to coding_agent.server.*; embedded subprocess test scripts similarly updated to import from server modules; monkeypatch targets for PipelineAdapter and module initialization updated.
Test framework and approval workflow tests migrated to server implementation
coding_agent/tests/coding_agent/test_approval_runtime_messages.py
Session manager and store imports updated to import from coding_agent.server modules.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#380: Moves SessionManager into coding_agent.server.session_manager, which this PR aligns with by migrating all test imports to the same server location.
  • delete-cloud/Coding-Agent-Loop#112: Introduces cloud-workspace config and binding-resolver wiring in coding_agent.ui.http_server, which this PR supersedes by converting the UI HTTP server into an alias of the server implementation.
  • delete-cloud/Coding-Agent-Loop#383: Refactors rate-limit initialization to import from coding_agent.server.rate_limit, which this PR aligns with by migrating security tests to import limiter from the server HTTP module.

Poem

🐰 Hop skip and a jump, the imports take flight,
From ui to server, now module paths are right!
Aliases forward with elegance true,
One source of truth—goodbye, old ui brew! ✨

✨ 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 refactor/test-server-imports

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 0181e30 into main May 29, 2026
1 check was pending
@delete-cloud
delete-cloud deleted the refactor/test-server-imports branch May 29, 2026 18:42
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