032: fix 2 critical QA issues — missing endregion + Tombstone dead helpers
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)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user