Repository navigation
fix: reject overflowing vec_add results - #366
Open
shenxi200-eng wants to merge 1 commit into
Open
shenxi200-eng wants to merge 1 commit into
shenxi200-eng wants to merge 1 commit into
Conversation
shenxi200-eng
marked this pull request as ready for review
November 10, 2026 09:08
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed behavior — maintainer policy confirmation requested
Refs #363.
The current API reference does not specify overflow behavior. This PR proposes SQLite errors while retaining the existing result type, rather than returning wrapped int8 values or non-finite float32 vectors. Please confirm the intended policy before merging. This is an intentional compatibility change, not a claim that error-on-overflow is already documented behavior.
Changes
int, checkINT8_MIN..INT8_MAX, then narrow.isfinite()before returning the result blob. In particular, retain ordinary float32 rounding: a sum that rounds to finiteFLT_MAXis still accepted.No changes to
vec_sub, distance/normalization/index kernels, allocation-size handling, dependencies, version, or CI.Validation
Linux aarch64 scalar/default ARM paths; GCC 13.3, CPython 3.12.3, SQLite runtime 3.45.1 with official 3.45.3 build headers, NumPy 1.26.4. No GPU or model downloads.
halt_on_error=1). These additional checks are local validation, not added dependencies/tests.git diff --checkpasses; the new Python test region conforms to Black. Full-file formatting has pre-existing differences, so no global reformat was applied.Commands (after the repository's normal vendor/header setup):
make -B loadable OMIT_SIMD=1 python -m pytest -q tests/test-*.pyThe local environment lacked
envsubst, so its ignored generated header was expanded with Python using the Makefile's template values; local rebuilds usedmake -B -o sqlite-vec.h loadable OMIT_SIMD=1. No build files were changed.ASan built but could not start in this proot environment: its allocator address-range reservation failed before test execution. ASan/leak validation is therefore incomplete. SIMD, Windows/macOS, experimental IVF, and the complete CI matrix were not tested. No performance improvement is claimed.
AI assisted the implementation, tests, and code review.