From 38f1c4d2d9245ca90503a6aef6e147fdcc511f8c Mon Sep 17 00:00:00 2001 From: pqhuy1987 Date: Fri, 22 May 2026 13:11:05 +0700 Subject: [PATCH] =?UTF-8?q?[CLAUDE]=20Infra:=20Plan=20B=20Hotfix=20CICD=20?= =?UTF-8?q?=E2=80=94=20SeedSampleContractWorkflowV2=20OUT=20of=20DemoSeed?= =?UTF-8?q?=20gate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CICD Monitor post-deploy verify (Run #231 SUCCESS) caught CRITICAL: SeedSampleContractWorkflowV2Async nested inside `if (!demoSeedDisabled)` branch → prod has DemoSeed:Disabled=true (Plan T S23 t10) → seed SKIP → QT-HD-V2-001 KHÔNG tồn tại prod → Drafter Workspace dropdown V2 EMPTY → V2 contract path BLOCKED end-to-end UAT. Fix: PROMOTE SeedSampleContractWorkflowV2 ra ngoài DemoSeed gate. Lý do architectural: - Sample workflow là INFRASTRUCTURE config (như Roles + Departments + Catalogs) - KHÔNG phải demo data wipeable - Production cần để Drafter create V2 contract - Admin có thể edit/delete/disable qua Designer sau seed (idempotent skip) Pattern lesson reusable cross-project: phân biệt INFRASTRUCTURE seed (always run) vs DEMO seed (gated by flag). Bảng phân loại: - INFRASTRUCTURE always: Roles, Departments, Catalogs, MenuTree, AdminPerms, Templates - DEMO gated: DemoUsers (30 sample, Plan T disabled prod), DemoContracts, DemoPE, SampleWorkflows - INFRASTRUCTURE NEW post-S29: SampleContractWorkflowV2 (cần cho V2 path work) Verify: - dotnet build PASS 0 err - Mig 32 + Mig 33 prod đã apply (Run #231 success) - Sample seed sẽ chạy on next IIS recycle post-push - Idempotent: skip nếu QT-HD-V2-001 already exists (rare race admin tự seed Designer trước) Post-deploy expect: - ApprovalWorkflows table +1 row Code=QT-HD-V2-001 ApplicableType=3 IsActive=1 IsUserSelectable=1 - Drafter login fe-user → /contracts/new → Workspace dropdown "Quy trình duyệt V2" có 1 option CICD Monitor ROI: caught BEFORE bro UAT 401/empty dropdown experience. Smart Friend guard pattern proven 4× cumulative S22 #44 + S25 #48 + S29 Plan B Reviewer ApplicableType + S29 Plan B CICD DemoSeed gate. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Persistence/DbInitializer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Backend/SolutionErp.Infrastructure/Persistence/DbInitializer.cs b/src/Backend/SolutionErp.Infrastructure/Persistence/DbInitializer.cs index 940b469..2af4775 100644 --- a/src/Backend/SolutionErp.Infrastructure/Persistence/DbInitializer.cs +++ b/src/Backend/SolutionErp.Infrastructure/Persistence/DbInitializer.cs @@ -107,9 +107,18 @@ public static class DbInitializer await SeedDemoContractsAsync(db, userManager, codeGen, logger); await SeedDemoPurchaseEvaluationsAsync(db, userManager, logger); await SeedSampleApprovalWorkflowsV2Async(db, userManager, logger); - await SeedSampleContractWorkflowV2Async(db, userManager, logger); } + // [Plan B S29 2026-05-22 Hotfix CICD] SeedSampleContractWorkflowV2Async + // PROMOTED ra ngoài DemoSeed gate — đây là INFRASTRUCTURE workflow + // (như Roles + Departments + Catalogs), KHÔNG phải demo data wipeable. + // Production cần workflow V2 mẫu để Drafter create V2 contract end-to-end + // (Workspace dropdown filter ApplicableType=3 + IsUserSelectable=true). + // CICD Monitor S29 Plan B caught: nested inside gate → skip prod → V2 + // path BLOCKED. Admin có thể edit/delete/disable qua Designer sau seed. + // Idempotent: skip nếu workflow QT-HD-V2-001 đã tồn tại. + await SeedSampleContractWorkflowV2Async(db, userManager, logger); + await WarnDefaultAdminPasswordAsync(userManager, logger); }