Skip to content

Commit 6d88583

Browse files
jope-bmclaude
andcommitted
fix: pass workspace to factory client and fix pyright errors
Pass the workspace param through to get_client() in factory mode so the fetched projects match the workspace metadata. Also fix pyright type errors in tests (missing isinstance assertion, missing organization_id param). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Joe P <joe@basicmemory.com>
1 parent 1630456 commit 6d88583

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/basic_memory/mcp/tools/project_management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ async def list_memory_projects(
199199
# Why: there is no local ASGI server; the factory IS the cloud source
200200
# Outcome: single fetch, projects reported as source="cloud" with workspace metadata
201201
if is_factory_mode():
202-
async with get_client() as client:
202+
async with get_client(workspace=workspace) as client:
203203
project_client = ProjectClient(client)
204204
project_list = await project_client.list_projects()
205205

tests/mcp/test_tool_project_management.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ async def test_list_memory_projects_factory_mode_explicit_workspace(app, test_pr
334334
):
335335
result = await list_memory_projects(output_format="json", workspace="tenant-org")
336336

337+
assert isinstance(result, dict)
337338
proj = result["projects"][0]
338339
assert proj["workspace_name"] == "Acme Corp"
339340
assert proj["workspace_type"] == "organization"
@@ -467,7 +468,11 @@ def test_merge_projects_overlap():
467468

468469

469470
def _make_workspace(
470-
tenant_id: str, name: str, workspace_type: str = "personal", role: str = "owner"
471+
tenant_id: str,
472+
name: str,
473+
workspace_type: str = "personal",
474+
role: str = "owner",
475+
organization_id: str | None = None,
471476
):
472477
"""Create a WorkspaceInfo for testing."""
473478
from basic_memory.schemas.cloud import WorkspaceInfo
@@ -477,6 +482,7 @@ def _make_workspace(
477482
name=name,
478483
workspace_type=workspace_type,
479484
role=role,
485+
organization_id=organization_id,
480486
has_active_subscription=True,
481487
)
482488

0 commit comments

Comments
 (0)