[PR #6220] [CLOSED] fix: allow clients to share subscription IDs #6182

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6220
Author: @mvanhorn
Created: 8/15/2026
Status: ❌ Closed

Base: main ← Head: fix/6065-allow-shared-subids


📝 Commits (1)

  • cdd8131 fix: allow clients to share subscription IDs

📊 Changes

5 files changed (+204 additions, -71 deletions)

View changed files

📝 internal/web/service/client_bulk.go (+0 -26)
📝 internal/web/service/client_crud.go (+0 -24)
📝 internal/web/service/client_portable.go (+0 -12)
➕ internal/web/service/client_shared_subid_test.go (+174 -0)
📝 internal/web/service/client_update_rename_test.go (+30 -9)

📄 Description

Summary

Remove only the cross-client subId collision queries and bulk bookkeeping from the three service files, retaining subId format validation, generated values for omitted subIds, email uniqueness, and the existing same-email identity checks. Replace the Update regression that expects rejection with a positive assertion that two distinct-email records retain the shared subId and that the edited inbound settings are updated. Add focused service tests covering shared-subId creation against an existing record, two same-batch BulkCreate entries, and orphan import against an existing record, while continuing to assert that both clients remain distinct by email.

Since commit 88a36773, the client service rejects a subId already held by a different email in Create, Update, BulkCreate, and the orphan branch of ImportClients. That restriction prevents distinct clients reconciled from different nodes from being aggregated behind one subscription URL, even though the subscription queries and SyncInbound path already support multiple client records per subId. Email remains the actual unique client identity and database constraint; subId is a non-unique indexed lookup key. Current main still contains the guards, so the reported behavior remains reproducible.

Closes #6065

Why

Remove only the cross-client subId collision queries and bulk bookkeeping from the three service files, retaining subId format validation, generated values for omitted subIds, email uniqueness, and the existing same-email identity checks. Replace the Update regression that expects rejection with a positive assertion that two distinct-email records retain the shared subId and that the edited inbound settings are updated. Add focused service tests covering shared-subId creation against an existing record, two same-batch BulkCreate entries, and orphan import against an existing record, while continuing to assert that both clients remain distinct by email.

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?

Not applicable to this change.

Screenshots / recordings

No user-visible surface changes in this PR, so there is nothing to show.

Breaking changes

None. This change is additive and does not alter an existing public interface or stored format.

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.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

AI disclosure

AI was used for assistance.

  • Tools: an AI coding assistant.

🔄 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/6220 **Author:** [@mvanhorn](https://github.com/mvanhorn) **Created:** 8/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/6065-allow-shared-subids` --- ### 📝 Commits (1) - [`cdd8131`](https://github.com/MHSanaei/3x-ui/commit/cdd81311761d1ffcc2b373a6cb625a4480a239af) fix: allow clients to share subscription IDs ### 📊 Changes **5 files changed** (+204 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/client_bulk.go` (+0 -26) 📝 `internal/web/service/client_crud.go` (+0 -24) 📝 `internal/web/service/client_portable.go` (+0 -12) ➕ `internal/web/service/client_shared_subid_test.go` (+174 -0) 📝 `internal/web/service/client_update_rename_test.go` (+30 -9) </details> ### 📄 Description ## Summary Remove only the cross-client subId collision queries and bulk bookkeeping from the three service files, retaining subId format validation, generated values for omitted subIds, email uniqueness, and the existing same-email identity checks. Replace the Update regression that expects rejection with a positive assertion that two distinct-email records retain the shared subId and that the edited inbound settings are updated. Add focused service tests covering shared-subId creation against an existing record, two same-batch BulkCreate entries, and orphan import against an existing record, while continuing to assert that both clients remain distinct by email. Since commit 88a36773, the client service rejects a subId already held by a different email in Create, Update, BulkCreate, and the orphan branch of ImportClients. That restriction prevents distinct clients reconciled from different nodes from being aggregated behind one subscription URL, even though the subscription queries and SyncInbound path already support multiple client records per subId. Email remains the actual unique client identity and database constraint; subId is a non-unique indexed lookup key. Current `main` still contains the guards, so the reported behavior remains reproducible. Closes #6065 ## Why Remove only the cross-client subId collision queries and bulk bookkeeping from the three service files, retaining subId format validation, generated values for omitted subIds, email uniqueness, and the existing same-email identity checks. Replace the Update regression that expects rejection with a positive assertion that two distinct-email records retain the shared subId and that the edited inbound settings are updated. Add focused service tests covering shared-subId creation against an existing record, two same-batch BulkCreate entries, and orphan import against an existing record, while continuing to assert that both clients remain distinct by email. ## 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) - [ ] 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? Not applicable to this change. ## Screenshots / recordings No user-visible surface changes in this PR, so there is nothing to show. ## Breaking changes None. This change is additive and does not alter an existing public interface or stored format. ## 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. - [x] I updated the Wiki / README / API docs if user-facing behavior changed. - [x] My commits follow the project's existing message style. - [ ] I have no unrelated changes mixed into this PR. **AI disclosure** AI was used for assistance. - Tools: an AI coding assistant. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:06:56 +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#6182
No description provided.