feat: run manual translations in the background #275

Merged
naps62-yolo merged 1 commits from feat/translate-async into main 2026-11-10 20:52:31 +00:00
Owner

Requested by naps

Manual translations now run in the background. POST /api/media-files/{id}/subtitles/translate validates as before, then answers 202 with the run and translates as its own task. A second request for a language already running is a 409.

Subtitle status (movie, episode, series) gains translations: runs that are running, or failed with a detail. A finished run drops off once its sidecar shows up on subtitles. The panel reads that, so a run started before leaving the page still shows when you come back, and it re-reads every 5 s until the run settles.

State is in memory only (§8). A restart mid-run loses it and writes nothing.

Why

A Coyote vs. Acme translation through the local qwen-14b took 7.5 minutes. The old handler was dropped when the page closed, so the work was lost with nothing reported.

Verification

just ci passes: 828 tests, biome, tsc. New tests cover a failure reported on status with nothing written, and a running translation that answers at once and refuses a second request. I have not checked the panel in a browser.

🤖 Generated with Claude Code

<!-- claude-projects-attribution: {"github_login":"naps62"} --> _Requested by **naps**_ Manual translations now run in the background. `POST /api/media-files/{id}/subtitles/translate` validates as before, then answers `202` with the run and translates as its own task. A second request for a language already running is a `409`. Subtitle status (movie, episode, series) gains `translations`: runs that are `running`, or `failed` with a `detail`. A finished run drops off once its sidecar shows up on `subtitles`. The panel reads that, so a run started before leaving the page still shows when you come back, and it re-reads every 5 s until the run settles. State is in memory only (§8). A restart mid-run loses it and writes nothing. <details><summary>Why</summary> A Coyote vs. Acme translation through the local qwen-14b took 7.5 minutes. The old handler was dropped when the page closed, so the work was lost with nothing reported. </details> <details><summary>Verification</summary> `just ci` passes: 828 tests, biome, tsc. New tests cover a failure reported on status with nothing written, and a running translation that answers at once and refuses a second request. I have not checked the panel in a browser. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
naps62-yolo added 1 commit 2026-11-10 19:55:39 +00:00
feat: run manual translations in the background
ci / web (pull_request) Successful in 25s
ci / rust (pull_request) Successful in 1m36s
ci / image (pull_request) Skipped
e2e / e2e (pull_request) Failing after 1m13s
1a38ecf161
The translate endpoint now checks the request, answers 202 with the
run, and translates as its own task. A slow local model takes minutes,
and the old handler was dropped as soon as the page closed, losing the
work. The run reports on the file's subtitle status until it lands or
fails, and the panel polls that instead of holding the request open.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
naps62-yolo merged commit c5dd55582e into main 2026-11-10 20:52:31 +00:00
naps62-yolo deleted branch feat/translate-async 2026-11-10 20:52:31 +00:00
Sign in to join this conversation.