File tree Expand file tree Collapse file tree
src/basic_memory/cli/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,11 +51,6 @@ def orphans(
5151
5252 try :
5353 validate_routing_flags (local , cloud )
54- # Trigger: no explicit routing flag provided.
55- # Why: orphans is a project-local graph inspection command like status.
56- # Outcome: default to local routing unless --cloud was explicitly requested.
57- if not local and not cloud :
58- local = True
5954 with force_routing (local = local , cloud = cloud ):
6055 project_name , entities = run_with_cleanup (run_orphans (project ))
6156
Original file line number Diff line number Diff line change 11"""Tests for the 'basic-memory orphans' CLI command."""
22
33import json
4- from contextlib import asynccontextmanager
4+ from contextlib import asynccontextmanager , nullcontext
55from unittest .mock import AsyncMock , MagicMock , patch
66
77from typer .testing import CliRunner
@@ -43,6 +43,19 @@ async def _fake_get_client(project_name=None):
4343 yield MagicMock ()
4444
4545
46+ @patch ("basic_memory.cli.commands.orphans.run_orphans" , new_callable = AsyncMock )
47+ @patch ("basic_memory.cli.commands.orphans.force_routing" )
48+ def test_orphans_preserves_project_routing_by_default (mock_force_routing , mock_run_orphans ):
49+ """Default invocation keeps routing implicit so project mode can choose local/cloud."""
50+ mock_force_routing .return_value = nullcontext ()
51+ mock_run_orphans .return_value = ("test-project" , [])
52+
53+ result = runner .invoke (cli_app , ["orphans" ])
54+
55+ assert result .exit_code == 0 , f"CLI failed: { result .output } "
56+ mock_force_routing .assert_called_once_with (local = False , cloud = False )
57+
58+
4659@patch ("basic_memory.cli.commands.orphans.ConfigManager" )
4760@patch ("basic_memory.cli.commands.orphans.get_active_project" , new_callable = AsyncMock )
4861@patch ("basic_memory.cli.commands.orphans.get_client" )
You can’t perform that action at this time.
0 commit comments