fix: expose local index rebuild command

This commit is contained in:
HumbleTurtle
2026-08-27 00:41:28 -03:00
parent 35acd72e4e
commit 7eace14042
4 changed files with 55 additions and 1 deletions
+19 -1
View File
@@ -33,7 +33,7 @@ def test_root_help_exposes_only_canonical_commands(capsys):
output = capsys.readouterr().out
visible = [name for name, metadata in module.COMMAND_METADATA.items() if metadata["visible"]]
assert visible == [name for name, _summary in module.CANONICAL_COMMANDS]
assert len(visible) == 10
assert len(visible) == 11
for name in visible:
assert f" {name}" in output
for hidden in ("chat", "plan", "lineage", "agent", "feedback", "where", "install"):
@@ -101,6 +101,24 @@ def test_init_and_auth_repair_normalize_to_existing_handlers(monkeypatch):
]
def test_reindex_routes_to_worker_and_has_side_effect_free_help(monkeypatch, capsys):
module = load_installer()
calls = []
monkeypatch.setattr(
module,
"run_wrapper",
lambda command, args: calls.append((command, args)) or 0,
)
assert module.main(["nap", "reindex", "--limit", "50"]) == 0
assert calls == [("reindex", ["--limit", "50"])]
calls.clear()
assert module.main(["nap", "reindex", "--help"]) == 0
assert calls == []
assert "Usage: nap reindex [--limit N]" in capsys.readouterr().out
def test_update_does_not_overwrite_repository_source(monkeypatch, capsys):
module = load_installer()
calls = []
+16
View File
@@ -36,6 +36,22 @@ def expect_unknown(mod, argv, expected_fragment):
raise AssertionError(f"expected RuntimeError for {argv}")
def test_reindex_cli_rebuilds_with_bounded_page_size():
mod = load_module()
calls = []
mod.reindex_project = lambda args: calls.append(dict(args)) or {
"indexed": 7,
"graph_complete": True,
}
output = io.StringIO()
with contextlib.redirect_stdout(output):
mod.cli_main(["napseer_mcp_server.py", "reindex", "--limit", "50"])
assert calls == [{"limit": 50}]
assert '"indexed": 7' in output.getvalue()
def test_auth_login_rejects_history_expansion_tail_before_browser():
mod = load_module()
mod.operator_account_login = lambda _args: (_ for _ in ()).throw(