feat(subscriptions): live posts-processed progress on backfill/recovery — #704 step 2
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 22s
CI / backend-lint-and-test (push) Failing after 26s
CI / integration (push) Failing after 3m0s

The running badge only showed the chunk counter; now it shows posts walked
— real walk progress. The ingester already reports posts_processed per
chunk (step 1); the backfill lifecycle accumulates it into
config_overrides._backfill_posts across chunks. SourceRecord exposes
backfill_posts; start_backfill/start_recovery clear it (fresh walk); stop
clears it too. SourceRow/SourceCard badge renders "Recovering · 45 posts"
(falls back to "(N)" chunks before any posts are counted).

Per-chunk accumulation (no mid-walk DB write) — simple and race-free; a
small over-count from each chunk re-walking its resumed page is fine for a
progress indicator.

Tests: lifecycle accumulates posts_processed across chunks; start clears a
prior _backfill_posts and the record exposes it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-05 23:43:23 -04:00
parent e53f8959af
commit b2e59e7e17
6 changed files with 67 additions and 5 deletions
+7
View File
@@ -515,6 +515,13 @@ class DownloadService:
new_overrides = dict(src.config_overrides or {})
chunks = int(new_overrides.get("_backfill_chunks", 0)) + 1
new_overrides["_backfill_chunks"] = chunks
# plan #704 (#5): accumulate posts-processed across chunks so the badge
# shows live walk progress, not just the chunk count. Cleared on
# (re)start. (Slight over-count: each chunk re-walks the resumed page —
# fine for a progress indicator.)
new_overrides["_backfill_posts"] = int(
new_overrides.get("_backfill_posts", 0)
) + int(getattr(dl_result, "posts_processed", 0) or 0)
completed = (
dl_result.success