korbit-ai[bot] commented on code in PR #32511:
URL: https://github.com/apache/superset/pull/32511#discussion_r1980982612


##########
superset/tasks/scheduler.py:
##########
@@ -123,13 +124,20 @@ def prune_log() -> None:
 
 
 @celery_app.task(name="prune_query")
-def prune_query() -> None:
+def prune_query(retention_period_days: Optional[int] = None) -> None:

Review Comment:
   ### Missing retention period validation <sub>![category 
Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The task accepts negative integers or zero as valid retention periods, which 
could lead to unintended data loss.
   
   ###### Why this matters
   Without validation, negative or zero values could cause immediate deletion 
of all queries or other unexpected behavior.
   
   ###### Suggested change ∙ *Feature Preview*
   Add validation for the retention period value. Example:
   ```python
   @celery_app.task(name="prune_query")
   def prune_query(retention_period_days: Optional[int] = None) -> None:
       if retention_period_days is not None and retention_period_days <= 0:
           raise ValueError("retention_period_days must be a positive integer")
   ```
   
   
   </details>
   
   <sub>
   
   [![Report a problem with this 
comment](https://img.shields.io/badge/Report%20a%20problem%20with%20this%20comment-gray.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmNWVjMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10cmlhbmdsZS1hbGVydCI+PHBhdGggZD0ibTIxLjczIDE4LTgtMTRhMiAyIDAgMCAwLTMuNDggMGwtOCAxNEEyIDIgMCAwIDAgNCAyMWgxNmEyIDIgMCAwIDAgMS43My0zIi8+PHBhdGggZD0iTTEyIDl2NCIvPjxwYXRoIGQ9Ik0xMiAxN2guMDEiLz48L3N2Zz4=)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/d72d0e02-ad88-44ae-ba3b-dada3e5b52e8?suggestedFixEnabled=true)
   
   💬 Chat with Korbit by mentioning @korbit-ai.
   </sub>
   
   <!--- korbi internal id:047a6d9a-816b-4214-9573-ae81043df7d8 -->
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to