getsentry / getsentry/sentry

Namespace collision between Session Replays and FileBlobs prevents S3 Lifecycle Management

Open
#111,688 3 comments 0 reactions 0 assignees View on GitHub
Feature Product Area: Replays
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
21h 10m
Merged PRs (30d)
635

Description

There is a path collision in the underlying storage (S3) between Session Replay segments and generic FileBlobs.
- Replays use a retention-based prefix: `"{retention_days or 30}/{project_id}/{replay_id}/{segment_id}"` (e.g., 90/123/...): https://github.com/getsentry/sentry/blob/26.3.1/src/sentry/replays/lib/storage.py#L64
- FileBlobs use a hashed path: shards/path (e.g., 90/7b0d/... where 90 is a hash prefix): https://github.com/getsentry/sentry/blob/26.3.1/src/sentry/models/files/abstractfileblob.py#L218

It is impossible to configure an S3 Lifecycle Policy to expire Replays based on their retention period (e.g., prefix 90/) because this prefix also contains permanent FileBlobs (artifacts, symbols) that happen to start with the same hash.

```
$ s3cmd ls s3://sentry/sentry/90/
DIR s3://sentry/sentry/90/2/
DIR s3://sentry/sentry/90/3/
DIR s3://sentry/sentry/90/4/
DIR s3://sentry/sentry/90/7b0d/
DIR s3://sentry/sentry/90/c649/
DIR s3://sentry/sentry/90/dec7/
```

Contributor guide

Open the contributing guide

Research direction

Start with the linked paths in src/sentry/replays/lib/storage.py and src/sentry/models/files/abstractfileblob.py, comparing how replay segments and FileBlobs are constructed in S3. Reproduce the overlapping prefixes with the issue's examples, then verify that replay retention can target replay objects without affecting permanent FileBlobs.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.