fix(sponsors): dispatch SponsorshipCreated/Removed when sponsorships are attached inline via addSponsor or updateSponsor#548
Conversation
…are attached inline via addSponsor or updateSponsor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughSummitSponsorService now collects sponsorship entities created/modified during sponsor transactions and dispatches SponsorCreated/SponsorUpdated plus per-sponsorship SponsorshipCreated/SponsorshipUpdated/SponsorshipRemoved events after the transaction. A job getter API was added and unit tests assert the queued domain event jobs and ordering. ChangesSponsorship lifecycle event emission
Support: job API and unit tests
🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 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 docstrings
🧪 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 |
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-548/ This page is automatically updated on each push to this PR. |
…created) for inline sponsorship events Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-548/ This page is automatically updated on each push to this PR. |
There was a problem hiding this comment.
Pull request overview
This PR ensures sponsor-related domain events are emitted when summit sponsorships are created/removed indirectly via SummitSponsorService::addSponsor() and SummitSponsorService::updateSponsor(), aligning inline attach/update flows with the dedicated sponsorship service’s event publishing.
Changes:
- Track newly created sponsorship entities during
addSponsor()and publishSponsorshipCreatedevents after the transaction. - Track added/removed sponsorship entities during
updateSponsor()and publishSponsorshipCreated/SponsorshipRemovedevents after the transaction. - Add debug logging around the new sponsorship event dispatches.
Comments suppressed due to low confidence (1)
app/Services/Model/Imp/SummitSponsorService.php:210
- Similar to addSponsor(), $added_sponsorships/$removed_sponsorships are mutated by reference outside the transaction callback. Because the transaction wrapper can retry the callback on reconnectable failures, these arrays can accumulate entries from failed attempts and later dispatch duplicate/incorrect SponsorshipCreated/Removed events. Consider keeping these collections local to the callback and returning them (or explicitly resetting them at the start of each callback execution) to make retries idempotent.
$added_sponsorships = [];
$removed_sponsorships = [];
$sponsor = $this->tx_service->transaction(function () use ($summit, $sponsor_id, $payload, &$added_sponsorships, &$removed_sponsorships) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
smarcet
left a comment
There was a problem hiding this comment.
@romanetar please review comments
… prevent duplicate events on retry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…utates an existing sponsorship type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: romanetar <roman_ag@hotmail.com>
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-548/ This page is automatically updated on each push to this PR. |
…are attached inline via addSponsor or updateSponsor (#548) * fix(sponsors): dispatch SponsorshipCreated/Removed when sponsorships are attached inline via addSponsor or updateSponsor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(sponsors): add debug logs and fix dispatch order (removed before created) for inline sponsorship events Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(sponsors): avoid by-reference capture in transaction callbacks to prevent duplicate events on retry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(sponsors): dispatch SponsorshipUpdated when sponsorship_id path mutates an existing sponsorship type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: review feedback Signed-off-by: romanetar <roman_ag@hotmail.com> --------- Signed-off-by: romanetar <roman_ag@hotmail.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
ref https://app.clickup.com/t/86ba0vf07
Summary by CodeRabbit