diff --git a/deeptutor/services/workspace/navigation.py b/deeptutor/services/workspace/navigation.py index f14a23ce0..c94cec9fa 100644 --- a/deeptutor/services/workspace/navigation.py +++ b/deeptutor/services/workspace/navigation.py @@ -23,7 +23,14 @@ async def read_workspace_indexes( ) -> tuple[list[dict[str, Any]], list[str]]: catalog = get_content_workspace_service().list_workspaces() names = {row["workspace_id"]: row["display_name"] for row in catalog} - ids = [""] + [row["workspace_id"] for row in catalog if row["kind"] == "workspace"] + # Archived workspaces are hidden everywhere else (the picker and the + # catalog resolve path both skip them), so polling them here only reports + # a folder the learner has already retired. + ids = [""] + [ + row["workspace_id"] + for row in catalog + if row["kind"] == "workspace" and not row.get("archived") + ] rows: list[dict[str, Any]] = [] unavailable: list[str] = [] for workspace_id in dict.fromkeys(ids): diff --git a/tests/services/workspace/test_navigation.py b/tests/services/workspace/test_navigation.py index 6cc3761ac..a3c5f4bf6 100644 --- a/tests/services/workspace/test_navigation.py +++ b/tests/services/workspace/test_navigation.py @@ -100,6 +100,28 @@ async def test_an_offline_workspace_does_not_hide_other_history(account): assert offline["workspace_id"] in index["unavailable_workspaces"] +@pytest.mark.asyncio +async def test_an_archived_workspace_is_not_polled(account): + from pathlib import Path + + archived = account.create_workspace("Archived") + Path(archived["path"]).rename(Path(archived["path"]).with_name("archived-moved")) + account.update_workspace(archived["workspace_id"], archived=True) + index = await session_index(50, 0) + assert archived["workspace_id"] not in index["unavailable_workspaces"] + + +@pytest.mark.asyncio +async def test_an_archived_workspace_is_not_polled(account): + from pathlib import Path + + archived = account.create_workspace("Archived") + Path(archived["path"]).rename(Path(archived["path"]).with_name("archived-moved")) + account.update_workspace(archived["workspace_id"], archived=True) + index = await session_index(50, 0) + assert archived["workspace_id"] not in index["unavailable_workspaces"] + + def test_move_rejects_combined_changes_before_mutating_either_store(account, scoped_client): target = account.create_workspace("Target")["workspace_id"] with workspace_context(""):