quak get and quak get-thumb fetch every collection to find one file #222

Closed
opened 2026-10-26 00:15:46 +01:00 by clawbot · 0 comments
Collaborator

quak get FILE and quak get-thumb FILE fetch the files of every new or changed collection before they fetch the one file asked for. On an empty cache that is every collection in the account. This is the same over-fetching as #217, and this fix builds on that one.

Where. Both commands call freshFile in src/cli-read.ts, which awaits lib.fresh(): a full refresh. They then look the file up in the refreshed store. The content cache finds a file's record in the store by its ID before it fetches the original or the thumbnail.

Fix (revised 26 October after the first review of #226).

  • When the cache already holds the account's collections, freshFile refreshes as before. That refresh fetches only what changed since the last one, so it is cheap, and it finds a file the cache did not know.
  • On an empty cache, freshFile makes one collections request through lib.freshCollections(). Then it fetches one collection's files at a time, with lib.freshFiles(collection) from #217, and stops at the first collection that holds the file. It stores none of the collections or file records it reads.
  • The content cache gets a plain way to fetch the original or thumbnail of a record it is given. get and get-thumb use it with the record freshFile found.
  • Output, default file names, live photos, exit codes and the "File N not found" message stay the same.

Tests. With quak's real Client against the fake server in test/ente-server.ts, holding at least three collections: on an empty cache, getCommand for a file in the second sends no /collections/v2/diff request for the third. On a cache that holds the account, getCommand sends the same requests as on next: no diff request for a collection that has not changed, including when the file is in no collection.

Done when both tests pass, and nothing get and get-thumb print changes but the progress lines of the refresh they no longer run on an empty cache.

Model: opus-5-5

`quak get FILE` and `quak get-thumb FILE` fetch the files of every new or changed collection before they fetch the one file asked for. On an empty cache that is every collection in the account. This is the same over-fetching as https://git.eeqj.de/sneak/quak/issues/217, and this fix builds on that one. **Where.** Both commands call `freshFile` in `src/cli-read.ts`, which awaits `lib.fresh()`: a full refresh. They then look the file up in the refreshed store. The content cache finds a file's record in the store by its ID before it fetches the original or the thumbnail. **Fix** (revised 26 October after the first review of https://git.eeqj.de/sneak/quak/pulls/226). - When the cache already holds the account's collections, `freshFile` refreshes as before. That refresh fetches only what changed since the last one, so it is cheap, and it finds a file the cache did not know. - On an empty cache, `freshFile` makes one collections request through `lib.freshCollections()`. Then it fetches one collection's files at a time, with `lib.freshFiles(collection)` from https://git.eeqj.de/sneak/quak/issues/217, and stops at the first collection that holds the file. It stores none of the collections or file records it reads. - The content cache gets a plain way to fetch the original or thumbnail of a record it is given. `get` and `get-thumb` use it with the record `freshFile` found. - Output, default file names, live photos, exit codes and the "File N not found" message stay the same. **Tests.** With quak's real `Client` against the fake server in `test/ente-server.ts`, holding at least three collections: on an empty cache, `getCommand` for a file in the second sends no `/collections/v2/diff` request for the third. On a cache that holds the account, `getCommand` sends the same requests as on `next`: no diff request for a collection that has not changed, including when the file is in no collection. **Done when** both tests pass, and nothing `get` and `get-thumb` print changes but the progress lines of the refresh they no longer run on an empty cache. Model: opus-5-5
clawbot self-assigned this 2026-10-26 00:15:46 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/quak#222