From fccf0099d796a03ee4f04ab71c49888f2c926a60 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Mon, 14 Sep 2026 08:31:50 +0200 Subject: [PATCH] =?UTF-8?q?fix(outbox):=20qualname=20nur=20fuer=20bound=20?= =?UTF-8?q?methods=20=E2=80=94=20plain=20functions=20behalten=20=5F=5Fname?= =?UTF-8?q?=5F=5F=20(test=5Foutbox=5Fphase5=2017/17=20gruen)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/outbox.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/core/outbox.py b/app/core/outbox.py index 5dcdd1d..3d61d6b 100644 --- a/app/core/outbox.py +++ b/app/core/outbox.py @@ -214,16 +214,23 @@ def _json_payload(payload: dict[str, Any]) -> str: def _get_handler_name(handler: Any) -> str: """Extract a human-readable name from a handler callable. - Prefers ``__qualname__`` (includes the owning class, e.g. - ``AutomationPlugin.on_contact_created``) over ``__name__`` so the - consumer registry distinguishes handlers that share a method name + For bound methods (plugin handlers are bound methods, e.g. + ``AutomationPlugin.on_contact_created``) prefers ``__qualname__`` so + the consumer registry distinguishes handlers that share a method name across plugins (automation/unified_search/system_notif all define ``on_contact_created`` — three distinct handlers, same short name). + + Plain functions keep their ``__name__`` (nested test functions have + verbose qualnames like ``test_x..handler``). """ - name = getattr(handler, "__qualname__", None) + if hasattr(handler, "__self__"): + qualname = getattr(handler, "__qualname__", None) + if qualname: + return qualname + name = getattr(handler, "__name__", None) if name: return name - name = getattr(handler, "__name__", None) + name = getattr(handler, "__qualname__", None) if name: return name return str(handler)