Skip to content

Print safe recovery commands for local branch and Worktree conflicts - #749

Merged
JacobStephens2 merged 5 commits into
mainfrom
issue-120
Oct 17, 2026
Merged

JacobStephens2 merged 5 commits into
mainfrom
issue-120

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

 acquire Issue branch / Worktree
   refuse local work that acquisition would replace
-  print prose or Git's raw refusal
+  identify the branch and occupied checkout
+  print quoted push / rename / non-forcing delete / removal alternatives
+  explain the applicable Continuation path

Commands name their working directory with git -C. Recovery stays a user choice, with ordinary Git refusal checks. Continuation advice accounts for occupied branches and paths, including main and Launch directory checkouts.

Closes #120

Evidence

  • Before: focused CLI regressions failed on missing recovery advice. The Spec review's exact reproducer also failed: switching a checkout's branch left the target pathname occupied and retry exited 1.
    After: cargo test --test acquisition_advice passes all eight regressions, including retained Spec reproducers for linked, main and launch checkouts. Tests execute copied advice through a POSIX shell, verify literal paths containing spaces/quotes/command substitutions, and confirm Git refuses divergent pushes, unmerged branch deletion and dirty Worktree removal.
  • The 50 acquisition regressions and nine Continuation tests pass, including failed-acquisition preservation and checkout ownership cases.
  • Final checks passed: full cargo test -- --test-threads=8 (two ignored unit tests), cargo clippy --all-targets -- -D warnings, cargo fmt --check, and git diff --check main...HEAD.

Test seams

  • The thirdshift CLI's acquisition failures against real local Git and fake GitHub: printed diagnostics, exit status, preserved work and absence of agent execution.
  • Worktree acquisition through Worktree::create_fresh and Worktree::continue_existing: independent acquisition checks and existing ownership/preservation regression cases.
  • Printed Git commands interpreted by a POSIX shell: literal argument handling and Git's ordinary refusal checks.

Merge Danger

Door: two-way

Blast Radius: diagnostics

Changes recovery diagnostics; users choose whether to execute the printed commands.

Unaddressed findings

  • Standards: none. The reviewer found no violations or actionable smells.
  • Spec: none. Both P2 advice findings were reproduced with the exact reviewer commands and fixed. Their regressions remain in tests/acquisition_advice.rs, including successful Continuation from another parent directory while preserving the original checkout.
  • Security: none. Single-session guidance review of 3bd86aea7caf5ba9b94312c09fd4a719d48c7ee4...HEAD and supporting code found no introduced findings. Checked shell command injection, checkout/path identity, acquisition and cleanup authority, and recovery preservation. In a network-disabled, resource-limited sandbox, cargo test --offline --locked --test acquisition_advice --test continuation -- --test-threads=2 passed 17 tests, and cargo test --offline --locked --bin thirdshift worktree::acquisition_tests -- --test-threads=2 passed 50 tests.

Changed files left unread by review: none on either axis. Both reviewers read all eight changed files and reviewed the final correction.

Built with codex · gpt-6.1-sol · high

@JacobStephens2
JacobStephens2 merged commit ecbba89 into main Oct 17, 2026
18 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-120 branch October 17, 2026 07:44
@JacobStephens2
JacobStephens2 restored the issue-120 branch October 17, 2026 07:48
@JacobStephens2 JacobStephens2 mentioned this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make local branch error give commands to push / delete / rename branch - and to delete local worktree

1 participant