@@ -192,13 +192,15 @@ public function worktree_list( ?string $repo = null, ?string $state = null, arra
192192 $ run ( 'git branch -M main ' , $ primary );
193193 $ run ( 'git push -u origin main ' , $ primary );
194194
195- // One real worktree with an artifact directory.
196- $ run ( 'git checkout -b feature-real ' , $ primary );
195+ // One real worktree with an artifact directory. Use a slashed branch so
196+ // bounded inventory's directory slug (`feature-real`) differs from HEAD's
197+ // branch identity (`feature/real`).
198+ $ run ( 'git checkout -b feature/real ' , $ primary );
197199 file_put_contents ( $ primary . '/feature-real.txt ' , 'real ' );
198200 $ run ( 'git add . && git commit -m feature ' , $ primary );
199- $ run ( 'git push -u origin feature- real ' , $ primary );
201+ $ run ( 'git push -u origin feature/ real ' , $ primary );
200202 $ run ( 'git checkout main ' , $ primary );
201- $ run ( sprintf ( 'git worktree add %s feature- real ' , escapeshellarg ( $ tmp . '/demo@feature-real ' ) ), $ primary );
203+ $ run ( sprintf ( 'git worktree add %s feature/ real ' , escapeshellarg ( $ tmp . '/demo@feature-real ' ) ), $ primary );
202204 mkdir ( $ tmp . '/demo@feature-real/target ' , 0755 , true );
203205 file_put_contents ( $ tmp . '/demo@feature-real/target/artifact.bin ' , str_repeat ( 'x ' , 1024 ) );
204206
@@ -249,6 +251,7 @@ public function worktree_list( ?string $repo = null, ?string $state = null, arra
249251 fn ( $ row ) => 'demo@feature-real ' === ( $ row ['handle ' ] ?? '' )
250252 ) ) );
251253 $ assert ( 1 , count ( $ apply_plan ['candidates ' ] ), 'extracted exactly one planned candidate ' );
254+ $ assert ( 'feature/real ' , $ apply_plan ['candidates ' ][0 ]['branch ' ] ?? '' , 'bounded dry-run records HEAD branch instead of directory slug ' );
252255
253256 $ workspace ->full_listing_calls = 0 ;
254257 $ start = microtime ( true );
@@ -257,6 +260,7 @@ public function worktree_list( ?string $repo = null, ?string $state = null, arra
257260 $ assert ( false , is_wp_error ( $ apply ), 'apply_plan revalidation succeeds on huge workspace ' );
258261 $ assert ( 0 , $ workspace ->full_listing_calls , 'apply_plan revalidation does not call full worktree_list ' );
259262 $ assert ( true , (bool ) ( $ apply ['pagination ' ]['safety_probes ' ] ?? false ), 'apply_plan revalidation still runs safety probes ' );
263+ $ assert ( array (), (array ) ( $ apply ['summary ' ]['skipped_by_reason ' ] ?? array () ), 'apply_plan does not reject slashed branches as branch mismatches ' );
260264 $ assert ( 1 , (int ) ( $ apply ['summary ' ]['removed_artifacts ' ] ?? 0 ), 'apply_plan removes the planned artifact ' );
261265 $ assert ( false , is_dir ( $ tmp . '/demo@feature-real/target ' ), 'apply_plan revalidation removes the target directory ' );
262266 $ assert_lt ( 5.0 , $ elapsed , 'apply_plan revalidation stays fast because only_handles narrows the scan ( ' . number_format ( $ elapsed , 3 ) . 's) ' );
0 commit comments