refactor(api): remove test-only model re-export from workspaces by clean6378-max-it · Pull Request #118 · cppalliance/cppa-cursor-browser · GitHub
Skip to content

refactor(api): remove test-only model re-export from workspaces#118

Merged
wpak-ai merged 2 commits into
masterfrom
refactor/remove-test-only-reexport
Jun 24, 2026
Merged

refactor(api): remove test-only model re-export from workspaces#118
wpak-ai merged 2 commits into
masterfrom
refactor/remove-test-only-reexport

Conversation

@clean6378-max-it

@clean6378-max-it clean6378-max-it commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

closes #109

Summary

Remove the test-only from models import Bubble, Composer, Workspace # noqa: F401 re-export from api/workspaces.py. Refactor tests/test_models_wired_at_read_sites.py to patch model classes at their actual usage sites in services/ instead of relying on an API-layer re-export.

Sprint item #6 (Tuesday PR 2 of 2, 3 pt).

Problem

api/workspaces.py contained imports that existed only to support the wired-at-read-sites spy harness. That let test implementation details shape the production import surface.

Changes

  • api/workspaces.py: remove the test-only model re-export block and comment; remove unused lookup_workspace_display_name import
  • tests/test_models_wired_at_read_sites.py: retarget spy patches to real consumption sites:
    • services.workspace_db.Bubble for /api/workspaces/.../tabs bubble validation
    • services.workspace_tabs.Composer for /api/workspaces/.../tabs composer validation
    • services.workspace_resolver.Workspace for lookup_workspace_display_name

Out of scope

Test plan

  • ruff check api/workspaces.py
  • pytest tests/test_models_wired_at_read_sites.py (13 passed)
  • pytest (full suite)
  • mypy --strict (if run in CI)

Acceptance criteria

  • Re-export import and comment removed from api/workspaces.py
  • Spy tests patch model classes at actual services/ usage sites
  • Same invariant verified without API-layer re-exports
  • api/workspaces.py imports only symbols it uses (ruff F401 clean)

Summary by CodeRabbit

  • Refactor
    • Streamlined internal imports by removing unused model exports and relying on the workspace name resolver directly.
  • Tests
    • Updated regression tests to patch the model deserialization points actually used by each production read path, improving spy correctness.
    • Cleaned up an unnecessary logging import in a schema drift test.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

@clean6378-max-it clean6378-max-it self-assigned this Jun 24, 2026
@clean6378-max-it clean6378-max-it requested a review from wpak-ai June 24, 2026 12:33
wpak-ai pushed a commit that referenced this pull request Jun 24, 2026
#119)

* docs: add Google-style docstrings to public api/services/utils/models surface

* docs: correct inaccurate API and model docstrings from PR review

* docs: address PR 119 review — Google-style sections and doc accuracy

* docs: complete validate_path and get_workspace_tab docstrings

* revert(workspaces): restore lookup_workspace_display_name import for #118
@wpak-ai wpak-ai merged commit 2f728d8 into master Jun 24, 2026
16 checks passed
@wpak-ai wpak-ai deleted the refactor/remove-test-only-reexport branch June 24, 2026 15:22
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.

cppa-cursor-browser: Test spy re-import cleanup in api/workspaces.py

3 participants