Sync cached files and refuse ones left empty or partial (closes #252) #263

Merged
clawbot merged 4 commits from issue-252-partial-cache-files into next 2026-10-15 19:27:33 +02:00
4 Commits
Author SHA1 Message Date
sneak e97673c7f2 Check cached file sizes at startup, not per request (closes #252)
check / check (push) Waiting to run
Lookup and LookupSource are as on next again: requests compare no
sizes and a hit reads no extra row. The reconciliation pass, at startup
and every five minutes, compares each cached source and variant file
with the size its row records and removes one that is empty or of
another size, with its rows and a warning naming the file; an empty
variant file without a row is removed rather than adopted. Source,
variant and .meta files all go through writeFileSynced (temp file,
sync, rename, directory sync), the .meta file before the variant, and
a failed directory sync removes the renamed file.

#252

Model: opus-5-5
2026-10-15 16:50:05 +00:00
sneak 6f3fea68c3 Test damaged cached files at startup and the .meta write (refs #252)
The tests of an empty or cut cached source or variant now run the
reconciliation pass, as pixa does at startup, before the next request,
and check that it logs a warning naming the file. New tests: the pass
removes an empty variant file without an accounting row instead of
adopting it, and VariantStorage.Store puts a new .meta file in place of
the old one rather than writing into it.

#252

Model: opus-5-5
2026-10-15 16:49:45 +00:00
sneak 34f09b83d0 Sync cached files and refuse ones left empty or partial (closes #252)
Source and variant files are synced to disk before the rename into
place, and their directory after. Lookup and LookupSource compare the
file's size with the size its row records: a file that is empty or of
another size is removed with its rows and a warning naming it, and the
request converts the image or fetches the source again. A variant whose
row cannot be read is judged by its file alone. Storing a source over a
file of another size replaces it. A source that fails to decode is not
removed for that alone.

#252

Model: opus-5-5
2026-10-15 16:49:45 +00:00
sneak d827840839 Test cached files left empty or partial (refs #252)
Failing tests: an empty or half-size cached source must be fetched
again once and then cached whole, an empty or cut cached variant must
be converted again instead of served, and storing a source over a file
of another size must replace it.

#252

Model: opus-5-5
2026-10-15 16:49:45 +00:00