feat: E2 — Upload & Encoding Pipeline ## Goal A creator can upload a v#277
Closed
fly-productivity-manager[bot] wants to merge 1 commit into
Closed
feat: E2 — Upload & Encoding Pipeline
## Goal
A creator can upload a v#277fly-productivity-manager[bot] wants to merge 1 commit into
fly-productivity-manager[bot] wants to merge 1 commit into
Conversation
## Goal A creator can upload a v [fly-dev run run_4d07f082c2c240d99a0bf1d78df4ad3f]
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
spooool | 711c14c | Jul 06 2026, 08:04 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All five tasks done. Here's a summary of what was implemented:
E2 — Upload & Encoding Pipeline
Bug fix (critical):
/encoderoute missing from container bootstrapcontainer/render/src/server.ts— The bootstrap server only proxied/render. The Worker sendsPOST /encodeto the container for the R2+FFmpeg path, which was silently returning 404 and marking every video asfailed. Added an/encodebootstrap handler mirroring/render: it lazily initialises the heavy server (FFmpeg + S3 client), forwards the body, and fires a/api/webhooks/encode/:id/failcallback if the container fails to boot. Also extracted aforwardToHeavyServer()helper to eliminate the duplication.Hardening: stale encoding timeout sweep
src/workers/index.ts— Added a daily sweep that marks videos stuck inencodingfor >6 hours asfailed. Covers two failure modes: a Cloudflare Stream webhook that never fires, or an EncoderContainer that crashes mid-job without posting/fail.Hardening: R2 object cleanup on abandoned uploads
src/workers/index.ts— The existing daily cron deleted staleuploadingD1 rows but left the R2 objects behind (edge case wheremultipart.complete()succeeded but the DB update failed). Now selects the r2_keys first, deletes those R2 objects, then removes the rows.Feature:
GET /api/videos/:id/statussrc/workers/videos.ts— Lightweight endpoint returning{id, status, playback_hls_url, thumbnail_url, thumbnail_candidates}, cached in KV for 10 s. Skips view counting and edge-cache overhead — intended for polling after upload.Feature: Encoding status polling in Upload.tsx
src/frontend/pages/Upload.tsx— After upload completes, polls/api/videos/:id/statusevery 5 s. Shows "queued for encoding…" → "encoding…" → "Your video is ready. Watch it now" (or an error state onfailed). Clears the timer on unmount.Tests
Added 4 new tests to
container/render/src/server.test.tscovering the/encoderoute: missing fields → 400, happy path → 200 + correct callbacks, queue full → 429, encode failure →/failcallback. All 1056 tests pass.Tests
Opened automatically by fly-dev run run_4d07f082c2c240d99a0bf1d78df4ad3f.