fix: correctness defects from codebase audit (signal race, archive cleanup, rsync capture)#21
Merged
Merged
Conversation
f1d2851 to
9a5ac3c
Compare
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
Three moderate correctness defects surfaced by a codebase audit, each its own revertible commit.
boolbetween the handler goroutine andrun()with no synchronization, a data race when a natural exit and a signal collided. Signal handling now derives the outcome fromsignal.NotifyContext, and a companion goroutine restores the default disposition so a second SIGINT terminates immediately instead of being swallowed. The exit-130 contract is unchanged and now covered by a-racesubprocess test for both SIGINT and SIGTERM.CleanupArchivesreported everyrclone lsdfailure as "no archive directory (nothing to clean)" and returned nil on every path, so a misconfigured remote silently skipped retention and the runner's warn branch was dead code. Listing failures are now classified (rclone exit 3 stays the benign first-run case; anything else returns a wrapped error the runner surfaces) and purge eligibility moved to a puretime.Parse-validated predicate that rejects calendar-invalid names like0000-13-45the old positional check accepted. Unrecognized directory names are warned and never purged.-vflag that grows with file count. Capture now goes through a bounded 64 KiB tail writer, leaving the stats parser and fixtures untouched (rsync prints the stats block last, so it always survives in the tail).Coverage added alongside the fixes: the
archiveDirExpiredpredicate table,tailBufferboundary cases,firstStderrLineunits, and the signal exit-code tests. Full suite passes under-race;golangci-lint --new-from-merge-basereports no new issues.