fix(netx): parse space-separated net id from alarmkey

Support UME alarmkey values like "<net_id> <x> <y>" when deriving ne_id so current alarms can join inventory correctly. Add regression coverage for hash, csv, and space-delimited alarmkey formats.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-13 16:29:19 +08:00
parent 67f7e48597
commit 626bb2b02e
2 changed files with 9 additions and 0 deletions

View file

@ -73,10 +73,14 @@ def _derive_ne_id_from_alarm(alarm: dict[str, Any]) -> str:
# Common UME formats observed:
# 1) "<net_id>#<suffix>"
# 2) "<net_id>, <x>, <y>"
# 3) "<net_id> <x> <y>"
if "#" in alarm_key:
return _s(alarm_key.split("#", 1)[0])
if "," in alarm_key:
return _s(alarm_key.split(",", 1)[0])
parts = [p for p in alarm_key.split() if p]
if len(parts) >= 2:
return _s(parts[0])
return ""