[PR #1130] [MERGED] fix(connections): block delete when in use; warn on dangling agent refs #4937

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1130
Author: @etherious1804
Created: 5/24/2026
Status: ✅ Merged
Merged: 5/24/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/1129-connection-delete-cascade


📝 Commits (2)

  • 5fd1378 fix(connections): block delete when in use; warn on dangling agent refs
  • f4708bd Merge refactor and port connection safeguards

📊 Changes

8 files changed (+369 additions, -12 deletions)

View changed files

📝 src-tauri/src/commands/storage/commands/entities.rs (+4 -0)
➕ src-tauri/src/connection_refs.rs (+211 -0)
📝 src-tauri/src/http_dispatch.rs (+7 -0)
📝 src-tauri/src/lib.rs (+1 -0)
➕ src/engine/generation/agent-runner.test.ts (+90 -0)
📝 src/engine/generation/agent-runner.ts (+50 -10)
📝 src/features/shell/connections/components/ConnectionEditor.tsx (+4 -1)
📝 src/shared/api/tauri-client.ts (+2 -1)

📄 Description

Linked issue

Closes #1129

Why this change

Deleting an API connection that is still referenced by agents or chats should not silently leave dangling connectionId values. On the refactor branch, the same safety behavior needs to live in the new storage/delete path and the generation runtime should make an explicit missing agent connection visible instead of falling back to the chat connection.

What changed

  • Added refactor-native connection reference handling in src-tauri/src/connection_refs.rs.
  • Routed both Tauri and remote storage_delete calls for connections through the new reference-aware delete helper.
  • Blocking delete now returns a connection_in_use conflict with referencing agents/chats unless force is passed.
  • Force delete clears the referencing agent/chat connectionId values before deleting the connection.
  • Generation now reports an explicit missing agent connection as a failed dangling_agent_connection agent result instead of silently using the chat connection.
  • The Connections UI now surfaces delete failures through the existing error banner.
  • Added regression coverage for connection delete behavior and dangling agent connection handling.

Validation

  • pnpm check passed locally on the exact tree pushed to this PR.
  • pnpm test passed locally.
  • cargo test --manifest-path src-tauri/Cargo.toml connection_refs passed locally.
  • pnpm exec vitest run src/engine/generation/agent-runner.test.ts passed locally.
  • GitHub CI passed for Browser Smoke and Performance, Frontend/Architecture/Organization, Rust Capability Layer, PR template check, auto-label, and linked issue status.
  • PR diff against refactor checked: 8 files only.
  • Review threads checked: none.

Notes

  • CodeRabbit status is passing, but the reported result is Review skipped; there are no inline review threads.
  • No schema, version, release metadata, or dependency files were touched.

🔄 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/1130 **Author:** [@etherious1804](https://github.com/etherious1804) **Created:** 5/24/2026 **Status:** ✅ Merged **Merged:** 5/24/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/1129-connection-delete-cascade` --- ### 📝 Commits (2) - [`5fd1378`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5fd13789b0c40c458ef6e18f3d79af41f7a9d6fa) fix(connections): block delete when in use; warn on dangling agent refs - [`f4708bd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f4708bd14e201416d080fde68f3f8e50b27136b4) Merge refactor and port connection safeguards ### 📊 Changes **8 files changed** (+369 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+4 -0) ➕ `src-tauri/src/connection_refs.rs` (+211 -0) 📝 `src-tauri/src/http_dispatch.rs` (+7 -0) 📝 `src-tauri/src/lib.rs` (+1 -0) ➕ `src/engine/generation/agent-runner.test.ts` (+90 -0) 📝 `src/engine/generation/agent-runner.ts` (+50 -10) 📝 `src/features/shell/connections/components/ConnectionEditor.tsx` (+4 -1) 📝 `src/shared/api/tauri-client.ts` (+2 -1) </details> ### 📄 Description ## Linked issue Closes #1129 ## Why this change Deleting an API connection that is still referenced by agents or chats should not silently leave dangling `connectionId` values. On the refactor branch, the same safety behavior needs to live in the new storage/delete path and the generation runtime should make an explicit missing agent connection visible instead of falling back to the chat connection. ## What changed - Added refactor-native connection reference handling in `src-tauri/src/connection_refs.rs`. - Routed both Tauri and remote `storage_delete` calls for `connections` through the new reference-aware delete helper. - Blocking delete now returns a `connection_in_use` conflict with referencing agents/chats unless `force` is passed. - Force delete clears the referencing agent/chat `connectionId` values before deleting the connection. - Generation now reports an explicit missing agent connection as a failed `dangling_agent_connection` agent result instead of silently using the chat connection. - The Connections UI now surfaces delete failures through the existing error banner. - Added regression coverage for connection delete behavior and dangling agent connection handling. ## Validation - [x] `pnpm check` passed locally on the exact tree pushed to this PR. - [x] `pnpm test` passed locally. - [x] `cargo test --manifest-path src-tauri/Cargo.toml connection_refs` passed locally. - [x] `pnpm exec vitest run src/engine/generation/agent-runner.test.ts` passed locally. - [x] GitHub CI passed for Browser Smoke and Performance, Frontend/Architecture/Organization, Rust Capability Layer, PR template check, auto-label, and linked issue status. - [x] PR diff against `refactor` checked: 8 files only. - [x] Review threads checked: none. ## Notes - CodeRabbit status is passing, but the reported result is `Review skipped`; there are no inline review threads. - No schema, version, release metadata, or dependency files were touched. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:52 +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#4937
No description provided.