From 3fc09b086e79bff47c28e20740d304eade253756 Mon Sep 17 00:00:00 2001 From: busya Date: Fri, 5 Jun 2026 10:32:37 +0300 Subject: [PATCH] =?UTF-8?q?032:=20fix=202=20critical=20QA=20issues=20?= =?UTF-8?q?=E2=80=94=20missing=20endregion=20+=20Tombstone=20dead=20helper?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C1: _llm_call.py — added missing #endregion _split_and_retry (violated INV_3) C2: dashboards/_helpers.py — sync _find_dashboard_id_by_slug and _resolve_dashboard_id_from_ref typed Tombstone per INV_6 (dead code, callers use _async versions from git/_helpers.py) --- backend/src/api/routes/dashboards/_helpers.py | 60 ++++++++----------- backend/src/plugins/translate/_llm_call.py | 2 + 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/backend/src/api/routes/dashboards/_helpers.py b/backend/src/api/routes/dashboards/_helpers.py index b7050849..a20d8fe9 100644 --- a/backend/src/api/routes/dashboards/_helpers.py +++ b/backend/src/api/routes/dashboards/_helpers.py @@ -12,51 +12,39 @@ from src.core.async_superset_client import AsyncSupersetClient from src.core.superset_client import SupersetClient -# #region _find_dashboard_id_by_slug [C:2] [TYPE Function] -# @BRIEF Resolve dashboard numeric ID by slug using Superset list endpoint. -# @PRE `dashboard_slug` is non-empty. -# @POST Returns dashboard ID when found, otherwise None. +# #region _find_dashboard_id_by_slug [C:2] [TYPE Tombstone] +# @DEPRECATED 2026-06-04 — replaced by _find_dashboard_id_by_slug_async +# @REPLACED_BY -> [_find_dashboard_id_by_slug_async] +# @BRIEF Resolve dashboard numeric ID by slug — sync version, dead code. +# Body removed: SupersetClient methods are now async; this function +# would raise AttributeError at runtime. def _find_dashboard_id_by_slug( client: SupersetClient, dashboard_slug: str, ) -> int | None: - """@DEPRECATED — dead code, use _find_dashboard_id_by_slug_async.""" - # This function is no longer called (only _async version is used). - # It remains as a reference but will raise AttributeError at runtime - # because SupersetClient methods are now async. - query_variants = [ - { - "filters": [{"col": "slug", "opr": "eq", "value": dashboard_slug}], - "page": 0, - "page_size": 1, - }, - { - "filters": [{"col": "slug", "op": "eq", "value": dashboard_slug}], - "page": 0, - "page_size": 1, - }, - ] - - for query in query_variants: - try: - _count, dashboards = client.get_dashboards_page(query=query) - if dashboards: - resolved_id = dashboards[0].get("id") - if resolved_id is not None: - return int(resolved_id) - except Exception: - continue - - return None + raise RuntimeError( + "_find_dashboard_id_by_slug is deprecated. " + "Use _find_dashboard_id_by_slug_async() instead." + ) # #endregion _find_dashboard_id_by_slug -# #region _resolve_dashboard_id_from_ref [C:2] [TYPE Function] -# @BRIEF Resolve dashboard ID from slug-first reference with numeric fallback. -# @PRE `dashboard_ref` is provided in route path. -# @POST Returns a valid dashboard ID or raises HTTPException(404). +# #region _resolve_dashboard_id_from_ref [C:2] [TYPE Tombstone] +# @DEPRECATED 2026-06-04 — replaced by _resolve_dashboard_id_from_ref_async +# @REPLACED_BY -> [_resolve_dashboard_id_from_ref_async] +# @BRIEF Resolve dashboard ID from slug-first reference — sync version, dead code. +# Body removed: SupersetClient methods are now async; this function +# would raise AttributeError at runtime. +def _resolve_dashboard_id_from_ref( + client: SupersetClient, + dashboard_ref: str, +) -> int: + raise RuntimeError( + "_resolve_dashboard_id_from_ref is deprecated. " + "Use _resolve_dashboard_id_from_ref_async() instead." + ) def _resolve_dashboard_id_from_ref( dashboard_ref: str, client: SupersetClient, diff --git a/backend/src/plugins/translate/_llm_call.py b/backend/src/plugins/translate/_llm_call.py index fa83cd88..d474db37 100644 --- a/backend/src/plugins/translate/_llm_call.py +++ b/backend/src/plugins/translate/_llm_call.py @@ -278,6 +278,8 @@ class LLMTranslationService: "skipped": left["skipped"] + right["skipped"], "retries": retries + left.get("retries", 0) + right.get("retries", 0)} + # #endregion _split_and_retry + # #region _try_recover_partial [C:3] [TYPE Function] [SEMANTICS translate, llm, recovery] # @BRIEF Try to recover translated rows from a truncated LLM response. # Saves recovered rows as SUCCESS records. Returns set of recovered row_index values.