mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-08-24 03:56:32 +00:00
The streaming ZIP refactor made `ZipResources` open each blob inline while `streamZipArchive`'s writer commits HTTP 200 on the first byte. A blob missing on disk (a DB record whose blob file is gone) failed mid-stream, so the client received a 200 with a central-directory-valid but incomplete archive — the missing files silently dropped (regression vs main, which buffered then sent). Stat every blob up front; a missing one now returns before any byte is written, so `streamZipArchive` emits a clean structured error instead. Keeps the streaming memory benefit. Tests (both proven fail-on-unfixed / pass-on-fixed): a unit test asserts the writer stays empty when a blob is missing, and a download-handler test asserts a missing blob in a multi-file ZIP returns a clean 500, not a truncated 200. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>