fix(2meet-data-optimizer): serve native meta in shadow_read and compare flat values
- In shadow_read, TMDO_Hook_Bus::intercept_get() returned the flat value. update_metadata() reads the old value through that filter after the Hook Bus has upserted the new one, so WP saw old === new and never wrote native meta: every update in shadow_read was lost on demotion (dev36 2026-09-26). shadow_read now returns $check (native) and compares flat on a sample of reads (filter tmdo_shadow_compare_sample_rate, default 0.1). aeav_only is unchanged; the post query router still routes in shadow_read. - Live suite shadow_write: xfail markers removed, HivePress listing case added (new int key hp_rating_count); fixtures gain post() and a post_type-scoped field()/flat(). - Verify: live shadow_write + serialized 8/8 PASS (old code: 4 FAIL); unit 685 OK, integration 484 OK, phpcs (phpcs.xml) 0, stan OK - PR: PR-056
This commit is contained in:
@@ -41,8 +41,7 @@ TMDO_Live::test(
|
||||
|
||||
tmdo_live_assert_true( false !== $ret, 'update_user_meta returned false' );
|
||||
tmdo_live_assert_same( array( 'After' ), TMDO_Live_Fixtures::native( 'user', $uid, 'first_name' ), 'native first_name' );
|
||||
},
|
||||
array( 'xfail' => 'PR-056' )
|
||||
}
|
||||
);
|
||||
|
||||
TMDO_Live::test(
|
||||
@@ -59,8 +58,7 @@ TMDO_Live::test(
|
||||
wp_cache_delete( $uid, 'user_meta' );
|
||||
|
||||
tmdo_live_assert_same( 'After', get_user_meta( $uid, 'last_name', true ), 'last_name after demotion' );
|
||||
},
|
||||
array( 'xfail' => 'PR-056' )
|
||||
}
|
||||
);
|
||||
|
||||
TMDO_Live::test(
|
||||
@@ -76,6 +74,23 @@ TMDO_Live::test(
|
||||
|
||||
tmdo_live_assert_true( false !== $ret, 'update_term_meta returned false' );
|
||||
tmdo_live_assert_same( array( 'heart' ), TMDO_Live_Fixtures::native( 'term', $tid, 'hp_icon' ), 'native hp_icon' );
|
||||
},
|
||||
array( 'xfail' => 'PR-056' )
|
||||
}
|
||||
);
|
||||
|
||||
TMDO_Live::test(
|
||||
'shadow_read: HivePress listing hp_rating_count (new int key) reaches native',
|
||||
static function () {
|
||||
TMDO_Live_Fixtures::field( 'post', 'hp_rating_count', 'hp_listing' );
|
||||
TMDO_Live_Fixtures::use_modes( array( 'post' => 'dual_write' ) );
|
||||
$lid = TMDO_Live_Fixtures::post( 'hp_listing' );
|
||||
TMDO_Live_Fixtures::use_modes( array( 'post' => 'shadow_read' ) );
|
||||
|
||||
// HivePress writes the recomputed count as an int; the flat read cast it
|
||||
// to the same int, so the old code skipped the native write.
|
||||
$ret = update_post_meta( $lid, 'hp_rating_count', 1 );
|
||||
|
||||
tmdo_live_assert_true( false !== $ret, 'update_post_meta returned false' );
|
||||
tmdo_live_assert_same( array( '1' ), TMDO_Live_Fixtures::native( 'post', $lid, 'hp_rating_count' ), 'native hp_rating_count' );
|
||||
tmdo_live_assert_same( '1', TMDO_Live_Fixtures::flat( 'post', $lid, 'hp_rating_count', 'hp_listing' ), 'flat hp_rating_count' );
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user