quak collections hangs with no output on a live account #210

Closed
opened 2026-10-16 14:09:46 +02:00 by clawbot · 2 comments
Collaborator

sneak, on his live Ente account (#187 (comment)): quak collections hangs with no output; login and whoami succeed.

Done when: quak collections lists the account's collections, or fails with a plain error naming the cause, within a bounded time; while it works it shows progress on stderr; a test covers the cause found.

Model: opus-5-5

sneak, on his live Ente account (https://git.eeqj.de/sneak/quak/issues/187#issuecomment-145033): `quak collections` hangs with no output; `login` and `whoami` succeed. **Done when:** `quak collections` lists the account's collections, or fails with a plain error naming the cause, within a bounded time; while it works it shows progress on stderr; a test covers the cause found. Model: opus-5-5
Owner
user@heraklion:~/tmp/quak$ time timeout 15 $Q collections

real    0m15.026s
user    0m2.412s
sys     0m0.325s
user@heraklion:~/tmp/quak$ time timeout 60 $Q collections

real    1m0.017s
user    0m11.745s
sys     0m1.382s
user@heraklion:~/tmp/quak$
``` user@heraklion:~/tmp/quak$ time timeout 15 $Q collections real 0m15.026s user 0m2.412s sys 0m0.325s user@heraklion:~/tmp/quak$ time timeout 60 $Q collections real 1m0.017s user 0m11.745s sys 0m1.382s user@heraklion:~/tmp/quak$ ```
Author
Collaborator

Plan.

Likely cause, to be confirmed in the code before the fix: with an empty cache, quak collections opens the library, and Library.open waits for a first full refresh. That refresh fetches and decrypts the file list of every collection in the account, one collection after another, and saves nothing until all of it is done. On a large account this takes longer than the runs in the comment above, prints nothing, and a run that is stopped saves nothing, so the next run starts again from the beginning. fresh() then runs a second refresh.

Fix:

  • src/library/index.ts, whose doc covers the refresh and the fresh reads: a fresh read of the collection list alone. It makes one collections request and answers without fetching any collection's files. It must not record anything that would make a later full refresh skip a collection's files. The read commands must be able to open the library without waiting for a full first refresh first.
  • collections in src/cli-commands.ts (through src/cli-read.ts) uses it. The CLI keeps using the library and its fresh reads, as sneak ruled on #36.
  • During a refresh, the library reports each collection whose files it has fetched (how many of how many) through onProgress. The commands that wait on a refresh (files, get, get-thumb, backup-metadata, the helpers) print this on stderr, so a large account shows progress instead of nothing.
  • README "CLI surface" says this.
  • Tests against the fake server in test/ente-server.ts: collections on an account with many collections makes no file-list request and prints every collection; a command that waits on a full refresh prints progress on stderr.

If the code shows a different cause, the worker fixes that one and says so on the PR.

Model: opus-5-5

Plan. Likely cause, to be confirmed in the code before the fix: with an empty cache, `quak collections` opens the library, and `Library.open` waits for a first full refresh. That refresh fetches and decrypts the file list of every collection in the account, one collection after another, and saves nothing until all of it is done. On a large account this takes longer than the runs in the comment above, prints nothing, and a run that is stopped saves nothing, so the next run starts again from the beginning. `fresh()` then runs a second refresh. Fix: - `src/library/index.ts`, whose doc covers the refresh and the fresh reads: a fresh read of the collection list alone. It makes one collections request and answers without fetching any collection's files. It must not record anything that would make a later full refresh skip a collection's files. The read commands must be able to open the library without waiting for a full first refresh first. - `collections` in `src/cli-commands.ts` (through `src/cli-read.ts`) uses it. The CLI keeps using the library and its fresh reads, as sneak ruled on https://git.eeqj.de/sneak/quak/issues/36. - During a refresh, the library reports each collection whose files it has fetched (how many of how many) through `onProgress`. The commands that wait on a refresh (`files`, `get`, `get-thumb`, `backup-metadata`, the helpers) print this on stderr, so a large account shows progress instead of nothing. - README "CLI surface" says this. - Tests against the fake server in `test/ente-server.ts`: `collections` on an account with many collections makes no file-list request and prints every collection; a command that waits on a full refresh prints progress on stderr. If the code shows a different cause, the worker fixes that one and says so on the PR. Model: opus-5-5
Sign in to join this conversation.