Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect handling of orphan fragment names consists of only digits #588

Merged
merged 5 commits into from
Apr 27, 2024

Conversation

SmileyChris
Copy link
Contributor

@SmileyChris SmileyChris commented Apr 23, 2024

Fixes #584

Checklist

  • Make sure changes are covered by existing or new tests.
  • For at least one Python version, make sure local test run is green.
  • Create a file in src/towncrier/newsfragments/. Describe your
    change and include important information. Your change will be included in the public release notes.
  • Make sure all GitHub Actions checks are green (they are automatically checking all of the above).

@SmileyChris SmileyChris requested a review from a team as a code owner April 23, 2024 22:57
@SmileyChris
Copy link
Contributor Author

Looking closer the true source of the error is because strip_if_integer_string reads the orphan of +12345 as an actual integer, stripping off the '+', causing this issue to lose its status as an orphan!

@SmileyChris
Copy link
Contributor Author

There, that's tidier!

@SmileyChris SmileyChris changed the title Orphan hash needs an alphabetic character Fix incorrect handling of orphan fragment names consists of only digits Apr 24, 2024
Copy link
Member

@adiroiban adiroiban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Many thanks. Only a minor comment regarding the release notes.

src/towncrier/_builder.py Show resolved Hide resolved
src/towncrier/newsfragments/588.bugfix Outdated Show resolved Hide resolved
"""Orphaned snippets can consist of only digits."""
self.assertEqual(
parse_newfragment_basename("+123.feature", ["feature"]),
("+123", "feature", 0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add another non-orphan test with an identifier looking like a commit sha? In the templates I've started using recently, I try to output PRs/issues, commits and arbitrary identifiers separately: https://github.com/cherrypy/cheroot/blob/3591a1c/docs/changelog-fragments.d/.towncrier-template.rst.j2#L59-L63.

It'd be nice if that remained functional. Hence an explicit test...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that should be a separate PR -- that's an interesting functional test but not really tied to the changes being made here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I brought it up is that I wasn't sure if this PR influences it. So it's kinda related as a possible regression. But I understand that it may be non-atomic and separate otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback.

This test is named test_orphan_all_digits . Based on that, I think that +123 is ok.

I also think that using a git commit ref is also a valid test... but it should be a separate test.

@adiroiban adiroiban enabled auto-merge (squash) April 27, 2024 00:35
@adiroiban
Copy link
Member

adiroiban commented Apr 27, 2024

It looks good. I have enabled auto-merge.

Thanks for your help.

I am happy to review and approve a PR that add more tests... but that should not be a blocker for this PR.

@adiroiban adiroiban merged commit 50fc1e6 into twisted:trunk Apr 27, 2024
15 checks passed
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.

Issue number incorrectly inferred when hash is all digits
3 participants