Two cancellation checks in hashWorker in scan.go have no test that
fails every time without them:
hashWorker drops the runs still queued once the scan is cancelled
(the ctx.Err() check at the top of its loop). TestHashWorkerDropsQueuedRuns catches its removal in some runs only:
a worker that hashes the run anyway then picks at random between
sending the result and leaving through the second check.
hashWorker abandons the send of a result once the scan is cancelled
(the ctx.Done() case beside that send). Removing it leaves make test passing, because stop() drains results and so frees a
waiting worker anyway. The tests that stop a scan mid-hash, TestScanHashWriteFailureUnwindsPool among them, reach it in some
runs only.
A test fails every time either check is removed, each on its own.
Model: opus-5-5
Two cancellation checks in `hashWorker` in `scan.go` have no test that
fails every time without them:
- `hashWorker` drops the runs still queued once the scan is cancelled
(the `ctx.Err()` check at the top of its loop).
`TestHashWorkerDropsQueuedRuns` catches its removal in some runs only:
a worker that hashes the run anyway then picks at random between
sending the result and leaving through the second check.
- `hashWorker` abandons the send of a result once the scan is cancelled
(the `ctx.Done()` case beside that send). Removing it leaves
`make test` passing, because `stop()` drains results and so frees a
waiting worker anyway. The tests that stop a scan mid-hash,
`TestScanHashWriteFailureUnwindsPool` among them, reach it in some
runs only.
Found while reworking https://git.eeqj.de/sneak/sfdupes/pulls/59.
## Definition of done
A test fails every time either check is removed, each on its own.
Model: opus-5-5
clawbot
added this to the 1.0.0 milestone 2026-10-04 12:25:45 +02:00
clawbot
self-assigned this 2026-10-04 12:25:45 +02:00
Implemented in #88: TestHashWorkerDropsQueuedRuns now fails every time the drop check is removed, and the new TestHashWorkerAbandonsBlockedSend fails every time the cancellation case beside the send is removed. scan.go is unchanged.
Model: opus-5-5
Implemented in https://git.eeqj.de/sneak/sfdupes/pulls/88: `TestHashWorkerDropsQueuedRuns` now fails every time the drop check is removed, and the new `TestHashWorkerAbandonsBlockedSend` fails every time the cancellation case beside the send is removed. `scan.go` is unchanged.
Model: opus-5-5
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.
Two cancellation checks in
hashWorkerinscan.gohave no test thatfails every time without them:
hashWorkerdrops the runs still queued once the scan is cancelled(the
ctx.Err()check at the top of its loop).TestHashWorkerDropsQueuedRunscatches its removal in some runs only:a worker that hashes the run anyway then picks at random between
sending the result and leaving through the second check.
hashWorkerabandons the send of a result once the scan is cancelled(the
ctx.Done()case beside that send). Removing it leavesmake testpassing, becausestop()drains results and so frees awaiting worker anyway. The tests that stop a scan mid-hash,
TestScanHashWriteFailureUnwindsPoolamong them, reach it in someruns only.
Found while reworking #59.
Definition of done
A test fails every time either check is removed, each on its own.
Model: opus-5-5
Implemented in #88:
TestHashWorkerDropsQueuedRunsnow fails every time the drop check is removed, and the newTestHashWorkerAbandonsBlockedSendfails every time the cancellation case beside the send is removed.scan.gois unchanged.Model: opus-5-5