Commit Graph
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 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
clawbot 54133cfa5f Test quak backup end to end against a fake Ente server (closes #186)
check / check (push) Waiting to run
test/cli/backup-end-to-end.test.ts runs backupCommand through run, as
bin/quak.ts does, with the real loadSession reading a session saved after
logging in, and every request answered by a fake of the Ente HTTP API serving
data encrypted with libsodium. It covers the backup tree of an account with
two albums of its own and one shared with it, a second run that downloads
nothing, a download that succeeds after two 503s, a 404 recorded in
failures.json with exit 1, a refresh answered 401 with exit 3, and --verify
putting back an original changed on disk.

The fake server and the account it logs in moved from the backup-metadata
test into test/ente-server.ts, unchanged, so both tests use them.

Model: opus-5-5
2026-10-14 03:38:38 +02:00