@@ -777,11 +777,11 @@ private function attach_cleanup_run_commands( array $result, string $mode ): arr
777777 }
778778
779779 $ result ['commands ' ] = array (
780- 'drain_parent ' => sprintf ('studio wp datamachine drain --job-id=%d ' , $ job_id ),
781- 'status ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --format=json ' , $ run_id ),
782- 'status_verbose ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --verbose --format=json ' , $ run_id ),
783- 'one_command_drain ' => sprintf ('studio wp datamachine-code workspace cleanup run --mode=%s --drain --format=json ' , $ mode ),
784- 'bytes_verification ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --format=json ' , $ run_id ),
780+ 'drain_parent ' => sprintf ('studio wp datamachine drain --job-id=%d ' , $ job_id ),
781+ 'status ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --format=json ' , $ run_id ),
782+ 'status_verbose ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --verbose --format=json ' , $ run_id ),
783+ 'one_command_drain ' => sprintf ('studio wp datamachine-code workspace cleanup run --mode=%s --drain --format=json ' , $ mode ),
784+ 'bytes_verification ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --format=json ' , $ run_id ),
785785 );
786786
787787 return $ result ;
@@ -805,8 +805,8 @@ private function drain_cleanup_run_to_status( array $result, array $assoc_args )
805805 return $ result ;
806806 }
807807
808- $ commands = array ();
809- $ errors = array ();
808+ $ commands = array ();
809+ $ errors = array ();
810810 $ max_passes = 10 ;
811811
812812 $ parent_command = sprintf ('datamachine drain --job-id=%d ' , $ job_id );
@@ -823,7 +823,7 @@ private function drain_cleanup_run_to_status( array $result, array $assoc_args )
823823 break ;
824824 }
825825
826- $ children = (array ) ( $ status ['evidence ' ]['children ' ] ?? array () );
826+ $ children = (array ) ( $ status ['evidence ' ]['children ' ] ?? array () );
827827 $ active_child_ids = array_values (
828828 array_unique (
829829 array_filter (
@@ -850,17 +850,17 @@ private function drain_cleanup_run_to_status( array $result, array $assoc_args )
850850 }
851851 }
852852
853- $ final = $ this ->cleanup_run_evidence_store ()->read ($ run_id , false , ! empty ($ assoc_args ['verbose ' ]));
854- $ output = $ final instanceof \WP_Error ? $ result : $ final ;
853+ $ final = $ this ->cleanup_run_evidence_store ()->read ($ run_id , false , ! empty ($ assoc_args ['verbose ' ]));
854+ $ output = $ final instanceof \WP_Error ? $ result : $ final ;
855855 $ output ['initial_run ' ] = $ result ;
856856 $ output ['drain ' ] = array (
857- 'success ' => array () === $ errors ,
858- 'commands ' => $ commands ,
859- 'errors ' => $ errors ,
860- 'verify_command ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --format=json ' , $ run_id ),
861- 'bytes_reclaimed ' => (int ) ( $ output ['cleanup_items ' ]['bytes_reclaimed ' ] ?? 0 ),
862- 'freed_human ' => (string ) ( $ output ['cleanup_items ' ]['freed_human ' ] ?? $ this ->format_bytes (0 ) ),
863- 'completion_state ' => (string ) ( $ output ['state ' ] ?? 'unknown ' ),
857+ 'success ' => array () === $ errors ,
858+ 'commands ' => $ commands ,
859+ 'errors ' => $ errors ,
860+ 'verify_command ' => sprintf ('studio wp datamachine-code workspace cleanup status %s --format=json ' , $ run_id ),
861+ 'bytes_reclaimed ' => (int ) ( $ output ['cleanup_items ' ]['bytes_reclaimed ' ] ?? 0 ),
862+ 'freed_human ' => (string ) ( $ output ['cleanup_items ' ]['freed_human ' ] ?? $ this ->format_bytes (0 ) ),
863+ 'completion_state ' => (string ) ( $ output ['state ' ] ?? 'unknown ' ),
864864 );
865865
866866 return $ output ;
@@ -1297,10 +1297,22 @@ private function render_cleanup_drain_summary( array $drain ): void {
12971297 WP_CLI ::log ('Drain summary: ' );
12981298 $ this ->format_items (
12991299 array (
1300- array ( 'metric ' => 'success ' , 'value ' => ! empty ($ drain ['success ' ]) ? 'yes ' : 'no ' ),
1301- array ( 'metric ' => 'completion_state ' , 'value ' => (string ) ( $ drain ['completion_state ' ] ?? 'unknown ' ) ),
1302- array ( 'metric ' => 'bytes_reclaimed ' , 'value ' => $ this ->format_bytes ($ drain ['bytes_reclaimed ' ] ?? 0 ) ),
1303- array ( 'metric ' => 'verify_command ' , 'value ' => (string ) ( $ drain ['verify_command ' ] ?? '' ) ),
1300+ array (
1301+ 'metric ' => 'success ' ,
1302+ 'value ' => ! empty ($ drain ['success ' ]) ? 'yes ' : 'no ' ,
1303+ ),
1304+ array (
1305+ 'metric ' => 'completion_state ' ,
1306+ 'value ' => (string ) ( $ drain ['completion_state ' ] ?? 'unknown ' ),
1307+ ),
1308+ array (
1309+ 'metric ' => 'bytes_reclaimed ' ,
1310+ 'value ' => $ this ->format_bytes ($ drain ['bytes_reclaimed ' ] ?? 0 ),
1311+ ),
1312+ array (
1313+ 'metric ' => 'verify_command ' ,
1314+ 'value ' => (string ) ( $ drain ['verify_command ' ] ?? '' ),
1315+ ),
13041316 ),
13051317 array ( 'metric ' , 'value ' ),
13061318 array ( 'format ' => 'table ' ),
0 commit comments