Skip to content

Conversation

cmanallen
Copy link
Member

@cmanallen cmanallen commented Oct 2, 2025

Added data-export for Session Replay to comply with EU data-portability regulations.

@cmanallen cmanallen requested review from a team as code owners October 2, 2025 14:15
@github-actions github-actions bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Oct 2, 2025
Copy link
Contributor

github-actions bot commented Oct 2, 2025

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.


def save_to_storage(destination_bucket: str, filename: str, contents: str) -> None:
storage = get_storage(None)
assert isinstance(storage, GoogleCloudStorage)
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential bug: The save_to_storage function incorrectly asserts the storage backend is GoogleCloudStorage, which will cause a crash if the default filesystem or S3 storage is used.
  • Description: The save_to_storage function, used for replay data exports, includes an assertion that the storage backend must be an instance of GoogleCloudStorage. However, the default storage backend for Sentry is filesystem, and it can also be configured to use other backends like S3. When the replay data export feature is triggered in an environment not using Google Cloud Storage, this isinstance check will fail, raising an AssertionError and crashing the background task handling the export. This will break the data export functionality, which is a compliance-related feature, in all non-GCS deployments.

  • Suggested fix: Remove the hard assertion assert isinstance(storage, GoogleCloudStorage). The function should either be made storage-agnostic or include logic to handle different storage backends. Alternatively, add configuration validation to ensure this feature is only used when Google Cloud Storage is the configured filestore backend.
    severity: 0.85, confidence: 0.98

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Member Author

Choose a reason for hiding this comment

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

We want it to crash.

Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 92.35294% with 13 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/replays/data_export.py 91.39% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #100778    +/-   ##
=========================================
  Coverage   81.13%    81.13%            
=========================================
  Files        8607      8609     +2     
  Lines      381775    381945   +170     
  Branches    24015     24015            
=========================================
+ Hits       309743    309897   +154     
- Misses      71705     71721    +16     
  Partials      327       327            

@cmanallen cmanallen merged commit 948867d into master Oct 2, 2025
73 checks passed
@cmanallen cmanallen deleted the cmanallen/replays-data-export branch October 2, 2025 14:37
Copy link

sentry-io bot commented Oct 2, 2025

Issues attributed to commits in this pull request

This pull request was merged and Sentry observed the following issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants