Skip to content

fix: correctness defects from codebase audit (signal race, archive cleanup, rsync capture)#21

Merged
jkleinne merged 4 commits into
mainfrom
fix/audit-correctness
Jun 10, 2026
Merged

fix: correctness defects from codebase audit (signal race, archive cleanup, rsync capture)#21
jkleinne merged 4 commits into
mainfrom
fix/audit-correctness

Conversation

@jkleinne

Copy link
Copy Markdown
Owner

Summary

Three moderate correctness defects surfaced by a codebase audit, each its own revertible commit.

  • A signal during a run shared a plain bool between the handler goroutine and run() with no synchronization, a data race when a natural exit and a signal collided. Signal handling now derives the outcome from signal.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 -race subprocess test for both SIGINT and SIGTERM.
  • CleanupArchives reported every rclone lsd failure 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 pure time.Parse-validated predicate that rejects calendar-invalid names like 0000-13-45 the old positional check accepted. Unrecognized directory names are warned and never purged.
  • The rsync executor buffered all of stdout in memory; with the example config's -v flag 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 archiveDirExpired predicate table, tailBuffer boundary cases, firstStderrLine units, and the signal exit-code tests. Full suite passes under -race; golangci-lint --new-from-merge-base reports no new issues.

@jkleinne jkleinne force-pushed the fix/audit-correctness branch from f1d2851 to 9a5ac3c Compare June 10, 2026 22:46
@jkleinne jkleinne merged commit ceabb6d into main Jun 10, 2026
2 checks passed
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.

1 participant