quak backup writes each file's ML data into its JSON file #163

Closed
opened 2026-10-06 01:16:50 +02:00 by clawbot · 0 comments
Collaborator

Part of #162 (one cron-safe command that mirrors the whole account).

What

quak backup <dir> writes Ente's ML data for each file (faces and the CLIP embedding: the payload backup-metadata writes as mlData) into the file's JSON beside its original, YYYY-MM-DD.<fileID>.json.

Today the backup's library fetches ML data into the cache's mldata/ in the background, the backup can finish before that fetch does, and the per-file JSON never carries it.

Definition of done

  • After its refresh, lib.backup() waits for an ML data fetch to complete (starting one if none is running) before it writes the per-file JSON files. A library whose client cannot fetch ML data skips this.
  • Each per-file JSON has mlData, the payload lib.mldata.forFile() returns (the same shape as backup-metadata's mlData), when the cache holds one. A file the server has no ML data for has no mlData field.
  • When the ML fetch fails, every file in scope whose data is not cached gets mlDataError with the reason instead, the result says so, and quak backup exits non-zero. The next run fetches again.
  • The per-file JSON is still rebuilt on every run, so ML data that arrived since the last run appears.
  • README "Backup layout": the per-file JSON holds the ML data; the sentence saying the ML fetch only fills the cache's mldata/ goes.
  • Tests with stand-ins, never the real service: payload written; no field when there is none; mlDataError and a non-zero exit when the fetch fails; a later successful run writes the data.
  • TODO.md: an entry at the top of Completed Steps.

Notes

runBackup drives a BackupLibrary interface; add what it needs there (waiting for the ML fetch, reading one payload) rather than reaching into Library internals. Keep it small.

Touches src/backup.ts, src/library/index.ts, tests, README.md, TODO.md. Units in flight beside it change src/cli-commands.ts, src/cli-run.ts, src/retry.ts and bin/quak.ts; leave those alone.

Model: opus-5-5

Part of https://git.eeqj.de/sneak/quak/issues/162 (one cron-safe command that mirrors the whole account). ## What `quak backup <dir>` writes Ente's ML data for each file (faces and the CLIP embedding: the payload `backup-metadata` writes as `mlData`) into the file's JSON beside its original, `YYYY-MM-DD.<fileID>.json`. Today the backup's library fetches ML data into the cache's `mldata/` in the background, the backup can finish before that fetch does, and the per-file JSON never carries it. ## Definition of done - After its refresh, `lib.backup()` waits for an ML data fetch to complete (starting one if none is running) before it writes the per-file JSON files. A library whose client cannot fetch ML data skips this. - Each per-file JSON has `mlData`, the payload `lib.mldata.forFile()` returns (the same shape as `backup-metadata`'s `mlData`), when the cache holds one. A file the server has no ML data for has no `mlData` field. - When the ML fetch fails, every file in scope whose data is not cached gets `mlDataError` with the reason instead, the result says so, and `quak backup` exits non-zero. The next run fetches again. - The per-file JSON is still rebuilt on every run, so ML data that arrived since the last run appears. - README "Backup layout": the per-file JSON holds the ML data; the sentence saying the ML fetch only fills the cache's `mldata/` goes. - Tests with stand-ins, never the real service: payload written; no field when there is none; `mlDataError` and a non-zero exit when the fetch fails; a later successful run writes the data. - `TODO.md`: an entry at the top of Completed Steps. ## Notes `runBackup` drives a `BackupLibrary` interface; add what it needs there (waiting for the ML fetch, reading one payload) rather than reaching into `Library` internals. Keep it small. Touches `src/backup.ts`, `src/library/index.ts`, tests, `README.md`, `TODO.md`. Units in flight beside it change `src/cli-commands.ts`, `src/cli-run.ts`, `src/retry.ts` and `bin/quak.ts`; leave those alone. Model: opus-5-5
clawbot self-assigned this 2026-10-06 01:16:50 +02:00
Sign in to join this conversation.