[CHA-2563] Add retention policy integration tests#227
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughAdded four ChatRestClient methods for retention policy management (get, set, delete, list runs), new dataclass models for retention policies and cleanup runs, and two tests that exercise setting/getting/deleting policies and fetching retention policy runs. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 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.
🧹 Nitpick comments (1)
getstream/models/__init__.py (1)
1825-1828: Note: Default type value applies to only one of four handled event types.
AsyncExportErrorEventis used forexport.bulk_image_moderation.error,export.channels.error,export.moderation_logs.error, andexport.users.error(pergetstream/webhook.pymapping). The default now specifically matchesbulk_image_moderation.error.This is fine for deserialization (the type comes from the payload), but if code instantiates this class directly without specifying
type, it will default to bulk image moderation regardless of the actual error context.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@getstream/models/__init__.py` around lines 1825 - 1828, The AsyncExportErrorEvent class currently sets type: str = dc_field(default="export.bulk_image_moderation.error", metadata=dc_config(field_name="type")), which biases direct instantiation to the bulk_image_moderation event; remove the hardcoded default so the field is required (e.g., change to type: str = dc_field(metadata=dc_config(field_name="type")) or use an explicit empty/default-less dc_field) and add optional runtime validation if needed; reference AsyncExportErrorEvent, the type field declaration, dc_field/dc_config usage, and the getstream/webhook.py mapping to ensure callers supply the correct specific event type when constructing instances.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@getstream/models/__init__.py`:
- Around line 1825-1828: The AsyncExportErrorEvent class currently sets type:
str = dc_field(default="export.bulk_image_moderation.error",
metadata=dc_config(field_name="type")), which biases direct instantiation to the
bulk_image_moderation event; remove the hardcoded default so the field is
required (e.g., change to type: str =
dc_field(metadata=dc_config(field_name="type")) or use an explicit
empty/default-less dc_field) and add optional runtime validation if needed;
reference AsyncExportErrorEvent, the type field declaration, dc_field/dc_config
usage, and the getstream/webhook.py mapping to ensure callers supply the correct
specific event type when constructing instances.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 34692f6d-7d29-403d-9747-43880155166d
📒 Files selected for processing (13)
getstream/chat/async_rest_client.pygetstream/chat/rest_client.pygetstream/common/async_rest_client.pygetstream/common/rest_client.pygetstream/feeds/rest_client.pygetstream/models/__init__.pygetstream/moderation/async_rest_client.pygetstream/moderation/rest_client.pygetstream/tests/test_webhook.pygetstream/video/async_rest_client.pygetstream/video/rest_client.pygetstream/webhook.pytests/test_chat_misc.py
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ceabba6 to
004840e
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ticket
Summary
SetRetentionPolicy,GetRetentionPolicy,GetRetentionPolicyRuns,DeleteRetentionPolicyChecklist
🤖 Generated with Claude Code
Summary by CodeRabbit