Files
zpan/server
saltbo 6e2cb47b72 fix(downloads): preserve transfer progress when a runtime report omits it
Download/upload totals were getting wiped on completed tasks. Two causes, both
mine:

1. nextTaskRuntime treated an incoming runtime as a full snapshot and REPLACED
   the stored one. reportSeedingStopped sends only {phase, seeding} (no
   progress), so the cumulative download/upload progress was erased — a completed
   task ended up as {phase: completed, seeding: {active: false}} with no
   transfer record. Progress is cumulative, not a per-report snapshot: carry it
   forward when a runtime report omits it (progress patches still apply on top).
2. clearStaleSeedingRuntime nulled the entire runtime to drop the seeding phase,
   which also erased progress. Now it surgically edits the JSON (phase ->
   completed, remove the seeding object) and keeps progress + file list.

Confirmed on prod: affected tasks had runtime collapsed to just engine/phase/
seeding with progress gone. Tests updated to assert a phase-only report
preserves progress.
2026-06-19 17:37:08 -04:00
..