Skip to content

Commit e20e37b

Browse files
test: fix ruff and mypy on search-index concurrency tests
1 parent b8d7e39 commit e20e37b

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tests/test_search_index_concurrency.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from api.search import _resolve_search_results, _search_via_index
1616
from tests.test_search_index import _index_patches, _write_session
1717
from utils.search_index import (
18+
IndexQueryResult,
1819
build_search_index,
1920
query_index_hits,
2021
reset_background_for_tests,
@@ -59,7 +60,7 @@ def indexed_tree(tmp_path, monkeypatch):
5960
}
6061

6162

62-
def _assert_sentinel_reader_result(term: str, result: dict[str, object]) -> None:
63+
def _assert_sentinel_reader_result(term: str, result: IndexQueryResult) -> None:
6364
if result["index_locked"]:
6465
return
6566
if not result["query_ok"]:
@@ -95,7 +96,7 @@ def _lock_events_satisfy_documented_contract(
9596

9697

9798
def _record_lock_events_during_build(
98-
cache_root,
99+
cache_root: Path,
99100
projects: str,
100101
) -> list[tuple[str, str]]:
101102
import utils.search_index as si
@@ -168,8 +169,7 @@ def writer() -> None:
168169

169170
with patches[0]:
170171
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)
173173
]
174174
threads.append(threading.Thread(target=writer, name="writer"))
175175
for thread in threads:
@@ -203,9 +203,7 @@ def mutator() -> None:
203203
for i in range(5):
204204
if stop.is_set():
205205
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"
209207
_write_session(
210208
session_path,
211209
[
@@ -309,7 +307,9 @@ def test_index_locked_without_hits_falls_back_to_live_scan(self, indexed_tree) -
309307
)
310308
assert len(hits) >= 1
311309

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:
313313
patches = _index_patches(indexed_tree["cache_root"])
314314
fake_hit = {
315315
"session_id": "session_alpha",

0 commit comments

Comments
 (0)