Carry file size, thumbnail size, and deletion flag through decryptFile (closes #37)
check / check (push) Successful in 24s

Foundation unit for the cache/API design. Three fields arrived on the wire
but decryptFile dropped them:

- Live files now set `file.size` from `info.fileSize` and `thumbnail.size`
  from `info.thumbSize`, left `undefined` when the server omits `info`.
- A deleted file is returned as a new `EnteFileTombstone` (`id`,
  `collectionID`, `updationTime`, `isDeleted: true`) with no decryption,
  since the server no longer holds ciphertext for it.

decryptFile now returns `EnteFile | EnteFileTombstone`. Rather than making
EnteFile's structural fields optional — which would force `?.`/guards across
every consumer under strict tsc and break the build — a tombstone is a
distinct minimal type, and `EnteFile.isDeleted?: false` is the discriminant
(a live file is never deleted). This keeps all existing consumers untouched;
they still receive fully-populated `EnteFile` values.

client.ts is the only direct caller: it now routes every row through
decryptFile and drops results whose `isDeleted` is set. listFiles still
returns live files only, so its observable behaviour is unchanged.

Model: opus-4-8
This commit is contained in:
2026-09-22 08:54:01 +00:00
parent d1d6cdd4f0
commit 3c46db56d5
7 changed files with 122 additions and 6 deletions
+6
View File
@@ -18,6 +18,12 @@ Update the README API reference section to match the current implementation.
# Completed Steps
- 2026-09-22: Carried file size, thumbnail size, and the deletion flag through
`decryptFile` (issue 37, foundation for the cache/API design). Live files now
populate `file.size`/`thumbnail.size` from the server's `info` (left
`undefined` when the server omits it), and a deleted file returns an
`EnteFileTombstone``id`, `collectionID`, `updationTime`, `isDeleted`
instead of decrypting ciphertext the server no longer holds.
- 2026-08-10: Made `lint-once.test.ts` enforce what its header claims. It walked
`make check` only, so it never read `Dockerfile` — the image CI builds through
`script/cibuild` — and a second `prettier --check .` could be added there with