Fix LLM validation and dashboard health hot paths

This commit is contained in:
2026-03-15 13:18:51 +03:00
parent 3928455189
commit a8563a8369
24 changed files with 1398 additions and 83 deletions

View File

@@ -117,6 +117,33 @@ class ProfileService:
)
# [/DEF:get_my_preference:Function]
# [DEF:get_dashboard_filter_binding:Function]
# @PURPOSE: Return only dashboard-filter fields required by dashboards listing hot path.
# @PRE: current_user is authenticated.
# @POST: Returns normalized username and profile-default filter toggles without security summary expansion.
def get_dashboard_filter_binding(self, current_user: User) -> dict:
with belief_scope("ProfileService.get_dashboard_filter_binding", f"user_id={current_user.id}"):
preference = self._get_preference_row(current_user.id)
if preference is None:
return {
"superset_username": None,
"superset_username_normalized": None,
"show_only_my_dashboards": False,
"show_only_slug_dashboards": True,
}
return {
"superset_username": self._sanitize_username(preference.superset_username),
"superset_username_normalized": self._normalize_username(preference.superset_username),
"show_only_my_dashboards": bool(preference.show_only_my_dashboards),
"show_only_slug_dashboards": bool(
preference.show_only_slug_dashboards
if preference.show_only_slug_dashboards is not None
else True
),
}
# [/DEF:get_dashboard_filter_binding:Function]
# [DEF:update_my_preference:Function]
# @PURPOSE: Validate and persist current user's profile preference in self-scoped mode.
# @PRE: current_user is authenticated and payload is provided.