[PR #5680] [CLOSED] refactor(xray): extract minimum eligible release tag for filtering #5959

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5680
Author: @Tomilla
Created: 6/30/2026
Status: ❌ Closed

Base: main ← Head: refactor/xray-min-version-filter-const


📝 Commits (2)

  • 96348e4 refactor(xray): name minimum eligible release tag
  • 432cc82 test(xray): use subtests for release tag cases

📊 Changes

2 files changed (+54 additions, -14 deletions)

View changed files

📝 internal/web/service/server.go (+32 -14)
📝 internal/web/service/server_xray_checksum_test.go (+22 -0)

📄 Description

Summary

Extract the minimum eligible Xray release tag into a named constant and reuse it in the GitHub release filtering logic. This keeps the threshold defined in one place instead of hardcoding the version inline.

Why

The previous comparison duplicated the minimum supported release threshold directly in the filtering condition, which made the intent harder to read and future updates more error-prone. A named constant makes the compatibility boundary explicit and simpler to maintain.

Previous implementation:

if major > 26 || (major == 26 && minor > 6) || (major == 26 && minor == 6 && patch >= 27) {
    versions = append(versions, release.TagName)
}

Reference:

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?

  • Ran the backend unit tests covering release-tag filtering and checksum parsing.
  • Verified that tags below v26.6.27 are excluded and v26.6.27 and newer tags are included.
  • Confirmed the refactor does not change behavior and only centralizes the minimum-version value.

Screenshots / recordings

N/A

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.
  • 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.

---

<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5680 **Author:** [@Tomilla](https://github.com/Tomilla) **Created:** 6/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `refactor/xray-min-version-filter-const` --- ### 📝 Commits (2) - [`96348e4`](https://github.com/MHSanaei/3x-ui/commit/96348e4382dd2cfc1b1362670a693a25170fc781) refactor(xray): name minimum eligible release tag - [`432cc82`](https://github.com/MHSanaei/3x-ui/commit/432cc8250e432453ef0a6187a96ab986a22a9840) test(xray): use subtests for release tag cases ### 📊 Changes **2 files changed** (+54 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/server.go` (+32 -14) 📝 `internal/web/service/server_xray_checksum_test.go` (+22 -0) </details> ### 📄 Description ## Summary Extract the minimum eligible Xray release tag into a named constant and reuse it in the GitHub release filtering logic. This keeps the threshold defined in one place instead of hardcoding the version inline. ## Why The previous comparison duplicated the minimum supported release threshold directly in the filtering condition, which made the intent harder to read and future updates more error-prone. A named constant makes the compatibility boundary explicit and simpler to maintain. Previous implementation: ```go if major > 26 || (major == 26 && minor > 6) || (major == 26 && minor == 6 && patch >= 27) { versions = append(versions, release.TagName) } ``` Reference: - [internal/web/service/server.go#L813-L832](https://github.com/MHSanaei/3x-ui/blob/bbfbd7eba624e49b5ccfc20c22e80d016b7facc3/internal/web/service/server.go#L813-L832) ## Type of change - [ ] Bug fix - [ ] New feature - [x] 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 - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - Ran the backend unit tests covering release-tag filtering and checksum parsing. - Verified that tags below `v26.6.27` are excluded and `v26.6.27` and newer tags are included. - Confirmed the refactor does not change behavior and only centralizes the minimum-version value. ## Screenshots / recordings N/A ## 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. - [ ] 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. - [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:18 +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#5959
No description provided.