Skip to content

RVF SDK silently drops metadata; native metadata is not durable or returned #704

Description

@thesoulpole

Versions

  • @ruvector/rvf@0.2.3
  • @ruvector/rvf-node@0.2.0
  • darwin-arm64 native binary 0.1.7
  • Node 26.4.0, macOS arm64

Public SDK reproduction

const db = await RvfDatabase.create(path, {
  dimensions: 2,
  metric: 'cosine',
}, 'node');

await db.ingestBatch([
  { id: 'red-item', vector: new Float32Array([1, 0]), metadata: { color: 'red' } },
  { id: 'blue-item', vector: new Float32Array([0, 1]), metadata: { color: 'blue' } },
]);

Observed:

  • Ingest reports both vectors accepted.
  • Unfiltered results contain no metadata.
  • A field-0 equality filter for red returns no results.

Native N-API reproduction

Using the low-level binding, pass one positional metadata record per vector:

db.ingestBatch(
  new Float32Array([1, 0, 0, 1]),
  [101, 102],
  [
    { fieldId: 0, valueType: 'string', value: 'red' },
    { fieldId: 0, valueType: 'string', value: 'blue' },
  ],
);

A field-0 red filter works while that database instance remains open. However:

  • Results still contain only ID and distance.
  • After close/reopen, the same filter returns no results.

Root cause

  • npm/packages/rvf/src/backend.ts accepts RvfIngestEntry.metadata but calls native ingestBatch(flat, ids) without metadata.
  • Native SearchResult contains only ID/distance.
  • Runtime inserts metadata into an in-memory MetadataStore, but no metadata segment is written and reloaded.
  • The SDK filter declaration omits the native parser's required valueType.

Impact

Applications can successfully ingest records while silently losing metadata. Filtering may appear to work through the native API and then stop working after restart, which can produce incomplete or incorrect search results without an error.

Requested fix

As an immediate safety measure, reject non-empty SDK metadata until it is supported rather than silently accepting it.

A complete fix needs:

  • A per-vector metadata shape across the SDK and N-API.
  • Metadata segment persistence and reload.
  • Aligned filter types, including valueType.
  • Either metadata-bearing search results or getMetadata(id).
  • Close/reopen tests, including vectors with unequal metadata-field counts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions