Skip to content

Commit d99d6b2

Browse files
HumanBean17claude
andcommitted
fix CI: lazy import refresh_decision in CLI, update MCP tools test
- Make refresh_decision import lazy inside _cmd_increment to avoid ModuleNotFoundError when running as installed entrypoint - Update test_registered_tool_surface_is_v2_navigation_only to include refresh_code_index in expected tool set - Fix CLI test mock paths to patch refresh_decision.choose_refresh_mode instead of java_codebase_rag.cli.choose_refresh_mode Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 4abbce4 commit d99d6b2

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

java_codebase_rag/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
resolve_operator_config,
2323
)
2424
from java_codebase_rag.pipeline import clip, run_build_ast_graph, run_build_ast_graph_incremental, run_cocoindex_drop, run_cocoindex_update
25-
from refresh_decision import choose_refresh_mode
2625
from java_ontology import VALID_UNRESOLVED_CALL_REASONS
2726

2827
_REFRESH_DEPRECATION = (
@@ -279,6 +278,8 @@ def _cmd_increment(args: argparse.Namespace) -> int:
279278
cfg.apply_to_os_environ()
280279

281280
def work() -> int:
281+
from refresh_decision import choose_refresh_mode
282+
282283
env = cfg.subprocess_env()
283284
verbose = bool(args.verbose)
284285

tests/test_cli_increment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_increment_dispatches_kuzu_incremental(tmp_path: Path) -> None:
6565
patch("java_codebase_rag.cli._resolved_from_ns", return_value=cfg),
6666
patch("java_codebase_rag.cli._startup_hints"),
6767
patch("java_codebase_rag.cli.run_cocoindex_update", return_value=_mock_completed_process()),
68-
patch("java_codebase_rag.cli.choose_refresh_mode", return_value=decision),
68+
patch("refresh_decision.choose_refresh_mode", return_value=decision),
6969
patch("java_codebase_rag.cli.run_build_ast_graph_incremental", return_value=_mock_completed_process()) as mock_incr,
7070
patch("java_codebase_rag.cli.run_build_ast_graph", return_value=_mock_completed_process()) as mock_full,
7171
patch("sys.stdout", new_callable=io.StringIO),
@@ -94,7 +94,7 @@ def test_increment_dispatches_kuzu_full_fallback(tmp_path: Path) -> None:
9494
patch("java_codebase_rag.cli._resolved_from_ns", return_value=cfg),
9595
patch("java_codebase_rag.cli._startup_hints"),
9696
patch("java_codebase_rag.cli.run_cocoindex_update", return_value=_mock_completed_process()),
97-
patch("java_codebase_rag.cli.choose_refresh_mode", return_value=decision),
97+
patch("refresh_decision.choose_refresh_mode", return_value=decision),
9898
patch("java_codebase_rag.cli.run_build_ast_graph_incremental", return_value=_mock_completed_process()) as mock_incr,
9999
patch("java_codebase_rag.cli.run_build_ast_graph", return_value=_mock_completed_process()) as mock_full,
100100
patch("sys.stdout", new_callable=io.StringIO),
@@ -123,7 +123,7 @@ def test_increment_removes_kuzu_warning(tmp_path: Path) -> None:
123123
patch("java_codebase_rag.cli._resolved_from_ns", return_value=cfg),
124124
patch("java_codebase_rag.cli._startup_hints"),
125125
patch("java_codebase_rag.cli.run_cocoindex_update", return_value=_mock_completed_process()),
126-
patch("java_codebase_rag.cli.choose_refresh_mode", return_value=decision),
126+
patch("refresh_decision.choose_refresh_mode", return_value=decision),
127127
patch("java_codebase_rag.cli.run_build_ast_graph_incremental", return_value=_mock_completed_process()),
128128
patch("sys.stdout", new_callable=io.StringIO),
129129
patch("sys.stderr", new_callable=io.StringIO) as mock_stderr,

tests/test_mcp_tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ async def test_registered_tool_surface_is_v2_navigation_only(mcp_server) -> None
2525
"describe",
2626
"neighbors",
2727
"resolve",
28+
"refresh_code_index",
2829
}
2930
assert names == expected
30-
assert len(names) == 5
31+
assert len(names) == 6
3132

3233

3334
async def test_all_tools_have_non_empty_description(mcp_server) -> None:

0 commit comments

Comments
 (0)