Skip to content

refactor(backup): share service_action_type, document vocabulary divergence#192

Merged
GeiserX merged 1 commit into
mainfrom
ai/service-action-review-fixes
Jun 10, 2026
Merged

refactor(backup): share service_action_type, document vocabulary divergence#192
GeiserX merged 1 commit into
mainfrom
ai/service-action-review-fixes

Conversation

@GeiserX

@GeiserX GeiserX commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to the review of #191 (service-action metadata in raw_data). The one genuinely actionable item from that review — pinning msg.action = None in the extended test factory — was already folded into #191 before merge, so this PR addresses the remaining polish suggestions:

  • Share the helper. Move service_action_type (was the module-private _service_action_type) into src/message_utils.py, right beside extract_topic_id — the shared home both the backfill and listener already import from. Drops the now-unused re import in telegram_backup.py.
  • Document the vocabulary divergence. The backfill derives action_type from low-level MessageAction class names (chat_edit_title, topic_create, …) while the live listener uses curated event names (title_changed, user_added, …). Only the raw_data shape is shared, not the values. The _process_message comment now says "structural parity (keys), not value parity," and the helper docstring spells out both this and the acronym edge.
  • Document the acronym edge. re.sub(r"(?<!^)(?=[A-Z])", "_", name) splits consecutive capitals letter-by-letter, e.g. MessageActionSetMessagesTTLset_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.
  • Tests. Add a direct unit test for service_action_type (topic, multi-word chat_edit_title, no-arg pin_message, and the acronym edge) plus two non-topic backfill tests through the real _process_message (MessageActionChatEditTitle with a title, MessageActionPinMessage without).

No behavior change for users; this is a refactor + test/documentation pass. action_type/new_title remain unread by any consumer today (the viewer gates on service_type === 'service'), so values are unchanged on disk.

Testing

  • Full suite: 1854 passed (1847 + 7 new) on Python 3.14
  • ruff check . and ruff format --check . clean

Type of Change

  • Refactor / internal quality (no functional change)
  • Tests

…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.
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@GeiserX, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 07f6df69-bb6d-4300-bc52-54a16f2e857b

📥 Commits

Reviewing files that changed from the base of the PR and between a5bb6e4 and df6e505.

📒 Files selected for processing (3)
  • src/message_utils.py
  • src/telegram_backup.py
  • tests/test_telegram_backup.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ai/service-action-review-fixes

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.25%. Comparing base (a5bb6e4) to head (df6e505).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #192   +/-   ##
=======================================
  Coverage   92.25%   92.25%           
=======================================
  Files          25       25           
  Lines        7141     7141           
=======================================
  Hits         6588     6588           
  Misses        553      553           
Files with missing lines Coverage Δ
src/message_utils.py 77.98% <100.00%> (+0.56%) ⬆️
src/telegram_backup.py 90.93% <100.00%> (-0.03%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

🐳 Dev images published!

  • drumsergio/telegram-archive:dev
  • drumsergio/telegram-archive-viewer:dev

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

@GeiserX GeiserX merged commit 4080a74 into main Jun 10, 2026
10 checks passed
@GeiserX GeiserX deleted the ai/service-action-review-fixes branch June 10, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant