From bf57aed17a17498827d9ace73d8d49cb6db59068 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Thu, 1 Oct 2026 09:46:21 +0800 Subject: [PATCH] =?UTF-8?q?retire(web):=20sanguo=5Fweb=20legacy=20?= =?UTF-8?q?=E5=B9=B3=E8=A1=8C=E5=90=8E=E7=AB=AF=E5=BD=92=E6=A1=A3=E2=80=94?= =?UTF-8?q?=E2=80=94=E7=94=A8=E6=88=B7=E6=8B=8D=E6=9D=BF=E3=80=8C=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BF=9D=E7=95=99=E5=BD=92=E6=A1=A3,=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=88=A0=E3=80=8D=20[nas]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - git mv sanguo_web → _retired/sanguo_web/(git 历史保全+墓碑 README: 归档原因/拍板记录/现役=sanguo_api) - 退出启动面三处: promote.sh ALL_MODS 白名单(15→14 模块)+docker/Dockerfile:63 COPY+docker/Dockerfile.nas:16 COPY——不可再被部署或启动为服务 - 背景(架构审计 P0-3): 硬编码 SECRET_KEY/admin123 默认口令/CORS 全开/可下 真实订单/零测试/与 sanguo_api 路由冲突; 生产从未部署为服务, 纯误启动风险 (README 旧「生产模式 uvicorn sanguo_web」指引已于 f6ca85e 勘误) - three-env §3.1 模块清单+§12 矩阵行同步; session-guide §5 角色表前端行 勘误(旧表把 sanguo_web 当前端模块推——实为 legacy 后端, 前端=frontend/) - 零外部 import(runuweb/tests/packages 全 grep 实证), pytest testpaths=tests 不受影响 Co-Authored-By: Claude Code --- _retired/sanguo_web/README.md | 6 ++++++ {sanguo_web => _retired/sanguo_web}/__init__.py | 0 {sanguo_web => _retired/sanguo_web}/api/__init__.py | 0 {sanguo_web => _retired/sanguo_web}/api/converter.py | 0 {sanguo_web => _retired/sanguo_web}/api/deps.py | 0 {sanguo_web => _retired/sanguo_web}/api/models.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/__init__.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/accounts.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/auth.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/gateway.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/market.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/settings.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/strategy.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/system.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/trades.py | 0 {sanguo_web => _retired/sanguo_web}/api/routes/trading.py | 0 {sanguo_web => _retired/sanguo_web}/database.py | 0 {sanguo_web => _retired/sanguo_web}/services/__init__.py | 0 .../sanguo_web}/services/main_service.py | 0 {sanguo_web => _retired/sanguo_web}/static/css/main.css | 0 {sanguo_web => _retired/sanguo_web}/static/js/api.js | 0 {sanguo_web => _retired/sanguo_web}/static/js/app.js | 0 {sanguo_web => _retired/sanguo_web}/static/js/websocket.js | 0 {sanguo_web => _retired/sanguo_web}/templates/index.html | 0 {sanguo_web => _retired/sanguo_web}/websocket/__init__.py | 0 {sanguo_web => _retired/sanguo_web}/websocket/events.py | 0 {sanguo_web => _retired/sanguo_web}/websocket/manager.py | 0 {sanguo_web => _retired/sanguo_web}/websocket/routes.py | 0 docker/Dockerfile | 1 - docker/Dockerfile.nas | 1 - docs/session-environment-guide.md | 2 +- docs/three-env-code-promote.md | 4 ++-- scripts/nas_sync/promote.sh | 2 +- 33 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 _retired/sanguo_web/README.md rename {sanguo_web => _retired/sanguo_web}/__init__.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/__init__.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/converter.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/deps.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/models.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/__init__.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/accounts.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/auth.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/gateway.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/market.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/settings.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/strategy.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/system.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/trades.py (100%) rename {sanguo_web => _retired/sanguo_web}/api/routes/trading.py (100%) rename {sanguo_web => _retired/sanguo_web}/database.py (100%) rename {sanguo_web => _retired/sanguo_web}/services/__init__.py (100%) rename {sanguo_web => _retired/sanguo_web}/services/main_service.py (100%) rename {sanguo_web => _retired/sanguo_web}/static/css/main.css (100%) rename {sanguo_web => _retired/sanguo_web}/static/js/api.js (100%) rename {sanguo_web => _retired/sanguo_web}/static/js/app.js (100%) rename {sanguo_web => _retired/sanguo_web}/static/js/websocket.js (100%) rename {sanguo_web => _retired/sanguo_web}/templates/index.html (100%) rename {sanguo_web => _retired/sanguo_web}/websocket/__init__.py (100%) rename {sanguo_web => _retired/sanguo_web}/websocket/events.py (100%) rename {sanguo_web => _retired/sanguo_web}/websocket/manager.py (100%) rename {sanguo_web => _retired/sanguo_web}/websocket/routes.py (100%) diff --git a/_retired/sanguo_web/README.md b/_retired/sanguo_web/README.md new file mode 100644 index 00000000..5f883725 --- /dev/null +++ b/_retired/sanguo_web/README.md @@ -0,0 +1,6 @@ +# sanguo_web —— ⚠️ 已退役归档(2026-10-01) + +> - **归档原因**:legacy 平行后端(07 月),生产从未部署为服务;自带硬编码 SECRET_KEY/admin123 默认口令/CORS 全开/可下真实订单(audit/20261001_architecture_code_audit/ P0-3),与现役 `sanguo_api` 路由路径冲突且零测试。 +> - **用户拍板(2026-10-01)**:代码保留归档、服务删除——移出 promote 白名单与 docker COPY 面,确保不可再被启动为服务。 +> - **现役后端**:`sanguo_api`(run_web.py 工厂,NAS 容器与 VPS sanguo-api 同款)。 +> - 全文见 git 历史(归档 commit 前一版路径=sanguo_web/)。 diff --git a/sanguo_web/__init__.py b/_retired/sanguo_web/__init__.py similarity index 100% rename from sanguo_web/__init__.py rename to _retired/sanguo_web/__init__.py diff --git a/sanguo_web/api/__init__.py b/_retired/sanguo_web/api/__init__.py similarity index 100% rename from sanguo_web/api/__init__.py rename to _retired/sanguo_web/api/__init__.py diff --git a/sanguo_web/api/converter.py b/_retired/sanguo_web/api/converter.py similarity index 100% rename from sanguo_web/api/converter.py rename to _retired/sanguo_web/api/converter.py diff --git a/sanguo_web/api/deps.py b/_retired/sanguo_web/api/deps.py similarity index 100% rename from sanguo_web/api/deps.py rename to _retired/sanguo_web/api/deps.py diff --git a/sanguo_web/api/models.py b/_retired/sanguo_web/api/models.py similarity index 100% rename from sanguo_web/api/models.py rename to _retired/sanguo_web/api/models.py diff --git a/sanguo_web/api/routes/__init__.py b/_retired/sanguo_web/api/routes/__init__.py similarity index 100% rename from sanguo_web/api/routes/__init__.py rename to _retired/sanguo_web/api/routes/__init__.py diff --git a/sanguo_web/api/routes/accounts.py b/_retired/sanguo_web/api/routes/accounts.py similarity index 100% rename from sanguo_web/api/routes/accounts.py rename to _retired/sanguo_web/api/routes/accounts.py diff --git a/sanguo_web/api/routes/auth.py b/_retired/sanguo_web/api/routes/auth.py similarity index 100% rename from sanguo_web/api/routes/auth.py rename to _retired/sanguo_web/api/routes/auth.py diff --git a/sanguo_web/api/routes/gateway.py b/_retired/sanguo_web/api/routes/gateway.py similarity index 100% rename from sanguo_web/api/routes/gateway.py rename to _retired/sanguo_web/api/routes/gateway.py diff --git a/sanguo_web/api/routes/market.py b/_retired/sanguo_web/api/routes/market.py similarity index 100% rename from sanguo_web/api/routes/market.py rename to _retired/sanguo_web/api/routes/market.py diff --git a/sanguo_web/api/routes/settings.py b/_retired/sanguo_web/api/routes/settings.py similarity index 100% rename from sanguo_web/api/routes/settings.py rename to _retired/sanguo_web/api/routes/settings.py diff --git a/sanguo_web/api/routes/strategy.py b/_retired/sanguo_web/api/routes/strategy.py similarity index 100% rename from sanguo_web/api/routes/strategy.py rename to _retired/sanguo_web/api/routes/strategy.py diff --git a/sanguo_web/api/routes/system.py b/_retired/sanguo_web/api/routes/system.py similarity index 100% rename from sanguo_web/api/routes/system.py rename to _retired/sanguo_web/api/routes/system.py diff --git a/sanguo_web/api/routes/trades.py b/_retired/sanguo_web/api/routes/trades.py similarity index 100% rename from sanguo_web/api/routes/trades.py rename to _retired/sanguo_web/api/routes/trades.py diff --git a/sanguo_web/api/routes/trading.py b/_retired/sanguo_web/api/routes/trading.py similarity index 100% rename from sanguo_web/api/routes/trading.py rename to _retired/sanguo_web/api/routes/trading.py diff --git a/sanguo_web/database.py b/_retired/sanguo_web/database.py similarity index 100% rename from sanguo_web/database.py rename to _retired/sanguo_web/database.py diff --git a/sanguo_web/services/__init__.py b/_retired/sanguo_web/services/__init__.py similarity index 100% rename from sanguo_web/services/__init__.py rename to _retired/sanguo_web/services/__init__.py diff --git a/sanguo_web/services/main_service.py b/_retired/sanguo_web/services/main_service.py similarity index 100% rename from sanguo_web/services/main_service.py rename to _retired/sanguo_web/services/main_service.py diff --git a/sanguo_web/static/css/main.css b/_retired/sanguo_web/static/css/main.css similarity index 100% rename from sanguo_web/static/css/main.css rename to _retired/sanguo_web/static/css/main.css diff --git a/sanguo_web/static/js/api.js b/_retired/sanguo_web/static/js/api.js similarity index 100% rename from sanguo_web/static/js/api.js rename to _retired/sanguo_web/static/js/api.js diff --git a/sanguo_web/static/js/app.js b/_retired/sanguo_web/static/js/app.js similarity index 100% rename from sanguo_web/static/js/app.js rename to _retired/sanguo_web/static/js/app.js diff --git a/sanguo_web/static/js/websocket.js b/_retired/sanguo_web/static/js/websocket.js similarity index 100% rename from sanguo_web/static/js/websocket.js rename to _retired/sanguo_web/static/js/websocket.js diff --git a/sanguo_web/templates/index.html b/_retired/sanguo_web/templates/index.html similarity index 100% rename from sanguo_web/templates/index.html rename to _retired/sanguo_web/templates/index.html diff --git a/sanguo_web/websocket/__init__.py b/_retired/sanguo_web/websocket/__init__.py similarity index 100% rename from sanguo_web/websocket/__init__.py rename to _retired/sanguo_web/websocket/__init__.py diff --git a/sanguo_web/websocket/events.py b/_retired/sanguo_web/websocket/events.py similarity index 100% rename from sanguo_web/websocket/events.py rename to _retired/sanguo_web/websocket/events.py diff --git a/sanguo_web/websocket/manager.py b/_retired/sanguo_web/websocket/manager.py similarity index 100% rename from sanguo_web/websocket/manager.py rename to _retired/sanguo_web/websocket/manager.py diff --git a/sanguo_web/websocket/routes.py b/_retired/sanguo_web/websocket/routes.py similarity index 100% rename from sanguo_web/websocket/routes.py rename to _retired/sanguo_web/websocket/routes.py diff --git a/docker/Dockerfile b/docker/Dockerfile index 130a2739..7dd6aa31 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -60,7 +60,6 @@ RUN pip install --no-cache-dir --upgrade pip -i https://pypi.tuna.tsinghua.edu.c # 声明装 ≥3.17.9,单装只校验自身依赖可落 3.17.3;vnpy_sqlite 实证兼容)。 # 复制应用代码(包含所有 sanguo 模块) -COPY sanguo_web/ /app/sanguo_web/ COPY vnpy_v4.4.0/vnpy/ /app/vnpy/ COPY sanguo_trader/ /app/sanguo_trader/ COPY sanguo_research/ /app/sanguo_research/ diff --git a/docker/Dockerfile.nas b/docker/Dockerfile.nas index 52115ff8..a5731d47 100644 --- a/docker/Dockerfile.nas +++ b/docker/Dockerfile.nas @@ -13,7 +13,6 @@ COPY sanguo_trader/ ./sanguo_trader/ COPY sanguo_research/ ./sanguo_research/ COPY sanguo_data/ ./sanguo_data/ COPY sanguo_common/ ./sanguo_common/ -COPY sanguo_web/ ./sanguo_web/ COPY vnpy_v4.4.0/vnpy/ ./vnpy/ COPY config/ ./config/ diff --git a/docs/session-environment-guide.md b/docs/session-environment-guide.md index 3ecb01c0..ed0a700e 100644 --- a/docs/session-environment-guide.md +++ b/docs/session-environment-guide.md @@ -103,7 +103,7 @@ ssh 49.232.102.198 'cd C:\sanguo_vnpy_v2 && C:\Python310\python.exe -X utf8 scri | 角色 | 模块 | 改完怎么推 | 必跑验证 | |------|------|-----------|----------| -| **前端** | `sanguo_web` | `--module sanguo_web` | Mac `pytest tests/`(无 web 子目录则全量)+ 浏览器看渲染 | +| **前端** | `frontend/`(Vue) | dist 不走 promote(CI 自动 rsync NAS;VPS 见 three-env §13) | Mac `npm run build` + 浏览器看渲染(`sanguo_web`=legacy 后端已归档 `_retired/`,2026-10-01) | | **后端** | `sanguo_api` | `--module sanguo_api` | Mac `pytest tests/api/` | | **策略** | `sanguo_portfolio` `sanguo_backtest` | **全量**(多模块) | Mac `pytest tests/portfolio/ tests/backtest/` + NAS 冒烟(Step 3) | | **数据** | `sanguo_data` `sanguo_common` | `--module sanguo_data` | NAS 冒烟(Step 3)+ **VPS 冒烟(Step 5)** | diff --git a/docs/three-env-code-promote.md b/docs/three-env-code-promote.md index 12e3dcb5..e3b9b9e8 100644 --- a/docs/three-env-code-promote.md +++ b/docs/three-env-code-promote.md @@ -42,7 +42,7 @@ bash scripts/nas_sync/promote.sh ``` 推送内容: -- 模块目录(15 个): `sanguo_api sanguo_backtest sanguo_common sanguo_data sanguo_factor sanguo_live sanguo_orchestrator sanguo_portfolio sanguo_qmt_bridge sanguo_research sanguo_trader sanguo_web scripts config tests` +- 模块目录(14 个): `sanguo_api sanguo_backtest sanguo_common sanguo_data sanguo_factor sanguo_live sanguo_orchestrator sanguo_portfolio sanguo_qmt_bridge sanguo_research sanguo_trader scripts config tests`(2026-10-01 起 `sanguo_web` 移出——legacy 平行后端归档至 `_retired/sanguo_web/`,退出 promote 白名单与 docker COPY 面) - 根文件(4 个): `pyproject.toml pytest.ini requirements-lock.txt run_web.py` ### 3.2 单模块快速补推 @@ -270,7 +270,7 @@ CI `enforce-label` 强制:本次 push 的 commit 必须带 `[vps]`(VPS 运 | 🔴 | `frontend/`(Vue 源码) | VPS 挂 `frontend/dist`(公网前端);vps-deploy.yml 每次自动构建+推送+重启 sanguo-api(§13) | | 🟡 弱触及 | `sanguo_orchestrator/` | 随 sanguo_api 常驻加载(run_web.py 单进程内存态,app.py 直接 import);VPS 控制台动作可触发,改后同样须重启 sanguo-api | | 🟡 弱触及 | `requirements-lock.txt` | VPS 手动 pip 装,lock 仅参考 | -| 🟢 | `sanguo_web/`(**legacy 平行后端,不是前端**) | 已退役、任何环境不部署(2026-10-01 架构审计 P0-3 待终裁处置);前端=`frontend/` | +| 🟢 | `sanguo_web/`(**legacy 平行后端,不是前端**) | 已退役归档 `_retired/sanguo_web/`(2026-10-01 用户拍板:代码保留、退出 promote 白名单+docker COPY,不可再启动为服务);前端=`frontend/` | | 🟢 | `docker/` `Dockerfile` `entrypoint.sh` `.gitea/` | VPS 无 docker | | 🟢 | `config/`(vnpy_db 等容器 config) | VPS 用 `SANGUO_DB_PATH` env 覆盖(backtest.yaml 仍作种子直推) | diff --git a/scripts/nas_sync/promote.sh b/scripts/nas_sync/promote.sh index 9fa12443..ec4ea924 100755 --- a/scripts/nas_sync/promote.sh +++ b/scripts/nas_sync/promote.sh @@ -21,7 +21,7 @@ VPS_CODE='C:/sanguo_vnpy_v2' # scp 目标用正斜杠 ALL_MODS=(sanguo_api sanguo_backtest sanguo_common sanguo_data sanguo_factor sanguo_live sanguo_orchestrator sanguo_portfolio sanguo_qmt_bridge - sanguo_research sanguo_trader sanguo_web scripts config tests) + sanguo_research sanguo_trader scripts config tests) ROOT_FILES=(pyproject.toml pytest.ini requirements-lock.txt run_web.py) # 解析参数: --module <名>(单模块) / --target (目标机器,默认 all)