t530: fix orphan pending_site after membership cancellation#910
t530: fix orphan pending_site after membership cancellation#910superdav42 merged 1 commit intomainfrom
Conversation
When a membership transitions to cancelled, the pending_site stored in membership meta is no longer silently orphaned. The new handle_pending_site_on_cancellation() handler in Membership_Manager: 1. Detects a pending_site on the cancelled membership 2. Saves it to a 24h transient keyed by customer email hash (wu_transferable_pending_ . md5($email)) for retry reclaim 3. Deletes the pending_site meta from the membership Fixes the production incident where a customer paid via WC order with a 100% coupon and received no site because the watchdog auto-cancel had already orphaned the pending_site (Membership 479). Resolves #902
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 4 minutes and 27 seconds. ⌛ 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. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ 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 |
Merge SummaryIssue: #902 — fix: orphan pending_site after membership cancellation — site never provisioned Root cause: When a membership was cancelled (e.g. by the ~2s watchdog timeout), the Fix: Added
Tests: 5 new unit tests in Files changed:
|
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 4dc261a are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
Summary
When a membership transitions to
cancelled(e.g. the watchdog timeout), thepending_sitestored inwu_membershipmetawas never cleaned up. If the customer retried checkout successfully, no code reclaimed the orphanedpending_site— the customer paid and received no site.This PR adds
handle_pending_site_on_cancellation()toMembership_Managerwhich hooks into the existingwu_transition_membership_statusaction and:pending_siteon the cancelled membershipwu_transferable_pending_+md5($email), making it reclaimable by a retry checkout flowdelete_pending_site()to remove the orphaned meta from the membershipFiles Changed
inc/managers/class-membership-manager.php— newhandle_pending_site_on_cancellation()method + hook registration ininit()tests/WP_Ultimo/Managers/Membership_Manager_Test.php— 5 new tests covering hook registration, pending_site cleanup, transient creation, no-op when no pending_site, and non-cancelled status bypassVerification
PHPStan:
No errorsResolves #902