fix(2meet-data-optimizer): give new posts' flat rows their status/date copies; sync drops cached counts

- add_flat_rows (wp_insert_post, after transition_post_status) inserts the
  copies with the empty row: a NULL copy turned the copy route off for the
  whole group until the next sync
- wp tmdo post-status-sync bumps the routed count version (not on dry runs)
- Test bootstrap: minimal WP_Post stub
- Found in the 2.4 correctness review (residual risks)
- Verify: 2 new integration tests; integration 606, unit 704, phpcs 0, stan OK
- PR: PR-133
This commit is contained in:
2026-09-28 00:32:59 +08:00
parent 80343ec282
commit 3e96357459
5 changed files with 53 additions and 2 deletions
+10
View File
@@ -132,6 +132,16 @@ class PostStatusSyncTest extends TestCase {
$this->assertSame( 2, $report['ps_a']['mismatched'] );
}
/** Routed counts cached while copies were stale are dropped by a sync (2.4 correctness review). */
public function test_a_sync_invalidates_cached_routed_counts_but_a_dry_run_does_not(): void {
$GLOBALS['_wp_last_changed'][ TMDO_Post_Query_Router::COUNT_VERSION_GROUP ] = 'before';
TMDO_Post_Status_Sync::run( true );
$this->assertSame( 'before', $GLOBALS['_wp_last_changed'][ TMDO_Post_Query_Router::COUNT_VERSION_GROUP ] );
TMDO_Post_Status_Sync::run();
$this->assertNotSame( 'before', $GLOBALS['_wp_last_changed'][ TMDO_Post_Query_Router::COUNT_VERSION_GROUP ] );
}
public function test_copies_use_the_posts_collation_so_they_compare_with_posts(): void {
global $wpdb;
TMDO_Post_Status_Sync::run();