Skip to content

fix(memory): preserve vector data and harden persistence - #1819

Draft
EmersonBraun wants to merge 4 commits into
mainfrom
EmersonBraun/memory-essential-private
Draft

EmersonBraun wants to merge 4 commits into
mainfrom
EmersonBraun/memory-essential-private

Conversation

@EmersonBraun

@EmersonBraun EmersonBraun commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Redis vector commands previously converted binary embeddings to strings, corrupting their bytes. This change preserves Buffer arguments, uses stable Vectra IDs and ordered Mongo ID upserts when supported, and protects adapter-owned ID/content fields.

It also preserves synchronous localStorage writes and expiry purges, uses atomic file replacement for the localStorage fallback, includes SQLite KV eviction in supported transactions, continues multi-backend erasure after failures, and retries failed lazy initialization after best-effort cleanup of owned resources. Tests cover local Vectra reopen/deletion, SQLite rollback, file corruption/rename failures, and mocked Redis/Mongo adapter behavior.

Vector KV TTL remains logical visibility only; physical deletion and maxMessages eviction are not implemented. Bounded over-fetch can miss live rows. Legacy Vectra duplicates and insert-only injected collection behavior are retained. Metadata-filter and legacy namespace contracts require separate work.

Validation: package tests/coverage, TypeScript lint, CJS/ESM/declaration build, and diff checks pass. The configured documentation gate and memory handoff query pass after local index regeneration; broad generated index changes are excluded from this PR. Live Redis/Mongo services were not exercised.

Final local evidence: 33 test files / 268 tests pass; 95.01% line coverage (90% required). The official gzip measurement is 15,998 bytes against the configured 16,000-byte limit; its margin is small, so CI size validation remains important.

The CI quality job builds all package artifacts required by the packed-consumer contract before evaluating it. The temporary-file regression fixtures use isolated directories and verify cleanup within those directories. Existing publication checks and size/coverage limits remain enforced.

Comment thread packages/memory/tests/kv-store-basic.test.ts Fixed
Comment thread packages/memory/tests/kv-store-basic.test.ts Fixed
Comment thread packages/memory/tests/kv-store-basic.test.ts Fixed
Use isolated temporary directories in memory file-store tests.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants