Skip to content

Commit f7d2125

Browse files
committed
fix(cli): preserve orphans project routing
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 9362e1f commit f7d2125

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/basic_memory/cli/commands/orphans.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff 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

tests/cli/test_orphans_command.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Tests for the 'basic-memory orphans' CLI command."""
22

33
import json
4-
from contextlib import asynccontextmanager
4+
from contextlib import asynccontextmanager, nullcontext
55
from unittest.mock import AsyncMock, MagicMock, patch
66

77
from 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")

0 commit comments

Comments
 (0)