wal: flush 20260729T2205

This commit is contained in:
pqhuy1987
2026-07-29 22:05:53 +07:00
parent b97b4b7405
commit a66b0a8341
2 changed files with 56 additions and 1 deletions

View File

@ -23,7 +23,8 @@ chain:
- [x] **W2 ĐÓNG — cicd VERDICT=PASS 6/6** (PHÉP 1+4 cicd [CI #428 gate 574 · bundle 2-app rotate + marker 1/1 + control-âm 3-tầng] + PHÉP 2+3+5+6 lead 2-nguồn [0-mig MIGTOP giữ · menu 142 · smoke 200 + **picker trả PE THẬT `PE/2026/A/045`** + control 404 · CỜ 13/13/2 giữ]). Synthesis `runs/2026-07-29-S161-khkk-w2-crud/w2-synthesis.md`. Tồn: F-10 bịt-đồng-bộ-2-module (cần anh) · dựng WF tay type-3+10 (trước W5) · UAT non-Admin
- [x] gate 5-anchor W3 PASS 5/5 (content-based; A1 path thật = Infrastructure/Services)
- [x] W3 đợt-1 `wf_ef4d05a8-98c` XONG (2 lane #53, sub-md cứu trọn): BE skeleton + rào-FK-547-vắng-dep + đối-chứng-chéo-FE-5/5 + 3 quyết lead-duyệt · FE panel wire :324 ×2 + SHA-pair 3/3 + marker ×3 bundle; build 0W/0E + 574/0 giữ; harvest 2 diary xong
- [!] wf: W3 đợt-2 `wf_445f7e28-38b` test-specialist 6-test-RED ĐANG CHẠY → đợt-3 BE implement GREEN (copy ApproveV2Async:217-394 adapt 3) → reviewer → ship. Run-folder `runs/2026-07-29-S161-khkk-w3-duyet/`
- [x] W3 đợt-2 `wf_445f7e28-38b` XONG (#53, sub-md+file cứu): 6 test PIN land, **lead chạy RED-evidence: 6/6 ĐỎ THẬT** (5 NotImplementedException từng nhánh + Inbox đỏ-assertion); fixture-riêng-có-interceptor vì CreatedBy (2 quyết hạ tầng khai trong sub-md)
- [!] wf: W3 đợt-3 `wf_c9d5f8d4-cbe` BE IMPLEMENT ĐANG CHẠY — đích 6/6 GREEN + suite **580/0** (uỷ quyền sửa TEST chỉ-khi-lỗi-seed, cấm nới assert; khai save-điểm + admin-override-site-2) → reviewer → ship. Run-folder `runs/2026-07-29-S161-khkk-w3-duyet/`
- [ ] W6 → W5 → W7 theo đồ thị plan-cha (sau W3)
- [ ] đợt-2 SAU khi wf về: test-specialist + database-agent (song song) → lead acceptance §③-B (build·test·sqlcmd 96·Down sạch·đo CỜ) → reviewer → commit/push → cicd-monitor 3-chân-kiềng
- [ ] setup thủ công TRƯỚC W5 (SAU W1 vì type=10 cần mig 69): dựng workflow type=3 + type=10 3-trạm qua Designer (seed chỉ 1 trạm)

View File

@ -0,0 +1,54 @@
# sub-test-specialist-2 — S161 W3 ĐỢT-2 TEST-BEFORE (6 test sàn, kỳ vọng ĐỎ)
> Ghi TỪNG MỤC trong lúc làm (bài #53: chỉ thứ trên đĩa mới sống).
> Scope MINE: `tests/SolutionErp.Infrastructure.Tests/Application/ContractSigningPlanApprovalTests.cs` (file MỚI).
> KHÔNG chạm: `src/Backend/**` · `fe-*/**` · slnx · commit/push · MEMORY.md.
⚠️ **Tên file sub-md:** lệnh lead (khối LUẬT) ghi `sub-test-specialist-2.md`; khối RUN-TRACE
boilerplate ghi `sub-test-specialist-0.md`. Chọn **-2** vì khớp đánh số của chính run-folder này
(implementer-backend-**0**, implementer-frontend-**1**) và tránh đè file (bài S133: 2 invocation
cùng role + cùng index ghi đè nhau, mất trọn nội dung). Khai ở đây để lead không phải đoán.
---
## §0 — ĐO TRƯỚC KHI GÕ (baseline TƯƠI, không tin số đề bài)
| Mục đo | Lệnh | Kết quả |
|---|---|---|
| Baseline | `dotnet test SolutionErp.slnx --nologo -v minimal -p:BuildInParallel=false -maxcpucount:1` | Domain **45/45** · Infra **529/529** · Failed **0****574** — KHỚP số bàn giao |
| Chữ ký service | `IContractSigningPlanWorkflowService.cs:25-29` + `ContractSigningPlanWorkflowService.cs:78-82` | `new ContractSigningPlanWorkflowService(db, currentUser, dateTime, notifications)` · `TransitionAsync(planId, action, comment, ct)` |
| Record trả về | `IContractSigningPlanWorkflowService.cs:38-41` | `ContractSigningPlanTransitionResult(int Phase, int? CurrentWorkflowStepIndex, int? CurrentApprovalLevelOrder)``Phase`**int** (QUYẾT-1 lane BE) |
| Skeleton ném gì | `ContractSigningPlanWorkflowService.cs:108/113/117/121` | `NotImplementedException("W3 đợt-3: " + action)` cho cả 4 nhánh ⇒ ĐỎ THẬT |
| Inbox W2 (không chạm service) | `ContractSigningPlanFeatures.cs:725-752` + `:229-264` | `GetMyContractSigningPlanInboxQueryHandler(db, currentUser)`; non-admin qua `ResolveV2InboxIdsAsync`**CHẠY ĐƯỢC HÔM NAY** |
| Con-trỏ là INDEX hay Order? | `ContractSigningPlanFeatures.cs:256-260` | `steps[idx]` sau `OrderBy(s => s.Order)``CurrentWorkflowStepIndex` = **INDEX 0-based**, KHÔNG phải `Step.Order`. Mã W2 đã chốt ⇒ test được phép ép Step.Order ≠ index (xem §2 T2) |
| FK bắt buộc row thật | `ApprovalWorkflowConfiguration.cs:72-75` (Level.ApproverUserId → Users **Restrict**) · `ContractSigningPlanConfiguration.cs:36-39` (Plan.ApprovalWorkflowId → ApprovalWorkflows **Restrict**) | ⇒ seed PHẢI có User thật + ApprovalWorkflow thật |
| loose-Guid (khỏi seed) | `ContractSigningPlanConfiguration.cs:10-12` + `ContractSigningPlan.cs:24-29` | `PurchaseEvaluationId / ProjectId / DepartmentId / DrafterUserId` KHÔNG FK ⇒ **không cần seed PE/Project/Department** (khác hẳn W2) |
| `MaKeHoach` UNIQUE | `ContractSigningPlanConfiguration.cs:28` | filtered unique ⇒ mỗi phiếu trong 1 fixture phải mã KHÁC nhau |
| Nguồn copy đợt-3 (để biết đo cái gì) | `ContractWorkflowService.cs:246` GroupBy · `:255-266` OR-of-N + **admin bypass** · `:289-316` UPSERT · `:355-393` advance/terminal | terminal set **CẢ HAI** con-trỏ = null (`:380-381`) ⇒ test pin null tại terminal |
| Stub notify có sẵn | `CreateContractCommandApplicableTypeTests.cs:95` `NoOpNotificationServiceApp`**cùng namespace** `...Tests.Application` | dùng thẳng, KHÔNG đẻ stub thứ 2 |
**Kết luận §0:** seed W3 NHẸ hơn W2 nhiều (không PE, không Supplier, không quote) — chỉ
`Users` + `ApprovalWorkflow(+Steps+Levels)` + `ContractSigningPlan(+Lines)`.
---
## §1 — 2 quyết định hạ tầng của file test
**(1) Fixture RIÊNG `KhkkWorkflowFixture``AuditingInterceptor`** (mirror `ContractSigningPlanCrudTests.cs:49-82` W2).
Lý do KHÔNG dùng `IdentityFixture`: guard trình đợt-3 = `CreatedBy == actor DeptManager Admin`
`CreatedBy` của phiếu phải là NGƯỜI THẬT. `TestApplicationDbContext` trần KHÔNG wire interceptor
`CreatedBy` sẽ là `null` cho mọi phiếu ⇒ nhánh `CreatedBy == actor` KHÔNG BAO GIỜ đúng, test
`submit` sẽ đỏ vì lý do sai. Seed phiếu bằng context của chính người soạn ⇒ `CreatedBy` khớp
`DrafterUserId` (2 đường đọc, cùng 1 giá trị — đợt-3 chọn đường nào cũng đúng).
**(2) User seed THẲNG `db.Users.Add(...)`, KHÔNG qua `UserManager`.**
Service đợt-3 lấy role từ `ICurrentUser.Roles` (lane BE khai QUYẾT-2: cố ý KHÔNG inject
`UserManager`) ⇒ kéo cả Identity stack vào chỉ để có row FK là phí. Repo chưa có tiền lệ
`db.Users.Add` trong tests (grep 0 hit) ⇒ mục này là **cái mới**, và nó chỉ hợp lệ vì
`Level.ApproverUserId` cần *row tồn tại*, không cần *đăng nhập được*.
---
## §2 — 6 test: đo gì, bẫy cài ở đâu
(điền tiếp bên dưới trong lúc viết)