Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion inc/Cli/Commands/WorkspaceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6398,6 +6398,10 @@ private function render_worktree_cleanup_eligible_drain_result( array $result, a
'metric' => 'processed',
'value' => (int) ( $summary['processed'] ?? 0 ),
),
array(
'metric' => 'planned',
'value' => (int) ( $summary['planned'] ?? 0 ),
),
array(
'metric' => 'would_remove',
'value' => (int) ( $summary['would_remove'] ?? 0 ),
Expand Down Expand Up @@ -6437,6 +6441,7 @@ private function render_worktree_cleanup_eligible_drain_result( array $result, a
fn( $row ) => array(
'pass' => (int) ( $row['pass'] ?? 0 ),
'processed' => (int) ( $row['processed'] ?? 0 ),
'planned' => (int) ( $row['planned'] ?? 0 ),
'would_remove' => (int) ( $row['would_remove'] ?? 0 ),
'removed' => (int) ( $row['removed'] ?? 0 ),
'skipped' => (int) ( $row['skipped'] ?? 0 ),
Expand All @@ -6445,7 +6450,7 @@ private function render_worktree_cleanup_eligible_drain_result( array $result, a
),
$passes
),
array( 'pass', 'processed', 'would_remove', 'removed', 'skipped', 'remaining_total', 'bytes' ),
array( 'pass', 'processed', 'planned', 'would_remove', 'removed', 'skipped', 'remaining_total', 'bytes' ),
array( 'format' => 'table' ),
'pass'
);
Expand Down
5 changes: 4 additions & 1 deletion inc/Workspace/WorkspaceCleanupEligibleDrainOrchestrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function run( array $input ): array|\WP_Error {
'summary' => array(
'passes' => 0,
'processed' => 0,
'planned' => 0,
'would_remove' => 0,
'removed' => 0,
'skipped' => 0,
Expand Down Expand Up @@ -133,7 +134,8 @@ public function run( array $input ): array|\WP_Error {
'pass' => $pass,
'dry_run' => ! empty($pass_result['dry_run']),
'processed' => (int) ( $summary['processed'] ?? 0 ),
'would_remove' => ! empty($pass_result['dry_run']) ? count( (array) ( $pass_result['candidates'] ?? array() ) ) : 0,
'planned' => ! empty($pass_result['dry_run']) ? count( (array) ( $pass_result['candidates'] ?? array() ) ) : 0,
'would_remove' => (int) ( $summary['would_remove'] ?? 0 ),
'removed' => (int) ( $summary['removed'] ?? 0 ),
'skipped' => (int) ( $summary['skipped'] ?? 0 ),
'bytes_reclaimed' => (int) ( $summary['bytes_reclaimed'] ?? 0 ),
Expand All @@ -147,6 +149,7 @@ public function run( array $input ): array|\WP_Error {
$result['pass_results'][] = $pass_summary;
++$result['summary']['passes'];
$result['summary']['processed'] += $pass_summary['processed'];
$result['summary']['planned'] += $pass_summary['planned'];
$result['summary']['would_remove'] += $pass_summary['would_remove'];
$result['summary']['removed'] += $pass_summary['removed'];
$result['summary']['skipped'] += $pass_summary['skipped'];
Expand Down
3 changes: 2 additions & 1 deletion tests/smoke-cleanup-eligible-drain.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ function cleanup_eligible_drain_assert( bool $condition, string $label ): void {
cleanup_eligible_drain_assert(false === $preview['applied'], 'preview is non-destructive');
cleanup_eligible_drain_assert(1 === count($preview_ability->calls), 'preview runs one pass');
cleanup_eligible_drain_assert('preview' === $preview['summary']['stop_reason'], 'preview stop reason');
cleanup_eligible_drain_assert(2 === $preview['summary']['would_remove'], 'preview counts would-remove candidates');
cleanup_eligible_drain_assert(2 === $preview['summary']['planned'], 'preview counts planned candidates');
cleanup_eligible_drain_assert(0 === $preview['summary']['would_remove'], 'preview does not claim removal before fresh safety checks');

$empty_ability = new CleanupEligibleDrainFakeAbility(
array(
Expand Down
Loading