5C DB audit 程式 repo 結構檢查與實作前盤點

返回文件索引

本文件以唯讀方式檢查程式 repo 目前的 audit / MySQL / schema / plugin 結構、候選檔案、測試基準與停止線。使用者尚未確認 5C 七項前,不修改程式 repo。

0. 檢查結論

項目結論
5C 承接位置第一批建議承接在 Application 層 audit contract / fake writer,不直接寫 MySQL。
既有 audit modelPluginAuditRecord 已存在,語意是安全摘要且明確不負責 DB 寫入。
既有 MySQL infrastructureHS.DeviceControl.Infrastructure.MySql 已存在,含 schema、LogWriter、TaskTraceStore、TaskStore 與 manual-only 測試入口。
本批不建議修改不直接改 MySQL writer、不新增 table、不改既有 DB public contract。

1. 候選新增 / 修改檔案

類型候選檔案建議
Audit modelsrc/HS.DeviceControl.Application/Auditing/AuditEventRecord.cs新增最小 audit event record,保存安全摘要欄位。
Audit writersrc/HS.DeviceControl.Application/Auditing/IAuditEventWriter.cs建立 writer contract,不綁 MySQL。
Fake writersrc/HS.DeviceControl.Application/Auditing/InMemoryAuditEventWriter.cs提供測試與本機驗證用 fake writer。
Teststests/HS.DeviceControl.Application.Tests新增 audit event record、writer、敏感資訊遮蔽測試。

2. 測試基準

測試結果
dotnet test tests\HS.DeviceControl.Application.Tests\HS.DeviceControl.Application.Tests.csproj --no-restore57 passed / 0 failed / 0 skipped
dotnet test tests\HS.DeviceControl.Infrastructure.MySql.Tests\HS.DeviceControl.Infrastructure.MySql.Tests.csproj --no-restore89 passed / 0 failed / 0 skipped
dotnet test HS.DeviceControl.sln --no-restore516 passed / 0 failed / 0 skipped

3. 明確停止線

4. 下一步

請等待使用者回覆 5C DB audit 實作前確認表 七項同意後,再進入程式 repo 的第一批 audit contract / fake writer 實作。