feat(capture-sdk): cross-page recording via sessionStorage persistence#76
Open
Swahjak wants to merge 7 commits into
Open
feat(capture-sdk): cross-page recording via sessionStorage persistence#76Swahjak wants to merge 7 commits into
Swahjak wants to merge 7 commits into
Conversation
…erit cross-page events
…top without active recording
…ss-file pollution
|
@Swahjak is attempting to deploy a commit to the redpangilinan's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
sessionStorageonpagehideso events survive full-page navigationsinit()detects the stored session and resumes the recording dock automatically with the originalstartedAttimestampMediaRecorder(recorder died during navigation), falls back to a screenshot so the report still includes the full cross-page debugger tracestartSession()on the new page, giving a continuous timeline in the final reportChanges
sdks/capture/src/debugger/session-storage.ts— new helpers:persistSession,loadPersistedSession,clearPersistedSession(5-minute expiry, version guard, try/catch for private browsing)sdks/capture/src/debugger/debugger-collector.ts— persist onpagehide, restore oninstall(), clear on finalize/reset; addshasActiveSession()andgetSessionStartedAt()sdks/capture/src/debugger/lazy-debugger-collector.ts— exposesensureSessionRestored(): Promise<number | null>sdks/capture/src/runtime/capture-runtime.ts— callsresumePersistedSession()ininit()when storage has a session;onStopRecordingfalls back to screenshot when no active recordingTest Plan
bun test sdks/capture/test)session-storage.test.ts— 8 tests covering round-trip, expiry, malformed input, invalid eventscross-page-recording.test.ts— 4 integration tests: no-session init, session-present init, screenshot fallback, full recording flow after resumeKnown limitations
MediaRecordercannot survive a navigation. The resumed page gets screenshot + full cross-page debugger trace, not a stitched video.sessionStorageis origin-scoped. Navigation to a different origin loses the session.