[CLAUDE] Docs+Skill: chốt Session 14 wrap-up — PE 3-button workflow + Task 2 defer
Session 14 (2026-05-07) docs/skill update:
STATUS.md:
- Last updated + Phase summary count (95→96 test, 20 mig, 57 bảng, 41 gotcha)
- Recently Done row Session 14 chi tiết (3-button + Task 2 in-progress + DesignTime/Runtime DB gotcha)
HANDOFF.md:
- TL;DR Session 14 prepend với 1 commit + Task 2 defer
- 5 cảnh báo Session 15+: TraLai phase orphan / Task 2 sample seed / DesignTime
vs Runtime DB / Budget N-stage defer / schema-diagram §17-19 defer
migration-todos.md: Phase 9 + Session 14 block 4 sub-task done + 2 defer task
Session log NEW `2026-05-07-2500-3-button-workflow.md`:
- Bối cảnh + spec 3-button (Duyệt/Trả lại/Từ chối) + implementation chi tiết
(Domain policy expand + Service tách reject + FE button + dialog warning)
- Tests update (95→96 với +1 NEW Reject_To_TuChoi_Locks_Permanently)
- Task 2 in-progress: DesignTime vs Runtime DB gotcha + API exit 255 sớm
- Plan organization sau S14
Skill ef-core-migration:
- description + heading: 17→20 migration
- Bảng migration history thêm Mig 18-19 (PE) + Mig 20 (Contract)
- Section MỚI "N-stage workflow pattern (Mig 18-20)" — architecture decision
với filtered unique trick + per-module migration packaging guideline
- Phase 8 update: 83→96 test breakdown
Skill contract-workflow:
- Section MỚI "Phase 9+ done (Mig 18-20 — Session 12/13/14)":
* N-stage workflow PE + Contract (entity + filtered unique split + service
refactor + tests + FE Designer + UsersPage cấp + API)
* PE 3-button approval (Duyệt/Trả lại/Từ chối) Session 14
* Defer: Budget N-stage / Phase TraLai=98 orphan
CLAUDE.md root: 16→20 migration + 55→57 bảng + 83→96 test
docs/rules.md §7: Phase 9 active 83→96 test
Verify: dotnet test 96 pass + npm build (skip — pure docs/skill update).
🎉 Session 14 wrap-up complete. Pushed 1 task (3-button) + Task 2 defer.
Cumulative since session start (13h17): 13 commit (1 button removal +
6 PE N-stage Chunk A-F + 5 Contract N-stage Chunk A,B,C,D,F + 1 3-button).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -1,6 +1,63 @@
|
||||
# HANDOFF — Brief 5 phút cho session tiếp theo
|
||||
|
||||
**Last updated:** 2026-05-07 (Session 13 — **Mirror N-stage Contract (Mig 20, 5 commit per-chunk + skip Chunk E auto-bind). Domain → App → Service → Tests +6 → FE Designer. 95 test pass. Budget defer cần versioned WF.**)
|
||||
**Last updated:** 2026-05-07 (Session 14 — **PE 3-button workflow Duyệt/Trả lại/Từ chối — Domain policy expand + Service tách reject 2 case + FE 3-button + 1 test mới = 96 pass. 1 commit `0d77698`. Task 2 sample seed defer (DesignTime vs Runtime DB gotcha + API exit sớm).**)
|
||||
|
||||
## TL;DR Session 14 (07/05 — PE 3-button approval workflow)
|
||||
|
||||
User chỉ thị thay 2-button approval (Duyệt + Reject mơ hồ) bằng **3 hành động rõ ràng** cho approver:
|
||||
- **Duyệt** = forward phase tiếp theo (decision=Approve)
|
||||
- **Trả lại** = về DangSoanThao + Drafter sửa (decision=Reject + target=DangSoanThao). Smart reject pattern Mig 16 + clear N-stage rows + Drafter resume jump-back tới phase đã reject.
|
||||
- **Từ chối** = phase=TuChoi (decision=Reject + target=TuChoi). Phiếu khoá vĩnh viễn (17 handler Mig 16 lock edit). Drafter phải tạo phiếu mới.
|
||||
|
||||
**1 commit (`0d77698`):**
|
||||
|
||||
- **Domain `PurchaseEvaluationPolicy.cs`**: NccOnly + NccWithPlan thêm `(X → TuChoi)` transition cho mọi phase trung gian (ChoPurchasing/ChoDuAn/ChoCCM/ChoCEODuyetPA/ChoCEODuyetNCC) với roles của phase đó. FromDefinition expand: mỗi step (trừ DangSoanThao) thêm (step.Phase → TuChoi) với roles step.
|
||||
- **Service** `PurchaseEvaluationWorkflowService.TransitionAsync` — Reject branch tách 2 case:
|
||||
```
|
||||
if (decision == Reject) {
|
||||
if (target != TuChoi) { // Trả lại
|
||||
RejectedFromPhase = fromPhase
|
||||
target = DangSoanThao // force
|
||||
clear N-stage rows tại fromPhase
|
||||
}
|
||||
// else target=TuChoi: giữ nguyên, KHÔNG set RejectedFromPhase, KHÔNG clear
|
||||
}
|
||||
```
|
||||
- **FE PeWorkflowPanel (admin + user mirror)**: render 3 button rõ:
|
||||
- "✓ Duyệt → <label phase>" brand
|
||||
- "← Trả lại (về Drafter sửa)" red khi `target=DangSoanThao && fromPhase != DangSoanThao`
|
||||
- "✗ Hủy / Từ chối" red khi `target=TuChoi`
|
||||
- Decision logic FE: `isReject = target=TuChoi || isSendBack`
|
||||
- **Dialog confirm**: title rõ theo loại, Cancel case warning đỏ "Phiếu sẽ bị khoá hoàn toàn", SendBack case hint amber "Phiếu về DangSoanThao, Drafter sửa rồi trình lại — workflow tự jump tới phase này".
|
||||
- **Tests update + add 1**:
|
||||
- rename `Reject_Sets_RejectedFromPhase_And_Forces_DangSoanThao` → `Reject_To_DangSoanThao_Sets_RejectedFromPhase_TraLai` (change target TuChoi→DangSoanThao)
|
||||
- NEW `Reject_To_TuChoi_Locks_Permanently_No_RejectedFromPhase` (Phase=TuChoi + RejectedFromPhase null)
|
||||
- update `NStage_Reject_Clears_InnerStep_Rows_At_Phase` target → DangSoanThao
|
||||
- **95 → 96 test pass** (+1 Từ chối).
|
||||
|
||||
**Task 2 sample seed in-progress (defer Session 15+):**
|
||||
|
||||
- Phát hiện gotcha: `DesignTimeDbContextFactory` hardcoded `SolutionErp_Design` connection — `dotnet ef database update` từ session 12-13 thực ra apply lên `_Design` DB, KHÔNG phải `_Dev` runtime DB. Khi user run API → DbInitializer auto-MigrateAsync apply lên `_Dev`.
|
||||
- Đã apply Mig 9-20 lên `SolutionErp_Dev` qua `dotnet ef database update --connection`.
|
||||
- Start API để DbInitializer auto-seed 30 demo user. API exit 255 sớm khi log buffer full (~100 lines) — seeding dở dang (chỉ seed Roles, chưa Users).
|
||||
- Defer Task 2 cho session sau. Cần: user manual `dotnet run` API 1 lần hoàn thành seed, hoặc Claude resume với output redirect to file.
|
||||
|
||||
## ⚠️ CẢNH BÁO Session 15+
|
||||
|
||||
1. **Phase TraLai = 98 (orphan)** — Domain enum đã có từ S11+++++++ nhưng KHÔNG dùng (user chốt Session 14 không cần phase trung gian, chỉ DangSoanThao + TuChoi). Để giữ enum không phá nhưng ko wire vào policy → orphan. Có thể remove migration sau (không gây hại).
|
||||
|
||||
2. **Task 2 sample seed pending**: 2 việc:
|
||||
- Update `Users.PositionLevel` (1=NV, 2=PP, 3=TP) cho 30 demo user đã seed (mapping email pattern: `tpb./ccm./pro./fin./act./equ./hra.` → 3 (TP), `pp.*` → 2 (PP), `nv./qs./` else → 1 (NV), `bod./pm./admin./huy.duong/chau.le` → null)
|
||||
- INSERT N-stage WorkflowDefinition v2 cho DuyetNcc với InnerSteps (PRO + CCM × 3 cấp NV/PP/TP)
|
||||
|
||||
3. **DesignTime vs Runtime DB distinction**: dev có 2 DB:
|
||||
- `SolutionErp_Design` — `dotnet ef migrations add/update` (DesignTimeDbContextFactory hardcode)
|
||||
- `SolutionErp_Dev` — runtime API (appsettings.Development.json)
|
||||
Khi muốn apply migrations lên Dev: `dotnet ef database update --connection "...SolutionErp_Dev..."` hoặc `dotnet run` API (DbInitializer auto-MigrateAsync).
|
||||
|
||||
4. **Budget N-stage defer** — chưa wire vì Budget chưa có versioned WorkflowDefinition. Cần migration `AddBudgetVersionedWorkflow` + `AddBudgetWorkflowInnerSteps`. User quyết riêng (feature mở rộng module lớn).
|
||||
|
||||
5. **schema-diagram §17-19 Mig 18-20** chưa update — defer cron audit 2026-06-01.
|
||||
|
||||
## TL;DR Session 13 (07/05 — Mirror N-stage workflow sang Contract)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user