Skip to content

Commit cd69c7d

Browse files
phernandezclaude
andcommitted
fix(core): finish removing semantic_search_enabled after today's merges
#1696 removed `semantic_search_enabled` from BasicMemoryConfig, but it was tested against a main that predated several milestone merges that still read the flag, so main failed static checks and most test jobs: - `index_project_and_report_readiness` (#1704) passed `embeddings=app_config.semantic_search_enabled`, which raised AttributeError on every `bm project add`. Semantic search is always on, so the add always runs the embedding pass. - test_db_reindex (#1704) parametrized the add on the flag; it now asserts the embedding pass runs. - test_deferred_embedding_resume (#1700) set the flag on its config. - test_config_env_overrides_not_persisted (#1701) used the flag as its example env-overridden boolean; it now uses `format_on_save`. Also makes #1704's cloud-prune test compare against str(Path) so it holds on Windows, where the path prints with backslashes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 61d965e commit cd69c7d

5 files changed

Lines changed: 16 additions & 20 deletions

File tree

‎src/basic_memory/cli/commands/db.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,10 @@ async def index_project_and_report_readiness(project: str) -> None:
311311
already-indexed project only redoes what changed.
312312
"""
313313
app_config = ConfigManager().config
314-
# Semantic search off is a supported configuration, not a failure, so the
315-
# embedding pass is skipped without the warning an explicit reindex prints.
316314
await _reindex(
317315
app_config,
318316
search=True,
319-
embeddings=app_config.semantic_search_enabled,
317+
embeddings=True,
320318
full=False,
321319
project=project,
322320
)

‎tests/cli/cloud/test_project_sync_command.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,14 @@ def test_cloud_prune_names_the_bmignore_in_the_config_dir(monkeypatch, config_ma
915915
"""The scan message names the real ignore file, not a hardcoded ~/.basic-memory (#1635)."""
916916
module = importlib.import_module("basic_memory.cli.commands.cloud.project_sync")
917917
_stub_prune_env(monkeypatch, module, matches=[])
918-
monkeypatch.setattr(module, "get_bmignore_path", lambda: Path("/cfg/.bmignore"))
918+
bmignore = Path("/cfg/.bmignore")
919+
monkeypatch.setattr(module, "get_bmignore_path", lambda: bmignore)
919920

920921
result = runner.invoke(app, ["cloud", "prune", "--name", "research", "--dry-run"])
921922

922923
assert result.exit_code == 0, result.output
923-
assert "matching /cfg/.bmignore" in " ".join(result.output.split())
924+
# str(Path) so the expectation matches the platform's separators (Windows CI).
925+
assert f"matching {bmignore}" in " ".join(result.output.split())
924926

925927

926928
def test_cloud_prune_help_points_at_the_config_dir():

‎tests/cli/test_db_reindex.py‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -883,17 +883,14 @@ def test_reindex_embedding_success_reports_index_and_model_and_exits_zero(
883883

884884

885885
@pytest.mark.asyncio
886-
@pytest.mark.parametrize("semantic_search_enabled", [True, False])
887-
async def test_project_add_indexing_runs_the_reindex_pass_then_reports_readiness(
888-
monkeypatch, semantic_search_enabled: bool
889-
):
886+
async def test_project_add_indexing_runs_the_reindex_pass_then_reports_readiness(monkeypatch):
890887
"""`project add` reuses the reindex pass, so its embedding phase shows the progress bar.
891888
892889
The old path made one foreground API request that embedded inline and printed
893-
nothing until it returned. Embeddings follow the config here, without the
894-
"Semantic search is not enabled" warning an explicit reindex prints.
890+
nothing until it returned. Semantic search is always on (#1696), so the add
891+
always runs the embedding pass.
895892
"""
896-
app_config = _stub_app_config(semantic_search_enabled=semantic_search_enabled)
893+
app_config = _stub_app_config()
897894
monkeypatch.setattr(db_cmd, "ConfigManager", lambda: SimpleNamespace(config=app_config))
898895
steps: list[tuple[str, object]] = []
899896

@@ -914,7 +911,7 @@ async def fake_report(project: str) -> None:
914911
"reindex",
915912
{
916913
"search": True,
917-
"embeddings": semantic_search_enabled,
914+
"embeddings": True,
918915
"full": False,
919916
"project": "research",
920917
},

‎tests/indexing/test_deferred_embedding_resume.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ async def _semantic_repository(
7171
app_config: BasicMemoryConfig,
7272
) -> SearchRepositoryBase:
7373
"""Build the backend's search repository with semantic search on a stub provider."""
74-
app_config.semantic_search_enabled = True
7574
if app_config.database_backend == DatabaseBackend.POSTGRES:
7675
async with db.scoped_session(session_maker) as session:
7776
try:

‎tests/test_config_env_overrides_not_persisted.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def file_manager(config_home: Path) -> ConfigManager:
3838
"projects": {"main": {"path": str(config_home / "main"), "mode": "local"}},
3939
"default_project": "main",
4040
"log_level": "INFO",
41-
"semantic_search_enabled": False,
41+
"format_on_save": False,
4242
}
4343
),
4444
encoding="utf-8",
@@ -50,21 +50,21 @@ def test_project_add_keeps_file_values_under_env_override(
5050
file_manager: ConfigManager, config_home: Path, monkeypatch
5151
):
5252
monkeypatch.setenv("BASIC_MEMORY_LOG_LEVEL", "DEBUG")
53-
monkeypatch.setenv("BASIC_MEMORY_SEMANTIC_SEARCH_ENABLED", "true")
53+
monkeypatch.setenv("BASIC_MEMORY_FORMAT_ON_SAVE", "true")
5454
monkeypatch.setenv("BASIC_MEMORY_CLI_OUTPUT_STYLE", "plain")
5555
_reset_config_cache()
5656

5757
# The env values are in effect for this process.
5858
loaded = file_manager.load_config()
5959
assert loaded.log_level == "DEBUG"
60-
assert loaded.semantic_search_enabled is True
60+
assert loaded.format_on_save is True
6161

6262
file_manager.add_project("leak", str(config_home / "leak"))
6363

6464
written = _read_file(file_manager)
6565
assert "leak" in written["projects"]
6666
assert written["log_level"] == "INFO"
67-
assert written["semantic_search_enabled"] is False
67+
assert written["format_on_save"] is False
6868
# The file never had this key, so the env value must not appear either.
6969
assert "cli_output_style" not in written
7070

@@ -101,7 +101,7 @@ def test_first_run_save_does_not_persist_env_values(config_home: Path, monkeypat
101101

102102
def test_explicit_key_is_persisted_despite_env_override(file_manager: ConfigManager, monkeypatch):
103103
monkeypatch.setenv("BASIC_MEMORY_LOG_LEVEL", "DEBUG")
104-
monkeypatch.setenv("BASIC_MEMORY_SEMANTIC_SEARCH_ENABLED", "true")
104+
monkeypatch.setenv("BASIC_MEMORY_FORMAT_ON_SAVE", "true")
105105
_reset_config_cache()
106106

107107
config = file_manager.load_config()
@@ -110,7 +110,7 @@ def test_explicit_key_is_persisted_despite_env_override(file_manager: ConfigMana
110110

111111
written = _read_file(file_manager)
112112
assert written["log_level"] == "WARNING"
113-
assert written["semantic_search_enabled"] is False
113+
assert written["format_on_save"] is False
114114

115115

116116
def test_legacy_sync_env_keeps_the_file_legacy_value(config_home: Path, monkeypatch):

0 commit comments

Comments
 (0)