refactor(search): address PR #750 round 8 review feedback

- Rename `verified_count` → `verified_chunk_count` to make the count
  granularity explicit at the field name (chunks vs unique docs).
- News verifier now fails open *per-item* on non-numeric stored doc_ids
  (matches notes/files/deck shape); a single bad id no longer rescues
  definitively-missing siblings from eviction.
- Update note-verifier integration test to use string doc_ids end-to-end
  to match production storage (scanner.py:241 stringifies note ids).
- Add regression test for the closed-task-group race guard in
  `verify_search_results` so the RuntimeError swallow is locked in.
- Convert remaining f-string logger calls in `server/semantic.py` to
  lazy %-style formatting (per repo convention).
- Document `evict_on_missing` as a developer/test flag (no env var) and
  flag the `get_file_info` 404→raise contract change in its docstring.
- Add a TODO(ADR-019) breadcrumb for the hardcoded 2× over-fetch so
  future tuning has a clear hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-05-01 21:40:30 +02:00
co-authored by Claude Opus 4.7
parent 3e981e647a
commit 8a2626da6c
6 changed files with 252 additions and 76 deletions
+4 -6
View File
@@ -80,16 +80,14 @@ class SemanticSearchResponse(BaseResponse):
search_method: str = Field(
default="semantic", description="Search method used (semantic or hybrid)"
)
verified_count: int = Field(
verified_chunk_count: int = Field(
default=0,
description=(
"Number of search result chunks that passed verify-on-read "
"access checks (ADR-019). Equals len(verified_results) before "
"trimming to limit. Note: multiple chunks of the same document "
"are counted separately here, whereas dropped_count counts "
"unique (doc_id, doc_type) pairs — the asymmetry is intentional "
"(verified_count is sized in result rows, dropped_count is "
"sized in unique ghost documents)."
"trimming to limit. Sized in chunks (result rows), NOT in "
"unique documents — pair with dropped_count carefully: "
"dropped_count is sized in unique (doc_id, doc_type) pairs."
),
)
dropped_count: int = Field(