mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5394] [MERGED] fix(nodes): block node delete while inbounds are still attached #5867
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5867
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5394
Author: @n0ctal
Created: 6/16/2026
Status: ✅ Merged
Merged: 6/19/2026
Merged by: @MHSanaei
Base:
main← Head:pr-db002-node-delete-guard📝 Commits (1)
21b369dfix(nodes): block node delete while inbounds are still attached📊 Changes
2 files changed (+78 additions, -8 deletions)
View changed files
📝
internal/web/service/node.go(+27 -8)➕
internal/web/service/node_delete_orphan_test.go(+51 -0)📄 Description
Summary
Refuse deleting a node while inbounds still reference it, so a delete can no longer leave orphaned inbounds behind.
Why
NodeService.Deletedropped the node row (and its per-node child rows) without checking for inbounds still referencing it vianode_id. Those orphaned inbounds keep a danglingnode_idthat then confuses node sync, subscriptions, and cleanup.Scope
Deletewith a clear error when inbounds are still attached to the nodeDeletestays tolerant of a missing node row, so it can still clean up orphaned rowsValidation
internal/web/servicepackage tests passRisk
Low. Adds a guard and wraps the existing deletes in one transaction; no schema change, no behaviour change on the happy path.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.