Skip to content

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Main1 #1134

wants to merge 10 commits into from

Conversation

bravecod
Copy link
Collaborator

@bravecod bravecod commented Jun 4, 2025

Summary

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a 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

const eventTypeObj = allEventTypeObjs[i];
const amountOfTimeSinceSession = Date.now() - eventTypeObj.sessionId;

packages/session-replay-browser/src/targeting/targeting-idb-store.ts#L99-L100

const targetingMatchObj = allTargetingMatchObjs[i];
const amountOfTimeSinceSession = Date.now() - targetingMatchObj.sessionId;

Fix in Cursor


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 👎

bravecod added 4 commits July 8, 2025 13:08
- 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
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.

2 participants