feat(zulip): add Prometheus topic autoresolve#2099
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds an optional ChangesZulip topic autoresolve feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/robusta/integrations/zulip/sender.py`:
- Line 93: The log statement currently emits the full topics list at warning
level via logging.warning(f"topics: {topics}"), which should be reduced to
debug-level noise; locate that call in src/robusta/integrations/zulip/sender.py
(the logging call that references the topics variable) and change it to
logging.debug(f"topics: {topics}") (ensure the logging module is
imported/available where used).
- Around line 100-117: The __find_msg_id_for_topic_title method currently uses
substring matching in its nested find_msg_id (if title in topic["name"]) which
can pick wrong topics; change the comparison to exact equality (e.g.,
topic["name"] == title) and also accept the resolved prefixed form (e.g., "✔ " +
title) to handle resolved messages, then keep the rest of the logic (refreshing
topic_cache via __load_topics(self.stream_id), warnings, and returning msg_id[0]
or None) unchanged so only the matching logic in find_msg_id is updated.
- Around line 219-234: The PATCH call after posting reuses the full `data` from
__build_msg_data (which includes the new `content`), so
r.patch(f".../messages/{msg_id}", data=data) overwrites the original message
text; instead construct a minimal patch payload (e.g., only the topic field set
to channel_topic plus "propagate_mode":"change_all") and use that for the PATCH
to update only the topic; update the code paths around __build_msg_data, the
POST call, and the subsequent r = self.zclient.patch(...) to send this minimal
patch when msg_id is present.
- Around line 73-82: The two Zulip helper methods __get_stream_id and
__find_msg_id_for_topic_title currently can return an int or None on
errors/not-found; update their function signatures to explicitly annotate the
return type as "-> int | None" (Python 3.10 union syntax) so the contract is
clear, and ensure any callers accept a possible None return; locate the methods
by name in sender.py and change their definitions to include the new return type
annotation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 583a78d2-e949-404c-9af3-7d42da1e659e
📒 Files selected for processing (4)
docs/configuration/sinks/zulip.rstsrc/robusta/core/sinks/zulip/zulip_sink.pysrc/robusta/core/sinks/zulip/zulip_sink_params.pysrc/robusta/integrations/zulip/sender.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
I would approve 👍 |
topic_autoresolvesupport for the Zulip sink