Skip to content

fix(monitors): apply schema migrations for custom_schedule and warning_recovery#619

Merged
riyazsh merged 1 commit into
mainfrom
riyaz/HAMR-392-monitor-schema-migrations
Jul 9, 2026
Merged

fix(monitors): apply schema migrations for custom_schedule and warning_recovery#619
riyazsh merged 1 commit into
mainfrom
riyaz/HAMR-392-monitor-schema-migrations

Conversation

@riyazsh

@riyazsh riyazsh commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Two monitor payload rejections observed when replaying monitors from an older API
version to a stricter destination. Both are schema drift; the fixes make the
payload valid without changing semantics.

  • custom_schedule requires on_missing_data — inject "default" (the
    documented default) when custom_schedule is set and on_missing_data is absent.
  • warning_recovery orphan — drop it when warning is not set; a recovery
    threshold with no warning threshold has nothing to recover from.

Both migrations live in pre_resource_action_hook so they apply on both create and update.
Null-safe on options and thresholds. Existing service-check groupby guard is unchanged.

Test plan

  • 8 new unit tests in tests/unit/test_monitors.py::TestMonitorsSchemaMigrations:
    injection, preservation of explicit values, orphan drop, and null-safety.
  • Full local tests/unit/ suite: 818 passed, 0 regressions.

@riyazsh
riyazsh requested a review from a team as a code owner July 9, 2026 15:40
@riyazsh
riyazsh force-pushed the riyaz/HAMR-392-monitor-schema-migrations branch from b17a085 to f5615d5 Compare July 9, 2026 15:44
@riyazsh riyazsh changed the title monitors: fix custom_schedule + warning_recovery schema migrations fix(monitors): apply schema migrations for custom_schedule and warning_recovery Jul 9, 2026
@riyazsh
riyazsh force-pushed the riyaz/HAMR-392-monitor-schema-migrations branch 2 times, most recently from 1a28981 to 45856d3 Compare July 9, 2026 15:49
…g_recovery

- Inject options.on_missing_data="default" when options.scheduling_options.custom_schedule
  is set and options.on_missing_data is absent.
- Drop options.thresholds.warning_recovery when options.thresholds.warning is absent
  (orphan field has no threshold to recover from).

Both run in pre_resource_action_hook so they apply on create + update. Null-safe on
options and thresholds. Existing service-check groupby guard is unchanged.

Adds 8 unit tests covering injection, preservation, orphan drop, and null-safety.
@riyazsh
riyazsh force-pushed the riyaz/HAMR-392-monitor-schema-migrations branch from 45856d3 to 06ac81f Compare July 9, 2026 15:57
@riyazsh
riyazsh merged commit 48439d1 into main Jul 9, 2026
10 checks passed
@riyazsh
riyazsh deleted the riyaz/HAMR-392-monitor-schema-migrations branch July 9, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants