Commit graph

133 commits

Author SHA1 Message Date
Alex Garcia
d04e2aeda1 Fix remaining fuzzer issues: leaks and macOS SDK headers
sqlite-vec.c:
- vec0_free: add loops to free partition, auxiliary, and metadata
  column names (previously leaked on error paths)
- vec0_init: update pNew->numXxxColumns incrementally in the parse
  loop so vec0_free sees correct counts on early goto-error paths
  (previously the counts were only written after the loop, so vec0_free
  would loop 0 times and leak names allocated inside the loop)

fuzz.yaml:
- macOS: pass -isysroot $(xcrun --sdk macosx --show-sdk-path) so
  Xcode clang can find system headers (stdio.h, assert.h, etc.)
- Fix artifact upload paths: libFuzzer writes crash-*/leak-* to
  the cwd (repo root), not tests/fuzz/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:35:41 -08:00
Alex Garcia
e4b1e264b5 Fix macOS fuzz: use Xcode clang instead of Homebrew LLVM
Homebrew LLVM 18's ASAN/libFuzzer runtimes contain weak-def symbols
for typed allocation operators (__ZnwmSt19__type_descriptor_t) that
don't exist in macOS 14's system libc++. Since the symbol is embedded
in the pre-built runtime dylibs (not our code), link-time flags cannot
fix it.

Switch to Apple's Xcode clang which ships its own libFuzzer and ASAN
runtime built against the system libc++ — no ABI mismatch possible.
No Homebrew LLVM install needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 10:44:39 -08:00
Alex Garcia
b93a669224 Fix macOS fuzz: explicitly link LLVM libc++ to avoid weak-def symbol error
The fuzz targets were crashing on macOS 14 with:
  dyld: weak-def symbol not found '__ZnwmSt19__type_descriptor_t'

libFuzzer compiled with LLVM 18 uses typed allocation ABI symbols
not present in macOS 14's system libc++. Since DYLD_LIBRARY_PATH
cannot override SIP-protected /usr/lib/libc++.1.dylib at runtime,
we fix this at link time:
- -nostdlib++: suppress implicit system libc++ linking
- -L$LLVM/lib/c++ -lc++: explicitly link LLVM's libc++ (which has the symbol)
- -Wl,-rpath,$LLVM/lib/c++: embed rpath so dyld finds LLVM's libc++ at runtime

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 10:06:36 -08:00
Alex Garcia
1b53b942e0 Fix remaining fuzzer issues: leaks, UBSAN NaN, macOS LLVM version
- fuzz.yaml: switch macOS to llvm@18 (latest LLVM uses typed allocation
  C++ ABI symbols not available on macOS 14 runner's system libc++)
- sqlite-vec.c: fix NaN input in vec_quantize_int8 by using !(val <= X)
  comparisons which evaluate to true for NaN, ensuring the clamp fires
- sqlite-vec.c: free pzErrMsg in vec_eachFilter error path (was leaking
  the error string returned by vector_from_value)
- sqlite-vec.c: add sqlite3_free(pNew) to vec0_init error path; vec0_free
  frees the contents but not the struct itself, mirroring vec0Disconnect
- sqlite-vec.c: free knn_data in vec0Filter_knn cleanup when rc != SQLITE_OK;
  on error the cursor's knn_data field is never set so it would not be
  freed by the cursor teardown path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 08:36:59 -08:00
Alex Garcia
8c976205dd gha: bump windows runners 2026-03-03 07:22:04 -08:00
Alex Garcia
cdbc34785f Fix fuzzer-found bugs and CI build issues
- fuzz.yaml: embed rpath to Homebrew LLVM's libc++ so macOS binaries can
  find the right C++ runtime at load time (fixes dyld weak-def crash)
- fuzz.yaml: add `make sqlite-vec.h` step on all platforms before building
  fuzz targets (the header is generated from a template, not checked in)
- fuzz.yaml: drop llvm version pin on Windows so choco succeeds when a
  newer LLVM is already installed on the runner
- sqlite-vec.c: change fvec_cleanup / fvec_cleanup_noop to take void*
  instead of f32* so they are ABI-compatible with vector_cleanup; removes
  UBSAN indirect-call errors at many call sites
- sqlite-vec.c: copy BLOB data into sqlite3_malloc'd buffer in
  fvec_from_value instead of aliasing the raw blob pointer, fixing UBSAN
  misaligned-load errors when SQLite hands us an unaligned blob
- sqlite-vec.c: guard npy_token_next string scan with ptr < end check
  before the closing-quote dereference (heap-buffer-overflow)
- sqlite-vec.c: clamp vec_quantize_int8 intermediate value to [-128, 127]
  before casting to i8 (UBSAN out-of-range conversion)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 07:16:33 -08:00
Alex Garcia
b1a02195d9 gha: attempt fuzz fixing 2026-03-03 06:44:35 -08:00
Alex Garcia
4418a341e0 Add GitHub Actions CI workflow for fuzz testing
Runs on push to main, nightly at 2am UTC, and manual dispatch.
Linux (ubuntu-22.04) and macOS (macos-14) are fully supported.
Windows (windows-2022) is best-effort with continue-on-error.
Crash artifacts are uploaded on failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 20:34:30 -08:00
Alex Garcia
0eb855ca67 gha: bump site runner 2026-03-01 21:43:43 -08:00
Alex Garcia
563a3e60f8 bump deploy pages 2026-02-13 10:04:59 -08:00
Alex Garcia
1953d776a6 gha: linux-arm setup uv 2026-02-13 09:53:47 -08:00
Alex Garcia
5674c14b0a gha: update linux arm runner 2026-02-13 09:52:06 -08:00
Alex Garcia
5f0e6e506f gha: use new sqlite-dist workflow 2026-02-13 09:46:40 -08:00
Alex Garcia
f27a3d3432 gha: npm publish --tag bruh 2026-02-13 08:47:49 -08:00
Alex Garcia
692ac21581 gha: npm publish requires --tag 2026-02-13 08:42:13 -08:00
Alex Garcia
c2f4d11b94 gha: bump node version? 2026-02-13 08:21:54 -08:00
Alex Garcia
831f4acbfd gha: OIDC unset NODE_AUTH_TOKEN 2026-02-13 08:16:02 -08:00
Alex Garcia
9333e62bdc npm oidc 2026-02-13 08:07:55 -08:00
Alex Garcia
6bf347fbba release env 2026-02-13 08:04:03 -08:00
Alex Garcia
aa2c61091e release script updates 2026-02-13 07:21:18 -08:00
Alex Garcia
1cbe22c78b build fixes, uv for testing 2026-02-13 06:48:07 -08:00
Alex Garcia
7748ad0b3a include linux-arm64 in npm builds 2025-01-10 13:17:38 -08:00
Alex Garcia
a223f5f17c macos-12 runner deprecated, bump to macos-13 2025-01-10 11:21:11 -08:00
Luke Hinds
cc7c29ec2f
Fix build for linux-aarch64 and clean up Android dupes (#160)
- Switched to the correct compiler (gcc-aarch64-linux-gnu) for linux-aarch64 builds to ensure 64-bit binaries are generated.
- Removed duplicate artifact upload for sqlite-vec-android-armv7a-extension in the dist job.

Resolves: #159
2025-01-10 11:15:11 -08:00
Alex Garcia
4c6baab632 skip test on windows releases 2024-11-20 06:52:07 -08:00
Alex Garcia
d54a0f4eb2 cleanup 2024-11-20 06:48:13 -08:00
Alex Garcia
352f953fc0
Metadata filtering (#124)
* initial pass at PARTITION KEY support.

* Initial pass, allow auxiliary columns on vec0 virtual tables

* update TODO

* Initial pass at metadata filtering

* unit tests

* gha this PR branch

* fixup tests

* doc internal

* fix tests, KNN/rowids in

* define SQLITE_INDEX_CONSTRAINT_OFFSET

* whoops

* update tests, syrupy, use uv

* un ignore pyproject.toml

* dot

* tests/

* type error?

* win: .exe, update error name

* try fix macos python, paren around expr?

* win bash?

* dbg :(

* explicit error

* op

* dbg win

* win ./tests/.venv/Scripts/python.exe

* block UPDATEs on partition key values for now

* test this branch

* accidentally removved "partition key type mistmatch" block during merge

* typo ugh

* bruv

* start aux snapshots

* drop aux shadow table on destroy

* enforce column types

* block WHERE constraints on auxiliary columns in KNN queries

* support delete

* support UPDATE on auxiliary columns

* test this PR

* dont inline that

* test-metadata.py

* memzero text buffer

* stress test

* more snpashot tests

* rm double/int32, just float/int64

* finish type checking

* long text support

* DELETE support

* UPDATE support

* fix snapshot names

* drop not-used in eqp

* small fixes

* boolean comparison handling

* ensure error is raised when long string constraint

* new version string for beta builds

* typo whoops

* ann-filtering-benchmark directory

* test-case

* updates

* fix aux column error when using non-default rowid values, needs test

* refactor some text knn filtering

* rowids blob read only on text metadata filters

* refactor

* add failing test causes for non eq text knn

* text knn NE

* test cases diff

* GT

* text knn GT/GE fixes

* text knn LT/LE

* clean

* vtab_in handling

* unblock aux failures for now

* guard sqlite3_vtab_in

* else in guard?

* fixes and tests

* add broken shadow table test

* rename _metadata_chunksNN shadown table to _metadatachunksNN, for proper shadowName detection

* _metadata_text_NN shadow tables to _metadatatextNN

* SQLITE_VEC_VERSION_MAJOR SQLITE_VEC_VERSION_MINOR and SQLITE_VEC_VERSION_PATCH in sqlite-vec.h

* _info shadow table

* forgot to update aux snapshot?

* fix aux tests
2024-11-20 00:59:34 -08:00
Alex Garcia
9bfeaa7842
Auxiliary column support (#123)
* initial pass at PARTITION KEY support.

* Initial pass, allow auxiliary columns on vec0 virtual tables

* update TODO

* unit tests

* gha this PR branch

* fixup tests

* doc internal

* fix tests, KNN/rowids in

* define SQLITE_INDEX_CONSTRAINT_OFFSET

* whoops

* update tests, syrupy, use uv

* un ignore pyproject.toml

* dot

* tests/

* type error?

* win: .exe, update error name

* try fix macos python, paren around expr?

* win bash?

* dbg :(

* explicit error

* op

* dbg win

* win ./tests/.venv/Scripts/python.exe

* block UPDATEs on partition key values for now

* test this branch

* accidentally removved "partition key type mistmatch" block during merge

* typo ugh

* bruv

* start aux snapshots

* drop aux shadow table on destroy

* enforce column types

* block WHERE constraints on auxiliary columns in KNN queries

* support delete

* support UPDATE on auxiliary columns
2024-11-20 00:30:23 -08:00
Alex Garcia
6658624172
PARTITION KEY support (#122)
* initial pass at PARTITION KEY support.

* unit tests

* gha this PR branch

* fixup tests

* doc internal

* fix tests, KNN/rowids in

* define SQLITE_INDEX_CONSTRAINT_OFFSET

* whoops

* update tests, syrupy, use uv

* un ignore pyproject.toml

* dot

* tests/

* type error?

* win: .exe, update error name

* try fix macos python, paren around expr?

* win bash?

* dbg :(

* explicit error

* op

* dbg win

* win ./tests/.venv/Scripts/python.exe

* block UPDATEs on partition key values for now
2024-11-20 00:02:04 -08:00
Alex Garcia
9780f6d445 bump dist to fix linux arm builds 2024-11-15 11:17:55 -08:00
Alex Garcia
04c6da4c62 update linux arm builds 2024-11-15 10:43:44 -08:00
Alex Garcia
7991cd734b gha: no -DSQLITE_CORE on pyodide build, shouldn't need it? 2024-11-08 21:49:10 -08:00
Alex Garcia
1f60587b0c run site deploy only when site changes 2024-11-08 21:48:42 -08:00
Alex Garcia
aae35ce106 try pyodide build 2024-11-08 21:46:41 -08:00
Alex Garcia
12259dc35e gha: get-measurement 2024-11-04 16:56:33 -08:00
Alex Garcia
beba23f17d try arm build, measure energy 2024-11-04 16:53:10 -08:00
Alex Garcia
b8fadf6afb bump sqlite-dist 2024-10-11 09:38:34 -07:00
Alex Garcia
b6245e21a2 bump sqlite-dist 2024-10-11 09:08:41 -07:00
Alex Garcia
6b1b59eea9 bump sqlite-dist v0.0.1-alpha.14 2024-09-16 10:47:37 -07:00
Alex Garcia
6f75fc327f android+ios release artifacts 2024-09-12 17:28:55 -07:00
Alex Garcia
a4811fcaa8 gha: ios run x86 build on macos-12 2024-09-12 16:10:58 -07:00
Alex Garcia
94fd29fc2d gha: clenaup android matrix 2024-09-12 16:09:42 -07:00
Alex Garcia
3b898c523b try more ios targets 2024-09-12 16:07:00 -07:00
Alex Garcia
bdbb00b636 gha: include-hidden-files: true smh 2024-09-07 10:05:36 -07:00
Alex Garcia
6d672fbc4f gha: include-hidden-files smh 2024-09-07 10:03:12 -07:00
Alex Garcia
5a1cd93074 gha: wasm debug 2024-09-07 10:00:17 -07:00
Alex Garcia
66dbec78eb try windows release using cl.exe 2024-09-07 09:49:12 -07:00
Alex Garcia
687a2821f2 ios build re-arrange, re-enable windows on test.yaml 2024-09-06 10:22:01 -07:00
Alex Garcia
d529eb09d1 gha: arm64? 2024-08-26 23:29:19 -07:00
Alex Garcia
10b54df298 gha: ndegub? 2024-08-26 23:27:12 -07:00