Skip to content

[tasks/github] Guard against None GraphQL response in collect_releases#428

Open
MoralCode wants to merge 1 commit into
mainfrom
devs6186/fix/3709-releases-none-typeerror
Open

[tasks/github] Guard against None GraphQL response in collect_releases#428
MoralCode wants to merge 1 commit into
mainfrom
devs6186/fix/3709-releases-none-typeerror

Conversation

@MoralCode

Copy link
Copy Markdown
Contributor

This PR was originally filed as augurlabs/augur#3722 by @devs6186

Changeset

  • Added None guard in fetch_data() in releases/core.py before the 'data' in data check
  • Added second None guard for the case where data['data']['repository'] itself is None
  • Guard the fallback fetch_data(..., True) call in releases_model() against a None return

Notes

request_graphql_dict() can return None when the API call fails (network error, private repo, etc). Doing if 'data' in data: on a NoneType raises TypeError: argument of type 'NoneType' is not iterable, which was crashing the collect_releases task. The fix logs a warning and returns cleanly rather than propagating an exception.

The second None check (data['data']['repository'] can be None if GitHub returns {"data": {"repository": null}} for a repo that no longer exists) prevents a similar crash further down.

Related issues/PRs

  • Fixes #3709

Description

  • Added None checks in fetch_data() so collect_releases handles a None GraphQL response without crashing

This PR fixes #3709

Notes for Reviewers
Three small guard additions in the same file. No logic changes to the happy path.

Signed commits

  • Yes, I signed my commits.

request_graphql_dict() can return None when the API call fails. The
in-operator check on a NoneType raised TypeError. Added explicit None
guards in fetch_data() and in the two call sites in releases_model() so
the task logs a warning and returns cleanly instead of crashing.

Fixes #3709

Signed-off-by: devs6186 <devyanshsomvanshi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants