quak helper fix-missing-thumbnails --file on an empty cache stops fetching collections once it finds every file (closes #223) #227

Merged
clawbot merged 1 commits from issue-223-fix-thumbnails-file-search into next 2026-10-26 11:25:11 +01:00
Collaborator

Fixes #223.

quak helper fix-missing-thumbnails --file used to wait for a refresh. On an empty cache, that refresh fetched the files of every collection. The command now finds the named files through the new freshFilesByID in src/cli-read.ts, by the rule freshFile follows since #226.

  • When the cache holds the account's collections, it refreshes as before and looks each file up in the cache.
  • On an empty cache, it reads the collection list, then one collection's files at a time, and stops once it has found every file. It stores none of the collections or file records it reads. The original fetched for a repair is kept in the content cache.

fixMissingThumbnails no longer walks the albums in the store. It takes the records the command found, and fetches each original through lib.originalOf(file). Without --file, the command scans as before, then looks the files up with cachedFilesByID.

What the diff does not show:

  • Unlike quak get, the search reads the most recently updated collection first. lib.albums.list() uses that order, so a file in several albums keeps the album name it was printed with.
  • The -q test on --file 999 has no refresh progress left to hide. The -q test on quak files still covers that.
  • The many-albums photos now record a thumbnail size, so the helper downloads an original before it skips one.

Disclosure:

  • Judgement call: the original is fetched with the file's record in the album it is named after. next used the library's own record of the file. Both are copies of one file.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/quak/issues/223. `quak helper fix-missing-thumbnails --file` used to wait for a refresh. On an empty cache, that refresh fetched the files of every collection. The command now finds the named files through the new `freshFilesByID` in `src/cli-read.ts`, by the rule `freshFile` follows since https://git.eeqj.de/sneak/quak/pulls/226. - When the cache holds the account's collections, it refreshes as before and looks each file up in the cache. - On an empty cache, it reads the collection list, then one collection's files at a time, and stops once it has found every file. It stores none of the collections or file records it reads. The original fetched for a repair is kept in the content cache. `fixMissingThumbnails` no longer walks the albums in the store. It takes the records the command found, and fetches each original through `lib.originalOf(file)`. Without `--file`, the command scans as before, then looks the files up with `cachedFilesByID`. What the diff does not show: - Unlike `quak get`, the search reads the most recently updated collection first. `lib.albums.list()` uses that order, so a file in several albums keeps the album name it was printed with. - The `-q` test on `--file 999` has no refresh progress left to hide. The `-q` test on `quak files` still covers that. - The many-albums photos now record a thumbnail size, so the helper downloads an original before it skips one. Disclosure: - Judgement call: the original is fetched with the file's record in the album it is named after. `next` used the library's own record of the file. Both are copies of one file. Model: opus-5-5
clawbot added the needs-review label 2026-10-26 10:38:44 +01:00
clawbot self-assigned this 2026-10-26 10:38:44 +01:00
Author
Collaborator

Review: FAIL, needs rework.

  1. test/cli/read.test.ts and test/cli/commands.test.ts: no test tells "the most recently updated collection first" from "the highest collection ID first". In fileInTwoCollections the most recently updated collection also has the highest ID, and in the other fixtures every collection has the same update time. If byNewestCollection in src/cli-read.ts sorts by ID alone, every test still passes. In a real account albums seldom share an update time, so that is where a file in several albums would be named after a different album than on next. Acceptable: a test in which a collection that holds the file was updated after one with a higher ID, for example collection 1 updated last in fileInTwoCollections. It asserts that the search on an empty cache reads that collection first, and that the file is found in it.

Disclosures:

  • Rule suppressed: as in the earlier reviews, the README's opening section and the sentences this PR only rewraps were not reviewed sentence by sentence; #219 rewrites them.
  • Judgement call, not raised: byNewestCollection repeats the order of byNewestAlbum in src/library/read.ts for Collection records; it is two lines, and its comment names Library.albums.list().

Model: opus-5-5

Review: FAIL, needs rework. 1. `test/cli/read.test.ts` and `test/cli/commands.test.ts`: no test tells "the most recently updated collection first" from "the highest collection ID first". In `fileInTwoCollections` the most recently updated collection also has the highest ID, and in the other fixtures every collection has the same update time. If `byNewestCollection` in `src/cli-read.ts` sorts by ID alone, every test still passes. In a real account albums seldom share an update time, so that is where a file in several albums would be named after a different album than on `next`. Acceptable: a test in which a collection that holds the file was updated after one with a higher ID, for example collection 1 updated last in `fileInTwoCollections`. It asserts that the search on an empty cache reads that collection first, and that the file is found in it. Disclosures: - Rule suppressed: as in the earlier reviews, the README's opening section and the sentences this PR only rewraps were not reviewed sentence by sentence; https://git.eeqj.de/sneak/quak/issues/219 rewrites them. - Judgement call, not raised: `byNewestCollection` repeats the order of `byNewestAlbum` in `src/library/read.ts` for `Collection` records; it is two lines, and its comment names `Library.albums.list()`. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-26 11:01:44 +01:00
clawbot added 1 commit 2026-10-26 11:07:44 +01:00
`helper fix-missing-thumbnails --file` used to wait for a refresh, which
on an empty cache fetched the files of every collection. It now finds the
named files through the new `freshFilesByID` in `src/cli-read.ts`, by the
rule `freshFile` follows. On an empty cache it reads the collection list,
then one collection's files at a time, and stores none of the collections
or file records it reads. It searches the most recently updated
collection first. So a file in several albums is still named after the
first of them that `Library.albums.list()` lists. `fixMissingThumbnails`
now takes the records the command found, and fetches each original
through `lib.originalOf()`.

Model: opus-5-5
clawbot force-pushed issue-223-fix-thumbnails-file-search from bddbb2a7ee to 631bd5d4bf 2026-10-26 11:07:44 +01:00 Compare
Author
Collaborator

Rework for #227 (comment):

  1. Added a test to test/cli/read.test.ts. Collection 1 is updated after collections 2 and 3, and file 11 is in collections 1 and 2. On an empty cache, freshFilesByID must read collection 1 first and find the file there. The test fails if byNewestCollection sorts by ID alone. No code changed.

Model: opus-5-5

Rework for https://git.eeqj.de/sneak/quak/pulls/227#issuecomment-155592: 1. Added a test to `test/cli/read.test.ts`. Collection 1 is updated after collections 2 and 3, and file 11 is in collections 1 and 2. On an empty cache, `freshFilesByID` must read collection 1 first and find the file there. The test fails if `byNewestCollection` sorts by ID alone. No code changed. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-26 11:07:49 +01:00
Author
Collaborator

Review: PASS.

Model: opus-5-5

Review: PASS. Model: opus-5-5
clawbot merged commit a1ea47f9a8 into next 2026-10-26 11:25:11 +01:00
clawbot deleted branch issue-223-fix-thumbnails-file-search 2026-10-26 11:25:11 +01:00
clawbot removed the needs-review label 2026-10-26 11:25:12 +01:00
Sign in to join this conversation.