|
15 | 15 | from api.search import _resolve_search_results, _search_via_index |
16 | 16 | from tests.test_search_index import _index_patches, _write_session |
17 | 17 | from utils.search_index import ( |
| 18 | + IndexQueryResult, |
18 | 19 | build_search_index, |
19 | 20 | query_index_hits, |
20 | 21 | reset_background_for_tests, |
@@ -59,7 +60,7 @@ def indexed_tree(tmp_path, monkeypatch): |
59 | 60 | } |
60 | 61 |
|
61 | 62 |
|
62 | | -def _assert_sentinel_reader_result(term: str, result: dict[str, object]) -> None: |
| 63 | +def _assert_sentinel_reader_result(term: str, result: IndexQueryResult) -> None: |
63 | 64 | if result["index_locked"]: |
64 | 65 | return |
65 | 66 | if not result["query_ok"]: |
@@ -95,7 +96,7 @@ def _lock_events_satisfy_documented_contract( |
95 | 96 |
|
96 | 97 |
|
97 | 98 | def _record_lock_events_during_build( |
98 | | - cache_root, |
| 99 | + cache_root: Path, |
99 | 100 | projects: str, |
100 | 101 | ) -> list[tuple[str, str]]: |
101 | 102 | import utils.search_index as si |
@@ -168,8 +169,7 @@ def writer() -> None: |
168 | 169 |
|
169 | 170 | with patches[0]: |
170 | 171 | threads = [ |
171 | | - threading.Thread(target=reader, name=f"reader-{i}") |
172 | | - for i in range(_READER_THREADS) |
| 172 | + threading.Thread(target=reader, name=f"reader-{i}") for i in range(_READER_THREADS) |
173 | 173 | ] |
174 | 174 | threads.append(threading.Thread(target=writer, name="writer")) |
175 | 175 | for thread in threads: |
@@ -203,9 +203,7 @@ def mutator() -> None: |
203 | 203 | for i in range(5): |
204 | 204 | if stop.is_set(): |
205 | 205 | break |
206 | | - session_path = ( |
207 | | - Path(projects) / "demo-proj" / f"session_bg_{i}.jsonl" |
208 | | - ) |
| 206 | + session_path = Path(projects) / "demo-proj" / f"session_bg_{i}.jsonl" |
209 | 207 | _write_session( |
210 | 208 | session_path, |
211 | 209 | [ |
@@ -309,7 +307,9 @@ def test_index_locked_without_hits_falls_back_to_live_scan(self, indexed_tree) - |
309 | 307 | ) |
310 | 308 | assert len(hits) >= 1 |
311 | 309 |
|
312 | | - def test_search_via_index_returns_partial_hits_when_locked_after_batch(self, indexed_tree) -> None: |
| 310 | + def test_search_via_index_returns_partial_hits_when_locked_after_batch( |
| 311 | + self, indexed_tree |
| 312 | + ) -> None: |
313 | 313 | patches = _index_patches(indexed_tree["cache_root"]) |
314 | 314 | fake_hit = { |
315 | 315 | "session_id": "session_alpha", |
|
0 commit comments