fix(config)!: keep captured data by default for deletions and excluded chats - #477
Conversation
…d chats DELETION_MODE now defaults to soft: a processed deletion marks the message deleted and keeps it. DELETION_MODE=hard stays available as an explicit choice, and its startup line keeps the warning. Adding a chat to any *_EXCLUDE_CHAT_IDS list no longer purges what the archive already holds for it. The chat is skipped as before; its rows, media folder and avatars stay unless EXCLUDE_DELETE_EXISTING=true. The run logs how many excluded chats kept their data, never which. BREAKING CHANGE: deployments that relied on the hard default must set DELETION_MODE=hard, and deployments that relied on exclusion purging must set EXCLUDE_DELETE_EXISTING=true.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: GeiserX/Telegram-Archive/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughExcluded chats keep existing archived data by default, with deletion controlled by ChangesArchive deletion behavior
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No concrete merge-blocking defect was established. Excluded chats retain archived data by default, and unset deletion mode keeps deleted messages marked in the archive. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 #477 +/- ##
==========================================
+ Coverage 94.96% 94.97% +0.01%
==========================================
Files 29 29
Lines 12318 12325 +7
==========================================
+ Hits 11698 11706 +8
+ Misses 620 619 -1
🚀 New features to boost your workflow:
|
Semantic port of upstream GeiserX#477 and the config half of GeiserX#474/GeiserX#445. - Excluded chats are skipped but keep their archived rows, media folder and avatars; the purge now needs EXCLUDE_DELETE_EXISTING=true. It moved into TelegramBackup._handle_excluded_chats so it can be tested. - DELETION_MODE defaults to soft (keep and mark deleted). - SKIP_MEDIA_DELETE_EXISTING defaults to false. - The configuration summary was logged from Config.__init__, before any handler existed, so it never reached a container log. It is Config.log_summary(), called at the end of setup_logging() and by the viewer after it builds its Config. BREAKING CHANGE: set EXCLUDE_DELETE_EXISTING=true, DELETION_MODE=hard or SKIP_MEDIA_DELETE_EXISTING=true to keep the old deleting behaviour. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Two settings still deleted archived data unless the operator opted out. With
LISTEN_DELETIONS=true, the defaultDELETION_MODE=hardremoved every message deleted in Telegram, anddocker-compose.ymlpassedhardexplicitly. Adding a chat to any*_EXCLUDE_CHAT_IDSlist purged its messages, media folder and avatars on the next run, with no flag and no README warning.Fix
DELETION_MODEdefaults tosoft. A processed deletion marks the message deleted and keeps it.hardstill works when set explicitly, and its startup line keeps the DELETED warning. The compose default, README,.env.exampleand thegetattrfallbacks in the listener and the sync-deletions pass all saysoftnow.EXCLUDE_DELETE_EXISTING, defaultfalse, parsed likeSKIP_MEDIA_DELETE_EXISTING. When it is false an excluded chat is still skipped, but its rows and files stay. The run logs one INFO line with the count only ("N excluded chat(s) keep their archived rows and files (EXCLUDE_DELETE_EXISTING=false)"), never a chat id. When it is true the purge runs as it did before..env.exampleblock and a commented compose line for the new flag. The README row says it deletes and cannot be undone.CLAUDE.mdnow listsEXCLUDE_DELETE_EXISTINGinstead of the exclude lists, and notes thatDELETION_MODE=hardis opt-in.What it deletes / overwrites / forgets
DELETION_MODE=hardorEXCLUDE_DELETE_EXISTING=true.is_deletedanddeleted_at. An excluded chat keeps everything captured before it was excluded.For a reviewer to push back on
!with a BREAKING CHANGE footer, and the release notes should say so. The CHANGELOG entry is left for release time.EXCLUDE_DELETE_EXISTINGis global, likeSKIP_MEDIA_DELETE_EXISTING. There is no per-accountTG_ACCOUNT_<N>_override.Tests
Full suite green: 4263 passed, 268 skipped.
ruff checkandruff format --checkare clean. Each new test was seen to fail under a one-line mutant and pass again after the exact line was restored: both defaults, both purge-gate branches, both summary lines, the hard warning and bothgetattrfallbacks.Summary by CodeRabbit
DELETION_MODE=hardto permanently remove them.EXCLUDE_DELETE_EXISTINGto remove that data.