[CLAUDE] Docs: S98 harness backlog — Fable-restore gỡ caveat H5.6 (runtime-verified spawn-test ×2) + monthly→2026-08-01 + skill Mig 60/61 + re-tier mega-line S93/S94→archive-S98 + cicd L1 curate + 3 orphan-append H2 + ledger mode-A note + email AI_INFRA

Verify: V1 conservation PASS (arithmetic full-accounting 0-byte-unaccounted) · V2 cross-doc PASS (detector 28→25, còn lại false-positive class) · V3 moved-not-cut PASS (sha-match + byte-arithmetic đóng vòng).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-02 10:57:33 +07:00
parent 310b9fce68
commit 4263d63e74
21 changed files with 107 additions and 32 deletions

View File

@ -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 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`) |
| `ef-core-migration` | Tạo/revert EF Core 10 migration, 3-file rule, DesignTimeDbContextFactory, migration history (mới nhất Mig 61; số → `docs/STATUS.md`) | "thêm migration", "EF migration", "schema update", "snapshot lỗi" | ✅ Updated S98 (Mig 60/61 PE EndedByLevelFinalize + backfill-fix; 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 #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/gotchas.md` — bẫy đã gặp (số hiện tại → `docs/STATUS.md`; latest #79 backfill soi NHẦM bảng — PE transition-marker ở `Changelogs.ContextNote` KHÔNG phải `Approvals`, verify marker-count prod trước, S97; #78 display-flag suy CONFIG thay RUNTIME → nói dối khi instance lệch config, fix field `EndedByLevelFinalize`, S97; #77 SPA bundle cache-lag → verify deploy BYTE-LEVEL (curl+grep bundle), incognito = golden-test, S96; #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)
- `docs/changelog/migration-todos.md` — roadmap 5 phase + Tier 3

View File

@ -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 59 AddCcmBudgetPeriodToPurchaseEvaluation, S87). 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 61 BackfillEndedByLevelFinalizeFromChangelog, S97). 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 59)
## Migration history (số hiện tại → `docs/STATUS.md` canonical; mới nhất Mig 61)
| # | Name | Tables added / changed |
|---|---|---|
@ -79,8 +79,10 @@ when-to-use:
| **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 , 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.** |
| **60** | **`AddPeEndedByLevelFinalize`** | **🎯 S97 PE +`EndedByLevelFinalize bit NOT NULL DEFAULT 0` cờ RUNTIME "phiếu ĐÃ kết thúc sớm bằng level-finalize" (set-true CHỈ nhánh finalize trong service); display `EndsBeforeCeo` cho phiếu DaDuyet đọc RUNTIME thay suy-CONFIG (gotcha #78 phiếu opt-out lên CEO hết báo sai "không qua CEO"). Kèm `Sql()` backfill marker soi NHẦM bảng `Approvals` match 0 (xem Mig 61). 1 AddColumn, no new table.** |
| **61** | **`BackfillEndedByLevelFinalizeFromChangelog`** | **🎯 S97 DATA-ONLY no-schema (đính chính Mig 60): backfill query ĐÚNG bảng `PurchaseEvaluationChangelogs.ContextNote LIKE N'%Duyệt KẾT THÚC tại%'` + PhaseAtChange=7. PE 2 bảng lịch-sử TÁCH VAI: `Approvals` = per-approver record vs `Changelogs.ContextNote` = transition+marker (`LogTransitionAsync`). Idempotent, SQL-Server-only, prod-verified A/005/A/008 flag 01 + A/010 control unchanged (gotcha #79 xác định đúng bảng-writer + verify marker-count prod TRƯỚC khi tin backfill; backfill=0-rows = cờ đỏ).** |
Total: **88 bảng** dbo + `__EFMigrationsHistory` (re-ground S62 cicd `sys.tables`; last schema-changing Mig 50 net 9388 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).
Total: **89 bảng** `sys.tables` (= 88 dbo-app + `__EFMigrationsHistory`; re-ground S97 cicd Run #482 LIVE số canonical `docs/STATUS.md`; last schema-changing Mig 50 net 9388-app, Mig 51-61 đều AddColumn/index/data-only không đổi số bảng). Xem `docs/database/schema-diagram.md` migration table + §11-15 module ERD 16+ Mig 27-61 chi tiết pending).
## N-stage workflow pattern (Mig 18-20 — Session 12-13)
@ -288,7 +290,7 @@ sqlcmd -S .\SQLEXPRESS -d SolutionErp -U vrapp -P <pw> -i migrate.sql
## Code pointers
- `src/Backend/SolutionErp.Infrastructure/Persistence/ApplicationDbContext.cs` DbSet cho 88 bảng (số migration `docs/STATUS.md`)
- `src/Backend/SolutionErp.Infrastructure/Persistence/ApplicationDbContext.cs` DbSet toàn bộ bảng app (số bảng/migration `docs/STATUS.md`)
- `src/Backend/SolutionErp.Infrastructure/Persistence/DesignTimeDbContextFactory.cs` EF tooling factory
- `src/Backend/SolutionErp.Infrastructure/Persistence/DbInitializer.cs` seed + warn + migrate runtime + backfill (idempotent reconcile pattern)
- `src/Backend/SolutionErp.Infrastructure/Persistence/Configurations/` IEntityTypeConfiguration<T> per entity
@ -297,5 +299,5 @@ sqlcmd -S .\SQLEXPRESS -d SolutionErp -U vrapp -P <pw> -i migrate.sql
## Related
- `docs/database/database-guide.md` — conventions + migration workflow chi tiết
- `docs/database/schema-diagram.md`**ERD 88 bảng** + §11 PE + §12 ~~Budget~~ (REMOVED Mig 50) + §13 PEDeptOpinions (Mig 15) + §14 ApprovalWorkflow V2 (Mig 22-25) + §15 PE Level Opinions V2 (Mig 26); §16+ Mig 27-55 detail pending (xem migration table)
- `docs/database/schema-diagram.md`**ERD** (số bảng → `docs/STATUS.md`) + §11 PE + §12 ~~Budget~~ (REMOVED Mig 50) + §13 PEDeptOpinions (Mig 15) + §14 ApprovalWorkflow V2 (Mig 22-25) + §15 PE Level Opinions V2 (Mig 26); §16+ Mig 27-61 detail pending (xem migration table)
- `docs/gotchas.md` #7, #17, #38 — migration pitfalls + Identity 4-field rename