@@ -38,6 +38,11 @@ function compact_output_large_rows( int $count ): array {
3838}
3939
4040$ large_rows = compact_output_large_rows (40 );
41+ $ hygiene_candidate_rows = $ large_rows ;
42+ $ hygiene_candidate_rows [0 ]['dirty ' ] = null ;
43+ $ hygiene_candidate_rows [0 ]['fresh_revalidation_status ' ] = 'not_run_inventory_only ' ;
44+ $ hygiene_candidate_rows [0 ]['fresh_revalidation_blockers ' ] = array ( 'pending_fresh_revalidation ' );
45+ $ hygiene_candidate_rows [0 ]['fresh_revalidation_checks ' ] = array ( 'dirty_worktree ' , 'unpushed_commits ' , 'primary_or_protected_worktree ' , 'containment_failure ' );
4146$ cleanup = WorkspaceCompactOutput::cleanup_result (
4247 array (
4348 'success ' => true ,
@@ -218,6 +223,7 @@ function compact_output_large_rows( int $count ): array {
218223 'locks ' => array ( 'active ' => 2 , 'stale ' => 40 , 'database ' => array ( 'locks ' => $ large_rows ) ),
219224 'cleanup ' => array (
220225 'blocker_probe_source ' => 'inventory_known ' ,
226+ 'expected_outcome ' => 'Expected outcome: hygiene found 40 cleanup-eligible row(s) pending fresh revalidation and 0 fresh-safe removals. ' ,
221227 'blocker_counts ' => array (
222228 'inventory_known ' => array (
223229 'dirty_worktree ' => 3 ,
@@ -238,7 +244,7 @@ function compact_output_large_rows( int $count ): array {
238244 'safe_to_remove_now ' => 0 ,
239245 ),
240246 ),
241- 'biggest_candidates ' => $ large_rows ,
247+ 'biggest_candidates ' => $ hygiene_candidate_rows ,
242248 ),
243249 'size ' => array (
244250 'total_bytes ' => 123456 ,
@@ -263,10 +269,14 @@ function compact_output_large_rows( int $count ): array {
263269compact_output_assert ('inventory_known ' === ( $ hygiene ['cleanup ' ]['blocker_probe_source ' ] ?? null ), 'Compact hygiene output must expose blocker probe source. ' );
264270compact_output_assert (3 === ( $ hygiene ['cleanup ' ]['blocker_counts ' ]['inventory_known ' ]['dirty_worktree ' ] ?? null ), 'Compact hygiene output must preserve inventory-known dirty blocker bucket. ' );
265271compact_output_assert (0 === ( $ hygiene ['cleanup ' ]['blocker_counts ' ]['fresh_probe ' ]['dirty_worktree ' ] ?? null ), 'Compact hygiene output must preserve fresh-probed dirty blocker bucket. ' );
272+ compact_output_assert (isset ($ hygiene ['cleanup ' ]['expected_outcome ' ]), 'Compact hygiene output must preserve expected cleanup outcome. ' );
266273compact_output_assert (40 === ( $ hygiene ['cleanup ' ]['summary ' ]['cleanup_buckets ' ]['cleanup_eligible_pending_revalidation ' ] ?? null ), 'Compact cleanup summary must preserve pending-revalidation bucket. ' );
267274compact_output_assert (0 === ( $ hygiene ['cleanup ' ]['summary ' ]['cleanup_buckets ' ]['safe_to_remove_now ' ] ?? null ), 'Compact cleanup summary must not mark unprobed inventory candidates safe. ' );
268275compact_output_assert (123456 === ( $ hygiene ['size ' ]['total_bytes ' ] ?? null ), 'Compact hygiene output must preserve size bytes. ' );
269276compact_output_assert (40 === ( $ hygiene ['size ' ]['entry_count ' ] ?? null ), 'Compact hygiene output must preserve size entry count. ' );
270277compact_output_assert (count ((array ) ( $ hygiene ['cleanup ' ]['biggest_candidates ' ] ?? array () )) <= 5 , 'Compact hygiene output must sample cleanup candidates. ' );
278+ compact_output_assert ('not_run_inventory_only ' === ( $ hygiene ['cleanup ' ]['biggest_candidates ' ][0 ]['fresh_revalidation_status ' ] ?? null ), 'Compact hygiene candidates must preserve fresh revalidation status. ' );
279+ compact_output_assert (array ( 'pending_fresh_revalidation ' ) === ( $ hygiene ['cleanup ' ]['biggest_candidates ' ][0 ]['fresh_revalidation_blockers ' ] ?? null ), 'Compact hygiene candidates must preserve fresh blocker examples. ' );
280+ compact_output_assert (in_array ('unpushed_commits ' , (array ) ( $ hygiene ['cleanup ' ]['biggest_candidates ' ][0 ]['fresh_revalidation_checks ' ] ?? array () ), true ), 'Compact hygiene candidates must preserve fresh revalidation checks. ' );
271281
272282echo "workspace compact output test passed. \n" ;
0 commit comments