codeant-ai-for-open-source[bot] commented on code in PR #41549:
URL: https://github.com/apache/superset/pull/41549#discussion_r3658927632


##########
superset/cli/deletion_retention.py:
##########
@@ -0,0 +1,98 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""Operator CLI for deletion retention.
+
+``force-purge`` and ``set-window`` are **operator-gated** — they are
+protected by deployment/shell access (the ``SECURITY.md`` operator trust
+boundary), not Flask-AppBuilder RBAC: a CLI invocation has no ``g.user``, so
+there is no ``403`` to enforce. A future REST route would carry real
+Admin/workspace-admin RBAC.
+"""
+
+import logging
+
+import click
+from flask.cli import with_appcontext
+
+logger = logging.getLogger(__name__)
+
+
[email protected]()
+def deletion_retention() -> None:
+    """Manage purge of soft-deleted entities (operator-gated)."""
+
+
+@deletion_retention.command()
+@with_appcontext
[email protected](
+    "--days",
+    "-d",
+    required=True,
+    type=int,
+    help="Retention window in days; 0 disables.",
+)
+def set_window(days: int) -> None:
+    """Set the per-workspace retention window (SharedKey, upsert)."""
+    from superset.key_value.shared_entries import upsert_shared_value
+    from superset.key_value.types import SharedKey
+
+    if days < 0:
+        raise click.BadParameter("--days must be >= 0")
+    upsert_shared_value(SharedKey.SOFT_DELETE_RETENTION_DAYS, days)

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not require workspace-specific scoping for the retention override; it 
is intentionally deployment-scoped with one SharedKey per Superset deployment.
   
   **Applied to:**
     - `superset/cli/deletion_retention.py`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



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