Skip to content

Commit 7fb2a5c

Browse files
shahar1dabla
authored andcommitted
Detect linked issues at the end of PR bodies in provider testing issue (apache#70396)
* Detect linked issues at the end of PR bodies in provider testing issue The provider testing issue generator missed linked issues when the reference was the last thing in the PR body (a common shape: "Fixes character after the number, which does not exist at end of string, so the reference was silently dropped and the release manager had to add the issue to the testing issue by hand (e.g. apache#53843 for the google 22.3.0rc1 issue). A negative lookahead matches the same references without needing a trailing character. * Address review: pin adjacent-reference behaviour, drop dead regex copy The old pattern consumed the separator character, so back-to-back references like "apache#111 apache#222" lost the second one — a test case now pins the fixed behaviour. The byte-identical dead copy of ISSUE_MATCH_IN_BODY in dev/assign_cherry_picked_prs_with_milestone.py is removed so grep leads only to the live definition. Generated-by: Claude Code (Fable 5)
1 parent 515c190 commit 7fb2a5c

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎dev/assign_cherry_picked_prs_with_milestone.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
MY_DIR_PATH = os.path.dirname(__file__)
4848
SOURCE_DIR_PATH = os.path.abspath(os.path.join(MY_DIR_PATH, os.pardir))
4949
PR_PATTERN = re.compile(r".*\(#([0-9]+)\)")
50-
ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)[^0-9]")
5150

5251
CHANGELOG_CHANGES_FILE = "changelog-changes.txt"
5352
DOC_ONLY_CHANGES_FILE = "doc-only-changes.txt"

‎dev/breeze/src/airflow_breeze/commands/release_management_commands.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
SOURCE_DIR_PATH = str(AIRFLOW_ROOT_PATH)
257257
PR_PATTERN = re.compile(r".*\(#([0-9]+)\)")
258258
PR_REFERENCE_PATTERN = re.compile(r"#([0-9]+)")
259-
ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)[^0-9]")
259+
ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)(?![0-9])")
260260
# Release-management commits (provider documentation / release preparation) are pure
261261
# release-process noise: they are not user-facing changes and existing providers already
262262
# exclude them (the release tooling parks them in the changelog's excluded section). Match

‎dev/breeze/tests/test_release_management_commands.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from airflow_breeze.commands import release_management_commands
2525
from airflow_breeze.commands.release_management_commands import (
26+
ISSUE_MATCH_IN_BODY,
2627
_ensure_default_python_for_reproducible_client,
2728
_is_initial_provider_release,
2829
_should_include_provider_in_issue,
@@ -292,3 +293,19 @@ def test_get_package_version_possibly_from_stable_txt_for_java_sdk(
292293
stable_txt.parent.mkdir(parents=True)
293294
stable_txt.write_text(stable_txt_content)
294295
assert get_package_version_possibly_from_stable_txt("java-sdk") == expected_version
296+
297+
298+
@pytest.mark.parametrize(
299+
("body", "expected"),
300+
[
301+
("Some description closes: #12345 and more text", [12345]),
302+
# reference at the very end of the body (e.g. "Fixes #53843" as the last line)
303+
("Generated-by: some agent Fixes #53843", [53843]),
304+
("related: #111, also see #222", [111, 222]),
305+
("adjacent references see #111 #222", [111, 222]),
306+
("no references here", []),
307+
("PR#123 without space is not a reference", []),
308+
],
309+
)
310+
def test_issue_match_in_body(body: str, expected: list[int]):
311+
assert [int(m.group(1)) for m in ISSUE_MATCH_IN_BODY.finditer(body)] == expected

0 commit comments

Comments
 (0)