Start the progress reporter once per snapshot, not once per path #255

Merged
clawbot merged 1 commits from issue-253-progress-reporter-once-per-snapshot into next 2026-10-07 00:12:11 +02:00
Collaborator

Fixes #253.

A backup without --cron of a snapshot with two or more paths panicked with close of closed channel. scanAllDirectories calls Scan once per path on one scanner, and Scan started the progress reporter and deferred its Stop on every call. Stop closes the reporter's signal channel, so the second path's Stop panicked.

scanAllDirectories now starts the reporter before the first path and stops it after the last, and Scan no longer starts or stops it. The reporter's first detailed status therefore prints once per snapshot instead of once per path.

What the diff does not show: anything that calls Scan directly on a scanner built with progress on now gets a reporter nobody starts. Only createNamedSnapshot turns progress on today; the GetProgress comment says the caller owns the start and stop.

TestBackupWithoutCronOfTwoPathSnapshotRestoresBothPaths runs CreateSnapshot without Cron on a snapshot with two paths, restores it from the store alone with verification, and compares every file of both paths. It was written first and panicked on next at 5d685f0.

Judgement call: the start and stop sit in scanAllDirectories, not createNamedSnapshot, so the reporter still stops before the metadata export, as it did when Scan stopped it.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/253. A backup without `--cron` of a snapshot with two or more `paths` panicked with `close of closed channel`. `scanAllDirectories` calls `Scan` once per path on one scanner, and `Scan` started the progress reporter and deferred its `Stop` on every call. `Stop` closes the reporter's signal channel, so the second path's `Stop` panicked. `scanAllDirectories` now starts the reporter before the first path and stops it after the last, and `Scan` no longer starts or stops it. The reporter's first detailed status therefore prints once per snapshot instead of once per path. What the diff does not show: anything that calls `Scan` directly on a scanner built with progress on now gets a reporter nobody starts. Only `createNamedSnapshot` turns progress on today; the `GetProgress` comment says the caller owns the start and stop. `TestBackupWithoutCronOfTwoPathSnapshotRestoresBothPaths` runs `CreateSnapshot` without `Cron` on a snapshot with two paths, restores it from the store alone with verification, and compares every file of both paths. It was written first and panicked on `next` at `5d685f0`. Judgement call: the start and stop sit in `scanAllDirectories`, not `createNamedSnapshot`, so the reporter still stops before the metadata export, as it did when `Scan` stopped it. Model: opus-5-5
clawbot added the needs-review label 2026-10-06 23:28:25 +02:00
clawbot self-assigned this 2026-10-06 23:28:25 +02:00
clawbot added 1 commit 2026-10-06 23:28:25 +02:00
A backup without --cron of a snapshot with two or more paths panicked
with "close of closed channel". Scan runs once per path, and it started
the progress reporter and deferred its Stop each time; Stop closes the
reporter's signal channel, so the second path's Stop panicked.
scanAllDirectories now starts the reporter before the first path and
stops it after the last, and Scan no longer starts or stops it. A new
test backs up a two-path snapshot with the reporter on and restores
both paths.

Model: opus-5-5
Author
Collaborator

Review passed.
Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit b06f992152 into next 2026-10-07 00:12:11 +02:00
clawbot deleted branch issue-253-progress-reporter-once-per-snapshot 2026-10-07 00:12:11 +02:00
Sign in to join this conversation.