[CLAUDE] Docs: S96 monthly drift audit + FD memory distill + mega-line re-tier
Monthly drift audit (2026-07-01, cron ngày 1) — workflow-prepared (wf_2d687d27-175, 4 clusters draft→adversarial-verify), em-main single-writer applied: - ef-core-migration/SKILL.md: latest-mig 56→59 + append table rows 57/58/59 + Mig 14 + Phase-7 Budget annotate DROPPED Mig 50 (S61) - skills/README.md: ef-core row Mig 55→59/S87 + gotcha cite #69→#76 (5 latest, authoritative gotchas.md headings) - docs/CLAUDE.md: Budget module marked REMOVED Mig 50 — §1 item 6 + roadmap Phase 7/8 rows (strike-through, non-destructive) - docs/governance/vocab-alias-map.md (NEW): 3 vocab-forks documented (run-trace / Ngân sách PRO / all-inherit canonical) + governance-detectors.ps1 $ExcludeExact entry (anti self-match) - re-tier STATUS/HANDOFF mega-line 5→3 blurbs (S92/S91 → archive verbatim, conservation delta=0, BOM preserved) + hoist 3 UAT-carry items to blockers FD memory distill (H17 loop strike-1 → CLEARED, GAPS: none): - frontend-designer L1 26129B→21492B: 5 old Activity war-stories → archive/2026-06.md + _INDEX + gist; Lessons value-protect distilled to L1 - budget.json measured.frontend-designer refreshed Detector 27→25 (2 real drift cleared; remaining = documented false-positives module-local/never-built-defer). AS-10 residual reviewer sub-write reverted (git-diff backstop, E-006 recurrence — guard HELD). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -17,7 +17,7 @@ Skill này là tài liệu chuyên biệt để Claude (và developer khác) dù
|
||||
| Skill | Mục đích | Trigger ví dụ | Trạng thái |
|
||||
|---|---|---|---|
|
||||
| `dependency-audit-erp` | Scan CVE NuGet + npm 2 FE, respect pin constraint (MediatR 12.4.1, Swashbuckle 6.9.0) | "npm audit", "dotnet vulnerable", "deps scan", "nâng cấp package" | ✅ New Tier 3 |
|
||||
| `ef-core-migration` | Tạo/revert EF Core 10 migration, 3-file rule, DesignTimeDbContextFactory, migration history (mới nhất Mig 55; số → `docs/STATUS.md`) | "thêm migration", "EF migration", "schema update", "snapshot lỗi" | ✅ Updated S74 (Mig 55 PE CcmNote) |
|
||||
| `ef-core-migration` | Tạo/revert EF Core 10 migration, 3-file rule, DesignTimeDbContextFactory, migration history (mới nhất Mig 59; số → `docs/STATUS.md`) | "thêm migration", "EF migration", "schema update", "snapshot lỗi" | ✅ Updated S87 (Mig 59 PE CcmBudgetPeriod; số → `docs/STATUS.md`) |
|
||||
| `iis-deploy-runbook` | 3 IIS site + win-acme cert + gitea-runner + LibreOffice + debug 500/502/SignalR prod + **G-084 IPv4/IPv6 hardening** | "prod 500", "IIS fail", "cert hết hạn", "restart app pool", "deploy IIS", "port hijack" | ✅ Updated (G-084) |
|
||||
|
||||
## Format chuẩn 1 skill
|
||||
@ -87,5 +87,5 @@ when-to-use:
|
||||
## Related
|
||||
|
||||
- `docs/CLAUDE.md` — quick rules + full stack context
|
||||
- `docs/gotchas.md` — bẫy đã gặp (số hiện tại → `docs/STATUS.md`; latest #69 FE bundle-hash non-deterministic + deploy rebuild-FE-unconditional, S72; #68 IDE TS diagnostic giữa background-agent/workflow = snapshot dở-dang → chỉ tin build sạch sau-cùng, S69; #67 Tailwind v4 accent palette thiếu-stop vỡ-màu im-lặng; #66 rule `h1-h4{color}` unlayered thắng utility `text-white`, S68)
|
||||
- `docs/gotchas.md` — bẫy đã gặp (số hiện tại → `docs/STATUS.md`; latest #76 `deploy.yml` render `appsettings.Production.json` từ `.example` mỗi deploy → prod thiếu config gitignored, S91; #75 seed demo UNGATED per-code → RE-ADD data đã wipe mỗi restart (wipe KHÔNG bền), S91; #74 MCP `save_to_disk` KHÔNG tạo file truy-cập được → chụp prod bằng PowerShell `CopyFromScreen`, S90; #73 UPDATE-handler absolute-set → CLEAR field khi FE KHÔNG gửi (bug-class S42), S85; #72 DateTime serialize thiếu 'Z' → FE hiểu local lệch +7h, S85)
|
||||
- `docs/changelog/migration-todos.md` — roadmap 5 phase + Tier 3
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: ef-core-migration
|
||||
description: Tạo/sửa/revert EF Core 10 migration cho SOLUTION_ERP. Dùng khi thêm entity mới, thay đổi schema, rollback migration, debug DesignTimeDbContextFactory fail. Đã có nhiều migration (số hiện tại → docs/STATUS.md canonical; mới nhất Mig 56 AddProBudgetSplitToPeWorkItemBudget, S76). Snapshot + Designer + Migration 3-file rule bắt buộc commit đủ.
|
||||
description: Tạo/sửa/revert EF Core 10 migration cho SOLUTION_ERP. Dùng khi thêm entity mới, thay đổi schema, rollback migration, debug DesignTimeDbContextFactory fail. Đã có nhiều migration (số hiện tại → docs/STATUS.md canonical; mới nhất Mig 59 AddCcmBudgetPeriodToPurchaseEvaluation, S87). Snapshot + Designer + Migration 3-file rule bắt buộc commit đủ.
|
||||
when-to-use:
|
||||
- "thêm migration"
|
||||
- "EF Core migration"
|
||||
@ -16,7 +16,7 @@ when-to-use:
|
||||
|
||||
> **Context:** .NET 10 + EF Core 10 + SQL Server. DbContext: `ApplicationDbContext` ở `Infrastructure/Persistence/`. Startup: `SolutionErp.Api`.
|
||||
|
||||
## Migration history (số hiện tại → `docs/STATUS.md` canonical; mới nhất Mig 56)
|
||||
## Migration history (số hiện tại → `docs/STATUS.md` canonical; mới nhất Mig 59)
|
||||
|
||||
| # | Name | Tables added / changed |
|
||||
|---|---|---|
|
||||
@ -33,7 +33,7 @@ when-to-use:
|
||||
| 11 | `AddRoleShortNameAndUserDepartment` | +Role.ShortName + User.DepartmentId/Position (cột thêm, không bảng mới) |
|
||||
| **12** | **`AddPurchaseEvaluations`** | **10 bảng module Duyệt NCC: PurchaseEvaluations + Suppliers + Details + Quotes + Approvals + Changelogs + Attachments + WorkflowDefinitions/Steps/StepApprovers** |
|
||||
| **13** | **`AddPurchaseEvaluationCodeSequences`** | **1 bảng `PurchaseEvaluationCodeSequences` (Prefix PK, LastSeq) — atomic sequence cho MaPhieu format `PE/{YYYY}/{A\|B}/{Seq:D3}`** |
|
||||
| **14** | **`AddBudgets`** | **4 bảng module Ngân sách: Budgets + BudgetDetails + BudgetApprovals + BudgetChangelogs. + nullable FK index `Contracts.BudgetId` & `PurchaseEvaluations.BudgetId`** |
|
||||
| **14** | **`AddBudgets`** | **⚠️ DROPPED Mig 50 (S61) — module Ngân sách cũ đã XÓA, thay bằng `PeWorkItemBudgets` per-gói-thầu. Bản gốc: 4 bảng Budgets + BudgetDetails + BudgetApprovals + BudgetChangelogs + nullable FK index `Contracts.BudgetId` & `PurchaseEvaluations.BudgetId` (append-only history, giữ row đánh dấu superseded).** |
|
||||
| **15** | **`AddPurchaseEvaluationDepartmentOpinions`** | **1 bảng `PurchaseEvaluationDepartmentOpinions` (UNIQUE PEId+Kind, max 1 row mỗi PeDepartmentKind per phiếu — Phê duyệt/Ccm/MuaHang/SmPm)** |
|
||||
| **16** | **`AddTwoStageDeptApprovalAndSmartReject`** | **3 bảng `Contract/PurchaseEvaluation/Budget DepartmentApprovals` (UNIQUE TargetId+Phase+Dept+Stage cho 2-stage NV.Review → TPB.Confirm per phòng × phase) + 4 ALTER (`Users.CanBypassReview` bit cho NV bypass + 3 `RejectedFromPhase` int cho smart reject jump-back). Phase 9 — đóng bug "NV duyệt được hết phase" anh Kiệt (FDC) báo. Logic 2-stage trong PurchaseEvaluationWorkflowService chỉ áp PE; HĐ + Budget defer.** |
|
||||
| **17** | **`AddManualBudgetFieldsToPeAndContract`** | **4 ALTER (PE + HĐ × `BudgetManualName` nvarchar(200) + `BudgetManualAmount` decimal(18,2)) — manual budget fallback khi user không link Budget entity approved. KHÔNG XOR với BudgetId, cả 2 cùng null OK. Carry-forward `pe.BudgetManualName/Amount → contract` ở `CreateContractFromEvaluation`. Phase 9 — Session 11 (2026-05-07).** |
|
||||
@ -76,6 +76,9 @@ when-to-use:
|
||||
| **54** | **`AddPeSuggestedAndApprovedPrice`** | **🎯 S73 — PE +5 cột giá đề xuất (ProSuggestedMin/Max + CcmSuggested + ApprovedPriceAmount + ApprovedPriceSource) additive-nullable — CEO chọn giá chốt + CCM duyệt-done opt-in. anh Kiệt FDC go-live 22/06.** |
|
||||
| **55** | **`AddCcmNoteToPeWorkItemBudget`** | **🎯 S74 — PeWorkItemBudget +`CcmNote nvarchar(1000)?` (ô "Ghi chú từ CCM" mirror ProNote). AddColumn-only, no new table.** |
|
||||
| **56** | **`AddProBudgetSplitToPeWorkItemBudget`** | **🎯 S76 — PeWorkItemBudget +`ProInitialAmount`+`ProAdjustmentAmount` decimal(18,2)? (cột PRO "Ban hành lần đầu"+"V0/hiệu chỉnh", mirror CCM Initial/Adjustment). AddColumn additive + `Sql()` data-migrate `ProInitial=ProEstimate WHERE ProEstimate NOT NULL` (4 rows prod, gotcha #64). no new table. Form ngân sách → MA TRẬN 3 cột Dự án/PRO/CCM (bảng lưới `<table>`).** |
|
||||
| **57** | **`AddPeSuggestedPriceNotes`** | **🎯 S77 — PurchaseEvaluations +`ProSuggestedPriceNote`+`CcmSuggestedPriceNote` nvarchar(1000)? (ghi chú kèm giá đề xuất PRO/CCM, mirror ProNote/CcmNote). 2 AddColumn additive-nullable, no new table.** |
|
||||
| **58** | **`AddPeMultiWinnerAndLevelFinalize`** | **🎯 S87 — PE multi-winner + per-Level finalize: PurchaseEvaluationSuppliers +`IsWinner bit` (nhiều NCC trúng thầu, thay winner đơn lẻ `SelectedSupplierId`) + ApprovalWorkflowLevels +`AllowApproverFinalize bit` (per-Cấp kết-thúc-tại-đây, không lên CEO) + `Sql()` backfill `IsWinner=1 WHERE SupplierId = pe.SelectedSupplierId` (phiếu UAT giữ winner cũ, idempotent). 2 AddColumn, no new table.** |
|
||||
| **59** | **`AddCcmBudgetPeriodToPurchaseEvaluation`** | **🎯 S87 — PurchaseEvaluations +`CcmBudgetPeriodAmount` decimal(18,2)? (ngân sách CCM cột Section-B kỳ này, per-PE, mirror `BudgetPeriodAmount` phía PRO). 1 AddColumn additive-nullable, no new table.** |
|
||||
|
||||
Total: **88 bảng** dbo + `__EFMigrationsHistory` (re-ground S62 cicd `sys.tables`; last schema-changing Mig 50 net 93→88 — Mig 51-55 đều AddColumn-only, không đổi số bảng). Xem `docs/database/schema-diagram.md` migration table + §11-15 module ERD (§16+ Mig 27-55 chi tiết pending).
|
||||
|
||||
@ -115,7 +118,7 @@ Architecture decision đáng ghi cho session sau:
|
||||
- Migration verify pattern thêm: chạy `dotnet test SolutionErp.slnx` local trước mỗi migration commit để chống regression policy/codegen.
|
||||
|
||||
**Phase 7 update (2026-04-28):**
|
||||
- Migration 14 `AddBudgets` — 4 bảng (Budgets/Details/Approvals/Changelogs) + 2 cột `BudgetId?` thêm vào Contracts & PurchaseEvaluations. Workflow hardcoded `BudgetPolicy.Default` (chưa versioned).
|
||||
- Migration 14 `AddBudgets` — ⚠️ **DROPPED Mig 50 (S61)** — module Budget cũ đã XÓA, thay bằng `PeWorkItemBudgets`. (Bản gốc: 4 bảng Budgets/Details/Approvals/Changelogs + 2 cột `BudgetId?` thêm vào Contracts & PurchaseEvaluations. Workflow hardcoded `BudgetPolicy.Default` chưa versioned.)
|
||||
- 14 demo user thật `@solutions.com.vn` qua `SeedDemoUsersAsync` reconcile (PRO 5 + CCM 7 + ISO 1 + CEO 1).
|
||||
|
||||
**Phase 6 update (2026-04-24):**
|
||||
|
||||
Reference in New Issue
Block a user