Repository navigation
fix(tooling): resume PR checkouts after completed deletions - #130630
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Both authenticated Codex review passes completed with no findings, including the separate published-head review of Ordinary exact-head CI passed. I also inspected the actual hosted logs: all 18 containment tests, 16 wrapper tests and 30 artifact-validation tests passed on Linux with pinned Vitest 4.1.11, including all six new completed-deletion recovery cases. Hosted core/plugin/root-test/scripts type checks, typed lint and formatting passed. This closes the stale-local-dependency limitation recorded above; the earlier local full-gate failures remain historical failures, not relabeled successes. The repair restores only the remaining index-to-target differences after existing journal/state validation. Literal NUL-delimited paths, foreign-state refusal and final tree/branch checks remain intact. Tooling is +4/-2 (two net invariant-comment lines); tests +48; production runtime unchanged. No cleanup-target credit. The latest ClawSweeper comment is currently a review-start placeholder with no findings or Rank-up moves. Native preparation and landing use a clean, current-main-matching trusted wrapper, never this PR's edited wrapper. No changelog is needed for this internal tooling repair. |
|
Merged via squash.
|
Closes #130628. Observed while preparing #130595.
What Problem This Solves
Fixes an issue where maintainers retrying an interrupted PR checkout would remain stuck on a Git pathspec error when the transition had already deleted a file. The failure also occurs when all files reached the target but checkout was interrupted before moving HEAD.
Why This Change Was Made
Recovery already proves that every index entry belongs to the journaled source or target. It now restores only entries still different from the target, instead of replaying completed deletions that Git can no longer resolve. The journal, source/target validation, literal NUL-delimited filenames, foreign-state refusal, and final tree/branch checks are unchanged.
The owner is
recover_review_transitioninscripts/pr-lib/worktree.sh; both native initialization and main/PR checkout use it. No reset, force-clean, fallback checkout, or relaxation of the worktree-containment boundary is added. The earlier recovery implementation was introduced in #125467 and carried forward by #129169's bounded pathspec streaming.User Impact
Interrupted maintainer PR transitions can be resumed after completed deletions. Product runtime, plugin APIs, configuration, and persisted user data do not change. Tooling is +4/-2 lines (the two extra lines explain the retry invariant); tests are +48. This repair is not counted toward the production cleanup target.
Evidence
Six real-Git regressions fail on the original implementation with
pathspec 'pr-only.txt' did not match any file(s) known to git. They cover partially restored and fully restored indexes plus a real recovery interrupted at checkout, in both branch and detached modes.On the fix, all 64 tests across three suites passed:
This exercises actual registered temporary Git worktrees and preserves sibling checkouts and review artifacts. Existing foreign staged/unstaged/untracked/ignored-state refusals and literal filename/bounded-argument regressions remain passing. Tested on macOS 27.0, Git 2.55.0, Node 24.19.0.
Complete independent pre-commit Codex review passed with no P0–P3 findings. It reviewed the full patch, complete owner/callers/tests and both baseline files with authenticated read-only isolation. A separate published-head review and ordinary exact-head hosted CI are still required before native preparation and merge.
Local formatting and initial changed-check guards passed. The complete local changed gate and targeted typed-lint wrapper could not finish because the shared installed dependencies are stale: for example Vitest 4.1.10 versus pinned 4.1.11, markdown-it 14.3.0 versus 15.0.0, and pi-tui 0.82.1 versus 0.84.2. The reported type errors were outside the changed files; no dependencies, assertions, or guards were weakened. Pinned hosted checks must close that gap before landing. No build is needed for this shell-only tooling/runtime boundary.
AI-assisted implementation and review.