ruvector-wasm-v2.3.1

parruda/swarmruvector-wasm-v2.3.1Oct 6, 2026by ruvnet

Upgrading?

AI Summary

Fixes IndexedDB persistence for VectorDB with commit-gated save, static loadFromIndexedDB method, and naming improvements.

Key Highlights

  • Fixed saveToIndexedDB() to actually save data with commit-gating
  • Fixed loadFromIndexedDB() as a working static async method
  • VectorDB.loadFromIndexedDB(name) with validation and error handling
  • New setDbName(name) and dbName getter for database naming
  • Snapshot storage with HNSW graph rebuild on load

New Features

  • Commit-gated IndexedDB save with transaction support
  • VectorDB.loadFromIndexedDB static method with validation
  • Database naming with setDbName() and dbName getter
  • Versioned snapshot storage
  • HNSW graph rebuild on load
  • npm/wasm TypeScript wrapper updated

Full Release Notes

## ruvector-wasm 2.3.1 / @ruvector/wasm 0.2.1 — IndexedDB persistence fix

`saveToIndexedDB()` in 0.2.0 reported success but saved nothing, and `loadFromIndexedDB` was an unimplemented stub. Both now work.

### Fixed
- **Save is commit-gated.** It resolves only after the IndexedDB transaction commits; errors and aborts (including quota exceeded) reject. The database is stored as one versioned snapshot record, so a save is all-or-nothing.
- **`VectorDB.loadFromIndexedDB(name)`** is a static async that returns a `VectorDB`. It rejects when nothing is saved under that name, or the payload is corrupt, an unsupported format, has mismatched dimensions or has duplicate ids. A failed load no longer leaves an empty database behind.
- **Naming.** New `setDbName(name)` and `dbName` getter. Names must be 1-128 chars of `[A-Za-z0-9_.-]`. Without `setDbName`, an instance saves under a random name, so choose one if you want to reload in a later session.
- The snapshot stores vectors and metadata; the HNSW graph is rebuilt on load.

Design and contract: [ADR-200](docs/adr/ADR-200-wasm-indexeddb-persistence-contract.md).

### Install
- crates.io: `ruvector-wasm = "2.3.1"`
- npm: `npm i @ruvector/wasm@0.2.1`

### Verification
- 16 `wasm-bindgen-test` browser tests pass in headless Chrome, including round-trip restore of vectors and search, missing database, invalid names, corrupt JSON, unsupported format and duplicate ids.
- A real page saved a database, was reloaded, and loaded it back intact.
- A mutation test (removing the write) turns the round-trip test red.

### Known limits
- No test forces a transaction abort or quota failure; that path is covered by code review only.
- A large database is stored as a single JSON string and the index is rebuilt on load.
- The `npm/wasm` TypeScript wrapper was updated to the new API but is a separate package and was not published.

Related Repositories