Panels dialog saves a ready I/O port draft on close and keeps an unfinished one; one qualified message-name rule on both sides

This commit is contained in:
2026-10-15 16:49:26 +02:00
parent 9836f3ff5f
commit fa8b178866
6 changed files with 150 additions and 34 deletions
+19
View File
@@ -12,6 +12,7 @@ from __future__ import annotations
import json
import math
import re
from enum import Enum
from typing import Any
@@ -320,6 +321,24 @@ class MessageSpec(BaseModel):
return hash((self.name, self.port))
#: A message named with its flow: the flow's own name, then the name inside it.
#: The one rule for anywhere a name has to arrive qualified; the frontend holds
#: a copy (``QUALIFIED_MESSAGE`` in ``deriveEdges.ts``).
QUALIFIED_PATTERN = re.compile(r"[a-z][a-z0-9_]*(\.[A-Za-z0-9_]+)+")
QUALIFIED_RULE = (
"Name the message as flow.name: a lowercase flow name, a dot, "
"then letters, digits and underscores"
)
def validate_qualified(value: str) -> str:
"""A qualified message name, or a ``ValueError`` saying what one looks like."""
if not QUALIFIED_PATTERN.fullmatch(value):
raise ValueError(QUALIFIED_RULE)
return value
def qualify(flow: str, name: str) -> str:
"""Resolve a message name against its flow namespace."""
if not name: