Repository navigation
fix(sdk-recorder): isolate uploads from restarted capture - #3380
Open
vedanth-jadhav wants to merge 1 commit into
Open
vedanth-jadhav wants to merge 1 commit into
vedanth-jadhav wants to merge 1 commit into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This was referenced Oct 26, 2026
This branch was previously deployed
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.
Destroying and restarting the SDK recorder while an older
stop()awaits video creation, upload or completion lets the old response overwrite the replacement's video ID/phase and runcleanup()against its live capture. The encoder identity was checked before upload, but ownership was lost across its later asynchronous calls.Carry that encoder identity through upload, check ownership after each await and before handling errors, and reject stale operations with
AbortErrorwithout emitting errors/completion or releasing replacement tracks. Snapshot the stopped recording's duration. Guard cleanup after user completion/error callbacks too, because those callbacks can restart capture synchronously.The SDK declaration build also exposed the existing generic unsubscribe error: registration widened the callback type while deletion used the original narrower type. Reuse the same typed callback reference for registration and removal; runtime subscription identity and public APIs are unchanged.
Validation (Linux x86_64, Bun 1.4.4, TypeScript 5.8.3, tsup 8.5.1):
tsc --noEmit, scoped strict source/test TypeScript, full ESM + declaration build, Biome andgit diff --checkpass. The pre-existing unsubscribe TS2345 was reproduced on baseline before the callback-reference correction.Reproduce:
cd packages/sdk-recorder && bun test && bun run typecheck && bun run build. Build tools were installed outside the checkout; no manifest, lockfile or generated-output changes. Capture and network events are controlled test fixtures; physical browser/device capture was not run. Existing in-flight remote requests can still finish after destroy; this change prevents their results from mutating a later recording and does not claim network cancellation. Extends the pre-upload stop ownership check from merged #3191; browser uploader cancellation #3353 is a separate implementation.

Confidence Score: 5/5
The PR appears safe to merge.Summary
The PR keeps an older upload from changing or cleaning up a restarted recording.
No actionable issues were found. Review checks were source-based; tests were not run during this review.
Reviews (1) · Last reviewed commit: "fix(sdk-recorder): isolate asynchronous ..." · Reviewed by Greptile