test(integration): str-coerce id comparison in document_is_searchable

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>
This commit is contained in:
Chris Coutinho
2026-06-18 00:38:28 +02:00
co-authored by Claude Opus 4.8
parent b8a9400ee0
commit 76cd716de6
+5 -1
View File
@@ -46,7 +46,11 @@ async def document_is_searchable(
tokens = search_term.lower().split() tokens = search_term.lower().split()
for r in results: for r in results:
if note_id is not None: if note_id is not None:
if r.get("id") == note_id: # str-coerce both sides: nc_semantic_search returns int ids today,
# but the Astrolabe API serialises some ids as strings — match the
# defensive comparison in _poll_astrolabe_search_for_note so a future
# schema change can't silently break the match.
if str(r.get("id")) == str(note_id):
if r.get("doc_type") == "note": if r.get("doc_type") == "note":
return True return True
# id matched but not a note — surface possible schema drift at # id matched but not a note — surface possible schema drift at