Skip to content

fix(monitors): Fix is_upserting flag reset logic#101556

Merged
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/fix-monitors-fix-is-upserting-flag-reset-logic
Oct 15, 2025
Merged

fix(monitors): Fix is_upserting flag reset logic#101556
evanpurkhiser merged 1 commit into
masterfrom
evanpurkhiser/fix-monitors-fix-is-upserting-flag-reset-logic

Conversation

@evanpurkhiser

@evanpurkhiser evanpurkhiser commented Oct 15, 2025

Copy link
Copy Markdown
Member

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

Fixes NEW-584: is_upserting prematurely reset when updating a in_progress

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
@evanpurkhiser evanpurkhiser requested a review from a team as a code owner October 15, 2025 20:38
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 15, 2025
@linear

linear Bot commented Oct 15, 2025

Copy link
Copy Markdown

@evanpurkhiser evanpurkhiser enabled auto-merge (squash) October 15, 2025 20:43
@codecov

codecov Bot commented Oct 15, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

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              

@evanpurkhiser evanpurkhiser merged commit 06a3cc5 into master Oct 15, 2025
96 of 98 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/fix-monitors-fix-is-upserting-flag-reset-logic branch October 15, 2025 21:30
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants