# Changelog: 2026-06-01 全量 Bug 修复 ## 变更摘要 一次性修复交接文件第八节 P0~P3 项及审查发现的认证/数据流问题。 ## 动机 - Vue `ServersPage` 批量 Agent 操作因 Vuetify `item-value` 返回 ID 而非对象导致 `server_ids` 无效 - Access Token 30 天与 Refresh Cookie 架构不一致;SPA 未使用 `credentials` 与自动 refresh - Agent 心跳直写 MySQL 与 Redis→10min 刷库设计冲突 - script-callback 缺少 `X-API-Key` 层防护 ## 涉及文件 ### 前端 - `frontend/src/pages/ServersPage.vue` - `frontend/src/api/index.ts` - `frontend/src/stores/auth.ts` - `frontend/src/router/index.ts` - `frontend/src/pages/TerminalPage.vue` - `frontend/src/utils/serverSelection.ts`(新) - `frontend/src/utils/apiError.ts`(新) ### 后端 - `server/api/agent.py` - `server/application/services/auth_service.py` - `server/config.py` - `server/application/services/script_jobs.py` - `server/application/services/script_service.py` - `server/domain/models/__init__.py` - `server/infrastructure/database/admin_repo.py` - `server/infrastructure/database/migrations.py` - `server/main.py` - `server/api/settings.py`(ruff 清理) ### 测试 - `tests/test_api.py` - `tests/test_nexus_v6.py` - `tests/test_step1to5_features.py` ### 文档 - `docs/design/specs/2026-06-01-bug-remediation-design.md` - `docs/design/plans/2026-06-01-bug-remediation.md` - `docs/audit/2026-06-01-bug-remediation.md` ## 是否需迁移/重启 - **需要**重启 Nexus 后端(认证、Agent、迁移 DROP 列) - **需要**重新构建并部署前端 SPA - 启动时自动执行 `admins` 表 DROP 废弃列(已存在则跳过) ## 生产部署记录(2026-06-01) - Git: `8311821` → `origin/main` - 后端: `supervisorctl restart nexus`,`/health` → `ok` - 前端: Vite build + tar/scp,`index.html` → `index-ngtHwr8t.js`,`ServersPage-Vzm34hgn.js` - 浏览器: 登录成功进入仪表盘与服务器列表 - API: `expires_in=3600`(60 分钟 access token) ## 验证方式 ```bash ruff check server/ python -c "import server.main" cd frontend && npm run type-check pytest tests/test_nexus_v6.py tests/test_step1to5_features.py -q ``` - 服务器页:勾选多台 → 批量安装 Agent → 提示 `N/M 成功` - 登录后刷新页面:HttpOnly refresh 恢复会话(无 localStorage token) - 未知 server_id 心跳:200 `discarded`,日志 debug 级 422 ## 未改项说明 - **WebSSH JWT 在 URL**:仍用 15 分钟专用 token + query(需 WS 协议改造,单独迭代) - **sysctl 命令注入**:当前 `sync_engine_v2` 已无 sysctl 拼接路径