Skip to content

fix(uptime): Preserve null assertions when editing monitors with feature flag off#107365

Merged
jaydgoss merged 4 commits intomasterfrom
jaygoss/new-724-uptime-monitor-edit-passes-empty-assertions-instead-of
Jan 30, 2026
Merged

fix(uptime): Preserve null assertions when editing monitors with feature flag off#107365
jaydgoss merged 4 commits intomasterfrom
jaygoss/new-724-uptime-monitor-edit-passes-empty-assertions-instead-of

Conversation

@jaydgoss
Copy link
Member

Summary

  • When editing uptime monitors with the uptime-runtime-assertions feature flag disabled, null assertions were being overwritten with an empty default structure
  • This fix preserves null assertions by adding checks in both the uptime alert form and detector form flows

Root Cause

When the feature flag is OFF:

  1. The UptimeAssertionsField component is not rendered
  2. The field's getValue transform (which converts empty children to null) never runs
  3. The empty assertion structure from getFormDataFromRule/uptimeSavedDetectorToFormData gets submitted to the backend

Changes

  1. uptimeAlertForm.tsx: Added onPreSubmit logic to restore the original assertion value when the feature flag is off
  2. fields.tsx: Added conversion of empty assertion structures to null in uptimeFormDataToEndpointPayload

Fixes NEW-724

Test plan

  • Existing tests pass
  • Manually verify editing an uptime monitor with null assertions preserves null when feature flag is off

…ure flag off

When the uptime-runtime-assertions feature flag is disabled, the
UptimeAssertionsField is not rendered, so its getValue transform
(which converts empty children to null) never runs. This caused
null assertions to be overwritten with an empty default structure.

This fix ensures null assertions are preserved by:
1. Adding onPreSubmit logic in uptimeAlertForm to restore the
   original assertion value when the feature flag is off
2. Converting empty assertion structures to null in
   uptimeFormDataToEndpointPayload for the detector flow

Fixes NEW-724
@jaydgoss jaydgoss requested review from a team as code owners January 30, 2026 21:05
@linear
Copy link

linear bot commented Jan 30, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 30, 2026
…lag off

Added tests to verify:
1. Null assertions are preserved when editing rules with feature flag disabled
2. Existing assertions are preserved when editing rules with feature flag disabled
3. Empty assertion structures are converted to null in uptimeFormDataToEndpointPayload
Copy link
Contributor

@Abdkhan14 Abdkhan14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…reSubmit

Changed to normalize empty/sentinel assertions to null by checking the
actual form value instead of restoring the original rule value. This
approach mirrors what the field's getValue transform does and is cleaner.

Also extracted hasRuntimeAssertions variable for consistency.
@jaydgoss jaydgoss enabled auto-merge (squash) January 30, 2026 21:31
@jaydgoss jaydgoss merged commit 75e2b9f into master Jan 30, 2026
57 checks passed
@jaydgoss jaydgoss deleted the jaygoss/new-724-uptime-monitor-edit-passes-empty-assertions-instead-of branch January 30, 2026 21:31
priscilawebdev pushed a commit that referenced this pull request Feb 2, 2026
…ure flag off (#107365)

## Summary
- When editing uptime monitors with the `uptime-runtime-assertions`
feature flag disabled, null assertions were being overwritten with an
empty default structure
- This fix preserves null assertions by adding checks in both the uptime
alert form and detector form flows

## Root Cause
When the feature flag is OFF:
1. The `UptimeAssertionsField` component is not rendered
2. The field's `getValue` transform (which converts empty children to
null) never runs
3. The empty assertion structure from
`getFormDataFromRule`/`uptimeSavedDetectorToFormData` gets submitted to
the backend

## Changes
1. **uptimeAlertForm.tsx**: Added `onPreSubmit` logic to restore the
original assertion value when the feature flag is off
2. **fields.tsx**: Added conversion of empty assertion structures to
null in `uptimeFormDataToEndpointPayload`

Fixes [NEW-724](https://linear.app/getsentry/issue/NEW-724)

## Test plan
- [x] Existing tests pass
- [ ] Manually verify editing an uptime monitor with null assertions
preserves null when feature flag is off
@github-actions github-actions bot locked and limited conversation to collaborators Feb 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants