rust-lang/highfive

Highfive crashes where a PR has no description

Closed this issue · 2 comments

When a PR is opened but has no description (like rust-lang/rust#56989), highfive crashes before assigning a reviewer or commenting.

Traceback (most recent call last):
  File "/home/ec2-user/highfive/highfive/newpr.py", line 433, in <module>
    handler.run()
  File "/home/ec2-user/highfive/highfive/newpr.py", line 71, in run
    self.new_pr()
  File "/home/ec2-user/highfive/highfive/newpr.py", line 359, in new_pr
    reviewer = self.find_reviewer(msg)
  File "/home/ec2-user/highfive/highfive/newpr.py", line 238, in find_reviewer
    match = reviewer_re.search(msg)
TypeError: expected string or buffer

This is caused by GitHub setting the body to null instead of an empty string where there is no PR description:

{
  "action": "opened",
  "number": 56989,
  "pull_request": {
    "number": 56989,
    "state": "open",
    "locked": false,
    "title": "Fix compiletest `trim` deprecation warnings",
    "user": {
      "login": "phansch",
      "id": 2042399,
      ...
    },
    "body": null,
    ...
  }
}

JFYI we often get highfive just ignoring PRs in the cargo repo. But that might be for a different reason.

Yeah, there are probably other bugs. Ping me on #infra as soon as it happens, so I can fetch the logs and investigate the crash!