python / bedevere

A bot to help identify missing information for CPython pull requests
Apache License 2.0
117 stars 58 forks source link

`News entry file name incorrectly formatted` when moving a news entry #642

Open nineteendo opened 4 months ago

nineteendo commented 4 months ago

If a news entry is moved to a different category, you get News entry file name incorrectly formatted as an error message.

https://github.com/python/bedevere/blob/504dc34aee40478ddea8331ad090b63710974e7c/bedevere/news.py#L59

https://github.com/python/bedevere/blob/504dc34aee40478ddea8331ad090b63710974e7c/bedevere/news.py#L73-L80

I spent way too long trying to figure this out.

hugovk commented 4 months ago

If a news entry is moved to a different category,

How does this happen?

Please can you share steps to reproduce?

nineteendo commented 4 months ago

I manually moved an existing news entry because it was in the wrong category.

hugovk commented 4 months ago

Please can you give explicit steps of what you did/ran, what happened and what you expected?

nineteendo commented 4 months ago

The relevant pull request is here: https://github.com/python/cpython/pull/120735

  1. I moved Misc/NEWS.d/next/Core and Builtins/2024-04-28-19-51-00.gh-issue-118263.Gaap3S.rst to Misc/NEWS.d/next/Library/2024-04-28-19-51-00.gh-issue-118263.Gaap3S.rst.
  2. I got this error: bedevere/news — News entry file name incorrectly formatted.
  3. I thought I had maybe broken the formatting in Misc/NEWS.d/3.13.0a6.rst or Misc/NEWS.d/3.13.0b1.rst, so I checked if I had modified the file correctly, which I did.
  4. I then went to this repository to look for the error message, which is only printed if in_next_dir and file_found.
  5. I checked the filename of the news entries against the regex, but they were correctly formatted.
  6. I then realised len(file["patch"]) had to be 0.

In this case the error message should simply be No news entry in Misc/NEWS.d/next/ or "skip news" label found.

nineteendo commented 4 months ago

We should probably move it to this check:

https://github.com/python/bedevere/blob/504dc34aee40478ddea8331ad090b63710974e7c/bedevere/news.py#L52-L53

if not util.is_news_dir(file["file_name"]) or len(file["patch"]) == 0:
    continue
rhansen commented 2 weeks ago

I also saw this error after renaming a blurb file to fix the referenced issue number in PR python/cpython#125285