From 69d0ac4dd37fc2a517c721d79b37f256fc8a546e Mon Sep 17 00:00:00 2001 From: can1357 Date: Sun, 21 Jun 2026 19:26:42 +0200 Subject: [PATCH] fix(python/robomp): updated mention regex to correctly reject suffixes - Updated the mention extraction regex to prevent partial matching when a suffix follows the `[bot]` identifier. - Added a regression test to ensure that invalid extended suffixes are correctly rejected. --- python/robomp/src/github_events.py | 2 +- python/robomp/tests/test_github_events.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/python/robomp/src/github_events.py b/python/robomp/src/github_events.py index 8aea67c36..644e513f4 100644 --- a/python/robomp/src/github_events.py +++ b/python/robomp/src/github_events.py @@ -153,7 +153,7 @@ def extract_mention(body: str | None, bot_login: str) -> str | None: if not login: return None pattern = re.compile( - rf"(? None: assert extract_mention("@roboomp[bot] go ahead", "roboomp[bot]") == "go ahead" +def test_extract_mention_rejects_extended_literal_app_suffix() -> None: + assert extract_mention("@roboomp[bot]-helper go ahead", "roboomp[bot]") is None + + def test_extract_mention_returns_none_without_mention() -> None: assert extract_mention("hello there", "robomp-bot") is None assert extract_mention(None, "robomp-bot") is None