From 10f41feecb84556296e9d7ad81539e8693fae6ed Mon Sep 17 00:00:00 2001 From: xCyanGrizzly Date: Sat, 22 Aug 2026 17:16:09 +0200 Subject: [PATCH] feat(worker): log attachments that no detection pattern matched The .7z.001 gap survived for months because an unmatched attachment left zero trace anywhere. All three isArchiveAttachment call sites now emit a debug line with the chat, message id and filename when a document is skipped, so future gaps of this class are greppable instead of invisible. Debug level because every non-archive message in a channel hits this. Co-Authored-By: Claude Sonnet 5 --- worker/src/rebuild.ts | 8 ++++++++ worker/src/tdlib/download.ts | 9 +++++++++ worker/src/tdlib/topics.ts | 9 +++++++++ 3 files changed, 26 insertions(+) diff --git a/worker/src/rebuild.ts b/worker/src/rebuild.ts index 484d1b4..f84748e 100644 --- a/worker/src/rebuild.ts +++ b/worker/src/rebuild.ts @@ -333,6 +333,14 @@ async function scanDestinationChannel( fileSize: BigInt(doc.document.size), date: new Date(msg.date * 1000), }); + } else if (doc?.file_name) { + // Not matched by any pattern in archive/detect.ts, so it is dropped without a + // packages/skipped_packages row. Grep "unrecognized attachment" to find naming + // schemes we do not handle yet. + log.debug( + { chatId: chatId.toString(), messageId: msg.id, fileName: doc.file_name }, + "Skipping unrecognized attachment (no archive/document pattern matched)" + ); } } diff --git a/worker/src/tdlib/download.ts b/worker/src/tdlib/download.ts index 7e155b7..089ca37 100644 --- a/worker/src/tdlib/download.ts +++ b/worker/src/tdlib/download.ts @@ -267,6 +267,15 @@ export async function getChannelMessages( }); continue; } + if (doc?.file_name) { + // Not matched by any pattern in archive/detect.ts, so it is dropped without a + // packages/skipped_packages row. Grep "unrecognized attachment" to find naming + // schemes we do not handle yet. + log.debug( + { chatId: chatId.toString(), messageId: msg.id, fileName: doc.file_name }, + "Skipping unrecognized attachment (no archive/document pattern matched)" + ); + } // Check for photo messages (potential previews) const photo = msg.content?.photo; diff --git a/worker/src/tdlib/topics.ts b/worker/src/tdlib/topics.ts index 6579388..4d313f5 100644 --- a/worker/src/tdlib/topics.ts +++ b/worker/src/tdlib/topics.ts @@ -280,6 +280,15 @@ export async function getTopicMessages( }); continue; } + if (doc?.file_name) { + // Not matched by any pattern in archive/detect.ts, so it is dropped without a + // packages/skipped_packages row. Grep "unrecognized attachment" to find naming + // schemes we do not handle yet. + log.debug( + { chatId: chatId.toString(), topicId: topicId.toString(), messageId: msg.id, fileName: doc.file_name }, + "Skipping unrecognized attachment (no archive/document pattern matched)" + ); + } // Check for photo messages (potential previews) const photo = msg.content?.photo;