From 65b0de469462d7051f685c2ca746e3608dd6887c Mon Sep 17 00:00:00 2001 From: sneak Date: Wed, 14 Oct 2026 05:18:34 +0000 Subject: [PATCH] runBackup rejects a contentConcurrency that is not a positive integer A library object whose contentConcurrency was missing, 0 or negative started no worker, so the backup stored no original, dropped the earlier entries of failures.json and reported no error. runBackup now throws a RangeError for any limit that is not a positive integer, as BoundedPool does, before it takes the lock. Model: opus-5-5 --- src/backup.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backup.ts b/src/backup.ts index db39266..b3eb8d8 100644 --- a/src/backup.ts +++ b/src/backup.ts @@ -972,6 +972,14 @@ export const runBackup = async ( "open the library with one)", ); } + // As `BoundedPool` does. A limit below 1, or one that is not a number, + // would back up no original and end with no error. + const { contentConcurrency } = lib; + if (!Number.isInteger(contentConcurrency) || contentConcurrency < 1) { + throw new RangeError( + `contentConcurrency must be a positive integer, got ${contentConcurrency}`, + ); + } if (opts.lock) { return runLockedBackup(lib, opts, downloadDirectory, opts.lock); }