From b829835194d19d758bcbb0a7bbe815bb2f6ffcfb Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Mon, 26 Oct 2026 09:30:08 -0400 Subject: [PATCH] Remove dead Markdown Database Integration persistence policies CanonicalPersistencePolicy declared partition identities through markdown_db_table_persistence_policy and LogPersistencePolicy bounded Action Scheduler log snapshots through markdown_db_persistent_table_query. MDI no longer applies either filter: the write engine and SQLite mirror that read them are retired, and mdi-native folds legacy partitions into snapshots. --- .../ActionScheduler/LogPersistencePolicy.php | 80 ------------- .../Bootstrap/AlwaysOnServiceProvider.php | 5 +- .../Database/CanonicalPersistencePolicy.php | 44 ------- ...scheduler-log-persistence-policy-smoke.php | 110 ------------------ tests/canonical-persistence-policy-smoke.php | 40 ------- 5 files changed, 1 insertion(+), 278 deletions(-) delete mode 100644 inc/Core/ActionScheduler/LogPersistencePolicy.php delete mode 100644 inc/Core/Database/CanonicalPersistencePolicy.php delete mode 100644 tests/action-scheduler-log-persistence-policy-smoke.php delete mode 100644 tests/canonical-persistence-policy-smoke.php diff --git a/inc/Core/ActionScheduler/LogPersistencePolicy.php b/inc/Core/ActionScheduler/LogPersistencePolicy.php deleted file mode 100644 index a500292852..0000000000 --- a/inc/Core/ActionScheduler/LogPersistencePolicy.php +++ /dev/null @@ -1,80 +0,0 @@ - - */ - public static function filterTablePolicy( $policy ): array { - $policy = is_array( $policy ) ? $policy : array(); - self::addDefaultIdentity( $policy, 'datamachine_jobs', 'job_id' ); - self::addDefaultIdentity( $policy, 'datamachine_logs', 'id' ); - return $policy; - } - - /** @param array $policy */ - private static function addDefaultIdentity( array &$policy, string $table, string $column ): void { - if ( ! array_key_exists( $table, $policy ) ) { - $policy[ $table ] = array( 'partition_by' => $column ); - return; - } - if ( is_array( $policy[ $table ] ) && ! array_key_exists( 'partition_by', $policy[ $table ] ) ) { - $policy[ $table ]['partition_by'] = $column; - } - } -} diff --git a/tests/action-scheduler-log-persistence-policy-smoke.php b/tests/action-scheduler-log-persistence-policy-smoke.php deleted file mode 100644 index 2a53dfe0f4..0000000000 --- a/tests/action-scheduler-log-persistence-policy-smoke.php +++ /dev/null @@ -1,110 +0,0 @@ - $query . ' /* third-party-policy */', - 20 -); -$composed = apply_filters( 'markdown_db_persistent_table_query', $source_query, 'actionscheduler_logs', 'custom_actionscheduler_logs', null ); -assert_log_persistence( - 'earlier third-party query policies are preserved inside the bounded source', - str_contains( $composed, '/* third-party-policy */ ) AS datamachine_action_scheduler_log_source' ) -); - -add_filter( 'datamachine_action_scheduler_log_persistence_row_budget', static fn() => '25', 10 ); -assert_log_persistence( 'digit-string budget is accepted', 25 === LogPersistencePolicy::rowBudget() ); -add_filter( 'datamachine_action_scheduler_log_persistence_row_budget', static fn() => '25; DROP TABLE posts', 20 ); -assert_log_persistence( 'unsafe budget falls back to the safe default', 10000 === LogPersistencePolicy::rowBudget() ); -$unsafe_budget_query = LogPersistencePolicy::filterPersistentTableQuery( $source_query, 'actionscheduler_logs', 'tenant_42_actionscheduler_logs', null ); -assert_log_persistence( - 'unsafe budget is never interpolated into SQL', - str_contains( $unsafe_budget_query, 'LIMIT 10000' ) && ! str_contains( $unsafe_budget_query, 'DROP TABLE' ) -); -add_filter( 'datamachine_action_scheduler_log_persistence_row_budget', static fn() => 999999, 30 ); -assert_log_persistence( 'budget has a bounded maximum', 100000 === LogPersistencePolicy::rowBudget() ); - -if ( $failed > 0 ) { - echo "\naction-scheduler-log-persistence-policy-smoke failed: {$failed}/{$total} assertions failed.\n"; - exit( 1 ); -} - -echo "\naction-scheduler-log-persistence-policy-smoke passed: {$total} assertions.\n"; diff --git a/tests/canonical-persistence-policy-smoke.php b/tests/canonical-persistence-policy-smoke.php deleted file mode 100644 index 4e9977668b..0000000000 --- a/tests/canonical-persistence-policy-smoke.php +++ /dev/null @@ -1,40 +0,0 @@ - false, - 'datamachine_jobs' => array( 'custom' => 'preserved' ), - 'datamachine_logs' => false, - ) -); -$overrides = CanonicalPersistencePolicy::filterTablePolicy( - array( - 'datamachine_jobs' => false, - 'datamachine_logs' => array( 'partition_by' => 'external_id' ), - ) -); - -$passed = false === $policy['other_table'] - && 'preserved' === $policy['datamachine_jobs']['custom'] - && 'job_id' === $policy['datamachine_jobs']['partition_by'] - && false === $policy['datamachine_logs'] - && false === $overrides['datamachine_jobs'] - && 'external_id' === $overrides['datamachine_logs']['partition_by']; - -echo ( $passed ? 'PASS' : 'FAIL' ) . ': high-churn tables declare stable partition identities without replacing existing policy.' . PHP_EOL; -exit( $passed ? 0 : 1 );