Repository navigation
Fix code-review findings: safer deletes, plus smaller bugs - #3
Merged
Merged
Conversation
…y helper The exported At let any caller build a Candidate that Remove accepts without Scan's checks, such as the one for a volume mounted inside a target. It is now a helper in the package's tests that fails on a folder it can't read. Tests ask Vet directly about each trap, and a new one checks that a candidate not from Scan is refused even when its path passes Vet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D9oJWw4k81eBvUNWWQjoMK
…aller bugs Could delete the wrong thing: - An empty DIR (a script's unset variable) was read as the current folder. - git was run with the inherited GIT_DIR / GIT_INDEX_FILE, so from a hook or a dotfiles shell it answered for another repo and tracked folders looked disposable. - A target with its own .git (a nested clone, a worktree) in an ignored build/ was treated as build output. - A volume mounted inside a listed folder after the scan was emptied. Smaller: - /dev/null counted as a terminal, so sweep > /dev/null opened the screen. - A build whose version is a bare commit hash was told to upgrade on every run, and sweep upgrade replaced it. - A target that vanished during the scan was listed as a 0.0 KB row that could never be deleted. - The scan status line could be cut inside the … on a very narrow terminal. Faster: targets in one folder are put to git together, so a project's node_modules, .next and dist cost two git runs instead of five. The re-check before each delete still asks per folder. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D9oJWw4k81eBvUNWWQjoMK
|
This was referenced Nov 13, 2026
devloop01
pushed a commit
that referenced
this pull request
Nov 13, 2026
…anges) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D9oJWw4k81eBvUNWWQjoMK
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.
Fixes from a code review of the last commit and then of the whole codebase.
Could delete the wrong thing
sweep.Atlet any caller build aCandidatethatRemoveaccepts without Scan's checks. It is now a test-only helper (at), and a new test checks that a candidate not from Scan is refused even when its path passesVet.DIR.sweep -y "$UNSET"was read as the current folder.Resolvenow refuses an empty path.GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILEset (hooks,rebase --exec, a dotfiles shell), git answered for another repo, so a folder with tracked files looked disposable. git now runs without the repo-local variables (the list fromgit rev-parse --local-env-vars)..git(a nested clone, a worktree) inside an ignoredbuild/,out/ordist/was treated as build output. Any target with its own.gitentry is now kept.Removedidn't re-check. It now does, right before deleting.Smaller bugs
/dev/nullcounted as a terminal, sosweep > /dev/nullopened the interactive screen.isTerminalnow asks for terminal settings, likeisatty.make buildin a clone without tags) was told to upgrade on every run, andsweep upgradereplaced it. Versions withoutvX.Y.Znumbers are now treated likedev.…at 10–11 columns.Speed
Targets in one folder are put to git together, so a project's
node_modules,.nextanddistcost two git runs instead of five. The questions asked of git are unchanged, andkeepgoes through the same code as the batch. The re-check before each delete still asks per folder, on purpose. This is not full per-repo batching.Not changed
The review also flagged that
q/ctrl+conly close the?key list instead of quitting. That is the documented behaviour ("Press any key to close") andTestScreenHelpAndRevealasserts it, so it is left as is.Testing
The code only builds on darwin/arm64 and this was written on Linux, so the suite has not been run on macOS. What was done:
GOOS=darwin GOARCH=arm64 go vet ./...passes (code and tests compile).tmpfsstanding in forhdiutil.Please run
make teston a Mac before merging.TestDevNullIsNotATerminaland thehdiutilmount tests are the ones that exercise macOS-specific code.Generated by Claude Code