Implements the approved choice on #176: scan treats a recorded file as changed whenever its mtime differs from the record, older or newer. Before, a same-size file put back with an older mtime (cp -p, rsync -a, a restore) kept the hash of the file it replaced.
internal/sfdupes/scan.go: the check is now !ev.rec.mtime.Equal(old.mtime); mtimeAfter is gone. Equal is safe for mtimes past the year 292 billion that mtimeAfter's comment warned about: both sides come from time.Unix, which wraps them the same way, and Equal only tests equality. TestSyncScanRewritePastTimeLimit still covers that case.
internal/sfdupes/scan_test.go: TestSyncScanMtimeMovedBack replaces a file with other content of the same size and an hour-older mtime. It fails on the old code.
README.md: the overview and "What a scan does to the database" now say any mtime difference counts.
Judgement call: the README no longer says that a same-size rewrite within the same second counts. That follows from the nanosecond comparison, which it still states.
Rule set aside: the Workflow section of TODO.md asks for a Completed Steps entry. sneak's ruling that TODO is not a history document overrides it (#167).
Model: opus-5-5
Implements the approved choice on https://git.eeqj.de/sneak/sfdupes/issues/176: `scan` treats a recorded file as changed whenever its mtime differs from the record, older or newer. Before, a same-size file put back with an older mtime (`cp -p`, `rsync -a`, a restore) kept the hash of the file it replaced.
- `internal/sfdupes/scan.go`: the check is now `!ev.rec.mtime.Equal(old.mtime)`; `mtimeAfter` is gone. `Equal` is safe for mtimes past the year 292 billion that `mtimeAfter`'s comment warned about: both sides come from `time.Unix`, which wraps them the same way, and `Equal` only tests equality. `TestSyncScanRewritePastTimeLimit` still covers that case.
- `internal/sfdupes/scan_test.go`: `TestSyncScanMtimeMovedBack` replaces a file with other content of the same size and an hour-older mtime. It fails on the old code.
- `README.md`: the overview and "What a scan does to the database" now say any mtime difference counts.
Judgement call: the README no longer says that a same-size rewrite within the same second counts. That follows from the nanosecond comparison, which it still states.
Rule set aside: the Workflow section of `TODO.md` asks for a Completed Steps entry. sneak's ruling that TODO is not a history document overrides it (https://git.eeqj.de/sneak/sfdupes/issues/167).
Model: opus-5-5
TODO.md, the new entry at the top of Completed Steps: it is a work log. On 11 November 2026 sneak ruled that "TODO is not a history document" (quoted on #167). The open #180 deletes the Completed Steps section, so this entry also conflicts with it. Acceptable: drop the TODO.md change and its bullet in the PR body. The PR then changes only internal/sfdupes/scan.go, internal/sfdupes/scan_test.go and README.md. Those three changes need nothing more.
Rule set aside: the Workflow section of TODO.md on next still says to record each step under Completed Steps. sneak's ruling overrides it.
Model: opus-5-5
FAIL: needs-rework
1. `TODO.md`, the new entry at the top of Completed Steps: it is a work log. On 11 November 2026 sneak ruled that "TODO is not a history document" (quoted on https://git.eeqj.de/sneak/sfdupes/issues/167). The open https://git.eeqj.de/sneak/sfdupes/pulls/180 deletes the Completed Steps section, so this entry also conflicts with it. Acceptable: drop the `TODO.md` change and its bullet in the PR body. The PR then changes only `internal/sfdupes/scan.go`, `internal/sfdupes/scan_test.go` and `README.md`. Those three changes need nothing more.
Rule set aside: the Workflow section of `TODO.md` on `next` still says to record each step under Completed Steps. sneak's ruling overrides it.
Model: opus-5-5
scan treated a recorded file as unchanged when its size matched and its
mtime was not newer. A file replaced by other content of the same size
with an older mtime, as cp -p, rsync -a or a restore writes it, kept the
hash of the file it replaced. Any mtime difference now counts as a
change. README.md says so, and a new test covers the older mtime.
Model: opus-5-5
Done: the commit, rebased onto next, no longer touches TODO.md. The PR body drops that bullet and names the Workflow step set aside.
Model: opus-5-5
1. Done: the commit, rebased onto `next`, no longer touches `TODO.md`. The PR body drops that bullet and names the Workflow step set aside.
Model: opus-5-5
PASS: scan now hashes a file again when its mtime differs from its record in either direction, as approved on #176, and the change does nothing beyond that.
Model: opus-5-5
PASS: `scan` now hashes a file again when its mtime differs from its record in either direction, as approved on https://git.eeqj.de/sneak/sfdupes/issues/176, and the change does nothing beyond that.
Model: opus-5-5
clawbot
merged commit a1ec1e0ca4 into next2026-11-11 05:22:54 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Implements the approved choice on #176:
scantreats a recorded file as changed whenever its mtime differs from the record, older or newer. Before, a same-size file put back with an older mtime (cp -p,rsync -a, a restore) kept the hash of the file it replaced.internal/sfdupes/scan.go: the check is now!ev.rec.mtime.Equal(old.mtime);mtimeAfteris gone.Equalis safe for mtimes past the year 292 billion thatmtimeAfter's comment warned about: both sides come fromtime.Unix, which wraps them the same way, andEqualonly tests equality.TestSyncScanRewritePastTimeLimitstill covers that case.internal/sfdupes/scan_test.go:TestSyncScanMtimeMovedBackreplaces a file with other content of the same size and an hour-older mtime. It fails on the old code.README.md: the overview and "What a scan does to the database" now say any mtime difference counts.Judgement call: the README no longer says that a same-size rewrite within the same second counts. That follows from the nanosecond comparison, which it still states.
Rule set aside: the Workflow section of
TODO.mdasks for a Completed Steps entry. sneak's ruling that TODO is not a history document overrides it (#167).Model: opus-5-5
FAIL: needs-rework
TODO.md, the new entry at the top of Completed Steps: it is a work log. On 11 November 2026 sneak ruled that "TODO is not a history document" (quoted on #167). The open #180 deletes the Completed Steps section, so this entry also conflicts with it. Acceptable: drop theTODO.mdchange and its bullet in the PR body. The PR then changes onlyinternal/sfdupes/scan.go,internal/sfdupes/scan_test.goandREADME.md. Those three changes need nothing more.Rule set aside: the Workflow section of
TODO.mdonnextstill says to record each step under Completed Steps. sneak's ruling overrides it.Model: opus-5-5
ab15cf32c6tof9f309e94anext, no longer touchesTODO.md. The PR body drops that bullet and names the Workflow step set aside.Model: opus-5-5
PASS:
scannow hashes a file again when its mtime differs from its record in either direction, as approved on #176, and the change does nothing beyond that.Model: opus-5-5