refactor(2meet-data-optimizer): stop registering the wc_product post group

- WooCommerce reads product meta directly and writes stock by SQL, so a flat copy drifted (R-2.1 V1 T4); product meta now stays in native only (plan decision 2). TMDO_Post_Fields registers wp_core, attachment and nav_menu_item. Existing wp_wpdo_post_wc_product tables are left in place and still dropped on uninstall; the orphan restore registers nothing for them while native meta holds the keys; `wp tmdo bridge-restore-native post --group=wc_product --retire` archives them.
- Tests that route products register the former group themselves (tmdo_test_register_wc_product_group(), same name and table); live router Q06 runs on wp_core's _wp_page_template instead of _sku. The post stress tester already skips flat tables that do not exist.
- Verify: PostFieldsRegistrationTest (RED before); dev36: wc_product absent from the registry and not restored as an orphan, a CLI order took stock 452 → 450 in native with no DB error (reverted), drift post 10 groups 0.
- PR: PR-077
This commit is contained in:
2026-09-27 01:11:52 +08:00
parent f15473527c
commit f48df1a33f
12 changed files with 68 additions and 174 deletions
+8 -7
View File
@@ -247,21 +247,22 @@ TMDO_Live::test(
TMDO_Live::test(
'Q06 LIKE matches substrings and escapes wildcards, routed',
static function () {
TMDO_Live_Fixtures::field( 'post', '_sku', 'product' );
// A text key of wp_core (WooCommerce's _sku left the flat tables in 1.2.0).
TMDO_Live_Fixtures::field( 'post', '_wp_page_template' );
TMDO_Live_Fixtures::use_modes( array( 'post' => 'shadow_read' ) );
$p = tmdo_live_router_posts(
'product',
'post',
array(
'P1' => array( '_sku' => 'tmdo-live-B1-1' ),
'P2' => array( '_sku' => 'tmdo-live-B1-10' ),
'P3' => array( '_sku' => 'tmdo-live-B2-1' ),
'P1' => array( '_wp_page_template' => 'tmdo-live-B1-1' ),
'P2' => array( '_wp_page_template' => 'tmdo-live-B1-10' ),
'P3' => array( '_wp_page_template' => 'tmdo-live-B2-1' ),
)
);
foreach ( array( 'B1-1', 'B1_1' ) as $needle ) {
tmdo_live_router_assert_native(
array(
'post_type' => 'product',
'meta_query' => array( array( 'key' => '_sku', 'value' => $needle, 'compare' => 'LIKE' ) ),
'post_type' => 'post',
'meta_query' => array( array( 'key' => '_wp_page_template', 'value' => $needle, 'compare' => 'LIKE' ) ),
),
array_values( $p ),
true