Skip to content

The new IVectorStorage contract runs on 6 of 8 implementations — the two left out are the one the KnowledgeBase uses on SQLite and the Supabase backend #941

Description

@sroussey

What

027dfa713 added packages/test/src/contract/vector-storage/ — eight assertion modules (similarity ranking, vector round-trip, dimension validation, metadata filter, search options, legacy encoding, the similaritySearch event) behind runVectorStorageContract. It is the right answer to the 2026-09-07 finding that eight vector implementations shared no contract, and the two defects that motivated it (#889's double-decode, and 0dc61428e's JSONB-instead-of-vector column) were both of the class a contract catches and a hand-written test does not.

It runs on six:

$ grep -rln runVectorStorageContract packages providers --include=*.ts | grep -v node_modules | grep -v dist
packages/test/src/contract/vector-storage/runVectorStorageContract.ts
packages/test/src/test/vector/InMemoryVectorStorage.test.ts
packages/test/src/test/vector/SqliteVectorStorage.search.test.ts
packages/test/src/test/vector/PostgresVectorStorage.search.test.ts
packages/test/src/test/vector/IndexedDbVectorStorage.search.test.ts
packages/test/src/test/vector/TelemetryVectorStorage.contract.test.ts
packages/test/src/test/vector/ScopedVectorStorage.contract.test.ts

There are eight:

$ find providers packages -name "*VectorStorage*.ts" -not -name "*.test.ts" \
      -not -path "*/dist/*" -not -path "*/node_modules/*" | grep -vE "IVectorStorage|Schema"
packages/indexeddb/src/storage/IndexedDbVectorStorage.ts       ✓
packages/knowledge-base/src/knowledge-base/ScopedVectorStorage.ts ✓
packages/storage/src/vector/InMemoryVectorStorage.ts           ✓
packages/storage/src/vector/TelemetryVectorStorage.ts          ✓
providers/postgres/src/storage/PostgresVectorStorage.ts        ✓
providers/sqlite/src/storage/SqliteVectorStorage.ts            ✓
providers/sqlite/src/storage/SqliteAiVectorStorage.ts          ✗
providers/supabase/src/storage/SupabaseVectorStorage.ts        ✗

Why these two in particular

SqliteAiVectorStorage is the one that ships. It is what packages/test/src/test/helpers/createSqliteKnowledgeBase.ts:77 builds, i.e. the implementation @workglow/knowledge-base actually uses on SQLite. It has its own vector-encoding INSERT path distinct from SqliteVectorStorage's — its _putInternal override exists precisely because "the parent's _putInternal … binds vectors as JSON BLOBs that vector_full_scan cannot decode" (SqliteAiVectorStorage.ts:442-450, whose docstring was rewritten this window). That is the exact shape of #889. Its only coverage is packages/test/src/test/vector/SqliteAiVectorStorage.integration.test.ts, hand-written.

SupabaseVectorStorage has SupabaseVectorStorage.validation.test.ts (validation only) and SupabaseVectorStorage.integration.test.ts (skipped without live Supabase credentials). Nothing exercises its ranking, its returned vector type, its topK/scoreThreshold, its metadata filter, or its similaritySearch event.

Why it matters

The two vector defects this repo found in the last fortnight both presented as "the store accepts writes and looks healthy from every angle except a query":

Nothing failed: the fallback returns the same values, which is why the contract suite passed over SQL it never ran. — 0dc61428e

a store that accepts writes and fails every query looks healthy from anywhere except a query. — 1d3b297 (#889)

A shared contract is the only thing that generalises that. Six of eight leaves the generalisation half-made, and the omitted half includes the implementation a downstream actually runs.

Proposed fix

  1. Add runVectorStorageContract to a SqliteAiVectorStorage.search.test.ts (unit kind, not .integration., for the same reason 1d3b297's commit message gave for naming its own file that way: "a test excluded from CI would not have caught this either").
  2. Add it to the Supabase suite behind the same live-credential skip the integration file already uses, so it runs where credentials exist and is at least written everywhere.
  3. Invert control the way Test infrastructure: 21 CI-invisible test files, conformance-suite gaps, test tsconfig refs (audit §1.6 + Part 3 item 14) #701's box 2 asks: a BACKENDS record the contract iterates, so a new IVectorStorage implementation missing from it is a type error rather than a review miss. That is what stops this recurring; the tabular suite has had the same gap for six cycles.

Found during the 2026-09-14 review of providers/. Verified against origin/main @ 2d36880. Relates to #701 (box 2).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions