fix(monitors): Coerce numeric string interval count to integer - #119417
fix(monitors): Coerce numeric string interval count to integer#119417Ritiky23 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1862cba. Configure here.
|
@sentry review |
|
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you add the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |

Summary
Fixes an issue where updating a Cron monitor interval count in the UI or via form-encoded request pipelines results in a validation error:
Invalid schedule for schedule unit count.Context
When a user updates a monitor's schedule (e.g., from "Every 5 minutes" to "Every 6 minutes"), the UI/API request payload can sometimes send the interval count as a numeric string (e.g.,
"6"instead of6).Previously,
ConfigValidator.validatehad a strict type check:if not isinstance(schedule[0], int): raise ValidationErrorThis rejected valid numeric strings that just needed type coercion.
Changes
ConfigValidator.validateinsrc/sentry/monitors/validators.pyto check ifschedule[0]is a string and attempt to coerce it to an integer."abc") still raise the appropriateValidationError.tests/sentry/monitors/test_validators.pyto cover both success (numeric strings coerced to integers) and failure (non-numeric strings rejected) cases.Closes #119214