0922cc1d68
- Struktur gemäß §8 (Eigentumsgrenzen), PLAN.md als normative Basis - Pflichtdokumente: STATUS.md, ERRORS.md, TEST_REPORT.md, CHANGELOG.md, ADRs - ADR-0001 Python 3.13-Pin, ADR-0002 GStreamer 1.28.6-Pin (Windows), ADR-0003 IPC TCP+MessagePack v1 - Kernpakete: hms_protocol, hms_domain, hms_parameter, hms_artnet, hms_adaptive, hms_capabilities, hms_plugin_sdk - Renderer-Spike: D3D11-Primärpfad + Dev-GL-Pfad (§36 Nr. 4-5) - Control Core: FastAPI REST + WebSocket (§36 Nr. 9) - Beispielplugins: Passthrough + Gaussian Blur (3 Adaptive-Quality- Varianten, HLSL/GLSL/GLES) - Tools: Art-Net-Emulator, Fixture-Generator (Master32/Layer64-CSV), Capability-Probe - JSON-Schemas: IPC, Plugin, Projekt, Cluster - 121 Unit-/Integrationstests grün, Ruff grün Gate 0 bleibt offen: Hardwaremessungen nur auf echter Windows-Referenz- hardware gültig (§29.7, §33).
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
"""Stabile Parameterpfade (PLAN.md §10.2).
|
|
|
|
Pfade werden niemals aus sichtbaren Namen gebildet; alle Teile sind UUIDs
|
|
oder feste Schlüsselwörter.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
|
|
_ALLOWED_ROOTS = {"composition", "output", "cluster", "master"}
|
|
|
|
|
|
def _is_uuid(value: str) -> bool:
|
|
try:
|
|
uuid.UUID(value)
|
|
return True
|
|
except (ValueError, AttributeError):
|
|
return False
|
|
|
|
|
|
def validate_parameter_path(path: str) -> bool:
|
|
"""True, wenn der Pfad dem Muster §10.2 entspricht."""
|
|
if not path or path.startswith("/") or "\\" in path or ".." in path:
|
|
return False
|
|
parts = path.split("/")
|
|
root = parts[0]
|
|
if root not in _ALLOWED_ROOTS:
|
|
return False
|
|
if root == "master":
|
|
return len(parts) == 2 and parts[1] != ""
|
|
if root in {"composition", "output"}:
|
|
if len(parts) < 3:
|
|
return False
|
|
if not _is_uuid(parts[1]):
|
|
return False
|
|
return all(p != "" for p in parts[2:])
|
|
# cluster: cluster/group/{uuid}/... oder cluster/node/{uuid}/...
|
|
if len(parts) >= 3 and parts[1] in {"group", "node"} and _is_uuid(parts[2]):
|
|
return all(p != "" for p in parts[3:])
|
|
return False
|
|
|
|
|
|
def layer_opacity_path(composition_id: str, layer_id: str) -> str:
|
|
return f"composition/{composition_id}/layer/{layer_id}/opacity"
|
|
|
|
|
|
def master_intensity_path() -> str:
|
|
return "master/intensity"
|