fix(monitors): Fix is_upserting flag reset logic#101556
Merged
evanpurkhiser merged 1 commit intoOct 15, 2025
Merged
Conversation
The is_upserting flag was being incorrectly reset when a completing check-in without config was updating an existing IN_PROGRESS check-in. The bug was that the flag was being reset too early in the flow, before we knew whether we were creating a new check-in or updating an existing one. Changes: - Removed premature is_upserting reset from _ensure_monitor_with_config() - Moved reset logic to after check-in creation, where we know if we created a brand new check-in vs updating an existing one - Renamed monitor_config to checkin_monitor_config in the check-in creation code to avoid variable shadowing and allow referencing the original monitor_config from params The flag should only be reset to False when: 1. A brand new check-in is created (not updating an existing one) 2. No monitor config was provided in the check-in params 3. The monitor was previously marked as is_upserting=True
klochek
approved these changes
Oct 15, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #101556 +/- ##
===========================================
+ Coverage 79.33% 80.97% +1.64%
===========================================
Files 8704 8706 +2
Lines 386898 386933 +35
Branches 24520 24520
===========================================
+ Hits 306960 313336 +6376
+ Misses 79587 73246 -6341
Partials 351 351 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The is_upserting flag was being incorrectly reset when a completing
check-in without config was updating an existing IN_PROGRESS check-in.
The bug was that the flag was being reset too early in the flow, before
we knew whether we were creating a new check-in or updating an existing one.
Changes:
a brand new check-in vs updating an existing one
code to avoid variable shadowing and allow referencing the original
monitor_config from params
The flag should only be reset to False when:
Fixes NEW-584:
is_upsertingprematurely reset when updating ain_progress