Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(tests): count keyless candidate_files the way the citation rule serves them (#3122)

Raghav Chamadiya8d0d98b61d11
diff --git a/tests/unit/server/mcp/test_answer_shortlist.py b/tests/unit/server/mcp/test_answer_shortlist.py
index f5da8643f..5a4337a20 100644
--- a/tests/unit/server/mcp/test_answer_shortlist.py
+++ b/tests/unit/server/mcp/test_answer_shortlist.py
@@ -65,8 +65,12 @@ def test_low_and_degraded_slim_the_guesses(confidence, extra):
"score": 3.0,
"functions": [{"name": "run_0", "line": 10}],
}
- # candidate_files keeps its bare-path shape at every grade.
- assert out["candidate_files"] == [p for p in _POOL if p != "src/pkg/f1.py"][:5]
+ # candidate_files keeps its bare-path shape and rank order at every grade.
+ # How many it serves on a degraded answer is the citation-order tests' concern.
+ ranked = [p for p in _POOL if p != "src/pkg/f1.py"]
+ served = out["candidate_files"]
+ assert served and served == ranked[: len(served)]
+ assert len(served) == (5 if confidence == "low" else 4)
assert "_candidate_file_facts" not in out