Skydio / revup

Effortlessly create and manage pull requests without changing branches. Powers a stacked diffs workflow with python and git "plumbing" commands.
https://github.com/Skydio/revup
MIT License
309 stars 59 forks source link

KeyError: login in github_utils adding author #178

Closed navignaw closed 2 months ago

navignaw commented 4 months ago

Describe the bug revup upload fails with a python KeyError if a reviewer author is missing the "login" attribute.

I am fairly sure this is due to a review from an automated app, i.e. Screenshot 2024-05-02 at 8 05 24 AM

as it started failing immediately after this reviewer left an automated comment on the PR.

Expected behavior revup upload works as intended

To Reproduce

  1. Create a PR with an automated reviewer. One way to do so is to set up the GHA https://github.com/googleapis/code-suggester, but there are probably easier ways to automate adding a reviewer
  2. Run revup upload against that topic

Logs

Traceback (most recent call last):
  File "/usr/local/bin/revup", line 8, in <module>
    sys.exit(_main())
  File "/usr/local/lib/python3.8/site-packages/revup/__main__.py", line 18, in _main
    sys.exit(asyncio.run(main()))
  File "/usr/local/Cellar/python@3.8/3.8.18/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/Cellar/python@3.8/3.8.18/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/site-packages/revup/revup.py", line 393, in main
    return await upload.main(
  File "/usr/local/lib/python3.8/site-packages/revup/upload.py", line 48, in main
    await topics.query_github()
  File "/usr/local/lib/python3.8/site-packages/revup/topic_stack.py", line 1015, in query_github
    ) = await github_utils.query_everything(
  File "/usr/local/lib/python3.8/site-packages/revup/github_utils.py", line 276, in query_everything
    reviewers.add(revs["author"]["login"])
KeyError: 'login'
navignaw commented 3 months ago

It looks like there is a check for login in the reviewRequests case. Any objections to just adding the same if "login" in X check to the other branch?

https://github.com/Skydio/revup/blob/71ca5eb4d8d47536a1c1052e171aaaee8f353632/revup/github_utils.py#L271