Private
Public Access
0
0

feat(app_controller): reset project state in _handle_reset_session

Stale project state from prior live_gui tests (shared session-scoped
subprocess) was leaking into subsequent tests, causing the
test_full_live_workflow race condition: 'Project not switched' errors
when self.project still claimed to be a different project.

The fix: _handle_reset_session now mirrors the default-project branch
of __init__ (lines 1743-1745), creating a fresh default project dict,
clearing active_project_path and project_paths, and reinitializing
the workspace manager.

- src/app_controller.py: 6 new lines in _handle_reset_session
- tests/test_handle_reset_session_clears_project.py: 3 tests
  (active_project_path, project_paths, self.project)
This commit is contained in:
2026-06-08 10:05:42 -04:00
parent abb3856525
commit 6ecb31ea0a
3 changed files with 86 additions and 6 deletions
+10 -6
View File
@@ -30,12 +30,14 @@ def test_get_project_switch_status_handles_empty_response() -> None:
def test_get_project_switch_status_default_is_idle() -> None:
"""get_project_switch_status() returns idle state when not in a live session."""
"""get_project_switch_status() returns idle state when server reports idle."""
client = ApiHookClient()
result = client.get_project_switch_status()
assert result["in_progress"] is False
assert result["path"] is None
assert result["error"] is None
with patch.object(client, "_make_request") as mock_make:
mock_make.return_value = {"in_progress": False, "path": None, "error": None}
result = client.get_project_switch_status()
assert result["in_progress"] is False
assert result["path"] is None
assert result["error"] is None
def test_live_project_switch_status_endpoint_idle(live_gui) -> None:
@@ -48,5 +50,7 @@ def test_live_project_switch_status_endpoint_idle(live_gui) -> None:
assert "error" in status
assert isinstance(status["in_progress"], bool)
assert status["in_progress"] is False, "expected no project switch in flight at session start"
assert status["path"] is None
assert status["error"] is None, f"expected no error at session start, got {status['error']!r}"
# path may be None (no project) or a str (current project loaded) - both are valid idle states
assert status["path"] is None or isinstance(status["path"], str)
assert status["error"] is None