tgc.church#256: route mapped multisite queue jobs - #56
Conversation
📝 WalkthroughWalkthroughThe change adds active domain-mapping resolution for switched-site payload URLs. It fails closed on canonical-domain conflicts. Worker scheduling now skips unroutable jobs and logs each affected site once. Regression fixtures cover mapping lookup, conflicts, and diagnostic deduplication. ChangesSwitched-site job routing
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant JobPayload
participant DomainMappingDB
participant WorkerProcess
JobPayload->>DomainMappingDB: Query active domain mapping
DomainMappingDB-->>JobPayload: Return mapped URL or conflict result
JobPayload->>WorkerProcess: Provide payload with site_url
WorkerProcess->>WorkerProcess: Skip scheduling when site_url is empty
WorkerProcess-->>WorkerProcess: Log once per site and keep job pending
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 PHPStan (2.2.6)PHPStan was skipped because the config uses disallowed 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 `@src/class-job-payload.php`:
- Around line 205-280: Cache the domain-mapping table availability and resolved
routing outcome used by current_mapped_site_url() and
canonical_domain_is_mapped_elsewhere() per site during a rescan, so repeated
payloads avoid repeating table and mapping queries. Add a reset of these caches
at the start of each rescan, ensuring routing metadata repairs are observed by
the next scan while preserving existing URL and conflict behavior.
🪄 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: 4ff7f208-99d2-4d2c-9b9d-b44852ddf9d1
📒 Files selected for processing (3)
src/class-job-payload.phpsrc/class-worker-process.phptests/regression.php
Summary
Root cause
Full-network scans used each
wp_blogscanonical domain for executor bootstrap. On domain-mapped sites, that hostname can resolve to a different blog, so the executor correctly rejected jobs with a payload-site mismatch and due Action Scheduler rows remained pending.Verification
composer validate --strictcomposer test:regressionphp -l src/class-job-payload.phpphp -l src/class-worker-process.phpphp -l tests/regression.phpgit diff --checkDeployment note
For superdav42/tgc.church#256. Keep the production-health issue open until this plugin commit is consumed by the Bedrock project, deployed, and the read-only Action Scheduler audit confirms the stale queues remain clear.
aidevops.sh v3.32.219 plugin for OpenCode v1.18.9 with gpt-5.6-sol spent 3h 35m and 731,130 tokens on this with the user in an interactive session.
Summary by CodeRabbit