Skip to content

Commit fef998b

Browse files
Fix cleanup release lint (#880)
* Fix cleanup release lint * Fix cleanup evidence PHPStan guard --------- Co-authored-by: homeboy-ci[bot] <266378653+homeboy-ci[bot]@users.noreply.github.com>
1 parent 0c0654f commit fef998b

3 files changed

Lines changed: 33 additions & 33 deletions

File tree

inc/Cleanup/DataMachineJobCleanupRunEvidenceStore.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private function aggregate_cleanup_child_jobs( array $child_jobs ): array {
147147

148148
$parent_job_ids = array();
149149
foreach ( $child_jobs as $child ) {
150-
$parent_job_id = (int) ( is_array($child) ? ( $child['parent_job_id'] ?? 0 ) : 0 );
150+
$parent_job_id = (int) ( $child['parent_job_id'] ?? 0 );
151151
if ( $parent_job_id > 0 ) {
152152
$parent_job_ids[ $parent_job_id ] = true;
153153
}
@@ -206,10 +206,10 @@ private function aggregate_cleanup_child_jobs( array $child_jobs ): array {
206206
}
207207
}
208208

209-
$summary['artifact_cleanup']['freed_human'] = $this->format_bytes($summary['artifact_cleanup']['bytes_reclaimed']);
210-
$summary['cleanup_items']['freed_human'] = $this->format_bytes($summary['cleanup_items']['bytes_reclaimed']);
211-
$summary['children']['batch_job_ids'] = array_values(array_unique($summary['children']['batch_job_ids']));
212-
$summary['children']['chunk_job_ids'] = array_values(array_unique($summary['children']['chunk_job_ids']));
209+
$summary['artifact_cleanup']['freed_human'] = $this->format_bytes($summary['artifact_cleanup']['bytes_reclaimed']);
210+
$summary['cleanup_items']['freed_human'] = $this->format_bytes($summary['cleanup_items']['bytes_reclaimed']);
211+
$summary['children']['batch_job_ids'] = array_values(array_unique($summary['children']['batch_job_ids']));
212+
$summary['children']['chunk_job_ids'] = array_values(array_unique($summary['children']['chunk_job_ids']));
213213
$summary['children']['pending_job_ids'] = array_values(array_unique($summary['children']['pending_job_ids']));
214214
$summary['children']['pending_without_drainable_action_job_ids'] = array_values(array_unique($summary['children']['pending_without_drainable_action_job_ids']));
215215
$summary['children']['processing_job_ids'] = array_values(array_unique($summary['children']['processing_job_ids']));
@@ -227,30 +227,30 @@ private function aggregate_cleanup_child_jobs( array $child_jobs ): array {
227227
* @return array<string,mixed>
228228
*/
229229
private function summarize_cleanup_children( array $children ): array {
230-
$limit = 10;
231-
$batch_ids = (array) ( $children['batch_job_ids'] ?? array() );
232-
$chunk_ids = (array) ( $children['chunk_job_ids'] ?? array() );
233-
$pending = (array) ( $children['pending_job_ids'] ?? array() );
230+
$limit = 10;
231+
$batch_ids = (array) ( $children['batch_job_ids'] ?? array() );
232+
$chunk_ids = (array) ( $children['chunk_job_ids'] ?? array() );
233+
$pending = (array) ( $children['pending_job_ids'] ?? array() );
234234
$undrainable = (array) ( $children['pending_without_drainable_action_job_ids'] ?? array() );
235-
$processing = (array) ( $children['processing_job_ids'] ?? array() );
235+
$processing = (array) ( $children['processing_job_ids'] ?? array() );
236236

237237
return array(
238-
'processing' => (int) ( $children['processing'] ?? 0 ),
239-
'completed' => (int) ( $children['completed'] ?? 0 ),
240-
'failed' => (int) ( $children['failed'] ?? 0 ),
241-
'skipped' => (int) ( $children['skipped'] ?? 0 ),
242-
'running' => (int) ( $children['running'] ?? 0 ),
243-
'total' => (int) ( $children['total'] ?? 0 ),
244-
'statuses' => (array) ( $children['statuses'] ?? array() ),
245-
'batch_total' => count($batch_ids),
246-
'chunk_total' => count($chunk_ids),
247-
'failed_job_ids' => (array) ( $children['failed_job_ids'] ?? array() ),
248-
'pending_job_ids' => array_slice($pending, 0, $limit),
238+
'processing' => (int) ( $children['processing'] ?? 0 ),
239+
'completed' => (int) ( $children['completed'] ?? 0 ),
240+
'failed' => (int) ( $children['failed'] ?? 0 ),
241+
'skipped' => (int) ( $children['skipped'] ?? 0 ),
242+
'running' => (int) ( $children['running'] ?? 0 ),
243+
'total' => (int) ( $children['total'] ?? 0 ),
244+
'statuses' => (array) ( $children['statuses'] ?? array() ),
245+
'batch_total' => count($batch_ids),
246+
'chunk_total' => count($chunk_ids),
247+
'failed_job_ids' => (array) ( $children['failed_job_ids'] ?? array() ),
248+
'pending_job_ids' => array_slice($pending, 0, $limit),
249249
'pending_without_drainable_action_job_ids' => array_slice($undrainable, 0, $limit),
250-
'processing_job_ids' => array_slice($processing, 0, $limit),
251-
'pending_truncated' => count($pending) > $limit,
252-
'processing_truncated' => count($processing) > $limit,
253-
'diagnostic_job_id_lists' => 'Re-run status with --verbose or use cleanup evidence for full child job IDs.',
250+
'processing_job_ids' => array_slice($processing, 0, $limit),
251+
'pending_truncated' => count($pending) > $limit,
252+
'processing_truncated' => count($processing) > $limit,
253+
'diagnostic_job_id_lists' => 'Re-run status with --verbose or use cleanup evidence for full child job IDs.',
254254
);
255255
}
256256

@@ -298,8 +298,8 @@ private function cleanup_run_drain_summary( int $job_id, string $state, array $c
298298
}
299299

300300
return array(
301-
'needed' => in_array($state, array( 'running', 'waiting_on_children' ), true),
302-
'commands' => $commands,
301+
'needed' => in_array($state, array( 'running', 'waiting_on_children' ), true),
302+
'commands' => $commands,
303303
'active_child_job_ids' => $active_child_ids,
304304
'undrainable_child_job_ids' => $undrainable_child_ids,
305305
'bytes_reclaimed' => (int) ( $cleanup_items['bytes_reclaimed'] ?? 0 ),

inc/Tasks/WorkspaceHygieneReportTask.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public function executeTask( int $jobId, array $params ): void {
112112
$this->failJob($jobId, $result->get_error_message());
113113
return;
114114
}
115-
$worktrees = (array) ( $result['worktrees'] ?? array() );
116-
$cleanup = (array) ( $result['cleanup']['summary'] ?? array() );
117-
$fast_counts = (array) ( $result['fast_stats']['counts'] ?? array() );
115+
$worktrees = (array) ( $result['worktrees'] ?? array() );
116+
$cleanup = (array) ( $result['cleanup']['summary'] ?? array() );
117+
$fast_counts = (array) ( $result['fast_stats']['counts'] ?? array() );
118118
$inventory_cleanup_candidates = (int) ( $cleanup['inventory_cleanup_candidate_count'] ?? $fast_counts['cleanup_eligible_unprobed_count'] ?? 0 );
119119
do_action(
120120
'datamachine_log',

inc/Workspace/WorktreeCleanupClassifier.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
final class WorktreeCleanupClassifier {
1717

1818
public const BUCKET_SAFE_TO_REMOVE_NOW = 'safe_to_remove_now';
19-
public const BUCKET_CLEANUP_ELIGIBLE_UNPROBED = 'cleanup_eligible_pending_revalidation';
19+
public const BUCKET_CLEANUP_ELIGIBLE_UNPROBED = 'cleanup_eligible_pending_revalidation';
2020
public const BUCKET_NEEDS_RECONCILIATION = 'needs_reconciliation';
2121
public const BUCKET_NEEDS_FULL_REVIEW = 'needs_full_review';
2222
public const BUCKET_BLOCKED_BY_DIRTY_OR_UNPUSHED = 'blocked_by_dirty_or_unpushed';
@@ -132,10 +132,10 @@ public static function buckets(
132132
array $skipped_by_reason,
133133
string $candidate_bucket = self::BUCKET_SAFE_TO_REMOVE_NOW
134134
): array {
135-
$buckets = array(
135+
$buckets = array(
136136
self::BUCKET_ARTIFACT_ONLY_DIRTY => 0,
137137
self::BUCKET_BLOCKED_BY_DIRTY_OR_UNPUSHED => 0,
138-
self::BUCKET_CLEANUP_ELIGIBLE_UNPROBED => 0,
138+
self::BUCKET_CLEANUP_ELIGIBLE_UNPROBED => 0,
139139
self::BUCKET_NEEDS_FULL_REVIEW => 0,
140140
self::BUCKET_NEEDS_RECONCILIATION => 0,
141141
self::BUCKET_SAFE_TO_REMOVE_NOW => 0,

0 commit comments

Comments
 (0)