Round-10 review nit: match the defensive `str(id) == str(note_id)` pattern used
by _poll_astrolabe_search_for_note. nc_semantic_search returns int ids today
(behaviour-neutral now), but the coercion guards against a future schema change
serialising ids as strings, which would otherwise silently break the match and
time out with a generic message.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- test_no_results_for_unrelated_query: replace pytest.skip with `unrelated =
... or 0.0` and fall through. The physics query almost always returns nothing
on this corpus, so the skip meant the comparison (and the manual-is-indexed
check) never ran. Treating no-results as score 0.0 keeps the test live and
vacuously satisfies `0.0 <= relevant`.
- test_sampling: the three limit/threshold/max-tokens tests now gate on a
representative created note being searchable (search_term + note_id) instead
of a bare idle signal that can fire before the new notes are enqueued.
- _get_with_retry: only sleep between attempts, not before giving up.
- _search_helpers: log the id/doc_type schema-drift mismatch at WARNING (CI runs
--log-cli-level=WARN) so it surfaces instead of hiding behind a timeout.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- _search_helpers: wrap the json.loads(search.content[0].text) parse in
try/except (IndexError, ValueError) so empty content / malformed JSON returns
False (keep polling) instead of escaping as a confusing traceback. Also debug-
log an id match with a non-note doc_type to surface schema drift instead of
silently timing out.
- test_astrolabe_session_jwt_search: drop _get_with_retry default to
max_attempts=2 (matches the "one retry" intent) and mark both search tests
@pytest.mark.timeout(300) so a cold model load + retry can't breach the 180s
default pytest timeout.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Type the new helper signatures (CLAUDE.md A5): `mcp_client: Any` in
document_is_searchable and `nc_mcp_client: Any` in _top_score.
- _top_score: guard the results list directly (`if not results`) instead of via
total_found, so max() can't hit an empty sequence.
- _get_with_retry: replace `raise last_exc # type: ignore` with an explicit
`assert last_exc is not None` then raise — clearer intent, no suppressor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Bump nc_semantic_search limit 10->50 in document_is_searchable: a freshly
indexed note can rank below seed data (e.g. deck cards) in a crowded corpus,
and the query is cheap.
- Fix the note_id-less fallback to token-match (all words present) instead of
contiguous-substring match, so multi-word search terms work when a caller
omits note_id.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Extract the duplicated `_document_is_searchable`/`_note_is_searchable`
helpers into a shared, Playwright-free `tests/integration/_search_helpers.py`
(`document_is_searchable`), used by both the plotly and sampling tests.
- Resolve the sampling Medium finding: `wait_for_vector_sync` now triggers the
searchability path on `search_term` alone (matching the plotly variant)
instead of requiring both `search_term` and `note_id`, removing the silent
fall-through to the unreliable gauge-delta path.
- Tighten `_get_with_retry`'s `last_exc` annotation to `httpx.TransportError`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>