本文件記錄第五階段 5B config schema 的程式實作、測試、停止線與提交驗收。5B 僅完成 appsettings metadata-only schema 與 validator,不代表系統已啟用真實 PluginLoader、外部 DLL 載入、DB audit、auth / Swagger 或 Windows Service。
0. 基本資訊
| 項目 | 內容 |
| 驗收日期 | 2026-06-07 |
| 對應節點 | 第五階段 5B config schema |
| 程式 repo / branch | hs-device-control-template / poc/nmodbus-tcp |
| 程式 commit | 1f635d6,新增 5B config schema 驗證 |
| GitHub Actions | 27087431249 success |
| 文件 repo 自動狀態同步 | 27087433624 success |
1. 程式修改範圍
| 類別 | 檔案 |
| Config model | AppSettingsConfig.cs |
| Config validator | ConfigValidator.cs |
| Sample config | samples/config/appsettings.json |
| Core tests | ConfigValidatorTests.cs、ConfigLoaderTests.cs |
| Config 文件 | docs/config-schema.md |
2. 實作內容
| 項目 | 結果 |
PluginLoader schema | 新增 metadata-only gate 與 contract / checksum 比對欄位。 |
| safe default | Enabled、AllowManualExternalDllVerification、AllowDisabledPluginReview 預設皆為 false。 |
Plugins schema | 新增 plugin id、version、contract version、checksum、source summary、enabled、disabled reason 與 capabilities。 |
| validator | 驗證必填、重複 PluginId、停用原因、capability、敏感字串與 unsafe source summary。 |
| sample config | 新增安全範例,不保存路徑、正式連線資訊或可載入檔案資訊。 |
3. 測試與驗收結果
| 驗證項目 | 結果 |
| Core.Tests | 196 passed / 0 failed / 0 skipped |
| Application.Tests | 57 passed / 0 failed / 0 skipped |
| Solution tests | 516 passed / 0 failed / 0 skipped |
| 停止線掃描 | 本次修改的 Core config / sample config 未命中外部載入 API、plugin folder scan、DB DDL、Swagger 或 Windows Service。 |
| 污染字串掃描 | 未命中指定污染字串。 |
| GitHub Actions | 27087431249 completed success |
4. 停止線確認
本次沒有載入外部 DLL、掃描 plugin folder、保存正式連線資訊、修改 Application plugin options public contract、修改 WebApi / ServiceHost / Adapter,或新增 DB audit / DDL / Apply。
5. 驗收結論
5B config schema 已完成本批核准範圍。下一步可進入 5C DB audit 邊界分析與實作前確認;任何 DB audit table、DDL、正式 Apply 或真實 DB 寫入仍需停下確認。