refactor(2meet-data-optimizer-hivepress-addon): stop registering Hot zone fields
Tests / PHP Lint (pull_request) Successful in 50s
Tests / Unit Tests (pull_request) Successful in 58s
Tests / Integration Tests (pull_request) Successful in 57s

- ADR-003 step 4 (AddOn side): core, requests, bookings, memberships and
  marketplace adapters no longer register zone=hot fields or contribute
  hot_* FSM modules; their keys live in TMDO_HivePress_Entity_Groups.
  Cold/warm registrations are unchanged.
- Hot-table doctor probes go with them (trait defaults apply). The
  hot-clause query rewrite and cron optimizer are now inert and are left
  for the ADR step-5 removal together with core's hot path.
- New NoHotZoneRegistrationTest pins the invariant across all 13 adapters;
  per-adapter hot assertions removed.
- Verify: HP unit 142 / integration 49 green, phpcs clean (WordPress)
- PR: PR-037
This commit is contained in:
2026-09-26 01:13:35 +08:00
parent 0e260ee3a9
commit 0254e40d83
11 changed files with 71 additions and 527 deletions
@@ -5,8 +5,8 @@
* Two related models:
*
* - Request (post_type=hp_request)
* hot fields: hp_drafted (bool), hp_expired_time (unix ts)
* — same access pattern as Listing (user dashboard + expiry cron)
* hp_drafted / hp_expired_time are flattened by the `hp_draft_flags`
* and `hp_request_core` entity groups (TMDO_HivePress_Entity_Groups).
*
* - Offer (comment_type=hp_offer, parent post_type=hp_request)
* stored in comment columns only — no comment meta to flatten.
@@ -59,74 +59,6 @@ if ( ! class_exists( 'TMDO_HivePress_Requests_Adapter' ) ) {
public function minimum_addon_version(): string {
return '1.2.0';
}
/**
* Register hot fields for hp_request post type.
*
* @param TMDO_Schema_Registry $registry Schema registry singleton.
*/
public function on_register_fields( TMDO_Schema_Registry $registry ): void {
$registry->register_many(
$this->plugin_slug(),
array(
array(
'post_type' => 'hp_request',
'meta_key' => 'hp_drafted',
'zone' => 'hot',
'data_type' => 'tinyint(1) NOT NULL DEFAULT 0',
'column' => 'hp_drafted',
'indexed' => true,
),
array(
'post_type' => 'hp_request',
'meta_key' => 'hp_expired_time',
'zone' => 'hot',
'data_type' => 'bigint(20) UNSIGNED NOT NULL DEFAULT 0',
'column' => 'hp_expired_time',
'indexed' => true,
),
)
);
}
/**
* Doctor probe — request hot table.
*
* @return array{ok:bool, message:string, details?:array<string,mixed>}
*/
public function doctor_check(): array {
global $wpdb;
if ( ! isset( $wpdb ) || ! is_object( $wpdb ) ) {
return array(
'ok' => false,
'message' => 'wpdb global not available',
);
}
$table = $wpdb->prefix . 'wpdo_hot_hp_request';
try {
$exists = (bool) $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table ) );
return array(
'ok' => $exists,
'message' => $exists
? sprintf( 'hivepress-requests: %s present', $table )
: sprintf( 'hivepress-requests: %s missing', $table ),
);
} catch ( \Throwable $e ) {
return array(
'ok' => false,
'message' => sprintf( 'hivepress-requests doctor failed: %s', $e->getMessage() ),
);
}
}
/**
* FSM modules this adapter contributes.
*
* @return array<int,string>
*/
public function migrations(): array {
return array( 'hot_hp_request' );
}
}
} // end if ( ! class_exists )