From 1bc6b708fc2abfe22b6ee8fdd59a8e9019a94c65 Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Tue, 26 May 2026 18:16:41 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20Docs:=20patch=20CLAUDE.md+docs/CLAUD?= =?UTF-8?q?E.md+implementer.md=20drift=20S19=E2=86=92S32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewer S33 startup audit verdict SEVERE drift CLAUDE.md baseline header (emain context first-load file misleads sub-agent spawns post-S19). Patches (10 line cross 3 file): - CLAUDE.md mig count 26→33 + bảng 59→60 (Mig 32+33 Plan B Contract V2 S29) - CLAUDE.md test count 81→111 × 2 sites - CLAUDE.md gotcha count 26→52 (cumulative S22-S32 +26 entries) - CLAUDE.md schema-diagram table 52→60 + +§14 Contract V2 LevelOpinions - CLAUDE.md audit next cycle 2026-05-01→2026-06-01 (cron next due 6 ngày) - CLAUDE.md Contract V2 wire status "chưa wire" → "ĐÃ WIRE (Mig 32+33 Plan B)" - docs/CLAUDE.md gotchas table 38→52 pitfall - implementer.md test baseline 81→111 × 2 (verify command + report format) Drift defer 2026-06-01 batch (Reviewer recommend): - investigator.md + reviewer.md gotcha 44→52 cosmetic - docs/gotchas.md #50/#51 renumber order (non-functional) Smart Friend independence note: Reviewer NOT softened verdict — em main patched S29 sub-agent cicd-monitor.md baseline but MISSED CLAUDE.md root cùng pass. Pattern reinforced: khi update mig count phải bundle CLAUDE.md. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/agents/implementer.md | 4 ++-- CLAUDE.md | 12 ++++++------ docs/CLAUDE.md | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.claude/agents/implementer.md b/.claude/agents/implementer.md index dbcc784..76f891f 100644 --- a/.claude/agents/implementer.md +++ b/.claude/agents/implementer.md @@ -120,7 +120,7 @@ Scope (pick 1): `Contract` · `PurchaseEvaluation` · `Budget` · `Form` · `Wor ### 4. Verify - Build clean: `dotnet build SolutionErp.slnx --nologo -v quiet` (0 err) -- Tests PASS (baseline 81 preserve): `dotnet test SolutionErp.slnx` +- Tests PASS (baseline 111 preserve): `dotnet test SolutionErp.slnx` - **Phase 9 UAT exception:** SKIP per chunk khi em main spec nói "UAT skip" — vẫn `npm run build` × 2 app - FE build: `cd fe-admin && npm run build` + `cd fe-user && npm run build` (mirror) - Live verify if deploy claim (sau CI run trên Gitea Actions complete): `curl https://api.solutions.com.vn/api/{controller}` @@ -138,7 +138,7 @@ Diff summary: Verification: - Build: clean / fail [error] -- Tests: 81/81 PASS (or "skipped per UAT rule") +- Tests: 111/111 PASS (or "skipped per UAT rule") - npm build × 2 app: pass / fail - Live verify (if applicable): [curl results] diff --git a/CLAUDE.md b/CLAUDE.md index d80fb1c..81f2438 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -50,7 +50,7 @@ Kiến trúc: **.NET 10 Clean Architecture + 2 React FE (admin + user) + SQL Ser - Audit fields: `CreatedAt`, `UpdatedAt`, `CreatedBy`, `UpdatedBy` (`BaseEntity`) - Soft delete: `IsDeleted`, `DeletedAt`, `DeletedBy` (`AuditableEntity`) - Migrations: `dotnet ef migrations add --project src/Backend/SolutionErp.Infrastructure --startup-project src/Backend/SolutionErp.Api` -- **Hiện có 26 migration → 59 bảng** (Phase 9+ Session 19 — Mig 26 `AddPeLevelOpinionsForV2`: bảng mới `PurchaseEvaluationLevelOpinions` UNIQUE composite (PEId, LevelId), FK Cascade Pe + Restrict Level. Section 5 "Ý kiến cấp duyệt" V2 dynamic theo workflow đã pin: forEach Step (Phòng) → forEach Level (Cấp) → forEach NV → 1 OpinionBox. Service `ApproveV2Async` UPSERT auto khi NV duyệt — Q1=1B (sync gắn với Duyệt, KHÔNG form input rời). SignedByUserId track signer thật, FE banner "Admin duyệt thay" khi !== ApproverUserId. Comment empty → "(duyệt — không ý kiến)" placeholder. Phiếu V1 legacy fallback Mig 15 4 box readOnly (data history). Mig 25 `AddIsUserSelectableToApprovalWorkflows`: ALTER `ApprovalWorkflows` +`IsUserSelectable bit` (admin pin/unpin workflow nào cho user pick lúc create phiếu, multi-select độc lập IsActive). Backfill `WHERE IsActive=1 SET 1` giữ behavior cũ. Designer +badge "Cho user chọn" + button Ghim/Bỏ ghim. Workspace filter dropdown chỉ workflows `IsUserSelectable=true`. Mig 22-24 V2 schema (Session 17): `ApprovalWorkflows`/Steps/Levels — Quy trình > Bước (Phòng) > Cấp (N NV cụ thể qua ApproverUserId, OR-of-N cùng cấp). PE.ApprovalWorkflowId pin V2. PE.CurrentApprovalLevelOrder track. State machine 5 trạng thái: Nháp / Đã gửi duyệt / Trả lại (Phase riêng TraLai=98) / Từ chối / Đã duyệt. PE Service V2 wire match `actor.Id == ApproverUserId`. Contract V2 chưa wire (Mig 27/28 defer Session 20+). 81 test pass. Mig 21 V1 flat workflow vẫn live cho phiếu cũ.) +- **Hiện có 33 migration → 60 bảng** (Phase 9+ Session 32 — Mig 32+33 Plan B Contract V2 cookie-cutter mirror PE Mig 22-26 (S29). Mig 26 `AddPeLevelOpinionsForV2`: bảng mới `PurchaseEvaluationLevelOpinions` UNIQUE composite (PEId, LevelId), FK Cascade Pe + Restrict Level. Section 5 "Ý kiến cấp duyệt" V2 dynamic theo workflow đã pin: forEach Step (Phòng) → forEach Level (Cấp) → forEach NV → 1 OpinionBox. Service `ApproveV2Async` UPSERT auto khi NV duyệt — Q1=1B (sync gắn với Duyệt, KHÔNG form input rời). SignedByUserId track signer thật, FE banner "Admin duyệt thay" khi !== ApproverUserId. Comment empty → "(duyệt — không ý kiến)" placeholder. Phiếu V1 legacy fallback Mig 15 4 box readOnly (data history). Mig 25 `AddIsUserSelectableToApprovalWorkflows`: ALTER `ApprovalWorkflows` +`IsUserSelectable bit` (admin pin/unpin workflow nào cho user pick lúc create phiếu, multi-select độc lập IsActive). Backfill `WHERE IsActive=1 SET 1` giữ behavior cũ. Designer +badge "Cho user chọn" + button Ghim/Bỏ ghim. Workspace filter dropdown chỉ workflows `IsUserSelectable=true`. Mig 22-24 V2 schema (Session 17): `ApprovalWorkflows`/Steps/Levels — Quy trình > Bước (Phòng) > Cấp (N NV cụ thể qua ApproverUserId, OR-of-N cùng cấp). PE.ApprovalWorkflowId pin V2. PE.CurrentApprovalLevelOrder track. State machine 5 trạng thái: Nháp / Đã gửi duyệt / Trả lại (Phase riêng TraLai=98) / Từ chối / Đã duyệt. PE Service V2 wire match `actor.Id == ApproverUserId`. Contract V2 ĐÃ WIRE (Mig 32+33 Plan B S29 — cookie-cutter mirror PE V2: `ApproveV2Async` + `ContractLevelOpinions` UPSERT + Workspace V2 Select dropdown). 111 test pass. Mig 21 V1 flat workflow vẫn live cho phiếu cũ.) ### Modules @@ -63,7 +63,7 @@ Kiến trúc: **.NET 10 Clean Architecture + 2 React FE (admin + user) + SQL Ser | Identity (User/Role/Permission/MenuItem) | `Domain/Identity/` | 1, 3, 11 | Feature-complete (30 demo user — 16 sample + 14 Solutions thật) | | Forms (Template + Clause) | `Domain/Forms/` | 4 | Feature-complete | | Notifications | `Domain/Notifications/` | 6 | In-app + SignalR OK, email SMTP TODO | -| **Tests** | `tests/SolutionErp.{Domain,Infrastructure}.Tests/` | — | **81 test pass** (58 Domain + 23 Infra: 17 codegen + 6 PE WF) — CI gate + path filter docs-only skip | +| **Tests** | `tests/SolutionErp.{Domain,Infrastructure}.Tests/` | — | **111 test pass** (58 Domain + 53 Infra) — CI gate + path filter docs-only skip | ### Commit convention @@ -84,7 +84,7 @@ tests/ └── Application/ (6 test - PeWorkflowDefinition versioning) ``` -**81 unit test pass** / ~3s (58 Domain + 23 Infra: 17 codegen + 6 PE WF versioning). +4 TraLai entry-point tests Session 17 (Standard_TraLai_To_DangGopY + BothPolicies_TraLai_To_ChoPurchasing + NextPhasesFrom_TraLai). Mig 21 drop 19 legacy N-stage/2-stage tests. CI gate + path filter live. +**111 unit test pass** / ~3s (58 Domain + 53 Infra: 17 codegen + 6 PE WF + 30 Per-NV regression + Plan M edge case + Plan O cascade hotfix tests). CI gate + path filter live. ```bash dotnet test SolutionErp.slnx # chạy cả 2 test project @@ -108,7 +108,7 @@ dotnet test SolutionErp.slnx # chạy cả 2 test project | `form-engine` — render docx/xlsx + PDF | `ef-core-migration` — EF migration + 3-file rule | | `permission-matrix` — role × menu × CRUD | `iis-deploy-runbook` — 3 site IIS + win-acme + runner | -**Audit định kỳ:** đầu mỗi tháng — combined skill + doc drift audit theo `docs/rules.md §6.4 + §9.4`. Cron `solution-erp-skill-audit-monthly` fire 9:00 ngày 1. Lần kế: **2026-05-01**. +**Audit định kỳ:** đầu mỗi tháng — combined skill + doc drift audit theo `docs/rules.md §6.4 + §9.4`. Cron `solution-erp-skill-audit-monthly` fire 9:00 ngày 1. Lần kế: **2026-06-01**. Quy tắc: - KHÔNG bulk-clone repo skill 3rd party. Chỉ thêm skill PROJECT-SPECIFIC. Xem `docs/rules.md §9` đầy đủ. @@ -128,9 +128,9 @@ Quy tắc: | [`docs/workflow-contract.md`](docs/workflow-contract.md) | State machine 9 phase HĐ + role matrix | | [`docs/forms-spec.md`](docs/forms-spec.md) | Catalog 8 form + quy định mã HĐ RG-001 | | [`docs/database/database-guide.md`](docs/database/database-guide.md) | DB conventions + migration workflow + cheatsheet | -| [`docs/database/schema-diagram.md`](docs/database/schema-diagram.md) | ⭐ ERD + luồng DB + data flow 52 table (+ §11 PE module + §12 Budget module + §13 PEDeptOpinions) | +| [`docs/database/schema-diagram.md`](docs/database/schema-diagram.md) | ⭐ ERD + luồng DB + data flow 60 table (+ §11 PE module + §12 Budget module + §13 PEDeptOpinions + §14 Contract V2 LevelOpinions) | | [`docs/flows/README.md`](docs/flows/README.md) | Index 6 flow (auth, permission, contract, form, SLA) | -| [`docs/gotchas.md`](docs/gotchas.md) | ⭐ 26 bẫy đã gặp — đọc trước khi debug tương tự | +| [`docs/gotchas.md`](docs/gotchas.md) | ⭐ 52 bẫy đã gặp — đọc trước khi debug tương tự | | [`.claude/skills/`](.claude/skills/README.md) | 6 skill: contract-workflow, form-engine, permission-matrix, dependency-audit-erp, ef-core-migration, iis-deploy-runbook | | [`docs/guides/vps-setup.md`](docs/guides/vps-setup.md) | ⭐ Master runbook deploy VPS shared với VIETREPORT | diff --git a/docs/CLAUDE.md b/docs/CLAUDE.md index 3889ca1..c71652c 100644 --- a/docs/CLAUDE.md +++ b/docs/CLAUDE.md @@ -62,7 +62,7 @@ SOLUTION_ERP/ │ ├── PROJECT-MAP.md bản đồ tổng quan │ ├── rules.md coding conventions │ ├── architecture.md layered + PE §9 + Budget §10 + Testing §11 -│ ├── gotchas.md 38 pitfall đã gặp +│ ├── gotchas.md 52 pitfall đã gặp │ ├── forms-spec.md 8 form catalog + RG-001 │ ├── workflow-contract.md 9 phase HĐ + role matrix │ ├── database/