Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
This PR moves dispatch of the “revoke line items” coordinator signal to the OrderReturnedView, rather than triggering it from within fulfill_order_returned_signal_task, so revocation is initiated directly from the CT “order returned” webhook handling path.
Changes:
- Dispatch
fulfill_order_returned_send_revoke_line_items_signalfromOrderReturnedViewafter validating the incoming returned-order message. - Remove the revoke-signal dispatch from
fulfill_order_returned_signal_task. - Update view and task tests to reflect the new dispatch location and expectations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
commerce_coordinator/apps/commercetools/views.py |
Adds revoke signal dispatch in OrderReturnedView. |
commerce_coordinator/apps/commercetools/sub_messages/tasks.py |
Removes revoke signal dispatch from the returned-order Celery task. |
commerce_coordinator/apps/commercetools/tests/test_views.py |
Updates OrderReturnedView tests to patch/assert the new revoke signal call. |
commerce_coordinator/apps/commercetools/tests/sub_messages/test_tasks.py |
Removes revoke-signal assertions/patching from returned-order task tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # revoke line items | ||
| fulfill_order_returned_send_revoke_line_items_signal.send_robust( | ||
| sender=self, | ||
| order_id=order_id, | ||
| return_items=return_items, |
There was a problem hiding this comment.
get_return_line_items() defaults to []. If a return message ever arrives with an empty returnInfo.items, this will still dispatch the revoke signal and enqueue a Celery task that immediately no-ops. Consider short-circuiting when return_items is empty (log + return 200) to reduce unnecessary queue traffic.
| fulfill_order_returned_send_revoke_line_items_signal.send_robust( | ||
| sender=self, | ||
| order_id=order_id, | ||
| return_items=return_items, |
There was a problem hiding this comment.
For observability/correlation, consider passing message_id through this revoke signal as well (it’s available just above and is already passed to fulfill_order_returned_signal). The receiver can ignore unknown kwargs, but logs will then include the CT subscription message id.
| return_items=return_items, | |
| return_items=return_items, | |
| message_id=message_id, |
Move revoke line items signal to
OrderReturnedViewinstead of chaining throughfulfill_order_returned_signal_taskInternal ticket: https://redventures.atlassian.net/browse/RV2U-473
Merge checklist:
Check off if complete or not applicable:
Post-merge: