Skip to content

Fix video trimmer recording failures - #3470

Open
vedanth-jadhav wants to merge 2 commits into
CapSoftware:mainfrom
vedanth-jadhav:fix/web-trimmer-recording-failures
Open

vedanth-jadhav wants to merge 2 commits into
CapSoftware:mainfrom
vedanth-jadhav:fix/web-trimmer-recording-failures

Conversation

@vedanth-jadhav

@vedanth-jadhav vedanth-jadhav commented Oct 27, 2026 •

Copy link
Copy Markdown

Problem

If preview playback is rejected while trimming, the recorder keeps running and its safety timer can later publish a partial video. Recorder errors and unexpected stops can also leave the trimmer stuck or publish incomplete output. The canvas capture track is retained after a successful trim.

Changes

  • Stop and discard failed or cancelled recordings, release the canvas capture track, and clear the frame callback and timeout.
  • Report playback, recorder, and timeout failures instead of offering partial output. Allow retry after a failure.
  • Cancel an active trim when switching files or leaving the page, without stopping the preview's audio destination track.

Validation

  • 11 focused tests pass, including eight mounted trimmer cases and three existing speed-controller cases. Playback rejection, recorder error, and canvas-track cleanup cases fail against main.
  • Tested together with fix(web): keep the audio in every trim, not just the first #3433: all 10 trimmer and audio cases pass in a combined checkout. Its fake stream was extended with getVideoTracks() to match the browser API used here.
  • Scoped strict TypeScript check of the component and tests with lightweight UI and analytics declarations; workflow YAML and diff checks pass. Biome reports the same 13 errors and five warnings already present in the component on main; the new test is clean.

Tests use media API stand-ins; a full web build and physical capture were not run.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the previous coverage gap addressed.

Summary

The PR stops failed or cancelled trims, releases canvas capture tracks, and prevents partial downloads.

  • Video trims discard failed recordings and clean up capture resources.

Reviews (2) · Last reviewed commit: "Test trimmer timeout cleanup" · Reviewed by Greptile

@vercel

vercel Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Someone is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines +134 to +142
it("discards recorder errors instead of publishing partial output", async () => {
await startTrim();
Recorder.instances[0]?.onerror?.();
await vi.waitFor(() =>
expect(container.textContent).toContain("Recording failed"),
);
expect(stopTrack).toHaveBeenCalledOnce();
expect(madeUrls).not.toContain("blob:output");
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Timeout failures lack coverage

The new tests never exercise the timeout that now rejects a stalled trim instead of publishing partial output. A regression could bring back partial downloads without failing these tests.

Add a fake-timer test that advances past the deadline and checks the error, recorder shutdown, canvas-track cleanup, and absence of an output URL. Also check that a late stop event cannot publish the failed recording.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/__tests__/unit/trimming-tool-recording-failure.test.ts
Line: 134-142

Comment:
**Timeout failures lack coverage**

The new tests never exercise the timeout that now rejects a stalled trim instead of publishing partial output. A regression could bring back partial downloads without failing these tests.

Add a fake-timer test that advances past the deadline and checks the error, recorder shutdown, canvas-track cleanup, and absence of an output URL. Also check that a late stop event cannot publish the failed recording.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in e734fea: the new fake-timer regression advances past the timeout and checks the error, recorder shutdown, canvas-track cleanup, absence of an output URL, and a late stop callback.

Copy link
Copy Markdown
Author

@greptile review

This branch has not been deployed

No deployments
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