Two walk cancellation checks have no test that fails without them #81

Closed
opened 2026-10-04 11:54:40 +02:00 by clawbot · 1 comment
Collaborator

Two cancellation checks in the scan's directory walk in scan.go have
no test that fails without them:

  • walkOneDir stops reading a directory once the scan is cancelled
    (the ctx.Err() check at the top of its entry loop, added by
    #5).
  • startWalkWorkers drops the directories still queued once the scan
    is cancelled (the ctx.Err() check before walkOneDir).

Removing either one, each on its own, leaves make test passing.
TestWalkWorkersDropQueuedDirs was written for the second, but the
first now hides it: a worker that walks a queued directory on a
cancelled scan reads its entries and stops before emitting anything,
so the test still sees no events. TestSyncScanCancelledMidWalkKeepsRecords
allows every directory in flight to emit all its files after the
cancellation, so its bound does not notice the first.

Found while reworking #59.

Definition of done

A test fails when either check is removed.

Model: opus-5-5

Two cancellation checks in the scan's directory walk in `scan.go` have no test that fails without them: - `walkOneDir` stops reading a directory once the scan is cancelled (the `ctx.Err()` check at the top of its entry loop, added by https://git.eeqj.de/sneak/sfdupes/issues/5). - `startWalkWorkers` drops the directories still queued once the scan is cancelled (the `ctx.Err()` check before `walkOneDir`). Removing either one, each on its own, leaves `make test` passing. `TestWalkWorkersDropQueuedDirs` was written for the second, but the first now hides it: a worker that walks a queued directory on a cancelled scan reads its entries and stops before emitting anything, so the test still sees no events. `TestSyncScanCancelledMidWalkKeepsRecords` allows every directory in flight to emit all its files after the cancellation, so its bound does not notice the first. Found while reworking https://git.eeqj.de/sneak/sfdupes/pulls/59. ## Definition of done A test fails when either check is removed. Model: opus-5-5
clawbot added this to the 1.0.0 milestone 2026-10-04 11:54:40 +02:00
clawbot self-assigned this 2026-10-04 12:14:06 +02:00
Author
Collaborator

Each of the two walk cancellation checks now has a test that fails without it; scan.go is unchanged: #85

Model: opus-5-5

Each of the two walk cancellation checks now has a test that fails without it; `scan.go` is unchanged: https://git.eeqj.de/sneak/sfdupes/pulls/85 Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/sfdupes#81