fix(nodes): roll back failed client reconciliation (#7229)

Node sync could commit a rejected inbound's client changes. The cross-inbound TUIC UUID check runs after the shared client record, the inbound links and the flow overrides are written, and the merge used to log the error and commit anyway: a shared client could keep another client's UUID, half-updated links and the node's settings for that inbound.

Each inbound's adopted configuration and client sync now run in a savepoint. A refusal rolls that inbound back and the merge goes on, so traffic and the inbounds that synced still commit; the refused inbound stays out of the orphan sweep and a later valid snapshot reconciles it.

A node inbound the master sees for the first time is stored with the settings the node reported and stamped as already delivered. Without the row the next reconcile deletes the inbound on the node; with other settings it overwrites the node's clients; and pushing the node's own inconsistent blob back is refused there on every tick, which keeps the node dirty and suspends adoption for all of its inbounds.

Run on a real master and node with clients connected: the refused inbound kept serving through a reconcile, the node stayed clean, and the master adopted it once the node's report was consistent.

Closes #7219
This commit is contained in:
Hamed
2026-11-28 09:40:57 +03:30
committed by GitHub
parent f68264965f
commit eb99820dd8
4 changed files with 377 additions and 67 deletions
+10
View File
@@ -143,6 +143,16 @@ jobs:
exit 1
fi
- name: PostgreSQL node client reconciliation rollback
run: |
set -o pipefail
go test ./internal/web/service -run '^TestNode(ClientReconcileRollback|RefusedFirstAdoptionKeepsNodeSettings)Postgres$' -count=1 -v | tee /tmp/postgres-node-client-rollback.log
passed=$(grep -c -- '^--- PASS: TestNode' /tmp/postgres-node-client-rollback.log || true)
if [ "$passed" -ne 2 ]; then
echo "expected both PostgreSQL node client reconciliation rollback tests to pass, got $passed" >&2
exit 1
fi
- name: PostgreSQL client usage history
run: |
set -o pipefail