Make backup wait for the server refresh and fail when it fails #122

Merged
clawbot merged 1 commits from issue-99-backup-refresh into next2 2026-09-23 08:07:44 +02:00
Collaborator

Fixes #99.

lib.backup() refreshed through the background loop's refresh, which returns at once when a refresh is already running and swallows a failure. Opening a library with an existing cache always starts one, so quak backup backed up the previous run's file list; with an expired session or no network it backed up stale data, or nothing on an empty cache, and exited 0.

backup() now uses the same refresh as fresh(): it joins a refresh already running or starts one, and rejects before creating any directory or reading or writing failures.json when it fails.

quak backup needs no change of its own: the error wrapper that landed with #102 prints the rejection as one quak: <error> line and exits 1. The CLI test goes through that wrapper.

Tests: a refresh already running when backup() is called (the backup includes the album it adds), a failed refresh with an existing cache (no download, failures.json byte-identical), a failed refresh with an empty cache (nothing written), and the CLI exit code and message. All four fail against the old refresh call.

make check passes.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/quak/issues/99. `lib.backup()` refreshed through the background loop's refresh, which returns at once when a refresh is already running and swallows a failure. Opening a library with an existing cache always starts one, so `quak backup` backed up the previous run's file list; with an expired session or no network it backed up stale data, or nothing on an empty cache, and exited 0. `backup()` now uses the same refresh as `fresh()`: it joins a refresh already running or starts one, and rejects before creating any directory or reading or writing `failures.json` when it fails. `quak backup` needs no change of its own: the error wrapper that landed with https://git.eeqj.de/sneak/quak/issues/102 prints the rejection as one `quak: <error>` line and exits 1. The CLI test goes through that wrapper. Tests: a refresh already running when `backup()` is called (the backup includes the album it adds), a failed refresh with an existing cache (no download, `failures.json` byte-identical), a failed refresh with an empty cache (nothing written), and the CLI exit code and message. All four fail against the old refresh call. `make check` passes. Model: opus-5-5
clawbot self-assigned this 2026-09-23 07:45:08 +02:00
clawbot added 1 commit 2026-09-23 07:45:08 +02:00
lib.backup() refreshed through the background loop's refresh, which returns
at once when one is already running and swallows a failure, so a backup
could run on the previous file list, or on an empty cache, and exit 0. It
now uses the refresh fresh() uses: it joins a running refresh or starts
one, and rejects before touching any file when it fails. The CLI's error
wrapper prints that as one line and exits 1.

Model: opus-5-5
clawbot added the needs-review label 2026-09-23 07:45:13 +02:00
Author
Collaborator

PASS on 530ceea rebased onto next2 36642f4.

Non-blocking: the reflowed header comment in src/backup.ts:7 runs past the 80-column wrap of the lines around it.

Model: opus-5-5

PASS on `530ceea` rebased onto `next2` `36642f4`. Non-blocking: the reflowed header comment in `src/backup.ts:7` runs past the 80-column wrap of the lines around it. Model: opus-5-5
clawbot merged commit 6757ddea94 into next2 2026-09-23 08:07:44 +02:00
clawbot deleted branch issue-99-backup-refresh 2026-09-23 08:07:44 +02:00
Sign in to join this conversation.