Skip to content

Commit 6885cba

Browse files
authored
fix: purge dm_ prefix remnants
* fix: purge dm_ prefix remnants in favor of datamachine_ * fix: align migration scaffolding assignments
1 parent 1b40051 commit 6885cba

35 files changed

Lines changed: 582 additions & 572 deletions

inc/Abilities/Email/EmailAbilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ private function saveToSentFolder( array $to, string $subject, string $body, arr
13341334
*
13351335
* @param string $from The derived From address.
13361336
*/
1337-
$from = apply_filters( 'dm_email_sent_folder_from', $from );
1337+
$from = apply_filters( 'datamachine_email_sent_folder_from', $from );
13381338
$to_str = implode( ', ', $to );
13391339
$date = gmdate( 'r' );
13401340

inc/Abilities/Engine/RunFlowAbility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ private static function backpressureDeferSeconds( int $flow_id ): int {
502502

503503
// Deterministic jitter in [0, base) spreads deferred flows across the
504504
// window instead of waking them all at base seconds.
505-
$jitter = absint( crc32( 'dm_backpressure_' . $flow_id ) ) % $base;
505+
$jitter = absint( crc32( 'datamachine_backpressure_' . $flow_id ) ) % $base;
506506

507507
return $base + $jitter;
508508
}

inc/Abilities/Flow/WebhookTriggerAbility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ public function executeSetRateLimit( array $input ): array {
878878
}
879879

880880
// Clear any existing rate limit counter so new config takes effect immediately.
881-
delete_transient( 'dm_webhook_rate_' . $flow_id );
881+
delete_transient( \DataMachine\Api\WebhookTrigger::rate_limit_transient_key( $flow_id ) );
882882

883883
$effective_max = $rate_config['max'] ?? \DataMachine\Api\WebhookTrigger::DEFAULT_RATE_LIMIT_MAX;
884884
$effective_window = $rate_config['window'] ?? \DataMachine\Api\WebhookTrigger::DEFAULT_RATE_LIMIT_WINDOW;

inc/Abilities/Media/GDRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ public function save_temp( string $format = 'png', int $quality = -1 ): ?string
787787
return null;
788788
}
789789

790-
$temp_file = tempnam( sys_get_temp_dir(), 'dm_img_' );
790+
$temp_file = tempnam( sys_get_temp_dir(), 'datamachine_img_' );
791791
$ext = 'jpeg' === $format ? '.jpg' : '.png';
792792
$path = $temp_file . $ext;
793793

inc/Api/WebhookTrigger.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ private static function check_rate_limit( int $flow_id, array $scheduling_config
518518
return null;
519519
}
520520

521-
$transient_key = 'dm_webhook_rate_' . $flow_id;
521+
$transient_key = self::rate_limit_transient_key( $flow_id );
522522
$current_count = (int) get_transient( $transient_key );
523523

524524
if ( $current_count >= $max ) {
@@ -568,6 +568,16 @@ function ( $result ) use ( $window ) {
568568
return null;
569569
}
570570

571+
/**
572+
* Build the per-flow rate-limit transient key.
573+
*
574+
* @param int $flow_id Flow ID.
575+
* @return string Transient key.
576+
*/
577+
public static function rate_limit_transient_key( int $flow_id ): string {
578+
return 'datamachine_webhook_rate_' . $flow_id;
579+
}
580+
571581
/**
572582
* Extract Bearer token from Authorization header.
573583
*

inc/Engine/Tasks/RecurringScheduler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ public static function calculateStaggerOffset( int $seed, int $interval_seconds
527527
if ( $max_offset <= 0 ) {
528528
return 0;
529529
}
530-
return absint( crc32( 'dm_stagger_' . $seed ) ) % $max_offset;
530+
return absint( crc32( 'datamachine_stagger_' . $seed ) ) % $max_offset;
531531
}
532532

533533
/**

inc/Engine/Tasks/TaskScheduler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public static function scheduleBatch( string $taskType, array $itemParams, array
375375
// so the chain caller → batch_parent is preserved even though
376376
// per-item children chain off the caller directly (below).
377377
$jobs_db = new Jobs();
378-
$batch_id = 'dm_batch_' . wp_generate_uuid4();
378+
$batch_id = 'datamachine_batch_' . wp_generate_uuid4();
379379
$batch_create_args = array(
380380
'pipeline_id' => 'direct',
381381
'flow_id' => 'direct',

inc/migrations/scaffolding.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ function datamachine_get_scaffold_defaults( string $agent_name = '' ): array {
9292
$admin_name = $admin_user ? $admin_user->display_name : '';
9393

9494
// --- Versions ---
95-
$wp_version = get_bloginfo( 'version' );
96-
$php_version = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
97-
$dm_version = defined( 'DATAMACHINE_VERSION' ) ? DATAMACHINE_VERSION : 'unknown';
98-
$created = wp_date( 'Y-m-d' );
95+
$wp_version = get_bloginfo( 'version' );
96+
$php_version = PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
97+
$datamachine_version = defined( 'DATAMACHINE_VERSION' ) ? DATAMACHINE_VERSION : 'unknown';
98+
$created = wp_date( 'Y-m-d' );
9999

100100
// --- Build SOUL.md context lines ---
101101
$context_items = array();
@@ -187,7 +187,7 @@ function datamachine_get_scaffold_defaults( string $agent_name = '' ): array {
187187
'This file tracks persistent knowledge. Keep it lean — persistent facts only, not session logs.',
188188
'',
189189
'## State',
190-
"- Data Machine v{$dm_version} activated on {$created}",
190+
"- Data Machine v{$datamachine_version} activated on {$created}",
191191
"- WordPress {$wp_version}, PHP {$php_version}",
192192
'',
193193
'## Lessons Learned',

tests/Unit/Abilities/Engine/PipelineBatchSchedulerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function test_fanout_stores_batch_state_in_engine_data(): void {
165165
$this->assertEquals( 'step_abc_123', $parent_engine['next_flow_step_id'] );
166166

167167
// No transient should exist.
168-
$this->assertFalse( get_transient( 'dm_pipeline_batch_' . $parent_id ) );
168+
$this->assertFalse( get_transient( 'datamachine_pipeline_batch_' . $parent_id ) );
169169
}
170170

171171
/**

tests/Unit/Abilities/TaxonomyAbilityWpErrorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class TaxonomyAbilityWpErrorTest extends WP_UnitTestCase {
1818

19-
private const TEST_TAXONOMY = 'dm_wp_error_terms';
19+
private const TEST_TAXONOMY = 'datamachine_wp_error_terms';
2020

2121
public function set_up(): void {
2222
parent::set_up();
@@ -80,7 +80,7 @@ public function test_merge_term_meta_callback_failure_returns_wp_error(): void {
8080
'term_id' => 0,
8181
'taxonomy' => self::TEST_TAXONOMY,
8282
'data' => array( 'name' => 'Charleston' ),
83-
'field_map' => array( 'name' => 'dm_name' ),
83+
'field_map' => array( 'name' => 'datamachine_name' ),
8484
)
8585
);
8686

@@ -94,7 +94,7 @@ public function test_merge_term_meta_static_helper_preserves_legacy_failure_arra
9494
0,
9595
self::TEST_TAXONOMY,
9696
array( 'name' => 'Charleston' ),
97-
array( 'name' => 'dm_name' )
97+
array( 'name' => 'datamachine_name' )
9898
);
9999

100100
$this->assertIsArray( $result );

0 commit comments

Comments
 (0)