-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Check for custom callouts on app builds #35628
Open
Charl1996
wants to merge
15
commits into
master
Choose a base branch
from
cs/SC-4113-check-for-custom-callouts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a847070
Add method for checking custom callouts
Charl1996 dd8145e
Tag app id
Charl1996 9e400b1
Add task for managing metrics for app build
Charl1996 16745fb
Invoke task after build has saved
Charl1996 fb0ff78
Make sure to fetch the apps deterministically
Charl1996 2741b7e
Remove pickle serialization
Charl1996 265a39d
Fix test
Charl1996 30598b0
Merge branch 'master' into cs/SC-4113-check-for-custom-callouts
Charl1996 f274054
Pass build id instead of app id
Charl1996 8b8e04c
Pull out function to calculate ids and memoize result
Charl1996 cd95688
Merge branch 'master' into cs/SC-4113-check-for-custom-callouts
Charl1996 452b577
Merge branch 'cs/SC-4113-check-for-custom-callouts' of github.com:dim…
Charl1996 6968738
Replace memoized -> quickcache
Charl1996 58df9e1
Merge branch 'master' into cs/SC-4113-check-for-custom-callouts
Charl1996 751d406
Merge branch 'master' into cs/SC-4113-check-for-custom-callouts
Charl1996 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential
IndexError
when accessing previous build IDIn
check_build_dependencies
, lines 142-143 calculateprevious_build_id
usingapp_build_ids[app_build_ids.index(new_build.id) + 1]
. Ifnew_build.id
is the last element inapp_build_ids
, this will result in anIndexError
. Additionally, ifnew_build.id
is not inapp_build_ids
, aValueError
will be raised.Modify the code to handle these edge cases safely:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Charl1996 Would you like me to help you implement the suggested fix to handle the edge cases safely? Let me know if you need any assistance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's fine. I don't think this will be a concern because the docstring in the
get_build_ids
says the following:"Returns all the built apps for an application id, in descending order of time built."
I've verified that it's indeed so, meaning
new_build.id
will definitely exist in the listlen(app_build_ids)
will evaluate to false, meaning this block of code won't execute in the first place.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Charl1996 I've found the implementation in
dbaccessors.py
and can confirm your explanation. The docstring indeed explicitly states that it "Returns all the built apps for an application id, in descending order of time built." This validates your assessment of the code's safety. Thank you for helping me understand the implementation better.🔗 Analysis chain
@Charl1996 Thank you for the detailed explanation. I understand now that the code is indeed safe due to the guarantees provided by
get_build_ids
. Your explanation makes perfect sense - since the builds are returned in descending order and the new build will always be present, we don't need additional error handling.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1548
✏️ Learnings added
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a carrot, Mr Rabbit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Charl1996 🥕 Thank you for the carrot! happy rabbit noises 🐰
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree this shouldn't be an issue, but you could save readers from going through the same thought process you outlined, and make it obvious that isn't an issue, by doing something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.