fix(2meet-data-optimizer): doctor ignores drift records of groups no longer registered

- A group's last drift record outlived its registration (wc_product and user hot on dev36, any add-on deactivated): doctor counted it and could warn forever with a --fix hint that cannot reach it. Only records of backfillable groups are read; the router and clean_since already go by the registry.
- Verify: DoctorTest (RED before); dev36 doctor user 9 → 8 groups
- PR: PR-089a
This commit is contained in:
2026-09-27 10:07:02 +08:00
parent fab07655a2
commit edf9e6bc93
2 changed files with 30 additions and 1 deletions
+2 -1
View File
@@ -148,7 +148,8 @@ class TMDO_CLI {
WP_CLI::log( 'Drift (last `wp tmdo drift-check` or daily sample):' );
foreach ( TMDO_Entity_Registry::VALID_ENTITY_TYPES as $entity_type ) {
$groups = TMDO_Entity_Migration_Engine::backfillable_groups( $entity_type );
$last = $status[ $entity_type ] ?? array();
// Records of groups no longer registered can be neither re-checked nor fixed.
$last = array_intersect_key( (array) ( $status[ $entity_type ] ?? array() ), array_flip( $groups ) );
if ( empty( $groups ) || ( empty( $last ) && ! TMDO_Mode_Manager::writes_to_flat( $entity_type ) ) ) {
continue;
}