Skip to content

Deepen destructive-action seams: confirm + destroy modules#9

Open
johnpmitsch wants to merge 2 commits into
mainfrom
refactor1
Open

Deepen destructive-action seams: confirm + destroy modules#9
johnpmitsch wants to merge 2 commits into
mainfrom
refactor1

Conversation

@johnpmitsch

@johnpmitsch johnpmitsch commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Tracks DX-5617

Summary

  • New confirm::mild(&ctx, prompt) / confirm::severe_delete_all(&ctx, singular) absorb the cfg + prompt + cancel-mapping ceremony that was repeated across 8 destructive command sites (one of which had already drifted into a local confirm_mild helper in kv/mod.rs).
  • New destroy module with single / all wraps the full destructive call (confirm → SDK closure → ✓ note) for 7 delete sites across tag, team, webhook, stream, and kv. Generic over the SDK response type.
  • Lower-level confirm primitives (Severity, ConfirmCfg, decide_without_prompt, prompt_yes_no, prompt_typed) demoted to pub(crate) so future commands can't drift back into copy-pasting the ceremony.

Skipped: endpoint archive stays on confirm::mild only (not a delete, so destroy::single's wording doesn't fit).

All existing prompt and note wording preserved byte-for-byte — kv keys still print quoted ({key:?}), webhook/stream/tag/team ids still print bare.

Also: gitignore CLAUDE.local.md for per-repo Claude notes that shouldn't land in this public repo.

Test plan

  • cargo test — 173 passed, 0 failed (same count as main)
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo build --release — no warnings
  • Manual smoke: qn tag delete N shows the expected y/N prompt on a TTY
  • Manual smoke: qn webhook delete-all requires --yes --yes on a non-TTY, exit code 5 without it

Eight destructive command sites were each rebuilding the same confirmation
ceremony (build ConfirmCfg → decide_without_prompt → optional prompt →
NeedsConfirmation/Cancelled mapping), with `kv/mod.rs` already drifting into
a local `confirm_mild` helper. Six of those sites also followed an identical
shape around the confirm: prompt → SDK delete call → ✓ note.

Two new seams:

- `confirm::mild(&ctx, prompt)` and `confirm::severe_delete_all(&ctx, singular)`
  absorb the cfg + prompt + cancel-mapping. The lower-level primitives
  (`Severity`, `ConfirmCfg`, `decide_without_prompt`, `prompt_yes_no`,
  `prompt_typed`) are now `pub(crate)` so future call sites can't drift back
  into copy-pasting the ceremony.

- New `destroy` module with `single` and `all` wraps the full destructive
  call: confirm → SDK closure → `✓ Deleted …` note. Generic over the SDK
  response type so each resource passes its own delete fn.

Converted: tag delete, team delete, webhook delete/delete_all,
stream delete/delete_all, kv set/list delete. endpoint archive stays on
`confirm::mild` (not a delete). All existing wording preserved byte-for-byte
(kv keys still print quoted; webhook/stream/tag/team ids still print bare).

173 tests pass, clippy clean, fmt clean.
Per-repo Claude notes (Linear team config, triage label mapping, domain
docs pointers) live in CLAUDE.local.md so they stay out of this public
repository. The detail docs already live under docs/agents/ which was
gitignored previously.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant