1. 現有結構
| 類型 | 現況 |
|---|---|
| WebApi project | HS.DeviceControl.WebApi.csproj,目前未引用 Swagger / OpenAPI package。 |
| Startup | 註冊 controllers、mock / in-memory Application services;尚未有 auth / Swagger pipeline。 |
| Controllers | TasksController、DevicesController、SchemaController、HealthController。 |
| Tests | WebApiControllerTests.cs,目前 7 tests passed。 |
2. 候選檔案
| 類型 | 候選檔案 | 風險 |
|---|---|---|
| Auth options | src/HS.DeviceControl.WebApi/Security/WebApiAuthOptions.cs | 不得保存正式 secret。 |
| Auth handler | src/HS.DeviceControl.WebApi/Security/ApiKeyAuthenticationHandler.cs | 錯誤訊息不得回顯 credential。 |
| Startup | src/HS.DeviceControl.WebApi/Startup.cs | pipeline 順序需測試。 |
| Swagger package | HS.DeviceControl.WebApi.csproj | 新增套件前需確認版本與範圍;production disabled。 |
| Tests | tests/HS.DeviceControl.WebApi.Tests | 需覆蓋 401、403、success、dev-only / production disabled。 |
3. 必跑測試
dotnet test tests\HS.DeviceControl.WebApi.Tests\HS.DeviceControl.WebApi.Tests.csproj --no-restore、Application tests、solution tests、停止線掃描與 commit 前檢查。