siftlode/backend/app/downloads
npeter83 7a6f351e64 fix(downloads): repair 5 confirmed backend bugs (B1-B5)
- B1 (sticky errored asset): get_or_create_asset now resets a reused status=='error'
  asset back to 'pending' (+clears the error), so a fresh enqueue/edit of a once-failed
  (source,format) pair actually re-downloads instead of the worker short-circuiting the
  new job with the stale error. Errored assets carry no expires_at, so without this the
  pair was permanently poisoned for all users until someone hit resume.
- B2 (ref_count leak): _release_asset counts 'error' as a holding state, so deleting an
  errored job decrements the ref_count that enqueue always incremented (the worker never
  decrements on failure). Errored rows are deliberately NOT deleted here — a concurrent
  B1 reuse could otherwise be lost-updated + FK-nulled; the row is fileless and harmless.
- B3: admin storage dashboard reads sysconfig.get_int(db,'download_total_max_bytes')
  (the admin-editable DB value GC enforces) instead of the raw env default.
- B4: the single-trim branch of normalize_edit_spec guards its float() coercion like the
  crop/segments branches — a malformed trim now yields a 400, not an unhandled 500.
- B5: formats.normalize guards int(max_height) → falls back to "best" instead of 500.

Reviewed (race in an earlier B2 draft caught + fixed); localdev boots, B4/B5 unit-verified.
2026-07-11 16:15:12 +02:00
..
__init__.py fix(downloads): add the downloads package (was wrongly gitignored) + robust sanitizer 2026-07-03 00:19:22 +02:00
backfill.py fix(share): self-host og:image so link previews stay reliable 2026-07-07 22:43:18 +02:00
edit.py fix(downloads): repair 5 confirmed backend bugs (B1-B5) 2026-07-11 16:15:12 +02:00
formats.py fix(downloads): repair 5 confirmed backend bugs (B1-B5) 2026-07-11 16:15:12 +02:00
gc.py feat(downloads): M3 — per-user quota + retention GC 2026-07-03 00:26:40 +02:00
links.py feat(downloads): clickable channels + poster fallback for thumbnail-less sources 2026-07-07 22:28:49 +02:00
og.py fix(share): self-host og:image so link previews stay reliable 2026-07-07 22:43:18 +02:00
quota.py feat(downloads): M4 — REST API (enqueue, manage, file-serve, sharing, admin) 2026-07-03 00:34:08 +02:00
service.py fix(downloads): repair 5 confirmed backend bugs (B1-B5) 2026-07-11 16:15:12 +02:00
storage.py feat(downloads): editor backend — trim/crop derivatives (phase 2) 2026-07-04 01:01:46 +02:00