# 外部 DLL manual-only fake verifier 實作與驗收紀錄

本文件記錄第五階段外部 DLL manual-only 節點的最小程式實作與驗收結果。本節點只完成 manual-only gate、request / result / plan / options、fake verifier 與測試；沒有載入真實 DLL，沒有掃描 plugin folder，沒有修改 config schema、Adapter public contract、WebApi、ServiceHost、Windows Service 或 DB schema。

## 0. 驗收狀態

| 項目 | 內容 |
|---|---|
| 驗收日期 | 2026-06-07 |
| 文件狀態 | 已完成 |
| 程式 repo | `hs-device-control-template` |
| 程式 branch | `poc/nmodbus-tcp` |
| 程式 commit | `bc3f191` |
| Commit 訊息 | 新增外部 DLL manual-only fake 驗證 |
| GitHub Actions | `27085788163` success |
| 本節點結論 | external DLL manual-only fake verifier 已在核准範圍內完成 |

## 1. 程式變更範圍

| 類型 | 檔案 |
|---|---|
| Error codes | `src/HS.DeviceControl.Application/Common/ApplicationErrorCodes.cs` |
| Request | `src/HS.DeviceControl.Application/Plugins/ExternalDllManualVerificationRequest.cs` |
| Options | `src/HS.DeviceControl.Application/Plugins/ExternalDllManualVerifierOptions.cs` |
| Plan | `src/HS.DeviceControl.Application/Plugins/ExternalDllManualVerificationPlan.cs` |
| Result | `src/HS.DeviceControl.Application/Plugins/ExternalDllManualVerificationResult.cs` |
| Contract | `src/HS.DeviceControl.Application/Plugins/IExternalDllManualVerifier.cs` |
| Fake verifier | `src/HS.DeviceControl.Application/Plugins/ExternalDllManualVerifier.cs` |
| Tests | `tests/HS.DeviceControl.Application.Tests/ExternalDllManualVerifierTests.cs` |

## 2. 實作結果

| 項目 | 結果 |
|---|---|
| Manual gate | 預設關閉；options 與 request 都明確允許時才可通過 fake verifier。 |
| Request validation | 檢查 plugin id、source summary 與安全摘要欄位。 |
| Source safety | 疑似完整路徑或敏感資訊會回 `APP-0353`。 |
| Contract version | 不符合預期時回 `APP-0355`。 |
| Checksum | 不符合預期時回 `APP-0354`。 |
| Result safety | message、warning、error 會遮蔽敏感資訊或疑似路徑。 |
| Plan | 回傳 required manual conditions 與 prohibited actions，明確標示本節點禁止真實載入。 |

## 3. 驗證結果

| 驗證項目 | 結果 |
|---|---|
| `dotnet test tests\HS.DeviceControl.Application.Tests\HS.DeviceControl.Application.Tests.csproj --no-restore` | 57 passed / 0 failed / 0 skipped |
| `dotnet test HS.DeviceControl.sln --no-restore` | 509 passed / 0 failed / 0 skipped |
| 停止線掃描 | 新增檔案與 staged diff 未命中外部載入 API、`.dll` 字串、plugin folder、`PluginLoadState.Loaded` 或 `external-code-load` |
| `git diff --cached --check` | 通過 |
| GitHub Actions | `27085788163` completed success |

補充：測試時仍出現既有 `.NET 5.0` EOL warning，這不是本節點新增問題。

## 4. 未納入與仍需確認事項

- 未載入真實 DLL。
- 未建立真實 DLL fixture。
- 未掃描 plugin folder。
- 未新增 config schema。
- 未修改 samples config。
- 未修改 Adapter public contract。
- 未修改 WebApi route、auth 或 Swagger。
- 未修改 ServiceHost 或 Windows Service。
- 未建立 DB audit table，也未執行 DDL / ALTER TABLE / Apply。
- 未保存或輸出完整路徑、secret、token、connection string、正式 IP 或正式 port。

## 5. 驗收結論

外部 DLL manual-only 節點已完成本批核准範圍：只做 fake verifier 與可稽核的 manual gate，不做真實 DLL 載入。下一步可進入 5B config schema 邊界分析與實作前確認；5B 仍屬 config schema 高風險邊界，需先完成文件確認後才可修改程式 repo。
