amoghrajesh commented on code in PR #67890:
URL: https://github.com/apache/airflow/pull/67890#discussion_r3345749924


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_store.py:
##########
@@ -61,7 +61,13 @@ def _resolve_expires_at(expires_at: datetime | None | 
Literal["default"]) -> dat
     """
     if expires_at == "default":
         days = conf.getint("state_store", "default_retention_days")
-        return datetime.now(tz=timezone.utc) + timedelta(days=days)
+        if days < 0:
+            raise HTTPException(
+                status_code=status.HTTP_400_BAD_REQUEST,
+                detail=f"[state_store] default_retention_days must be >= 0, 
got {days}. "
+                "Set to 0 to disable expiry.",
+            )
+        return None if days == 0 else datetime.now(tz=timezone.utc) + 
timedelta(days=days)

Review Comment:
   Yes it is intentional. The SDK had always treated `days <= 0` as "never 
expire" and the config docs say "Set to 0 to disable expiry," so days=0 now 
aligns the API with both. The old `now + timedelta(days=0)` = now behavior was 
effectively a bug: rows would expire immediately instead of never. Worth 
calling out explicitly though and let me add it 
   
   



-- 
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]

Reply via email to