Fix "ingest push" for GitHub repos by reading the compare API as a dict#9625
Draft
hneiva wants to merge 1 commit into
Draft
Fix "ingest push" for GitHub repos by reading the compare API as a dict#9625hneiva wants to merge 1 commit into
hneiva wants to merge 1 commit into
Conversation
Bug 2009865 switched github.compare_shas() from the compare REST endpoint
(which returns a dict) to PyGithub (a list of commit objects) and updated
the Pulse push loader to match — but left the `ingest` management
command's query_data() doing dict access on the result:
compare_response.get("merge_base_commit")
compare_response["commits"]
The GitHub compare API always returns a merge_base_commit, so query_data
hit `.get()` on a list and raised AttributeError immediately — meaning
`./manage.py ingest push <github-repo>` has been broken since that change.
Call the compare REST endpoint directly via fetch_api() for both compare
requests in query_data, restoring the dict shape it expects. The Pulse
push loader is unaffected and keeps using compare_shas().
Add a regression test for query_data's dict handling; this code path had
no test coverage, which is how the regression went unnoticed.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug 2009865 switched github.compare_shas() from the compare REST endpoint (which returns a dict) to PyGithub (a list of commit objects) and updated the Pulse push loader to match — but left the
ingestmanagement command's query_data() doing dict access on the result:The GitHub compare API always returns a merge_base_commit, so query_data hit
.get()on a list and raised AttributeError immediately — meaning./manage.py ingest push <github-repo>has been broken since that change.Call the compare REST endpoint directly via fetch_api() for both compare requests in query_data, restoring the dict shape it expects. The Pulse push loader is unaffected and keeps using compare_shas().
Add a regression test for query_data's dict handling; this code path had no test coverage, which is how the regression went unnoticed.