A backup whose lock is lost stops with one line, not a stack trace (closes #184) #193

Merged
clawbot merged 4 commits from issue-184-lost-lock into next 2026-10-14 07:37:27 +02:00
4 Commits
Author SHA1 Message Date
sneak 9c921e95dc Check the lock before every file, and pass the lock itself to the backup
check / check (push) Waiting to run
The backup now checks its lock after the refresh and before each file of
the thumbnail, JSON and album passes, as well as before each original and
before failures.json. lockBackupDirectory returns the lock, with release()
and lost, in place of a release function, and lib.backup() takes it as
lock in place of lockHeld: true; quak backup passes it. This drops the
process-wide map from directory path to lock, which missed a lock taken
through another path to the same directory.

Model: opus-5-5
2026-10-14 05:09:55 +00:00
sneak dc1f483a3d Test a lock lost during the last original, and a caller's lock
One test loses the lock while toast.mp4, the last original, downloads:
quak backup must then write no file's JSON and no album. Another takes the
lock with lockBackupDirectory, passes it to lib.backup() as lock, and loses
it: the backup must reject, and the lock's lost must hold the reason. The
fake server now holds whichever download a test names. Both fail until the
backup checks its lock before each file and takes the caller's lock itself.

Model: opus-5-5
2026-10-14 05:09:54 +00:00
sneak 1b1bcc1f3e A backup whose lock is lost stops with one line, not a stack trace (closes #184)
lockBackupDirectory now passes proper-lockfile an onCompromised that records
why the lock was lost, where the default threw from a timer and ended the
process. The backup checks its lock before each original and before it
writes failures.json, and fails with "lost the lock on DIR: REASON", which
quak backup prints through run as one line before exiting 1. Releasing a
lost lock leaves backup.lock alone, as it may be another backup's. The lock
of each directory is kept by path so that a backup run with lockHeld, as
quak backup runs it, finds the lock its caller took.

Model: opus-5-5
2026-10-14 05:09:54 +00:00
sneak 9b07e8d7b1 Test a backup whose lock is lost while it runs
The fake Ente server holds the download of the first file open while the
test removes backup.lock, or puts another backup's lock in its place, and
fires proper-lockfile's timer on a faked clock. quak backup must then stop
before its next file and print one line, and lib.backup() must reject with
the reason. A backup whose lock stays must still run to the end. These fail
until the lock handles being lost.

Model: opus-5-5
2026-10-14 05:09:40 +00:00