Repository navigation
Remove a failed Skill or Review acquisition's empty temp directory - #2017
Open
JacobStephens2 wants to merge 4 commits into
Open
JacobStephens2 wants to merge 4 commits into
JacobStephens2 wants to merge 4 commits into
Conversation
SkillWorktree kept its tempdir before acquisition, so a failed add left an empty thirdshift-skill-* or thirdshift-review-* directory behind. Remove only that still-empty allocated directory instance on failure, keeping retained checkouts and the acquisition error. Closes #1975
Cover hook work on the Review path too and assert the occupation error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A failed Skill or Review checkout acquisition no longer leaves an empty
thirdshift-skill-*orthirdshift-review-*directory in the temp root.Confirmed cause:
SkillWorktreereleased theTempDirguard withkeep()before callingacquisition::add/add_review. Acquisition counts that directory as pre-existing (path_existed), so its recovery is allowed to leave the directory in place. And because noSkillWorktreewas returned, nothing removed it. KeepingTempDir's recursive cleanup during acquisition would be unsafe, because a failing hook can leave work that ADR 0014 requires us to retain. So only the still-empty directory is removed.The new tests are in
src/worktree/skill_tests.rs. Each runs in a child process with its ownTMPDIR, so the test can count leftover directories:SkillWorktree::atand throughon_pull_requestgit worktree add, using a Git wrapper; the occupier's checkout and the branch stay intactEvidence
Execution evidence
skill.rsfix not applied):cargo test --bin thirdshift worktree::skill_testscargo test --bin thirdshift worktree::skill_testsscripts/affected-tests origin/mainselected the full suite:PASS cargo test (846.99s). That run was on the first commit. The second commit only renames things and tightens the tests, and the focused module above passes on it.cargo clippy --all-targetsreports no warnings.Merge Danger
Door: two-way
Blast Radius: narrow. The change only affects failed Skill and Review acquisitions: the one directory this attempt allocated is removed if it is still empty and still the same directory instance.
Review coverage
Standards and Spec reviewers read every changed file (
src/worktree.rs,src/worktree/skill.rs,src/worktree/skill_tests.rs). Fixed after review: Spec 1 (hook-work control now coverson_pull_request), Spec 3 (the occupation test now asserts the error names the branch), Standards 4–6 (renamedallocate→acquire_in_temp,isolated→ran_in_isolated_child,MISSING→MISSING_COMMIT).Unaddressed findings
Standards
skill.rsacquire_in_temp). Declined. The cited checks (ownership.rs:735verify,review_recovery.rs:225verify_file) verify pinned ownership evidence in other modules. This one is a single comparison that guardsremove_dir, so sharing a helper would couple unrelated checks.test_support::git_fault. Declined.git_faultcannot setTMPDIR, and these tests need an isolated temp root to count leftover directories. Widening a shared helper used by other suites is outside this fix.assert_test_without_warnings. Declined. That helper fails on anywarning:line, and thelaunch_directoryfixture's empty clone prints one. The comment inran_in_isolated_childrecords this.Spec
ReviewWorktreeand does not reach these allocation paths.SkillWorktree::athas no branch, so its regression uses an invalid commit.scripts/affected-testsran. Addressed by the run above:scripts/affected-tests origin/main→PASS cargo test. Localmainwas stale, soorigin/mainwas used.Closes #1975
Built with claude 2.1.314 · opus · default effort
Security review outcome
No unaddressed introduced findings.