refactor(search): pre-push review fixes for PR #750

Address findings surfaced by `pre-push-review` after the round 8 sweep:

- Add deck verifier symmetry tests (404, transient 5xx, unexpected
  exception, non-numeric metadata) so deck has the same shape as the
  notes/news/files verifiers. Also add unexpected-exception tests for
  the news and file verifiers, which had `except Exception` branches
  no test was reaching. Keeps the registry-style verifier coverage
  uniform.
- Modernize sibling field types in `VectorSyncState`, `AppContext`,
  and `OAuthAppContext` from `Optional[X]` to `X | None`, matching the
  `eviction_task_group: TaskGroup | None` field added in the round 8
  diff (resolves the inconsistency flagged by A6). The lone remaining
  `Optional` import is dropped.
- Reverse cross-reference direction in the verifier docstrings: the
  later-defined `_verify_deck_cards` and `_verify_news_items` now
  point at `_verify_notes` as the canonical hoisted-cast pattern,
  rather than `_verify_notes` forward-referring to verifiers defined
  below it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-05-01 21:57:38 +02:00
co-authored by Claude Opus 4.7
parent 06fe3916e7
commit 3153c9dac4
3 changed files with 195 additions and 23 deletions
+5 -4
View File
@@ -72,8 +72,9 @@ async def _verify_notes(
doc_id = result.id
# Parse defensively before the network call so a malformed payload
# produces a specific log line, not a generic "unexpected error"
# from the catch-all ``except Exception`` below. The parallel
# implementation in ``_verify_deck_cards`` follows the same pattern.
# from the catch-all ``except Exception`` below. ``_verify_notes``
# is the canonical shape; ``_verify_deck_cards`` and
# ``_verify_news_items`` mirror this hoisted-cast pattern.
try:
note_id_int = int(doc_id)
except (TypeError, ValueError) as e:
@@ -210,8 +211,8 @@ async def _verify_deck_cards(
# Parse defensively before the network call so a malformed payload
# produces a specific log line, not a generic "unexpected error"
# from the catch-all ``except Exception`` below. The parallel
# implementation in ``_verify_news_items`` follows the same pattern.
# from the catch-all ``except Exception`` below. Mirrors the
# canonical hoisted-cast pattern in ``_verify_notes``.
try:
board_id_int = int(board_id)
stack_id_int = int(stack_id)