Skip to content

Commit bd44528

Browse files
Fix cleanup summary lint
1 parent 1e7e382 commit bd44528

1 file changed

Lines changed: 40 additions & 22 deletions

File tree

inc/Cli/Commands/WorkspaceCommand.php

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,12 +1338,30 @@ private function render_cleanup_operator_summary( array $summary ): void {
13381338
$artifacts = (array) ( $summary['artifact_cleanup'] ?? array() );
13391339
$this->format_items(
13401340
array(
1341-
array( 'metric' => 'planned_rows', 'value' => (int) ( $cleanup_counts['planned'] ?? 0 ) ),
1342-
array( 'metric' => 'applied_rows', 'value' => (int) ( $cleanup_counts['applied'] ?? 0 ) ),
1343-
array( 'metric' => 'skipped_rows', 'value' => (int) ( $cleanup_counts['skipped'] ?? 0 ) ),
1344-
array( 'metric' => 'failed_rows', 'value' => (int) ( $cleanup_counts['failed'] ?? 0 ) ),
1345-
array( 'metric' => 'bytes_reclaimed', 'value' => $this->format_bytes($cleanup_counts['bytes_reclaimed'] ?? 0) ),
1346-
array( 'metric' => 'remaining_reclaimable_artifacts', 'value' => $this->format_bytes($artifacts['remaining_reclaimable_artifact_bytes'] ?? 0) ),
1341+
array(
1342+
'metric' => 'planned_rows',
1343+
'value' => (int) ( $cleanup_counts['planned'] ?? 0 ),
1344+
),
1345+
array(
1346+
'metric' => 'applied_rows',
1347+
'value' => (int) ( $cleanup_counts['applied'] ?? 0 ),
1348+
),
1349+
array(
1350+
'metric' => 'skipped_rows',
1351+
'value' => (int) ( $cleanup_counts['skipped'] ?? 0 ),
1352+
),
1353+
array(
1354+
'metric' => 'failed_rows',
1355+
'value' => (int) ( $cleanup_counts['failed'] ?? 0 ),
1356+
),
1357+
array(
1358+
'metric' => 'bytes_reclaimed',
1359+
'value' => $this->format_bytes($cleanup_counts['bytes_reclaimed'] ?? 0),
1360+
),
1361+
array(
1362+
'metric' => 'remaining_reclaimable_artifacts',
1363+
'value' => $this->format_bytes($artifacts['remaining_reclaimable_artifact_bytes'] ?? 0),
1364+
),
13471365
),
13481366
array( 'metric', 'value' ),
13491367
array( 'format' => 'table' ),
@@ -1400,24 +1418,24 @@ private function build_cleanup_operator_summary( array $result ): array {
14001418

14011419
return array_filter(
14021420
array(
1403-
'success' => (bool) ( $result['success'] ?? false ),
1404-
'run_id' => (string) ( $result['run_id'] ?? '' ),
1405-
'job_id' => isset($result['job_id']) ? (int) $result['job_id'] : null,
1406-
'mode' => (string) ( $result['mode'] ?? $result['evidence']['engine_data']['cleanup_run']['mode'] ?? '' ),
1407-
'state' => (string) ( $result['state'] ?? '' ),
1408-
'status' => (string) ( $result['status'] ?? '' ),
1409-
'parent_status' => (string) ( $result['parent_status'] ?? '' ),
1410-
'created_at' => (string) ( $result['created_at'] ?? '' ),
1411-
'completed_at' => (string) ( $result['completed_at'] ?? $result['parent_completed_at'] ?? '' ),
1412-
'cleanup_counts' => array(
1421+
'success' => (bool) ( $result['success'] ?? false ),
1422+
'run_id' => (string) ( $result['run_id'] ?? '' ),
1423+
'job_id' => isset($result['job_id']) ? (int) $result['job_id'] : null,
1424+
'mode' => (string) ( $result['mode'] ?? $result['evidence']['engine_data']['cleanup_run']['mode'] ?? '' ),
1425+
'state' => (string) ( $result['state'] ?? '' ),
1426+
'status' => (string) ( $result['status'] ?? '' ),
1427+
'parent_status' => (string) ( $result['parent_status'] ?? '' ),
1428+
'created_at' => (string) ( $result['created_at'] ?? '' ),
1429+
'completed_at' => (string) ( $result['completed_at'] ?? $result['parent_completed_at'] ?? '' ),
1430+
'cleanup_counts' => array(
14131431
'planned' => (int) ( $cleanup_items['planned_rows'] ?? 0 ),
14141432
'applied' => (int) ( $cleanup_items['applied_rows'] ?? 0 ),
14151433
'skipped' => (int) ( $cleanup_items['skipped_rows'] ?? 0 ),
14161434
'failed' => (int) ( $cleanup_items['failed_rows'] ?? 0 ),
14171435
'bytes_reclaimed' => (int) ( $cleanup_items['bytes_reclaimed'] ?? 0 ),
14181436
'freed_human' => (string) ( $cleanup_items['freed_human'] ?? $this->format_bytes($cleanup_items['bytes_reclaimed'] ?? 0) ),
14191437
),
1420-
'artifact_cleanup' => array(
1438+
'artifact_cleanup' => array(
14211439
'planned' => (int) ( $artifacts['planned_rows'] ?? 0 ),
14221440
'applied' => (int) ( $artifacts['applied_rows'] ?? 0 ),
14231441
'skipped' => (int) ( $artifacts['skipped_rows'] ?? 0 ),
@@ -1426,10 +1444,10 @@ private function build_cleanup_operator_summary( array $result ): array {
14261444
'remaining_reclaimable_artifact_bytes' => (int) ( $remaining['remaining_reclaimable_artifact_bytes'] ?? $artifacts['remaining_reclaimable_artifact_bytes'] ?? 0 ),
14271445
'remaining_reclaimable_human' => $this->format_bytes($remaining['remaining_reclaimable_artifact_bytes'] ?? $artifacts['remaining_reclaimable_artifact_bytes'] ?? 0),
14281446
),
1429-
'children' => $this->build_cleanup_operator_child_summary( (array) ( $result['children'] ?? $result['evidence']['children'] ?? array() ) ),
1430-
'by_type' => (array) ( $cleanup_items['by_type'] ?? array() ),
1431-
'skipped_by_reason' => (array) ( $remaining['skipped_by_reason'] ?? $cleanup_items['skipped_examples_by_reason'] ?? array() ),
1432-
'failed_by_reason' => (array) ( $cleanup_items['failed_by_reason'] ?? $artifacts['failed_by_reason'] ?? array() ),
1447+
'children' => $this->build_cleanup_operator_child_summary( (array) ( $result['children'] ?? $result['evidence']['children'] ?? array() ) ),
1448+
'by_type' => (array) ( $cleanup_items['by_type'] ?? array() ),
1449+
'skipped_by_reason' => (array) ( $remaining['skipped_by_reason'] ?? $cleanup_items['skipped_examples_by_reason'] ?? array() ),
1450+
'failed_by_reason' => (array) ( $cleanup_items['failed_by_reason'] ?? $artifacts['failed_by_reason'] ?? array() ),
14331451
'top_blocked_examples' => $this->cleanup_operator_blocked_examples($result),
14341452
'recommended_commands' => (array) ( $remaining['recommended_commands'] ?? array() ),
14351453
'locks' => (array) ( $result['locks'] ?? array() ),
@@ -1485,7 +1503,7 @@ private function cleanup_operator_blocked_examples( array $result ): array {
14851503
}
14861504

14871505
usort($examples, fn( $a, $b ) => (int) ( $b['size_bytes'] ?? 0 ) <=> (int) ( $a['size_bytes'] ?? 0 ));
1488-
$seen = array();
1506+
$seen = array();
14891507
$deduped = array_values(array_filter(
14901508
$examples,
14911509
function ( array $row ) use ( &$seen ): bool {

0 commit comments

Comments
 (0)