Deprecate `safemode`: confirm destructive operations explicitly, with `prompt=False` at the call
Maintainer antworten meist innerhalb von 6 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Start by reading the implementations of Table.delete(), Table.drop(), Schema.drop(), and the configuration paths named in the issue, then locate their existing tests and delete/drop documentation. Map how safemode supplies the current prompt default before estimating the changes. Done means the acceptance criteria pass across each configuration path, per-call-site warning, non-TTY behavior, docs, and 2.4 release notes.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Problem
dj.config["safemode"] (default True) sets the default prompt for Table.delete(), Table.drop() and Schema.drop(). Setting it to False turns off confirmation for every destructive call in the process, at once and out of sight:
- It's usually switched off for convenience, in a helper, a
datajoint.json, or aDJ_SAFEMODEenvironment variable, and then it applies to code that never asked for it. - A reader of
(Session & key).delete()can't tell whether it will prompt without knowing the process's configuration. - The setting's name says nothing about what it controls.
Getting it wrong costs more than the setting saves: a silent cascade delete or schema drop in the wrong session can't be undone. Skipping confirmation is a decision about one call, so it belongs at that call.
Proposal (2.4)
promptdefaults toTrueinTable.delete(),Table.drop()andSchema.drop(). Passingprompt=Falseis the supported way to skip confirmation. The deprecated setting is honored, with a warning, until 3.0 (item 3).- Deprecate
safemode. Setting it throughdj.config,datajoint.json,DJ_SAFEMODE,config.override()or an instance's config emits aDeprecationWarningnaming the replacement: passprompt=Falseat the call. - Warn where code relied on it. While the deprecated setting is
False, a destructive call made without an explicitpromptwarns once per call site, says to passprompt=False, and behaves as it does today, so existing scripts keep working through 2.x. - No silent hangs. When
prompt=Trueand there's no interactive terminal (stdinisn't a TTY: batch jobs, CI, schedulers), raiseDataJointErrorsaying to passprompt=False, instead of blocking oninput(). - Remove
safemodein 3.0.
Documentation
- The delete and drop docs and the configuration reference: replace
safemodewith explicitprompt=False, and show the pattern for scripts: preview first (for exampledj.Diagram.cascade(T & cond).counts()), then(T & cond).delete(prompt=False). - Say plainly that with
prompt=True, the confirmation is answered while the delete's transaction is open, so the affected rows and tables stay locked until it's answered. In shared databases, preview first and delete withprompt=False. - What's new in 2.4: the deprecation and the migration (search for
safemode, and passprompt=Falsewhere the call should not ask).
Acceptance criteria
- With default configuration,
delete(),drop()andSchema.drop()prompt unless called withprompt=False. - Setting
safemodein any of its forms emits aDeprecationWarning; behavior is otherwise unchanged in 2.x. prompt=Truewithout a TTY raises with a message namingprompt=False; no call blocks on input in a non-interactive process.- Tests cover each configuration path, the per-call-site warning, and the no-TTY error.
- The docs and release notes describe the migration.
- Vorherrschende Sprache
- Python
- Sterne
- 198
- Forks
- 103
- Ø Merge
- 6 T. 1 Std.
- Gemergte PRs (30 T.)
- 10
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus datajoint/datajoint-python
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
datajoint/datajoint-python#1703 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
datajoint/datajoint-python#1702 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
datajoint/datajoint-python#1701 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
datajoint/datajoint-python#1691 ·
Maintainer antworten meist innerhalb von 6 Tagen
-
dependencies needs-discussion
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
datajoint/datajoint-python#1687 ·
Maintainer antworten meist innerhalb von 6 Tagen
Alle Issues in datajoint/datajoint-python
Ähnliche Issues
-
needs-triage
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 85/100
gke-labs/kube-agents#6620 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
open-webui/open-webui#34719 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
cognition
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
One non-object JSON record makes the session catalog exitEvtl. vergeben @he-yufeng hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
collabnix/awesome-mcp-lists#433 ·
Maintainer antworten meist innerhalb von 4 Tagen