Fix crash on null repository in PR history#29
Conversation
The GitHub GraphQL API returns null for the repository field on PR nodes when the repo has been deleted or the token lacks access. Skip these nodes instead of crashing with TypeError. Fixes #28
Summary of ChangesHello @jeffreyksmithjr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug that caused the application to crash when encountering pull requests associated with deleted or inaccessible repositories in a user's GitHub history. By adding explicit checks for null repository objects returned by the GitHub GraphQL API, the system now gracefully skips these invalid entries, ensuring stability and preventing TypeError exceptions. New tests have been added to validate this robust handling. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🥚 Good Egg: HIGH TrustScore: 80% Top Contributions
|
There was a problem hiding this comment.
Code Review
The pull request effectively addresses the reported crash by adding null checks for the 'repository' field in github_client.py. The new tests adequately cover the null-repository scenario for both fetch_user_merged_prs and get_user_contribution_data, ensuring the fix works as expected. The changes are well-implemented and maintain code quality.
|
Thanks @Kroppeb for filing. It now works and you score a respectable |
Summary
TypeError: 'NoneType' object is not subscriptablewhen a user's PR history includes PRs to deleted or inaccessible repositories (Error while accessing contribution data #28)nullfor therepositoryfield on such PR nodes; we now skip them gracefully in all three PR-parsing loops ingithub_client.pyfetch_user_merged_prsandget_user_contribution_dataTest plan
ruff) and type check (mypy) cleangood-egg score Kroppeb --repo 2ndSetAI/good-eggnow returnsHIGH (81%)instead of crashingFixes #28