backfillMemoryTopicsOp()
backfillMemoryTopicsOp(
ctx:VaultMemoryOperationsContext,memoryIds: readonlystring[]):Promise<string[]>
Defined in: src/lib/db/memoryVault/operations.ts:2057
Fill topics for the sweep’s topicsBackfill rows from the links they
already carry — the one-time migration of pre-v42 rows, whose topics exist
only in the device-local index and so never reach the server. No LLM call.
Bumps topics_updated_at (that’s the point — it’s what makes the row
upload) while pinning updated_at, like every other topic writer. Callers
must pass a limit-bounded list: each row’s upload carries its embedding, so
an unbounded pass re-uploads the entire vault at once.
source is derived from topics_user_managed, the only provenance a legacy
row has: a curated memory’s topics are recorded as user, everything else as
auto. Skips deleted, foreign-user, unlinked rows, and rows that already have
a record. Returns the ids filled.
Runs as ONE writer over the whole (caller-bounded) list, in two phases:
resolve every row’s write — all the awaits — and only then prepare and batch,
synchronously. Resolving and preparing per row inside its own writer is what
fired WatermelonDB’s “wasn’t sent to batch() synchronously” diagnostic once
per memory (~107 on a single dev launch, sdk#891); it also cost N writes.
Same treatment as stampTopicsExtractedAtOp, including its
transpilation hazard — the prepare pass MUST stay a .map().
Parameters
| Parameter | Type |
|---|---|
|
| |
|
|
readonly |
Returns
Promise<string[]>
Deprecated
App code: use MemoryStore.maintenance.backfillTopics (createLocalMemoryStore).