diff --git a/mempalace/cli.py b/mempalace/cli.py index 1d56f88e1c..3204160e1c 100644 --- a/mempalace/cli.py +++ b/mempalace/cli.py @@ -1188,8 +1188,13 @@ def cmd_purge(args): where = clauses[0] if len(clauses) == 1 else {"$and": clauses} backend = ChromaBackend() + from .backends.base import PalaceRef + try: - col = backend.get_collection(palace_path, "mempalace_drawers") + col = backend.get_collection( + palace=PalaceRef(id=palace_path, local_path=palace_path), + collection_name="mempalace_drawers", + ) except Exception as e: print(f"\n Error reading palace: {e}") return @@ -1278,8 +1283,13 @@ def cmd_mined(args): return backend = ChromaBackend() + from .backends.base import PalaceRef + try: - col = backend.get_collection(palace_path, "mempalace_drawers") + col = backend.get_collection( + palace=PalaceRef(id=palace_path, local_path=palace_path), + collection_name="mempalace_drawers", + ) except Exception as e: print(f"\n Error reading palace: {e}") return @@ -1486,10 +1496,14 @@ def cmd_repair(args): print(f" Palace: {palace_path}") backend = ChromaBackend() + from .backends.base import PalaceRef # Try to read existing drawers try: - col = backend.get_collection(palace_path, collection_name) + col = backend.get_collection( + palace=PalaceRef(id=palace_path, local_path=palace_path), + collection_name=collection_name, + ) total = col.count() print(f" Drawers found: {total}") except Exception as e: @@ -1641,8 +1655,13 @@ def cmd_compress(args): # Connect to palace backend = ChromaBackend() + from .backends.base import PalaceRef + try: - col = backend.get_collection(palace_path, "mempalace_drawers") + col = backend.get_collection( + palace=PalaceRef(id=palace_path, local_path=palace_path), + collection_name="mempalace_drawers", + ) except Exception: print(f"\n No palace found at {palace_path}") print(" Run: mempalace init then mempalace mine ") diff --git a/tests/test_cli.py b/tests/test_cli.py index bbb3d8e901..b8c6b1e08a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1195,7 +1195,14 @@ def test_cmd_repair_uses_configured_collection(mock_config_cls, tmp_path, capsys out = capsys.readouterr().out assert "Repair complete" in out - mock_backend.get_collection.assert_called_once_with(str(palace_dir), "custom_drawers") + # Migrated to kwargs-only PalaceRef form in #37 — the assertion checks + # call shape, so it has to track the new signature. + from mempalace.backends.base import PalaceRef as _PalaceRef + + mock_backend.get_collection.assert_called_once_with( + palace=_PalaceRef(id=str(palace_dir), local_path=str(palace_dir)), + collection_name="custom_drawers", + ) assert mock_backend.create_collection.call_args_list == [ call(str(palace_dir), "custom_drawers__repair_tmp"), call(str(palace_dir), "custom_drawers"),