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

Closes out the remaining nits flagged in the round-6 review.

Critical:
- _verify_files contract comment now enumerates all None-return cases
  (404 + malformed PROPFIND XML) and documents the false-eviction
  trade-off; self-healing via re-indexing recovers
- int(r.id) cast at the SemanticSearchResult boundary now raises a
  TypeError with explicit doc_type/value context instead of bubbling
  up as an opaque "Search failed: ..." McpError

Design observations:
- nc_semantic_search_answer docstring documents the per-note
  round-trip cost from the post-verification race guard
- News verification latency hint added to configuration.md
- SemanticSearchResponse exposes verified_count + dropped_count so
  short result pages on high-ghost-density indexes are
  distinguishable from genuine scarcity. verify_search_results now
  returns (kept, dropped_count); production caller and tests updated

Minor:
- Comment clarifies the .get() fallback in verify_search_results is
  defensive only (run_verifier always populates the entry)
- Eviction task-group guard narrowed from except Exception to
  except RuntimeError (the only documented failure mode of
  TaskGroup.start_soon on a closed group)
- Indexer logs a warning when a deck_card task is missing
  board_id/stack_id, surfacing data-quality issues at index time
  rather than at verification time
- New unit test covers the news verifier's non-numeric-id fail-open
  path (one bad doc_id keeps the entire batch)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-05-01 21:02:27 +02:00
co-authored by Claude Opus 4.7
parent ffcca23a7b
commit e8df6003c5
7 changed files with 159 additions and 29 deletions
+16
View File
@@ -80,6 +80,22 @@ class SemanticSearchResponse(BaseResponse):
search_method: str = Field(
default="semantic", description="Search method used (semantic or hybrid)"
)
verified_count: int = Field(
default=0,
description=(
"Number of unique documents that passed verify-on-read access "
"checks (ADR-019). Equals len(results) before trimming to limit."
),
)
dropped_count: int = Field(
default=0,
description=(
"Number of unique documents dropped as ghost records during "
"verify-on-read (ADR-019). A short result page (len(results) < "
"limit) combined with a non-zero dropped_count indicates ghost "
"density rather than scarcity of relevant content."
),
)
class SamplingSearchResponse(BaseResponse):