From c506919d7ddafcd4d1495c3efa8f1cbde3af993e Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Fri, 22 May 2026 13:43:51 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20Skill:=20S27=20audit=20late=20drift?= =?UTF-8?q?=20fix=20include=20batch=20(mig=2026=E2=86=9231,=20gotcha=2044?= =?UTF-8?q?=E2=86=9249)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3 file skill modified bởi S27 audit late (drift trigger +8 gotcha vượt §9.4 threshold) — committed log `docs/changelog/skill-audit-2026-05-late.md` đã ghi chi tiết 5 patches, NHƯNG 3 file SKILL.md tự thân chưa được include trong commit batch S29 wrap `e199603` (em main quên git add `.claude/skills/`). Changes confirm S27 audit late patches: - .claude/skills/README.md: ef-core-migration cell `26 mig → 31 mig` + Session marker `S19 → S23 t1 (Mig 31 F2 per-Approver-slot)` + docs/gotchas count `44 → 49 bẫy` - .claude/skills/dependency-audit-erp/SKILL.md: gotcha count `41 → 49 bẫy` - .claude/skills/ef-core-migration/SKILL.md: description `26 mig → 31 mig` + heading `26 → 31 migration hiện có` + Tests note `77 → 111 test pass` + DbSet cho 59 bảng note `26 → 31 mig` Verify: - git diff 3 file content already match docs/changelog/skill-audit-2026-05-late.md spec → S27 patches confirmed apply - KHÔNG drift NEW post S29 — chỉ catch-up include batch missing CI skip per paths-ignore (.claude/skills/** match docs-only pattern). Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/skills/README.md | 4 ++-- .claude/skills/dependency-audit-erp/SKILL.md | 2 +- .claude/skills/ef-core-migration/SKILL.md | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.claude/skills/README.md b/.claude/skills/README.md index 3d3a8ef..b908441 100644 --- a/.claude/skills/README.md +++ b/.claude/skills/README.md @@ -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, **26 migration history** (Init → AddPeLevelOpinionsForV2) | "thêm migration", "EF migration", "schema update", "snapshot lỗi" | ✅ Updated Session 19 (Mig 26 PE Level Opinions V2) | +| `ef-core-migration` | Tạo/revert EF Core 10 migration, 3-file rule, DesignTimeDbContextFactory, **31 migration history** (Init → RefactorSkipToFinalToApproverLevel) | "thêm migration", "EF migration", "schema update", "snapshot lỗi" | ✅ Updated Session 23 t1 (Mig 31 F2 per-Approver-slot swap) | | `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` — 44 bẫy đã gặp +- `docs/gotchas.md` — 49 bẫy đã gặp (S25 +#48 SQLite tie-break, #49 dual-phase UI confusion — pending docs add per HANDOFF) - `docs/changelog/migration-todos.md` — roadmap 5 phase + Tier 3 diff --git a/.claude/skills/dependency-audit-erp/SKILL.md b/.claude/skills/dependency-audit-erp/SKILL.md index 7e31ae0..d02cf87 100644 --- a/.claude/skills/dependency-audit-erp/SKILL.md +++ b/.claude/skills/dependency-audit-erp/SKILL.md @@ -150,6 +150,6 @@ Lưu vào `docs/changelog/deps-audit-{YYYY-MM-DD}.md` nếu có action. ## Related -- `docs/gotchas.md` — 41 bẫy package compat / CI / IIS / Identity đã gặp +- `docs/gotchas.md` — 49 bẫy package compat / CI / IIS / Identity / per-NV refactor / SQLite tie-break đã gặp - `docs/changelog/migration-todos.md` Phase 5.1 — checklist deps scan CI - `SolutionErp.slnx` + `global.json` — .NET version pin diff --git a/.claude/skills/ef-core-migration/SKILL.md b/.claude/skills/ef-core-migration/SKILL.md index f02e2b5..2875086 100644 --- a/.claude/skills/ef-core-migration/SKILL.md +++ b/.claude/skills/ef-core-migration/SKILL.md @@ -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ó 26 migration sẵn (Init → AddPeLevelOpinionsForV2). 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ó 31 migration sẵn (Init → RefactorSkipToFinalToApproverLevel Mig 31 S23 t1 F2 per-Approver-slot swap). 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 (26 migration hiện có) +## Migration history (31 migration hiện có) | # | Name | Tables added / changed | |---|---|---| @@ -77,7 +77,7 @@ Architecture decision đáng ghi cho session sau: **Phase 8 update (2026-04-29 Session 5):** - Migration 15 `AddPurchaseEvaluationDepartmentOpinions` — 1 bảng riêng (UNIQUE PEId+Kind), max 4 row mỗi phiếu cho 4 phòng ban (Phê duyệt/Ccm/MuaHang/SmPm). UPDATE in-place khi user đổi ý, audit qua Changelog. -- Tests Phase 1-2-3mini live (Mig 21 drastic refactor drop legacy 19): `tests/SolutionErp.Domain.Tests/` (54 test policy state machine) + `tests/SolutionErp.Infrastructure.Tests/` (17 test code generator + 6 test PE WF versioning). **Total 77 test pass / ~3s**. Drop 19 legacy (PE 2-stage S9 + PE N-stage S12 + Contract N-stage S13 + PE Reject S14) — Mig 21 simplify model, write new tests cho flat workflow flow khi UAT bug. +- Tests Phase 1-2-3mini live + cumulative S22-S25 regression tests: `tests/SolutionErp.Domain.Tests/` (58 test policy state machine) + `tests/SolutionErp.Infrastructure.Tests/` (53 test = 17 codegen + 7 PE 2-stage + 7 PE N-stage + 6 PE WF + 5 AuthorizePolicy + 4 TraLai + 2 Plan M edge case + 1 V2 actor scope + 4 Approver F2/lookup regression). **Total 111 test pass / ~5s**. S22-S23 +20 cumulative regression: ReturnMode + DraftGuard + Reflection AuthorizePolicy + V2 actor scope reject + per-NV lookup discrimination (Plan N+O). Mig 21 drop 19 legacy (PE 2-stage S9 + PE N-stage S12 + Contract N-stage S13 + PE Reject S14) — flat workflow stabilized post-S22 V2 ground truth. - CI optimize 3 fix (29/04): - Manual checkout bypass github.com (gotcha #39) — fix TCP timeout 21s - Path filter docs-only skip (gotcha #41) — commit MD-only KHÔNG trigger CI @@ -255,7 +255,7 @@ sqlcmd -S .\SQLEXPRESS -d SolutionErp -U vrapp -P -i migrate.sql ## Code pointers -- `src/Backend/SolutionErp.Infrastructure/Persistence/ApplicationDbContext.cs` — DbSet cho 59 bảng (26 migration) +- `src/Backend/SolutionErp.Infrastructure/Persistence/ApplicationDbContext.cs` — DbSet cho 59 bảng (31 migration) - `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 per entity