fix(vector): guard _group_int_doc_ids against non-int doc_id values
Skip and warn instead of stringifying floats / unexpected types in the backfill helper. A stray doc_id=3.0 would otherwise be rewritten to "3.0", which producers (str(int)) and the keyword index would never match, and which int() on the verification side would reject. Also add a doc_id=0 case to the backfill test to guard against a future falsy-skip regression. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
fc9786c3a9
commit
64f0842977
@@ -161,6 +161,18 @@ def _group_int_doc_ids(points: list[Any]) -> tuple[dict[str, list[Any]], int]:
|
||||
value = payload.get("doc_id")
|
||||
if value is None or isinstance(value, str):
|
||||
continue
|
||||
if not isinstance(value, int):
|
||||
# Producers only ever write int or str; anything else is a
|
||||
# producer bug. Stringifying e.g. a float would write "3.0",
|
||||
# which producers (str(int)) and the keyword index would
|
||||
# never match, and which int() on the verification side
|
||||
# would later reject. Skip and log loudly instead.
|
||||
logger.warning(
|
||||
"Unexpected doc_id type %s on point %s; skipping rewrite",
|
||||
type(value).__name__,
|
||||
point.id,
|
||||
)
|
||||
continue
|
||||
by_value.setdefault(str(value), []).append(point.id)
|
||||
return by_value, scanned
|
||||
|
||||
|
||||
Reference in New Issue
Block a user