Skip to content

fix(crons): Serialize the config type correctly #85211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 14, 2025

Conversation

leeandher
Copy link
Member

Applies the serialization to the config that the frontend has been typed to expect. Specifically the schedule type being served as an integer, but expected as a string.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 13, 2025
Copy link

codecov bot commented Feb 13, 2025

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   #85211       +/-   ##
===========================================
+ Coverage   33.19%   87.97%   +54.78%     
===========================================
  Files        8150     9627     +1477     
  Lines      452435   543922    +91487     
  Branches    21089    21089               
===========================================
+ Hits       150202   478539   +328337     
+ Misses     301930    65080   -236850     
  Partials      303      303               

@leeandher leeandher marked this pull request as ready for review February 14, 2025 16:23
@leeandher leeandher requested a review from a team as a code owner February 14, 2025 16:23
Comment on lines +334 to +338
config = obj.monitor_config.copy() if obj.monitor_config else {}
if "schedule_type" in config:
# XXX: We don't use monitor.get_schedule_type_display() in case it differs from the
# config saved on the check-in
config["schedule_type"] = ScheduleType.get_name(config["schedule_type"])
Copy link
Member

Choose a reason for hiding this comment

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

Feels like what we probably really should be doing is having some type of sub-serializer for the config object, but this is fine for now I think

@leeandher leeandher merged commit 6dc7600 into master Feb 14, 2025
48 of 49 checks passed
@leeandher leeandher deleted the leander/fix-cron-check-serializer branch February 14, 2025 18:22
leeandher added a commit that referenced this pull request Feb 14, 2025
Adds an all monitor checks page for cron issues with some custom cells.
There is one thing that should be addressed though but it requires a
backend fix, the schedule from the API currently returns the enum
integer for the schedule (e.g. `1` instead of `crontab`). I will put up
a PR to fix this serialization, since without it, the number appears in
the tool tip, along with 'Unknown Schedule'.


<img width="1197" alt="image"
src="https://github.com/user-attachments/assets/4f93ed4d-6740-4f30-adee-e1b715655aa7"
/>


**todo**
- [x] Add tests 
- [x] Put up the PR to change the serialization -
#85211

---------

Co-authored-by: Evan Purkhiser <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 2, 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