fix : resolve syntax error in backend/campaigns/tasks.py - #646
Conversation
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughChangesCampaign click tracking and task maintenance
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant EmailStep
participant ClickTrackingView
participant CampaignLead
EmailStep->>EmailStep: Sign lead, step, and destination into t
EmailStep->>ClickTrackingView: Send tracking URL with t
ClickTrackingView->>ClickTrackingView: Verify token and destination scheme
ClickTrackingView->>CampaignLead: Update click analytics and condition step
ClickTrackingView-->>EmailStep: Redirect to verified destination
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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: 1
🤖 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 `@backend/campaigns/tasks.py`:
- Around line 523-537: Update the token generation in the campaign
link-rewriting flow around token_payload and signed_token so the destination URL
is covered by the signature, and update the corresponding validation/redirect
logic in the click-tracking view to verify that same destination before
redirecting. Preserve existing handling for mailto/tel links and already-tracked
URLs, and reject tampered or otherwise invalid destinations rather than
redirecting.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ac8fd44d-62c6-485b-a95b-696999d1a9fa
📒 Files selected for processing (1)
backend/campaigns/tasks.py
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@backend/campaigns/tasks.py`:
- Around line 532-535: Update the URL filtering logic around urlsplit in the
link-rewrite loop to require an absolute HTTP or HTTPS URL before generating a
tracking redirect. Treat empty-scheme relative URLs such as /pricing and
protocol-relative URLs such as //example.com/path as non-rewritable, while
preserving rewriting for valid HTTP(S) destinations and skipping other schemes.
In `@backend/campaigns/views.py`:
- Line 796: Update the unpacking in the payload parsing flow to explicitly mark
the unused step ID, while preserving campaign_lead_id and dest_url extraction
and the existing split limit. Use the project’s conventional throwaway variable
naming so Ruff RUF059 no longer reports the assignment.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 53b2dab3-8763-465b-b8b9-24b4c96e4da6
📒 Files selected for processing (2)
backend/campaigns/tasks.pybackend/campaigns/views.py
Pull Request
🔗 Related Issue
Closes #341
📝 Summary of Changes
backend/campaigns/tasks.py.🏷️ Type of Change
🧪 Testing
Steps to test:
backenddirectory.python manage.py test campaigns.📸 Screenshots (if applicable)
N/A
✅ Checklist
Summary by CodeRabbit
http/httpsdestinations before redirecting.