Repository navigation
fix(studio-server): two exports in the same second get separate jobs - #7053
Conversation
There was a problem hiding this comment.
Requesting changes on e369f3e1 for one thing: the Comments check fails because of this diff.
RAISED comment share: packages/studio-server/src/routes/render.ts is 10.9% (45/414), at the base 10.5% (43/409) — 2 comment line(s) added.
The ratchet won't let a file's comment share go up, and the new two-line comment above baseId is what pushes it over. Delete the comment, or move what it says into a name, for example a small nextFreeRenderJobId(baseId, ext) helper. Once that check passes, I don't see another blocker.
The rest checks out:
- Fix: the id is chosen and
renderJobs.setruns in the same synchronous step (adapter.startRenderreturns synchronously and nothing is awaited in between), so two concurrent POSTs can't both get the same id. Checking for an existing${jobId}${ext}also stops a file from a restarted session being overwritten. A single export keeps its old id and file name. - Consumers: nothing in
studio/studio-serverparses the timestamp back out of the id. The list, delete, view and download routes key on the full id, so a-2suffix works with all of them. - Fails without the fix: I confirmed it locally. At head,
render.test.tshas 90 passing, two runs in a row. With the baserender.tsand the new test, the named test fails (expected 1 to be 2, 1 failed / 89 passed).
Edit accuracy: accurate 267 (base branch 267), smooth 97 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
There was a problem hiding this comment.
Approving at e7c88ab3. The only blocker from the last review is resolved: the comment is now a named helper, nextFreeRenderJobId, and the Comments check passes on this head.
The change since e369f3e1 only moves the loop into that helper. It works the same way, and the id is still chosen and stored in the same synchronous step, with nothing awaited in between.
I reran the named test on this head. render.test.ts passes 90/90. With the base render.ts, "gives two exports started in the same second their own job and output file" fails (1 failed / 89 passed).
Ports upstream heygen-com#7053 (92943d9): when a render job id derived from the second-resolution timestamp is already taken in memory or on disk, append a numeric suffix instead of overwriting the earlier output. Adds a regression test that failed on the old code. Also records the 2026-11-02 upstream review pass: 14 consecutive commits judged with file:line evidence and the commit baseline advanced to 4c1c178; the remaining range is kept in ROADMAP. Co-authored-by: Miguel Ángel <miguel.sierra@heygen.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Two exports of one project started in the same second now get their own job and their own output file. The second takes a
-2suffix (then-3, and so on) when the id is already a running job or its file already exists.Why
POST /api/projects/:id/renderbuilt the job id as the project id plus a timestamp with one-second resolution, and that id is also the output file name. Two exports within a second shared a key in the server's job map, so the second replaced the first job and both wrote the same file. The id is minted in one place,packages/studio-server/src/routes/render.ts. A single export keeps the same id and file name as before.Testing
fails without the fix: packages/studio-server/src/routes/render.test.ts > "gives two exports started in the same second their own job and output file"
On the devbox: 90 passed in
render.test.ts, 3 runs in a row; with the oldrender.tsthe new test fails (1 failed, 89 passed).Size
A short change to one id and its test; it has no other carrier.