fix(dwh): validate adapter limits strictly

This commit is contained in:
2026-07-11 20:19:05 +02:00
parent 216984aac8
commit f6302b31dd
7 changed files with 84 additions and 19 deletions
+7
View File
@@ -26,6 +26,13 @@ class PlanSummary:
node_types: list[str]
def require_positive_int(value: object, *, name: str) -> int:
"""Return a validated positive integer, excluding booleans and numeric lookalikes."""
if type(value) is not int or value <= 0:
raise ValueError(f"{name} must be a positive integer")
return value
def _inject_limit(sql: str, limit: int) -> tuple[str, bool]:
"""Aggiunge LIMIT limit+1 se assente (il +1 serve a rilevare il troncamento).
Se la query ha gia' un suo LIMIT, lo si rispetta."""