Submit an issue View all issues Source
MIR-798

Deploy upload progress bar and speedup stats (mirsync follow-up)

Done public
phinze phinze Opened Mar 12, 2026 Updated Mar 16, 2026

Follow-up to MIR-668. Now that delta file transfer gives us per-file manifests and a known set of files to upload, we can show meaningful upload progress and speedup stats.

Key idea — streaming compression ratio

The tar pipeline is tar.Writer → gzip.Writer → pipe. By counting bytes on both sides (uncompressed in, compressed out), we get a live compression ratio that stabilizes after the first few KB. Multiply by the remaining uncompressed bytes (already known from manifest file sizes — no extra I/O) to project total wire bytes. This gives us a real progress bar without adding any latency or extra work to the critical path.

Important constraint: don't add any pre-upload computation that delays getting bytes on the wire. The manifest walk already stats every file, so uncompressed totals are free. The ratio counters are just two integers on existing writers. Everything piggybacks on work we're already doing.

Nice to have (later)

Server could also cache the compression ratio in manifest.json at saveSourceImage time (compressed layer.tar.gz size / uncompressed total is trivially available). Returning it in PrepareUploadResult would give the client a predicted ratio before byte one — useful for instant ETA display, but not essential since the streaming ratio converges fast.

Deliverables

  • Byte counters on tar/gzip writers during filtered tar creation
  • Use manifest file sizes + live ratio for progress bar with ETA
  • Speedup summary after upload: Uploaded 142KB (2.1MB cached) — 14.8x speedup