fix(media): stop promising downloads for skipped chats and half-described documents - #478
Conversation
…ibed documents Rows in SKIP_MEDIA_CHAT_IDS chats and document rows with only one of mime_type/file_name read as pending forever. Reconcile now marks them filtered, clears stale reasons from files already on disk, and the maintenance scripts log the config summary again.
|
Warning Review limit reachedNext included review available in 13 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: GeiserX/Telegram-Archive/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🐳 Dev images published!
The dev/test instance will pick up these changes automatically (Portainer GitOps). To test locally: docker pull drumsergio/telegram-archive:dev
docker pull drumsergio/telegram-archive-viewer:dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #478 +/- ##
==========================================
+ Coverage 94.96% 94.98% +0.01%
==========================================
Files 29 29
Lines 12318 12340 +22
==========================================
+ Hits 11698 11721 +23
+ Misses 620 619 -1
🚀 New features to boost your workflow:
|
|
🐳 Dev images published!
The dev/test instance will pick up these changes automatically (Portainer GitOps). To test locally: docker pull drumsergio/telegram-archive:dev
docker pull drumsergio/telegram-archive-viewer:dev |
Some media rows still read "Will download on next backup" and count as pending, even though no run will ever fetch them. There are two cases. A document with a file name but no stored MIME type (or the reverse) matched neither the download filter nor the "filtered" mark. A row in a chat listed in
SKIP_MEDIA_CHAT_IDSis never fetched, but nothing marked it either. A third problem: a file already on disk could keep a stale "oversize" reason.Fix
_document_mime_conditionwrapsmime_typeandfile_nameinCOALESCE(..., '')in the arms that compare them. When one column was NULL, the OR evaluated to NULL instead of true or false. It now matches whatConfig.document_mime_alloweddoes with a missing value. The arm that keeps a row with both columns NULL is unchanged.reconcile_media_skip_reasonstakesskip_media_chat_ids. Rows in those chats are markedfiltered, and the clear step leaves them alone, so a second pass changes nothing. Removing a chat from the setting clears the mark on the next pass. The retry drain passesconfig.skip_media_chat_ids.downloaded = 1rows, and a row on disk counts as one whose reason no longer holds. The over-size writer leavesdownloadedas it was, so a file fetched by an earlier run with a higher cap could sit on disk marked "oversize". The two mark UPDATEs still touch onlydownloaded = 0.Configcallconfig.log_summary()again. They printed that summary before 8.14.0.What it deletes / overwrites / forgets
media.skip_reasononly, which is derived state that every run re-derives from the settings. Rows in skipped chats go from NULL tofiltered. A downloaded row loses a staleoversizeorfiltered.SKIP_MEDIA_CHAT_IDS, its rows go back to pending.For review
downloaded = 0from the clears. That alone would not clear the realistic case, a file fetched under a higher cap, because the clear also required the file to be under the cap. The test seeds that exact row._strip_original_media_pathskeepsskip_reason, so a skipped row still shows its reason, and the tests pin that. A downloaded file seen in a no-download session still reads "Will download on next backup" because the strip blanks every path. That behaviour predates 8.14.0. Giving it its own message would be a separate UI change.filteredrow over the cap keepsfilteredand all counts are zero).test_a_filtered_row_over_the_cap_keeps_its_reasonalready asserts exactly that, so I proved it can fail with a mutant instead of adding a duplicate.