refactor(backup): share service_action_type, document vocabulary divergence#192
Conversation
…rgence Follow-up to #191 review: - Move service_action_type to message_utils.py beside extract_topic_id (both paths' shared home); drop the now-unused re import in telegram_backup.py. - Docstring notes the acronym snake-case edge (SetMessagesTTL -> set_messages_t_t_l) and that the backfill action_type vocabulary is intentionally distinct from the listener's curated event names — only the raw_data shape is shared, not the values. - Reword the _process_message comment to say structural parity (keys), not value parity. - Add direct unit tests for service_action_type (topic, multi-word, no-arg, acronym edge) and a non-topic MessageActionChatEditTitle / MessageActionPinMessage backfill test.
|
Warning Review limit reached
More reviews will be available in 1 minute and 5 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #192 +/- ##
=======================================
Coverage 92.25% 92.25%
=======================================
Files 25 25
Lines 7141 7141
=======================================
Hits 6588 6588
Misses 553 553
🚀 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 |
Summary
Follow-up to the review of #191 (service-action metadata in
raw_data). The one genuinely actionable item from that review — pinningmsg.action = Nonein the extended test factory — was already folded into #191 before merge, so this PR addresses the remaining polish suggestions:service_action_type(was the module-private_service_action_type) intosrc/message_utils.py, right besideextract_topic_id— the shared home both the backfill and listener already import from. Drops the now-unusedreimport intelegram_backup.py.action_typefrom low-levelMessageActionclass names (chat_edit_title,topic_create, …) while the live listener uses curated event names (title_changed,user_added, …). Only theraw_datashape is shared, not the values. The_process_messagecomment now says "structural parity (keys), not value parity," and the helper docstring spells out both this and the acronym edge.re.sub(r"(?<!^)(?=[A-Z])", "_", name)splits consecutive capitals letter-by-letter, e.g.MessageActionSetMessagesTTL→set_messages_t_t_l. No title-bearing action we consume is affected, and the tag is a stable, unparsed identifier — cosmetic only, now pinned by a test so it can't silently change.service_action_type(topic, multi-wordchat_edit_title, no-argpin_message, and the acronym edge) plus two non-topic backfill tests through the real_process_message(MessageActionChatEditTitlewith a title,MessageActionPinMessagewithout).No behavior change for users; this is a refactor + test/documentation pass.
action_type/new_titleremain unread by any consumer today (the viewer gates onservice_type === 'service'), so values are unchanged on disk.Testing
ruff check .andruff format --check .cleanType of Change