[PR #2053] [MERGED] Require confirm for admin clear all #5414

Closed
opened 2026-10-22 04:16:05 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2053
Author: @cha1latte
Created: 6/3/2026
Status: ✅ Merged
Merged: 6/3/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2029-admin-clear-confirm


📝 Commits (1)

  • 53e4973 Require confirm for admin clear all

📊 Changes

5 files changed (+232 additions, -5 deletions)

View changed files

📝 src-tauri/src/commands/storage/admin.rs (+65 -1)
📝 src-tauri/src/commands/storage/commands/agents.rs (+5 -2)
📝 src-tauri/src/http_dispatch.rs (+70 -1)
📝 src-tauri/src/http_server.rs (+91 -0)
📝 src/shared/api/admin-api.ts (+1 -1)

📄 Description

Linked issue

Closes #2029

Why this change

  • Refactor clear-all had UI confirmation, but the backend destructive command had no confirmation argument to validate once invoked. This restores a backend guard so missing or false confirmation returns invalid_input before storage/media deletion.

What changed

  • Require confirm: true inside admin_clear_all before clearing storage/runtime media.
  • Thread the confirmation argument through admin_clear_all_command and remote /api/invoke dispatch.
  • Update the shared admin API wrapper so the existing UI-confirmed clear-all action sends { confirm: true }.
  • Add Rust coverage for missing/false confirmation preserving seeded storage, confirmed clear-all deleting, remote dispatch behavior, remote admin-secret rejection, and the existing expunge control.

Refactor impact

Primary owner:

Rust storage / remote runtime

Impact areas reviewed:

  • src-tauri admin storage command helper
  • Tauri IPC command wrapper
  • remote /api/invoke dispatch
  • remote non-loopback admin-secret access guard
  • shared admin API wrapper used by settings reset UI

Boundary notes:

  • Product behavior remains in src-tauri storage/admin command code.
  • Feature UI still calls the focused shared API wrapper and does not import raw Tauri APIs.
  • Remote dispatch continues through the existing HTTP pipeline and privileged-command secret gate.

Pressure points touched:

  • src-tauri/src/lib.rs command registration was reviewed; no registration change needed because the command name stayed the same.
  • Destructive storage deletion now has backend confirmation validation before state.storage.clear_all().

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo test --manifest-path src-tauri/Cargo.toml admin_clear_all -- --nocapture passed: 8 tests.
  • cargo test --manifest-path src-tauri/Cargo.toml admin_expunge -- --nocapture passed: 1 test.
  • pnpm typecheck passed.
  • pnpm check passed.
  • git diff --check passed.
  • Workflow note: node C:/Users/celia/.codex/tools/marinara-proof-gate.mjs scratch/bugfix-verification.json could not run because that local tool path does not exist in this environment.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix for an existing destructive admin action; no new user-discoverable feature or workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

N/A: backend destructive-command guard and remote dispatch coverage only; no visible UI changed.

Summary by CodeRabbit

  • Security
    • Added confirmation requirement to the clear all storage command to prevent accidental data loss. Users must now explicitly confirm the destructive action before proceeding.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2053 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2029-admin-clear-confirm` --- ### 📝 Commits (1) - [`53e4973`](https://github.com/Pasta-Devs/Marinara-Engine/commit/53e4973ca257234bd30bdf2eea5942084e3bebbc) Require confirm for admin clear all ### 📊 Changes **5 files changed** (+232 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/admin.rs` (+65 -1) 📝 `src-tauri/src/commands/storage/commands/agents.rs` (+5 -2) 📝 `src-tauri/src/http_dispatch.rs` (+70 -1) 📝 `src-tauri/src/http_server.rs` (+91 -0) 📝 `src/shared/api/admin-api.ts` (+1 -1) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #2029 ## Why this change - Refactor clear-all had UI confirmation, but the backend destructive command had no confirmation argument to validate once invoked. This restores a backend guard so missing or false confirmation returns `invalid_input` before storage/media deletion. ## What changed - Require `confirm: true` inside `admin_clear_all` before clearing storage/runtime media. - Thread the confirmation argument through `admin_clear_all_command` and remote `/api/invoke` dispatch. - Update the shared admin API wrapper so the existing UI-confirmed clear-all action sends `{ confirm: true }`. - Add Rust coverage for missing/false confirmation preserving seeded storage, confirmed clear-all deleting, remote dispatch behavior, remote admin-secret rejection, and the existing expunge control. ## Refactor impact Primary owner: Rust storage / remote runtime Impact areas reviewed: - `src-tauri` admin storage command helper - Tauri IPC command wrapper - remote `/api/invoke` dispatch - remote non-loopback admin-secret access guard - shared admin API wrapper used by settings reset UI Boundary notes: - Product behavior remains in `src-tauri` storage/admin command code. - Feature UI still calls the focused shared API wrapper and does not import raw Tauri APIs. - Remote dispatch continues through the existing HTTP pipeline and privileged-command secret gate. Pressure points touched: - `src-tauri/src/lib.rs` command registration was reviewed; no registration change needed because the command name stayed the same. - Destructive storage deletion now has backend confirmation validation before `state.storage.clear_all()`. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo test --manifest-path src-tauri/Cargo.toml admin_clear_all -- --nocapture` passed: 8 tests. - `cargo test --manifest-path src-tauri/Cargo.toml admin_expunge -- --nocapture` passed: 1 test. - `pnpm typecheck` passed. - `pnpm check` passed. - `git diff --check` passed. - Workflow note: `node C:/Users/celia/.codex/tools/marinara-proof-gate.mjs scratch/bugfix-verification.json` could not run because that local tool path does not exist in this environment. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [ ] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix for an existing destructive admin action; no new user-discoverable feature or workflow. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence N/A: backend destructive-command guard and remote dispatch coverage only; no visible UI changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Security** * Added confirmation requirement to the clear all storage command to prevent accidental data loss. Users must now explicitly confirm the destructive action before proceeding. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:05 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#5414
No description provided.