sentry icon indicating copy to clipboard operation
sentry copied to clipboard

fix(aci): Change open period range boundary to inclusive

Open snigdhas opened this issue 7 months ago • 4 comments

Some issues have the same regression/resolution time in our db and the range boundary today would reject those as valid start/end times for open periods. Updating the boundary to be inclusive on both ends should fix this and allow an open period to start at the same time that the previous one ends.

snigdhas avatar Jun 13 '25 18:06 snigdhas

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #93535    +/-   ##
========================================
  Coverage   88.03%   88.04%            
========================================
  Files       10325    10330     +5     
  Lines      595677   596288   +611     
  Branches    23134    23134            
========================================
+ Hits       524411   524989   +578     
- Misses      70773    70806    +33     
  Partials      493      493            

codecov[bot] avatar Jun 13 '25 18:06 codecov[bot]

Hm ADD CONSTRAINT EXCLUDE is an unsafe operation -- we can wipe the table and pause writes before applying this if that would make it safe? Otherwise the safer suggestion is to make a new table 🤔

snigdhas avatar Jun 13 '25 18:06 snigdhas

Talked to @wedamija - we'll turn off the ff for writes and run the post-deploy migration to delete rows before running this migration with SafeRunSQL.

snigdhas avatar Jun 13 '25 22:06 snigdhas

This PR has a migration; here is the generated SQL for src/sentry/migrations/0927_make_open_period_range_boundary_inclusive.py

for 0927_make_open_period_range_boundary_inclusive in sentry

--
-- Custom state/database change combination
--
                    ALTER TABLE "sentry_groupopenperiod" ADD CONSTRAINT "exclude_overlapping_date_start_end" EXCLUDE USING GIST ("group" WITH =, (TSTZRANGE("date_started", "date_ended", '[]')) WITH &&);
                    
--
-- Remove constraint exclude_overlapping_start_end from model groupopenperiod
--
ALTER TABLE "sentry_groupopenperiod" DROP CONSTRAINT "exclude_overlapping_start_end";

github-actions[bot] avatar Jun 13 '25 22:06 github-actions[bot]

This PR has a migration; here is the generated SQL for src/sentry/migrations/0930_make_open_period_range_boundary_inclusive.py

for 0930_make_open_period_range_boundary_inclusive in sentry

--
-- Custom state/database change combination
--
                    ALTER TABLE "sentry_groupopenperiod" ADD CONSTRAINT "exclude_overlapping_date_start_end" EXCLUDE USING GIST ("group_id" WITH =, (TSTZRANGE("date_started", "date_ended", '[]')) WITH &&);
                    
--
-- Remove constraint exclude_overlapping_start_end from model groupopenperiod
--
ALTER TABLE "sentry_groupopenperiod" DROP CONSTRAINT "exclude_overlapping_start_end";

github-actions[bot] avatar Jun 16 '25 23:06 github-actions[bot]