Skip to main content
← Back to list
01Issue
BugIn ProgressSwamp CLI
Assigneesstack72

Relationships

#1581 Catalog backfill reconciles against the local cache, not the datastore

Opened by keeb · 8/10/2026

Split out of #1580, which fixed the walk bug that exposed this.

backfillAsync in src/domain/data/data_query_service.ts sources its rows from dataRepo.findAllGlobal() — a walk of the local disk — and then commits them with bulkReplaceNamespace / bulkReplaceAll, which DELETE the namespace before reinserting. Anything the local walk cannot see is deleted from the catalog.

Under hydrationStrategy: lazy the local tree is a cache by definition: data lives in the datastore and is materialized locally on demand. Reconciling a cache against an index and deleting the difference means data present in the datastore but not yet pulled is dropped from the catalog.

This is what turns any gap in the walk from an incomplete index into a destructive one. #1580 closed one such gap (numeric data names) and added swamp doctor datastores --repair to recover, but the amplifier is still here: the next walk gap will delete rows the same way.

Observed while verifying #1580: on a lazy-hydration repo (@keeb/mongodb-datastore, namespace swamp-media) .swamp/data/ holds only _catalog.db — zero records are materialized locally. swamp doctor datastores correctly reports "covers all 0 record(s) on disk", which is true of the cache and useless as a statement about the repo's data. The completeness check added in #1580 is therefore a no-op for lazy repos.

Worth deciding whether backfill should reconcile against the datastore, or whether replace-semantics should be narrowed to only the subtree the walk actually covered.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 3 MOREPR_LINKED

In Progress

8/11/2026, 2:10:39 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack728/11/2026, 1:10:34 AM

Sign in to post a ripple.