Skip to content

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

Description

@clean6378-max-it

Calendar Day

Tuesday, June 23, 2026 (PR 2 of 2)

Planned Effort

3 story points — sprint item #6 (Medium)

Problem

api/workspaces.py contains an import that exists solely to support a test harness: from models import Bubble, Composer, Workspace # noqa: F401. The production module's import surface is shaped by test requirements — a test implementation detail leaks into production code. The test file tests/test_models_wired_at_read_sites.py should patch the actual consumption sites rather than relying on a re-export in the API layer.

Goal

One merged PR that removes the test-only re-export from api/workspaces.py and refactors the wired-at-read-sites test to patch model classes at their real usage sites in services/, preserving the same invariant.

Scope

Touch points

  • api/workspaces.py — remove the re-export import block and its comment
  • tests/test_models_wired_at_read_sites.py — patch services.workspace_listing.Bubble, etc. at actual usage sites

Out of scope

Acceptance Criteria

  • The re-export import and its comment block are removed from api/workspaces.py
  • tests/test_models_wired_at_read_sites.py is refactored to patch model classes at their actual usage sites in services/
  • The spy harness verifies the same invariant without depending on API-layer re-exports
  • All existing tests pass
  • api/workspaces.py imports only symbols it actually uses (ruff F401 clean without the # noqa)
  • PR approved by at least 1 reviewer

Verification

cd C:\Users\Jasen\CppAliance\cppa-cursor-browser
.\.venv\Scripts\Activate.ps1
ruff check api/workspaces.py
pytest tests/test_models_wired_at_read_sites.py
pytest

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions