ref(conversations): Simplify conversation details endpoint#116087
ref(conversations): Simplify conversation details endpoint#116087obostjancic wants to merge 9 commits into
Conversation
…n detail The detail endpoint was forcing a 30-day window regardless of any statsPeriod passed by the frontend, causing timeouts for large orgs querying all projects. Now the endpoint respects the passed statsPeriod as the first attempt and widens to 7d then 30d only when the conversation is not found in the narrower window. Successful params are memoised so subsequent pagination pages skip the failed narrow attempts. Timeouts surface as a 504 with a structured error code and actionable message rather than a generic error. The frontend fallback now sends no time params so the backend widening sequence owns the full retention window logic. Refs TET-2388 Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
|
🚨 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 |
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.58% |
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
73a68b1 to
842ec72
Compare
Remove pagination, closures, and custom timeout handling in favor of
a single query loop with progressive time-window widening.
- Replace GenericOffsetPaginator with a direct Response({data: [...]})
- Inline widening loop in get() instead of closure-based data_fn pattern
- Add 14d widening step (7d -> 14d -> 30d)
- Accept any statsPeriod as initial step without capping at 30d
- Let TimeoutException propagate via handle_query_errors() like other
endpoints instead of custom 504 handling
- Cap results at MAX_SPANS=1000
Co-Authored-By: Claude Sonnet 4 <[email protected]>
79ffe3a to
2dce353
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ec373c1. Configure here.
ec373c1 to
83e8615
Compare
A user-supplied statsPeriod larger than 30d bypassed the retention validation and produced an unbounded Snuba query. Now any statsPeriod at or above MAX_RETENTION_DAYS is ignored and the standard 7d/14d/30d widening steps are used instead. Co-Authored-By: Claude Sonnet 4 <[email protected]>
83e8615 to
233c80a
Compare

When no explicit start/end is provided, the endpoint now probes progressively wider time windows to find the conversation before paginating. A cheap limit=1 query tries the requested statsPeriod (if < 30d), then 7d, 14d, and 30d and returns the first match. The paginator then fetches full pages within that resolved window.
When explicit start/end are provided, nothing changes — the endpoint validates them against the 30-day retention limit and paginates directly.
statsPeriod values >= 30d are silently ignored to prevent unbounded Snuba queries.
Refs TET-2388