From f21538d488e76637d77974334dd892a18efc8749 Mon Sep 17 00:00:00 2001 From: Shahar Epstein <60007259+shahar1@users.noreply.github.com> Date: Fri, 24 Jul 2026 18:09:49 +0300 Subject: [PATCH] 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. #53843 for the google 22.3.0rc1 issue). A negative lookahead matches the same references without needing a trailing character. --- .../commands/release_management_commands.py | 2 +- .../tests/test_release_management_commands.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py index c308278d2d3b2..c7efa5a2fd3d6 100644 --- a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py +++ b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py @@ -256,7 +256,7 @@ SOURCE_DIR_PATH = str(AIRFLOW_ROOT_PATH) PR_PATTERN = re.compile(r".*\(#([0-9]+)\)") PR_REFERENCE_PATTERN = re.compile(r"#([0-9]+)") -ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)[^0-9]") +ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)(?![0-9])") # Release-management commits (provider documentation / release preparation) are pure # release-process noise: they are not user-facing changes and existing providers already # exclude them (the release tooling parks them in the changelog's excluded section). Match diff --git a/dev/breeze/tests/test_release_management_commands.py b/dev/breeze/tests/test_release_management_commands.py index 6c16bfa1c83c5..e007569bb6fb2 100644 --- a/dev/breeze/tests/test_release_management_commands.py +++ b/dev/breeze/tests/test_release_management_commands.py @@ -23,6 +23,7 @@ from airflow_breeze.commands import release_management_commands from airflow_breeze.commands.release_management_commands import ( + ISSUE_MATCH_IN_BODY, _ensure_default_python_for_reproducible_client, _is_initial_provider_release, _should_include_provider_in_issue, @@ -292,3 +293,18 @@ def test_get_package_version_possibly_from_stable_txt_for_java_sdk( stable_txt.parent.mkdir(parents=True) stable_txt.write_text(stable_txt_content) assert get_package_version_possibly_from_stable_txt("java-sdk") == expected_version + + +@pytest.mark.parametrize( + ("body", "expected"), + [ + ("Some description closes: #12345 and more text", [12345]), + # reference at the very end of the body (e.g. "Fixes #53843" as the last line) + ("Generated-by: some agent Fixes #53843", [53843]), + ("related: #111, also see #222", [111, 222]), + ("no references here", []), + ("PR#123 without space is not a reference", []), + ], +) +def test_issue_match_in_body(body: str, expected: list[int]): + assert [int(m.group(1)) for m in ISSUE_MATCH_IN_BODY.finditer(body)] == expected