improved logging

This commit is contained in:
Ayzen
2026-06-06 00:52:52 +03:00
parent af6005d68f
commit aea49f6128
65 changed files with 1206 additions and 240 deletions
+6
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import logging
from typing import Any
from python_app.models.gui_profile_schema import (
@@ -18,6 +19,8 @@ from python_app.models.gui_profile_schema import (
)
from python_app.models.run_config_model import RunConfigModel
logger = logging.getLogger(__name__)
def _as_dict(value: Any, context: str) -> dict[str, Any]:
"""Validate payload node is object-like, treating missing values as empty object."""
@@ -74,6 +77,7 @@ def gui_profile_from_dict(payload: dict[str, Any]) -> GuiProfileModel:
profile = GuiProfileModel(run_config=RunConfigModel.from_dict(payload), gui=None)
gui_payload = payload.get("gui")
if gui_payload is None:
logger.debug("Decoded GUI profile without a 'gui' section; UI state left unset")
return profile
gui_object = _as_dict(gui_payload, "gui")
@@ -124,6 +128,7 @@ def gui_profile_from_dict(payload: dict[str, Any]) -> GuiProfileModel:
and root_gpr_object.get("mode") in {"point", "extended"}
)
if selected_mode == "gpr" and (legacy_algorithm_mode is not None or has_legacy_root_gpr_mode):
logger.debug("Migrating legacy GPR profile: rewriting selected_mode 'gpr' -> 'legacy_gpr'")
selected_mode = "legacy_gpr"
gpr_context = "gui.processing.gpr"
@@ -495,6 +500,7 @@ def gui_profile_from_dict(payload: dict[str, Any]) -> GuiProfileModel:
)
profile.gui = gui
logger.debug("Decoded GUI profile: selected_mode=%s", gui.processing.selected_mode)
return profile