[PR #6426] [CLOSED] feat(panel): add fast rollback from dev to stable release with local snapshot restore #6263

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

📋 Pull Request Information

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

Base: main ← Head: feat/dev-fast-rollback-stable


📝 Commits (10+)

  • b561872 feat(panel): add stable binary snapshot and rollback engine
  • 5ccd0b9 feat(server): expose rollbackPanel endpoint and api docs
  • 3a131fe feat(ui): add fast rollback action and version selection to PanelUpdateModal
  • d853a32 docs(api): update server API reference for rollbackPanel
  • f94305f Merge branch 'main' into feat/dev-fast-rollback-stable
  • 9cece93 fix(panel): address review feedback on rollback execution, nil db panic, and reactive modal state
  • e7b8d6a Merge branch 'main' into feat/dev-fast-rollback-stable
  • 0eb9954 fix(panel): address review feedback on online rollback slot release and postgres credentials exposure
  • 135484b Merge branch 'main' into feat/dev-fast-rollback-stable
  • d15cfc9 Merge branch 'main' into feat/dev-fast-rollback-stable

📊 Changes

28 files changed (+1178 additions, -35 deletions)

View changed files

📝 docs/content/docs/en/reference/api/server.mdx (+8 -1)
📝 docs/public/openapi.json (+52 -0)
📝 frontend/public/openapi.json (+52 -0)
📝 frontend/src/pages/api-docs/endpoints.ts (+16 -0)
📝 frontend/src/pages/index/PanelUpdateModal.css (+10 -0)
📝 frontend/src/pages/index/PanelUpdateModal.tsx (+119 -2)
➕ frontend/src/test/panel-update-modal.test.tsx (+104 -0)
📝 internal/web/controller/panel_update_test.go (+53 -0)
📝 internal/web/controller/server.go (+13 -4)
📝 internal/web/service/panel/panel.go (+263 -11)
📝 internal/web/service/panel/panel_test.go (+54 -0)
➕ internal/web/service/panel/snapshot.go (+141 -0)
➕ internal/web/service/panel/snapshot_test.go (+139 -0)
📝 internal/web/service/server.go (+4 -4)
📝 internal/web/service/server_pg_restore_test.go (+59 -0)
📝 internal/web/translation/ar-EG.json (+7 -1)
📝 internal/web/translation/en-US.json (+7 -1)
📝 internal/web/translation/es-ES.json (+7 -1)
📝 internal/web/translation/fa-IR.json (+7 -1)
📝 internal/web/translation/id-ID.json (+7 -1)

...and 8 more files

📄 Description

Summary

Adds a fast, reliable one-click rollback mechanism to revert dev and dev-latest builds back to official stable release versions in 3x-ui.

Why

Users running bleeding-edge dev builds or dev-latest channel releases can encounter unexpected bugs or regressions. Downgrading manually requires CLI knowledge and manual backups. This feature enables one-click rollback directly from the panel overview modal, supporting both instant offline restoration from a pre-upgrade local snapshot and online installation of the latest stable release, with automatic pre-rollback database safety backups.

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?

  1. Unit & Integration Tests (Go):
    • Added snapshot_test.go covering saving stable installation snapshots, reading metadata, restoring binaries, verifying executable permissions, and handling corrupt/missing snapshots.
    • Added TestStartRollback_LocalSuccess, TestStartRollback_InvalidMode, TestPanelRollbackInvalidMode in panel_test.go and panel_update_test.go.
    • Verified that go test ./internal/web/service/panel/... ./internal/web/controller/... ./internal/web/... passes 100%.
  2. Frontend Tests & Build:
    • Added component tests in panel-update-modal.test.tsx testing rollback button visibility when in dev mode, mode selection when local snapshot differs from latest online release, and POST payload verification to /panel/api/server/rollbackPanel.
    • Verified npm run typecheck, npm run lint, npm run format:check, npm run test, and npm run build pass without errors.
    • Tested i18n dead-key verification across all 13 locales.

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.

🔄 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/6426 **Author:** [@rqzbeh](https://github.com/rqzbeh) **Created:** 9/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/dev-fast-rollback-stable` --- ### 📝 Commits (10+) - [`b561872`](https://github.com/MHSanaei/3x-ui/commit/b561872cd5fa893c3cd4c05443db3038931744f5) feat(panel): add stable binary snapshot and rollback engine - [`5ccd0b9`](https://github.com/MHSanaei/3x-ui/commit/5ccd0b99449641645b186242d3cc5d241ae86c7e) feat(server): expose rollbackPanel endpoint and api docs - [`3a131fe`](https://github.com/MHSanaei/3x-ui/commit/3a131fefa6dcb923cee101d9c8e41745cd61f254) feat(ui): add fast rollback action and version selection to PanelUpdateModal - [`d853a32`](https://github.com/MHSanaei/3x-ui/commit/d853a324f5a9f74a96c84f0efd8c17704ed8cdd5) docs(api): update server API reference for rollbackPanel - [`f94305f`](https://github.com/MHSanaei/3x-ui/commit/f94305fa8d9979af2fcb323629fb0309a906de9f) Merge branch 'main' into feat/dev-fast-rollback-stable - [`9cece93`](https://github.com/MHSanaei/3x-ui/commit/9cece93353c5ff405dc6eccdcbc68a2e7a1637ff) fix(panel): address review feedback on rollback execution, nil db panic, and reactive modal state - [`e7b8d6a`](https://github.com/MHSanaei/3x-ui/commit/e7b8d6a68e219e632cc13970d18e991950ddd3fd) Merge branch 'main' into feat/dev-fast-rollback-stable - [`0eb9954`](https://github.com/MHSanaei/3x-ui/commit/0eb9954fb4eb9f225ed93fbddb2c30d5ade1b533) fix(panel): address review feedback on online rollback slot release and postgres credentials exposure - [`135484b`](https://github.com/MHSanaei/3x-ui/commit/135484b56775d6e3c2b5b5e3cfa93099040c6ff6) Merge branch 'main' into feat/dev-fast-rollback-stable - [`d15cfc9`](https://github.com/MHSanaei/3x-ui/commit/d15cfc93d6b13a2ecb9b997dc304b4b77672c037) Merge branch 'main' into feat/dev-fast-rollback-stable ### 📊 Changes **28 files changed** (+1178 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/en/reference/api/server.mdx` (+8 -1) 📝 `docs/public/openapi.json` (+52 -0) 📝 `frontend/public/openapi.json` (+52 -0) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+16 -0) 📝 `frontend/src/pages/index/PanelUpdateModal.css` (+10 -0) 📝 `frontend/src/pages/index/PanelUpdateModal.tsx` (+119 -2) ➕ `frontend/src/test/panel-update-modal.test.tsx` (+104 -0) 📝 `internal/web/controller/panel_update_test.go` (+53 -0) 📝 `internal/web/controller/server.go` (+13 -4) 📝 `internal/web/service/panel/panel.go` (+263 -11) 📝 `internal/web/service/panel/panel_test.go` (+54 -0) ➕ `internal/web/service/panel/snapshot.go` (+141 -0) ➕ `internal/web/service/panel/snapshot_test.go` (+139 -0) 📝 `internal/web/service/server.go` (+4 -4) 📝 `internal/web/service/server_pg_restore_test.go` (+59 -0) 📝 `internal/web/translation/ar-EG.json` (+7 -1) 📝 `internal/web/translation/en-US.json` (+7 -1) 📝 `internal/web/translation/es-ES.json` (+7 -1) 📝 `internal/web/translation/fa-IR.json` (+7 -1) 📝 `internal/web/translation/id-ID.json` (+7 -1) _...and 8 more files_ </details> ### 📄 Description ## Summary Adds a fast, reliable one-click rollback mechanism to revert `dev` and `dev-latest` builds back to official stable release versions in 3x-ui. ## Why Users running bleeding-edge `dev` builds or `dev-latest` channel releases can encounter unexpected bugs or regressions. Downgrading manually requires CLI knowledge and manual backups. This feature enables one-click rollback directly from the panel overview modal, supporting both instant offline restoration from a pre-upgrade local snapshot and online installation of the latest stable release, with automatic pre-rollback database safety backups. ## Type of change - [ ] Bug fix - [x] New feature - [ ] Refactoring (no behavior change) - [x] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [x] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [x] Database / migrations - [x] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? 1. **Unit & Integration Tests (Go)**: - Added `snapshot_test.go` covering saving stable installation snapshots, reading metadata, restoring binaries, verifying executable permissions, and handling corrupt/missing snapshots. - Added `TestStartRollback_LocalSuccess`, `TestStartRollback_InvalidMode`, `TestPanelRollbackInvalidMode` in `panel_test.go` and `panel_update_test.go`. - Verified that `go test ./internal/web/service/panel/... ./internal/web/controller/... ./internal/web/...` passes 100%. 2. **Frontend Tests & Build**: - Added component tests in `panel-update-modal.test.tsx` testing rollback button visibility when in dev mode, mode selection when local snapshot differs from latest online release, and POST payload verification to `/panel/api/server/rollbackPanel`. - Verified `npm run typecheck`, `npm run lint`, `npm run format:check`, `npm run test`, and `npm run build` pass without errors. - Tested i18n dead-key verification across all 13 locales. ## 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. - [x] 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:07:29 +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#6263
No description provided.