Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: never truncate unacknowledged collection item removal records (#12433)

[._.]/ Adam Eivy3af8dbe11e57
diff --git a/server/services/mediaCollections.js b/server/services/mediaCollections.js
index 91ec397311..94c73e15aa 100644
--- a/server/services/mediaCollections.js
+++ b/server/services/mediaCollections.js
@@ -127,13 +127,10 @@ const sanitizeRemovedItems = (raw) => {
if (!item || itemKey(item) !== key) continue;
entries.push([key, removedAt]);
}
- // Bounded like `items`: keep the newest removals, which are the ones a
- // lagging peer is most likely to still hold an older copy of.
- if (entries.length > ITEMS_MAX) {
- entries.sort((a, b) => parseTsMs(b[1]) - parseTsMs(a[1]));
- entries.length = ITEMS_MAX;
- }
- // Sorted keys keep the wire form and snapshot checksum byte-stable.
+ // Deliberately uncapped: dropping an unacknowledged record would let a stale
+ // copy back in. There is at most one record per distinct key, and tombstone
+ // GC is what bounds them. Sorted keys keep the wire form and snapshot
+ // checksum byte-stable.
return Object.fromEntries(entries.sort(([a], [b]) => a.localeCompare(b)));
};