# 审计 — 新服务器接入自动化

## 范围（文件清单）

| 文件 | 变更 |
|------|------|
| `server/application/services/server_onboarding_service.py` | 调度入口 |
| `server/application/services/server_batch_service.py` | `_run_onboard` |
| `server/application/server_batch_common.py` | `detect_and_save_target_path` |
| `server/api/servers.py` | 创建/导入/IP 添加钩子 |
| `server/api/schemas.py` | `onboarding_job_id` |
| `frontend/src/composables/servers/useServerFormDialog.ts` | 任务注册 |
| `tests/test_server_onboarding.py` | 单测 |

## Step 3 规则扫描

| H | 规则 | 结论 |
|---|------|------|
| H1 | sudoers 仍走白名单模板 | PASS |
| H2 | 创建 API 不因 onboard 失败而 5xx | PASS — 后台 job |
| H3 | 探测失败不阻断推送 | PASS — wwwroot 回退 |

## Closure

| H | 判定 | 依据 |
|---|------|------|
| H1 | PASS | files_sudoers_service |
| H2 | PASS | schedule 独立 try/except |
| H3 | PASS | detect 失败 stdout 提示 |

## DoD

- [x] pytest test_server_onboarding
- [x] changelog 2026-06-11-server-onboarding-automation.md
- [x] 设计 docs/design/specs/2026-06-11-server-onboarding-automation-design.md

## 验证

```bash
pytest tests/test_server_onboarding.py -q
```
