Storage Service: A few correctness fixes

Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
automated-signal
2026-09-02 19:53:58 +00:00
committed by GitHub
co-authored by Scott Nonnenberg
parent ae0fecd185
commit 35bad4c170
29 changed files with 1355 additions and 537 deletions
+38 -16
View File
@@ -213,24 +213,27 @@ import {
} from './Interface.std.ts';
import {
_removeAllCallLinks,
beginDeleteAllCallLinks,
beginDeleteCallLink,
callLinkExists,
defunctCallLinkExists,
deleteCallHistoryByRoomId,
deleteCallLinkAndHistory,
deleteCallLinkFromSync,
finalizeDeleteCallLink,
deleteCallLink,
deleteDefunctCallLink,
deleteExpiredCallLinks,
deleteExpiredDefunctCallLinks,
getAllAdminCallLinks,
getAllCallLinkRecordsWithAdminKey,
getAllCallLinkRecordsForStorageService,
getAllCallLinks,
getAllDefunctCallLinksWithAdminKey,
getAllMarkedDeletedCallLinkRoomIds,
getAllDefunctCallLinksForStorageService,
getCallLinkByRoomId,
getCallLinkRecordByRoomId,
getDefunctCallLinkByRoomId,
getTimestampOfOldestDefunctCallLink,
getTimestampOfOldestDeletedCallLink,
insertCallLink,
insertDefunctCallLink,
insertOrUpdateCallLinkFromSync,
markAllCallLinksDeleted,
markCallLinkDeleted,
updateCallLink,
updateCallLinkState,
updateDefunctCallLink,
@@ -264,6 +267,7 @@ import {
updateChatFolderPositions,
updateChatFolderDeletedAtTimestampMsFromSync,
deleteExpiredChatFolders,
deleteChatFolderById,
} from './server/chatFolders.std.ts';
import {
getAllPinnedMessages,
@@ -529,14 +533,16 @@ export const DataReader: ServerReadableInterface = {
getNextExpiringPinnedMessageAcrossConversations,
callLinkExists,
defunctCallLinkExists,
getAllCallLinks,
getCallLinkByRoomId,
getCallLinkRecordByRoomId,
getDefunctCallLinkByRoomId,
getAllAdminCallLinks,
getAllCallLinkRecordsWithAdminKey,
getAllDefunctCallLinksWithAdminKey,
getAllMarkedDeletedCallLinkRoomIds,
getAllCallLinkRecordsForStorageService,
getAllDefunctCallLinksForStorageService,
getTimestampOfOldestDefunctCallLink,
getTimestampOfOldestDeletedCallLink,
getMessagesBetween,
getNearbyMessageFromDeletedSet,
getMostRecentAddressableMessages,
@@ -685,15 +691,22 @@ export const DataWriter: ServerWritableInterface = {
insertOrUpdateCallLinkFromSync,
updateCallLink,
updateCallLinkState,
beginDeleteAllCallLinks,
beginDeleteCallLink,
markAllCallLinksDeleted,
markCallLinkDeleted,
deleteCallLink,
deleteDefunctCallLink,
deleteCallHistoryByRoomId,
deleteCallLinkAndHistory,
finalizeDeleteCallLink,
_removeAllCallLinks,
deleteCallLinkFromSync,
insertDefunctCallLink,
updateDefunctCallLink,
deleteExpiredCallLinks,
deleteExpiredDefunctCallLinks,
migrateConversationMessages,
saveEditedMessage,
saveEditedMessages,
@@ -791,6 +804,7 @@ export const DataWriter: ServerWritableInterface = {
updateChatFolderDeletedAtTimestampMsFromSync,
markChatFolderDeleted,
deleteExpiredChatFolders,
deleteChatFolderById,
createMegaphone,
updateMegaphone,
@@ -8585,6 +8599,14 @@ function markNotificationProfileDeleted(
): number | undefined {
const now = new Date().getTime();
const existing = getNotificationProfileById(db, id);
if (existing && existing.deletedAtTimestampMs) {
logger.warn(
`markNotificationProfileDeleted: Notification profile ${id} already had deletedAtTimestampMs set`
);
return existing.deletedAtTimestampMs;
}
const [query, parameters] = sql`
UPDATE notificationProfiles
SET