refactor: make API registry authoritative

This commit is contained in:
leefer
2026-07-29 18:07:34 +08:00
parent b0cbd25f64
commit 93fc4505a9
9 changed files with 230 additions and 67 deletions
+12
View File
@@ -0,0 +1,12 @@
from __future__ import annotations
import re
import uuid
REQUEST_ID_PATTERN = re.compile(r"[A-Za-z0-9._-]{8,80}")
def correlation_id(supplied: str = "") -> str:
value = str(supplied or "").strip()
return value if REQUEST_ID_PATTERN.fullmatch(value) else uuid.uuid4().hex