Skip to content

revert: undo wu_pre_* filter chokepoints (ADR-001 Amendment 1 supersedure)#1262

Merged
superdav42 merged 2 commits into
mainfrom
revert/adr-001-amendment-1-wu-pre-filters
May 22, 2026
Merged

revert: undo wu_pre_* filter chokepoints (ADR-001 Amendment 1 supersedure)#1262
superdav42 merged 2 commits into
mainfrom
revert/adr-001-amendment-1-wu-pre-filters

Conversation

@superdav42
Copy link
Copy Markdown
Collaborator

@superdav42 superdav42 commented May 22, 2026

Summary

Reverts two recently-merged PRs that added wu_pre_* filter chokepoints to the model layer. These filters were the load-bearing interception points for the original WP Ultimo Multi-Tenancy Phase 3.4/3.5 plan (a REST-pull Network_Client SDK on each sovereign tenant).

That plan has been superseded by ADR-001 Amendment 1 — Direct-DB Push Model (merged downstream in Ultimate-Multisite/ultimate-multisite-multi-tenancy#86). Under the new architecture:

  • The sovereign tenant runs as a near-stock single-site WordPress install.
  • The tenant never calls out to the network at request time — no HTTP client, no JWT, no cache layer.
  • Network state changes are pushed into each tenant's local wp_options / wp_blogmeta by a network-side Tenant_State_Pusher (Action Scheduler job).
  • The tenant reads only from its own local DB.

The two wu_pre_* filter PRs being reverted have no consumer under the push model and become dead-code surface in core. Removing them keeps upstream's API minimal.

Reverted PRs

Reverted Original PR Description Reason
commit 00d617fc #1260 wu_pre_* filters on 6 model methods Tenant never hooks these under push model
commit 9acf0c7f #1259 wu_pre_* filters on Base_Model::get_by_id, ::get_by, ::get_by_hash Tenant never hooks these under push model

Kept (aligned with amendment, not reverted)

PR Description Why kept
#1257 Disable tenant-side Gateway Manager in sovereign mode Aligned — sovereign tenant has no payment surface
#1258 Disable incompatible compat shims in sovereign mode Aligned — incompatible behaviour gated off
#1261 Disable tenant-side Checkout in sovereign mode Aligned — customer-facing checkout moves to main site

These three will be extended in a follow-up PR (downstream "3-A7") to disable the remaining customer-facing UI elements (Account_Summary, Billing_Info, Invoices, My_Sites, Subscription, Site_Actions, Template_Switching, Domain_Mapping) in sovereign mode, with replacement links to a new main-site Customer_Hub (downstream "3-A8").

Risk

Low. The reverted filters are net-new in core (merged hours ago) and have no published consumer. Reverting before any third-party integration depends on them is the cheap moment.

Verification

  • git diff origin/main -- inc/models/class-base-model.php — clean removal of the filter blocks
  • git diff origin/main -- inc/models/*.php — clean removal of per-method filter blocks
  • Core test suite unchanged; these PRs introduced no test coverage that needs accompanying removal.

References

  • ADR-001 Amendment 1 (merged): Ultimate-Multisite/ultimate-multisite-multi-tenancy#86
  • ADR-001 Amendment 1 doc: Ultimate-Multisite/ultimate-multisite-multi-tenancy:docs/adr-001-amendment-1-direct-db-push.md
  • Original tenancy parent-task (closed): Ultimate-Multisite/ultimate-multisite-multi-tenancy#43

aidevops.sh v3.17.28 plugin for OpenCode v1.15.7 with claude-opus-4-7 spent 17h 9m and 125,709 tokens on this with the user in an interactive session.

Summary by CodeRabbit

  • Refactor
    • Removed internal filter hooks across multiple models (Base_Model, Customer, Domain, Membership, and Site) that previously allowed early result overrides. Methods now execute their standard database logic directly.
    • Removed corresponding tests for filter behavior.

Note: If you've customized integrations using these filter hooks, they will require updates.

Review Change Stack

This reverts commit ef74b6a.

Under ADR-001 Amendment 1 — Direct-DB Push Model
(Ultimate-Multisite/ultimate-multisite-multi-tenancy#86), sovereign
tenants do not read network state via filter chokepoints at request
time. Instead, the network pushes state into each tenant's local
wp_options / wp_blogmeta via a Tenant_State_Pusher Action Scheduler
job, and the tenant reads only from its local DB.

These wu_pre_* filters on Base_Model::get_by, ::get_by_hash,
::query_by_columns, and the upstream model methods were the
load-bearing interception points for the original REST-pull plan
(Phase 3.4 / Phase 3.5). Under the push model they are dead-code
surface — no sovereign tenant code hooks them. Reverting to keep
core's surface area minimal.

Ref Ultimate-Multisite/ultimate-multisite-multi-tenancy#86
)"

This reverts commit f87f1e2.

Under ADR-001 Amendment 1 — Direct-DB Push Model
(Ultimate-Multisite/ultimate-multisite-multi-tenancy#86), the
sovereign tenant runs as a single-site WordPress install that reads
only its local DB. The Base_Model getter filters (get_by_id,
get_by, get_by_hash) were intended as the interception points for
the tenant's planned Network_Client SDK, allowing the tenant to
service model reads from network state.

That entire plan is replaced by direct-DB push from network into
the tenant's local wp_options / wp_blogmeta. The tenant has no
SDK, no HTTP client, no cache, no filter hook into Base_Model.
These filters become dead-code surface in core and are reverted to
keep the upstream API minimal.

The companion 6-model-method filters PR (#1260) is reverted in the
preceding commit.

Ref Ultimate-Multisite/ultimate-multisite-multi-tenancy#86
@superdav42 superdav42 added origin:interactive Created by interactive user session adr-001 ADR-001 sovereign tenant isolation work labels May 22, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 482dd900-0a41-4b98-aac3-dba276ca0742

📥 Commits

Reviewing files that changed from the base of the PR and between 2da29b3 and 9acf0c7.

📒 Files selected for processing (6)
  • inc/models/class-base-model.php
  • inc/models/class-customer.php
  • inc/models/class-domain.php
  • inc/models/class-membership.php
  • inc/models/class-site.php
  • tests/WP_Ultimo/Models/Base_Model_Test.php
💤 Files with no reviewable changes (6)
  • inc/models/class-customer.php
  • inc/models/class-domain.php
  • inc/models/class-base-model.php
  • inc/models/class-membership.php
  • tests/WP_Ultimo/Models/Base_Model_Test.php
  • inc/models/class-site.php

📝 Walkthrough

Walkthrough

Removes apply_filters() early-return hooks from Base_Model static lookup methods and six model-specific query/aggregate methods, eliminating filter-based overrides that previously allowed plugins to short-circuit database execution. Corresponding test coverage is removed.

Changes

Model filter hook removal

Layer / File(s) Summary
Base_Model lookup filters
inc/models/class-base-model.php
get_by_id(), get_by_hash(), and get_by() remove wu_pre_get_by_id_{$model}, wu_pre_get_by_hash_{$model}, and wu_pre_get_by_{$model} early-return filters, proceeding directly to query class instantiation without filter-based short-circuiting.
Model-specific aggregate and lookup filters
inc/models/class-customer.php, inc/models/class-membership.php, inc/models/class-domain.php, inc/models/class-site.php
Customer::get_total_grossed(), Membership::get_total_grossed(), Domain::get_by_site(), Site::get_membership(), Site::get_all_by_type(), and Site::get_all_categories() remove their respective wu_pre_* early-return filter hooks, executing database queries directly without override capability.
Test coverage removal
tests/WP_Ultimo/Models/Base_Model_Test.php
Seven test methods validating pre-filter behavior are removed, including tests for null defaults, instance returns, and model discrimination by the wu_pre_get_by_* filter family.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

origin:worker

Poem

🐰 The filters fade like morning dew,
Those pre-get hooks we bid adieu,
Direct to queries, swift and clean—
No overrides to intervene!
Tests retire as hooks depart,
A simpler model-layer art. 🌱

🚥 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 clearly and accurately summarizes the primary change: reverting wu_pre_* filter additions that were implemented in recent commits.
Linked Issues check ✅ Passed The PR correctly implements the ADR-001 Amendment 1 decision by reverting net-new wu_pre_* filter chokepoints (PR-1 and PR-2 from #43) that became unnecessary under the Direct-DB Push Model.
Out of Scope Changes check ✅ Passed All changes are in-scope removals of wu_pre_* filters and their tests from Base_Model and six model methods, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 revert/adr-001-amendment-1-wu-pre-filters

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

Performance Test Results

Performance test results for 0245ff9 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: /

Run DB Queries Memory Before Template Template WP Total LCP TTFB LCP - TTFB
0 40 37.73 MB 659.00 ms (-26.00 ms / -4% ) 124.00 ms (-10.50 ms / -8% ) 833.00 ms 1586.00 ms (-42.00 ms / -3% ) 1512.00 ms (-42.90 ms / -3% ) 68.30 ms (+2.25 ms / +3% )
1 56 49.13 MB 746.00 ms 113.00 ms (+3.50 ms / +3% ) 858.50 ms 1654.00 ms 1587.45 ms 61.55 ms (-1.55 ms / -3% )

@superdav42 superdav42 closed this May 22, 2026
@superdav42 superdav42 reopened this May 22, 2026
@superdav42 superdav42 merged commit 40fa6e7 into main May 22, 2026
17 checks passed
@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 added the review-feedback-scanned Merged PR already scanned for quality feedback label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adr-001 ADR-001 sovereign tenant isolation work origin:interactive Created by interactive user session review-feedback-scanned Merged PR already scanned for quality feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant