-
Notifications
You must be signed in to change notification settings - Fork 49
Main1 #1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: IndexedDB Cleanup Assumes Incorrect Session ID Format
The IndexedDB store cleanup logic incorrectly assumes sessionId
is a timestamp when calculating session age (Date.now() - sessionId
). This affects both the targeting and session replay stores and leads to incorrect cleanup for session IDs that are not timestamps.
packages/targeting/src/targeting-idb-store.ts#L94-L95
Amplitude-TypeScript/packages/targeting/src/targeting-idb-store.ts
Lines 94 to 95 in 0f142d5
const eventTypeObj = allEventTypeObjs[i]; | |
const amountOfTimeSinceSession = Date.now() - eventTypeObj.sessionId; |
packages/session-replay-browser/src/targeting/targeting-idb-store.ts#L99-L100
Amplitude-TypeScript/packages/session-replay-browser/src/targeting/targeting-idb-store.ts
Lines 99 to 100 in 0f142d5
const targetingMatchObj = allTargetingMatchObjs[i]; | |
const amountOfTimeSinceSession = Date.now() - targetingMatchObj.sessionId; |
BugBot free trial expires on June 9, 2025
Your team has used $0.00 of the $50.00 spend limit so far. Team admins can manage spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
- Changed 'this.sr' to 'this.sessionReplay' in evaluateTargetingAndCapture call - Updated imports to use direct function imports instead of namespace import - Fixed TypeScript compilation error in plugin-session-replay-browser
- Removed duplicate idb@^8.0.0 entry pointing to version 8.0.3 - Keeps the existing [email protected] entry as specified in package.json
- Changed expectation from toHaveBeenCalledTimes(1) to toHaveBeenCalled() - Updated test to account for setSessionId triggering recording via evaluateTargetingAndCapture - Added explanatory comments about the targeting functionality changes
- Replace ESLint disable comments with bracket notation for mock method access - Fix unsafe assignment warnings with proper type assertions - Use mockResolvedValue for proper async mock handling - Maintain 100% test coverage for both packages after test refactoring - Remove redundant helper tests while preserving essential functionality
Summary
Checklist