[PR #6339] [MERGED] fix(clients): sync auto-renewal across inbounds #6225

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6339
Author: @dawNotPoi
Created: 8/27/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @MHSanaei

Base: main ← Head: fix/6301-autorenew-shared-inbounds


📝 Commits (2)

  • 15a67e5 fix(clients): sync auto-renewal across inbounds
  • ca1cfce fix(clients): preserve manual disable during renewal

📊 Changes

2 files changed (+187 additions, -18 deletions)

View changed files

➕ internal/web/service/inbound_autorenew_shared_email_test.go (+154 -0)
📝 internal/web/service/inbound_traffic.go (+33 -18)

📄 Description

Summary

  • Propagate a shared client's renewed expiry and enabled state to every attached inbound.
  • Restore the renewed runtime user in each affected inbound without double-counting renewals or quota resets.
  • Add a real SQLite regression test covering both inbound settings, the shared client records, and runtime apply plans.

Why

When one email is attached to multiple inbounds, the first inbound advances the shared traffic row. Later inbounds then take the zero-renewal path and retain stale expired/disabled settings, which can overwrite the renewed state in the shared clients table.

Closes #6301.

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?

  • Reproduced the failure against the previous implementation with one email attached to two local inbounds.
  • go test ./internal/web/service -run TestAutoRenewClients -count=1
  • go test -race ./internal/web/service -run TestAutoRenewClients_UpdatesEveryInboundForSharedEmail -count=1
  • make test-go
  • make lint-go
  • make verify

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 files changed.)
  • I updated the Wiki / README / API docs if user-facing behavior changed. (No documentation update is required.)
  • 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/6339 **Author:** [@dawNotPoi](https://github.com/dawNotPoi) **Created:** 8/27/2026 **Status:** ✅ Merged **Merged:** 9/2/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/6301-autorenew-shared-inbounds` --- ### 📝 Commits (2) - [`15a67e5`](https://github.com/MHSanaei/3x-ui/commit/15a67e5d0084de294952e252a7a1d4f35ae99f29) fix(clients): sync auto-renewal across inbounds - [`ca1cfce`](https://github.com/MHSanaei/3x-ui/commit/ca1cfced5439cedb2aee2d32a3e1f4eee87e1848) fix(clients): preserve manual disable during renewal ### 📊 Changes **2 files changed** (+187 additions, -18 deletions) <details> <summary>View changed files</summary> ➕ `internal/web/service/inbound_autorenew_shared_email_test.go` (+154 -0) 📝 `internal/web/service/inbound_traffic.go` (+33 -18) </details> ### 📄 Description ## Summary - Propagate a shared client's renewed expiry and enabled state to every attached inbound. - Restore the renewed runtime user in each affected inbound without double-counting renewals or quota resets. - Add a real SQLite regression test covering both inbound settings, the shared client records, and runtime apply plans. ## Why When one email is attached to multiple inbounds, the first inbound advances the shared traffic row. Later inbounds then take the zero-renewal path and retain stale expired/disabled settings, which can overwrite the renewed state in the shared clients table. Closes #6301. ## 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) - [x] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [x] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - Reproduced the failure against the previous implementation with one email attached to two local inbounds. - `go test ./internal/web/service -run TestAutoRenewClients -count=1` - `go test -race ./internal/web/service -run TestAutoRenewClients_UpdatesEveryInboundForSharedEmail -count=1` - `make test-go` - `make lint-go` - `make verify` ## 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 files changed.) - [x] I updated the Wiki / README / API docs if user-facing behavior changed. (No documentation update is required.) - [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:07:14 +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#6225
No description provided.