Skip to content

feat(frontend): async reel generation via submit + poll - #35

Merged
upgradedev merged 1 commit into
mainfrom
feat/async-generation-frontend
Jul 27, 2026
Merged

feat(frontend): async reel generation via submit + poll#35
upgradedev merged 1 commit into
mainfrom
feat/async-generation-frontend

Conversation

@upgradedev

Copy link
Copy Markdown
Owner

What

Photo reels now use the backend's async job flow (POST /reels/jobs → poll GET /reels/jobs/{id}) instead of a single blocking request that 504s at the Firebase/Cloud Run edge on a multi-minute live render. Closes the M2 gap end-to-end (each request stays well under the proxy cap).

Changes (frontend only)

  • lib/api.ts: submitReelJob + getReelJob + Zod schemas; result reuses ReelResponseSchema. Sync client kept.
  • lib/queries.ts: useSubmitReelJob + usePollReelJob (interval loop, ~4s tick, ~12min ceiling → synthesized 504 reusing the existing timeout copy, 3-consecutive-error budget, immediate first tick, unmount-safe).
  • GenerateReel.tsx: photo path → submit+poll; synthetic (no-photo) path stays a direct blocking call. isPending/isSuccess/error derived to bridge submit→poll. lib/progress.ts + humanized copy reused unchanged.

Additive

Backend untouched (both sync + async endpoints remain). useUploadReel kept for callers. Only generation-flow tests updated (GenerateReel/api/queries/e2e mocks). 191 tests pass locally; CI re-verifies.

Photo reels now submit POST /reels/jobs and poll GET /reels/jobs/{id} rather
than blocking on a single multi-minute request that 504s at the edge proxy.
The job's terminal result is the identical ReelResponse shape, so the success
and error render paths are shared with the synchronous flow unchanged. The
synthetic (no-photo) path stays a direct blocking call (the job route requires
at least one photo). Guard rails: ~4s interval, ~12min wall-clock ceiling
(surfaced through the existing 504 timeout copy), a 3-consecutive transient
error budget, an immediate first tick (offline jobs finish instantly), and
unmount-safe cleanup. lib/progress.ts and the humanized copy are reused, not
changed.
@upgradedev
upgradedev merged commit 2440073 into main Jul 27, 2026
12 checks passed
@upgradedev
upgradedev deleted the feat/async-generation-frontend branch July 27, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant