From 12713c50128d6ce1e4dcf26521a9d440d74a4104 Mon Sep 17 00:00:00 2001 From: dan-claude-bot Date: Sun, 19 Jul 2026 19:40:39 +0000 Subject: [PATCH] fix: box restore asks before it destroys, in its own words (#105) The 'confirm' precondition existed but the dispatch hardcoded rm's wording, so giving restore the token would have asked the operator to confirm deleting the box they were rescuing. The prompt is now a per-row field; restore names the snapshot and the loss. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 33 +++++++++++++++++ bin/box | 66 ++++++++++++++++++++++++++------- test/cli.sh | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 189 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ea60c1..c0c7ee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,39 @@ which records not just what changed but what each drill run proved. ### Fixed +- **`box restore` asks before it destroys — and the confirmation prompt is + now the row's, not rm's** (#105) — `restore` and `rm` both irreversibly + discard user state, and only one of them asked. The table gave `restore` + the preconditions `box,arg2`: the instance is ours, a snapshot name is + present, go. So `box restore work stale-label` silently threw away + everything done in the box since that snapshot, with no prompt, no + `--force`, and no way to take it back — a warning in `--help` is not a + gate. It has been that way since the verb shipped, and it is about to + become routine rather than rare (heavy-duty/rig#62's pristine snapshot), + which is the wrong time to still be relying on the operator typing the + right label. The reason it stayed ungated is worth recording, because it + is the actual bug: `confirm` was already a precondition token, but the + dispatch line hardcoded the *words* — `confirm "delete $inst and all its + snapshots"` — so the one-token fix would have gated restore behind a + prompt offering to DELETE the box the operator was trying to rescue. A + gate that names the wrong act is worse than no gate; it is how people + learn to answer `y` without reading. So the prompt moved into the table + as a seventh field, each row saying what it is about to do in its own + words, and `restore` now asks to "roll `` back to snapshot + `