Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(api): type orphaned draft variable stats with TypedDict (#34590)
YBoy9c880dd65088
diff --git a/api/commands/retention.py b/api/commands/retention.pyindex 82a77ea77a7..657a2a2e839 100644--- a/api/commands/retention.py+++ b/api/commands/retention.py@@ -1,7 +1,7 @@import datetimeimport loggingimport time-from typing import Any+from typing import TypedDictimport clickimport sqlalchemy as sa@@ -503,7 +503,19 @@ def _find_orphaned_draft_variables(batch_size: int = 1000) -> list[str]:return [row[0] for row in result]-def _count_orphaned_draft_variables() -> dict[str, Any]:+class _AppOrphanCounts(TypedDict):+ variables: int+ files: int+++class OrphanedDraftVariableStatsDict(TypedDict):+ total_orphaned_variables: int+ total_orphaned_files: int+ orphaned_app_count: int+ orphaned_by_app: dict[str, _AppOrphanCounts]+++def _count_orphaned_draft_variables() -> OrphanedDraftVariableStatsDict:"""Count orphaned draft variables by app, including associated file counts.@@ -526,7 +538,7 @@ def _count_orphaned_draft_variables() -> dict[str, Any]:with db.engine.connect() as conn:result = conn.execute(sa.text(variables_query))- orphaned_by_app = {}+ orphaned_by_app: dict[str, _AppOrphanCounts] = {}total_files = 0for row in result: