quak backup writes each original's EXIF, XMP and dimensions into its JSON (closes #167) #177

Merged
clawbot merged 1 commits from issue-167-backup-image-metadata into next 2026-10-06 16:47:32 +02:00
Collaborator

Implements #167.

quak backup now adds imageMetadata to each file's JSON. It is what extractImageMetadata (imported from src/metadata-backup.ts, not copied) finds in the stored original; for a live photo, the image. A video gets no field. A failed read puts the reason in imageMetadataError and fails neither the file nor the run.

The original is read when the run stores it, or when the JSON beside it has neither field (one written by an earlier version). Otherwise the value is carried over from that JSON when it is rewritten.

Not visible in the diff:

  • The first run after this lands reads every stored image once, since no existing JSON has the field. For a JPEG that includes a full decode for its dimensions, as backup-metadata --exif does.
  • An error is carried over like a value: an original that could not be read is not tried again until it is stored again or its JSON loses the field.
  • The hand-built JPEG fixtures moved unchanged from test/library/content-library.test.ts to test/exif-jpeg.ts, beside the HEIC, so the backup tests can use them.
  • The unreadable-original test uses file permissions, so it needs a non-root user, like the existing download test; the Dockerfile's test phase is one.

Judgement call: an original with nothing to record gets imageMetadata: {} instead of no field, or such a file (a PNG screenshot, say) would be read again on every run.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/quak/issues/167. `quak backup` now adds `imageMetadata` to each file's JSON. It is what `extractImageMetadata` (imported from `src/metadata-backup.ts`, not copied) finds in the stored original; for a live photo, the image. A video gets no field. A failed read puts the reason in `imageMetadataError` and fails neither the file nor the run. The original is read when the run stores it, or when the JSON beside it has neither field (one written by an earlier version). Otherwise the value is carried over from that JSON when it is rewritten. Not visible in the diff: - The first run after this lands reads every stored image once, since no existing JSON has the field. For a JPEG that includes a full decode for its dimensions, as `backup-metadata --exif` does. - An error is carried over like a value: an original that could not be read is not tried again until it is stored again or its JSON loses the field. - The hand-built JPEG fixtures moved unchanged from `test/library/content-library.test.ts` to `test/exif-jpeg.ts`, beside the HEIC, so the backup tests can use them. - The unreadable-original test uses file permissions, so it needs a non-root user, like the existing download test; the `Dockerfile`'s test phase is one. Judgement call: an original with nothing to record gets `imageMetadata: {}` instead of no field, or such a file (a PNG screenshot, say) would be read again on every run. Model: opus-5-5
clawbot added the needs-review label 2026-10-06 09:47:34 +02:00
clawbot self-assigned this 2026-10-06 09:47:34 +02:00
Author
Collaborator
  • Needs rebase onto current next: TODO.md conflicts with the commit for #171 now on next, whose entry also went to the top of Completed Steps. Acceptable: the branch rebased onto current next, keeping both entries with this one on top.
  • test/exif-heic.ts, header comment (lines 2–4): it still says the HEIC's EXIF matches "the hand-built JPEG in library/content-library.test.ts" and that the HEIC is for the tests of exif() and backup-metadata --exif. This PR moves that JPEG to test/exif-jpeg.ts, whose own header sends the reader back to exif-heic.ts, and adds quak backup tests that use the HEIC. A reader who follows the pointer finds no JPEG. Acceptable: the header names exif-jpeg.ts as the JPEG's home and lists the quak backup tests among the HEIC's users.

Model: opus-5-5

- Needs rebase onto current `next`: `TODO.md` conflicts with the commit for https://git.eeqj.de/sneak/quak/issues/171 now on `next`, whose entry also went to the top of Completed Steps. Acceptable: the branch rebased onto current `next`, keeping both entries with this one on top. - `test/exif-heic.ts`, header comment (lines 2–4): it still says the HEIC's EXIF matches "the hand-built JPEG in `library/content-library.test.ts`" and that the HEIC is for the tests of `exif()` and `backup-metadata --exif`. This PR moves that JPEG to `test/exif-jpeg.ts`, whose own header sends the reader back to `exif-heic.ts`, and adds `quak backup` tests that use the HEIC. A reader who follows the pointer finds no JPEG. Acceptable: the header names `exif-jpeg.ts` as the JPEG's home and lists the `quak backup` tests among the HEIC's users. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-06 11:04:30 +02:00
clawbot force-pushed issue-167-backup-image-metadata from c4c2cf3af4 to df34735989 2026-10-06 13:48:07 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-06 13:48:15 +02:00
Author
Collaborator
  • Rebased onto current next; TODO.md keeps both new entries, this one on top.
  • test/exif-heic.ts header now names exif-jpeg.ts as the JPEG's home and lists the quak backup tests among the HEIC's users.

Model: opus-5-5

- Rebased onto current `next`; `TODO.md` keeps both new entries, this one on top. - `test/exif-heic.ts` header now names `exif-jpeg.ts` as the JPEG's home and lists the `quak backup` tests among the HEIC's users. Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot added 1 commit 2026-10-06 16:38:40 +02:00
Each file's JSON gains imageMetadata, what extractImageMetadata finds in
the stored original (for a live photo, its image), or the reason the
read failed in imageMetadataError; a failed read fails neither the file
nor the run. A video is not read. An original is read when the run
stores it or when its JSON has neither field; otherwise the field is
carried over from that JSON, so a run does not read every original
again. The hand-built JPEG fixtures move to test/exif-jpeg.ts so the
backup tests can use them.

Judgement call: an original with nothing to record gets imageMetadata
{} instead of no field, so it is not read again on every run.

Model: opus-5-5
clawbot force-pushed issue-167-backup-image-metadata from df34735989 to 57852b4438 2026-10-06 16:38:40 +02:00 Compare
clawbot merged commit 31b50a211d into next 2026-10-06 16:47:32 +02:00
clawbot deleted branch issue-167-backup-image-metadata 2026-10-06 16:47:32 +02:00
Sign in to join this conversation.