Skip to content

fix: avoid fragile pending site loopback#1416

Merged
superdav42 merged 1 commit into
mainfrom
fix/checkout-pending-root
Jun 13, 2026
Merged

fix: avoid fragile pending site loopback#1416
superdav42 merged 1 commit into
mainfrom
fix/checkout-pending-root

Conversation

@superdav42

@superdav42 superdav42 commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Follow-up to fix: recover interrupted pending site polling #1415: remove the backend recovery helper/test that finalized partially-created blogs during polling.
  • Fix the root publish path instead: when the runtime lacks fastcgi_finish_request() / litespeed_finish_request(), skip the fragile 0.01s pending-site admin-ajax loopback and enqueue/dispatch the immediate Action Scheduler publish action.
  • Update the no-finish regression so it asserts no wu_publish_pending_site loopback is attempted and the publish action is queued in the main-site scheduler context.

Verification

  • php -l inc/models/class-membership.php && php -l inc/managers/class-membership-manager.php && php -l tests/WP_Ultimo/Managers/Membership_Manager_Test.php
  • vendor/bin/phpcs inc/models/class-membership.php inc/managers/class-membership-manager.php tests/WP_Ultimo/Managers/Membership_Manager_Test.php
  • git diff --check
  • WP-CLI runtime probe with wu_publish_pending_site_can_finish_request=false: publish_loopback_requests=0, http_requests=0, has_scheduled_main=yes.

Notes

  • Focused PHPUnit could not run because the WordPress PHPUnit test library is not installed in this checkout.
  • Direct production investigation showed the humansite checkout path is not currently taking the sovereign/multi-tenancy path; the runtime lacks finish-request support, so the fragile non-blocking pending-site loopback was the root risk.

aidevops.sh v3.20.57 plugin for OpenCode v1.17.4 with gpt-5.5

Summary by CodeRabbit

  • Bug Fixes

    • Improved pending site publishing handling for runtimes with limited PHP request control support. The system now properly queues publishing jobs through Action Scheduler when immediate request finishing isn't available.
  • Refactor

    • Simplified pending site creation workflow by removing manual recovery logic for interrupted operations.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 25c664dd-dad2-41f0-b165-45f21fcf8110

📥 Commits

Reviewing files that changed from the base of the PR and between c575595 and cc8a79d.

📒 Files selected for processing (3)
  • inc/managers/class-membership-manager.php
  • inc/models/class-membership.php
  • tests/WP_Ultimo/Managers/Membership_Manager_Test.php
💤 Files with no reviewable changes (1)
  • inc/managers/class-membership-manager.php

📝 Walkthrough

Walkthrough

This PR removes the interrupted pending-site recovery path from the membership manager's check_pending_site_created() method and its associated helper function. It updates Membership::publish_pending_site_async() to immediately enqueue the async fallback when loopback is enabled but request-finishing support is unavailable. Tests are correspondingly updated to validate the simplified behavior.

Changes

Pending Site Publishing Flow Simplification

Layer / File(s) Summary
Recovery path and method removal
inc/managers/class-membership-manager.php, tests/WP_Ultimo/Managers/Membership_Manager_Test.php
check_pending_site_created() no longer calls recover_interrupted_pending_site() to finalize orphaned blogs; the protected method is deleted entirely. check_pending_site_created() now proceeds directly to stale publishing-state detection. The Site model import is removed and the recovery validation test is deleted.
Async publish fallback for missing finish_request support
inc/models/class-membership.php, tests/WP_Ultimo/Managers/Membership_Manager_Test.php
publish_pending_site_async() now immediately enqueues and dispatches wu_async_publish_pending_site when loopback is enabled but request-finishing is unavailable, then returns early. The prior fallback that set loopback_started to true is removed. The test "skips loopback without finish support" replaces the prior variant and verifies zero loopback requests while confirming the async action is queued.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bug, origin:worker

Poem

🐰 A simpler path, the recovery's gone,
No orphaned blogs left to dwell so long,
When finish fails, we queue and dispatch with grace,
Async fallback finds its natural place—
Cleaner flows for pending sites to roam! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly summarizes the main change: removing fragile pending site loopback logic to improve reliability.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/checkout-pending-root

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🔨 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!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit 130092f into main Jun 13, 2026
12 checks passed
@superdav42

Copy link
Copy Markdown
Collaborator Author

Summary

  • Follow-up to fix: recover interrupted pending site polling #1415: remove the backend recovery helper/test that finalized partially-created blogs during polling.
  • Fix the root publish path instead: when the runtime lacks fastcgi_finish_request() / litespeed_finish_request(), skip the fragile 0.01s pending-site admin-ajax loopback and enqueue/dispatch the immediate Action Scheduler publish action.
  • Update the no-finish regression so it asserts no wu_publish_pending_site loopback is attempted and the publish action is queued in the main-site scheduler context.

Verification

  • php -l inc/models/class-membership.php && php -l inc/managers/class-membership-manager.php && php -l tests/WP_Ultimo/Managers/Membership_Manager_Test.php
  • vendor/bin/phpcs inc/models/class-membership.php inc/managers/class-membership-manager.php tests/WP_Ultimo/Managers/Membership_Manager_Test.php
  • git diff --check
  • WP-CLI runtime probe with wu_publish_pending_site_can_finish_request=false: publish_loopback_requests=0, http_requests=0, has_scheduled_main=yes.

Notes

  • Focused PHPUnit could not run because the WordPress PHPUnit test library is not installed in this checkout.
  • Direct production investigation showed the humansite checkout path is not currently taking the sovereign/multi-tenancy path; the runtime lacks finish-request support, so the fragile non-blocking pending-site loopback was the root risk.

aidevops.sh v3.20.57 plugin for OpenCode v1.17.4 with gpt-5.5


Merged via PR #1416 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant