finalize: KeyError when a news fragment's id contains a dot
まだ誰も着手していません。
評価
調査の方向性
traceback は jaraco/develop/towncrier.py の _release_bump を指しています。ここでは、フラグメントのファイル名が分割され、型が _release_bumps で検索されます。この関数とその呼び出し元を読み、+drop-python-3.10.feature.rst という名前のフラグメントを使って tox -e finalize を実行してください。finalize が feature 型を使ってドットを含む ID を処理し、KeyError を発生させなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
towncrier._release_bump parses a fragment filename from the left, so a dot anywhere in the id portion shifts the type field and raises KeyError.
Reproducer
A fragment named +drop-python-3.10.feature.rst (dropping support for an EOL Python, the version number written naturally):
$ tox -e finalize
...
File ".../jaraco/develop/towncrier.py", line 27, in _release_bump
return _release_bumps[type_]
KeyError: '10'
Because:
>>> '+drop-python-3.10.feature.rst'.split('.', 2)
['+drop-python-3', '10', 'feature.rst']
Notably, towncrier itself is fine with the name
towncrier build --draft renders the fragment under Features exactly as intended — it parses the type from the right. So the name is only invalid by jaraco.develop's stricter reading, which makes the failure surprising: the changelog builds, but the release can't be cut.
Suggested fix
rsplit matches towncrier's own interpretation and is a one-character change:
>>> '+drop-python-3.10.feature.rst'.rsplit('.', 2)
['+drop-python-3.10', 'feature', 'rst']
Two adjacent observations
_release_bumps is built as collections.defaultdict(feature='minor', ...). Those are all keyword arguments, so default_factory is None and the mapping raises KeyError like a plain dict. If the defaultdict was meant to supply a fallback bump for unrecognized types, it isn't doing so.
check_changes() wouldn't have caught this either — it tests f".{key}" in file.suffixes, and .feature is among ['.10', '.feature', '.rst'], so the name passes. It also isn't called from finalize(), so nothing validates names before release_kind() runs.
Seen with jaraco.develop 9.0.0, towncrier 26.9.0.
- 主要言語
- Python
- スター
- 7
- フォーク
- 5
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
jaraco/jaraco.develop のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
jaraco/jaraco.develop#27 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
jaraco/jaraco.develop#22 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
jaraco/jaraco.develop#13 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
jaraco/jaraco.develop#8 · コメント 4 件 ·
jaraco/jaraco.develop の issue をすべて見る
似ている issue
-
link-rot
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
developmentseed/titiler-cmr#265 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Insecure Brotli version <1.2.1対応中かも @jamescw19 が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
stac-utils/stac-fastapi-pgstac#438 · リアクション 1 件 ·
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信