[PR #5778] [CLOSED] fix(node): avoid full inbound reconcile after client edits #5985

Closed
opened 2026-11-02 04:05:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5778
Author: @rqzbeh
Created: 7/3/2026
Status: ❌ Closed

Base: main ← Head: fix/node-client-noop-reconcile


📝 Commits (2)

  • aab8d90 fix(node): avoid redundant client-edit reconciles
  • 68687d6 fix(node): resolve correctness gaps in client-edit reconciles

📊 Changes

6 files changed (+254 additions, -2 deletions)

View changed files

📝 internal/web/runtime/reconcile_skip_test.go (+116 -0)
📝 internal/web/runtime/remote.go (+14 -0)
📝 internal/web/service/bulk_clients_test.go (+9 -1)
📝 internal/web/service/client_bulk.go (+4 -0)
📝 internal/web/service/client_inbound_apply.go (+36 -1)
📝 internal/web/service/node_bulk_dispatch_test.go (+75 -0)

📄 Description

Summary

Avoids remote-node full inbound reconciles caused by client edits, especially no-op client saves.

  • No-op UpdateInboundClient now preserves the existing client updated_at and returns before any DB write, runtime RPC, or node dirty mark when the effective settings did not change.
  • Successful remote per-client add/update/delete calls now record the pushed inbound fingerprint, so the later dirty-node reconcile keeps the crash-recovery safety net but skips panel/api/inbounds/update/:id when the node already has the same wire payload.

Why

Closes #5764.
Closes #5771.

Saving an unchanged client used to stamp a fresh updated_at, mark the remote node dirty, then let the 5s node sync send a full inbound update. On the node that full update removes/re-adds the Xray inbound handler, which matches the reported traffic stop while the Xray process still appears running.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  • go test ./internal/web/service ./internal/web/runtime -run 'TestNodeUpdateInboundClient(NoopSkipsRuntimeAndDirty|LivePushKeepsDirtyBackup)$|TestRemotePerClientMutationsSeedReconcileFingerprint$|TestReconcileInbound_SkipsUnchanged$' -count=1
  • go test ./internal/web/service ./internal/web/runtime -count=1
  • go test ./...
  • go test -shuffle=on -count=1 ./...
  • go test -race -shuffle=on -count=1 ./...
  • go test -run '^$' -fuzz 'FuzzParseLink$' -fuzztime=30s ./internal/util/link/
  • go test -run '^$' -fuzz 'FuzzDecodeCertPin$' -fuzztime=30s ./internal/web/runtime/
  • go build ./...
  • golangci-lint run
  • go run golang.org/x/vuln/cmd/govulncheck@latest ./...
  • cd frontend && npm ci && npm run lint && npm run typecheck && npm test && npm run build && npm audit --audit-level=high
  • git diff --check

Screenshots / recordings

N/A — backend-only change.

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass. (No frontend changes; ran anyway.)
  • I updated the Wiki / README / API docs if user-facing behavior changed. (N/A.)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 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/MHSanaei/3x-ui/pull/5778 **Author:** [@rqzbeh](https://github.com/rqzbeh) **Created:** 7/3/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/node-client-noop-reconcile` --- ### 📝 Commits (2) - [`aab8d90`](https://github.com/MHSanaei/3x-ui/commit/aab8d9028855a8d602c6f394a45b43950f78357d) fix(node): avoid redundant client-edit reconciles - [`68687d6`](https://github.com/MHSanaei/3x-ui/commit/68687d6e15dd7ec5f5af3d7389a1191e18d3a5f2) fix(node): resolve correctness gaps in client-edit reconciles ### 📊 Changes **6 files changed** (+254 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/runtime/reconcile_skip_test.go` (+116 -0) 📝 `internal/web/runtime/remote.go` (+14 -0) 📝 `internal/web/service/bulk_clients_test.go` (+9 -1) 📝 `internal/web/service/client_bulk.go` (+4 -0) 📝 `internal/web/service/client_inbound_apply.go` (+36 -1) 📝 `internal/web/service/node_bulk_dispatch_test.go` (+75 -0) </details> ### 📄 Description ## Summary Avoids remote-node full inbound reconciles caused by client edits, especially no-op client saves. - No-op `UpdateInboundClient` now preserves the existing client `updated_at` and returns before any DB write, runtime RPC, or node dirty mark when the effective settings did not change. - Successful remote per-client add/update/delete calls now record the pushed inbound fingerprint, so the later dirty-node reconcile keeps the crash-recovery safety net but skips `panel/api/inbounds/update/:id` when the node already has the same wire payload. ## Why Closes #5764. Closes #5771. Saving an unchanged client used to stamp a fresh `updated_at`, mark the remote node dirty, then let the 5s node sync send a full inbound update. On the node that full update removes/re-adds the Xray inbound handler, which matches the reported traffic stop while the Xray process still appears running. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [ ] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [x] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - `go test ./internal/web/service ./internal/web/runtime -run 'TestNodeUpdateInboundClient(NoopSkipsRuntimeAndDirty|LivePushKeepsDirtyBackup)$|TestRemotePerClientMutationsSeedReconcileFingerprint$|TestReconcileInbound_SkipsUnchanged$' -count=1` - `go test ./internal/web/service ./internal/web/runtime -count=1` - `go test ./...` - `go test -shuffle=on -count=1 ./...` - `go test -race -shuffle=on -count=1 ./...` - `go test -run '^$' -fuzz 'FuzzParseLink$' -fuzztime=30s ./internal/util/link/` - `go test -run '^$' -fuzz 'FuzzDecodeCertPin$' -fuzztime=30s ./internal/web/runtime/` - `go build ./...` - `golangci-lint run` - `go run golang.org/x/vuln/cmd/govulncheck@latest ./...` - `cd frontend && npm ci && npm run lint && npm run typecheck && npm test && npm run build && npm audit --audit-level=high` - `git diff --check` ## Screenshots / recordings N/A — backend-only change. ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the test suite pass locally. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. (No frontend changes; ran anyway.) - [x] I updated the Wiki / README / API docs if user-facing behavior changed. (N/A.) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:05:31 +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
MHSanaei/3x-ui#5985
No description provided.