test(integration): address round-4 review — type hints & small robustness

- Type the new helper signatures (CLAUDE.md A5): `mcp_client: Any` in
  document_is_searchable and `nc_mcp_client: Any` in _top_score.
- _top_score: guard the results list directly (`if not results`) instead of via
  total_found, so max() can't hit an empty sequence.
- _get_with_retry: replace `raise last_exc  # type: ignore` with an explicit
  `assert last_exc is not None` then raise — clearer intent, no suppressor.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-06-17 23:04:26 +02:00
co-authored by Claude Opus 4.8
parent 367afa0402
commit 7c13c6e49a
3 changed files with 8 additions and 5 deletions
+4 -3
View File
@@ -405,7 +405,7 @@ async def test_retrieval_quality_all_queries(
)
async def _top_score(nc_mcp_client, query: str) -> float | None:
async def _top_score(nc_mcp_client: Any, query: str) -> float | None:
"""Return the best fusion score for ``query``, or None if no results."""
result = await nc_mcp_client.call_tool(
"nc_semantic_search",
@@ -413,9 +413,10 @@ async def _top_score(nc_mcp_client, query: str) -> float | None:
)
assert result.isError is False
data = json.loads(result.content[0].text)
if data["total_found"] == 0:
results = data.get("results", [])
if not results: # guard the list directly, not via total_found
return None
return max(r["score"] for r in data["results"])
return max(r["score"] for r in results)
async def test_no_results_for_unrelated_query(nc_mcp_client, indexed_manual_pdf):