[CLAUDE] Docs: S59 session-end closeout - 10 dot ship prod-verified #273->#282 + gotcha #61/#62 + harvest gate PASS 5/5

- Session log MOI 2026-06-11-S59-wipe-tree-pmh-uat-batch.md (wipe testing data +
  tree 4 tang + 71 ma PMH + 6 vong UAT realtime, bundle FINAL B1DtNT9C/D6uF3Mln Run #282).
- STATUS/HANDOFF flush S59 (header + table + In Progress + Recently Done + bundle line).
- gotchas.md +2: #61 sqlcmd -f 65001 (console mojibake vs data-hong-that) + #62 rename
  natural-key DB-truoc-code-sau (seed per-code idempotent). CLAUDE.md root cite 62.
- Agent-memory 5 file: cicd x9 run entries + UTC-annotate #275 + bundle status-line final,
  inv-codebase recon S59 + curate S51->archive, H1 x2 + H2 x2 closeout entries.
- H2 GATE PASS 5/5 (0 miss, 0 on-behalf can append) + H1 ALL-4-FRESH (cross-count
  verified: gotcha 62 x3 nguon, bundle 4-source). RAG: 2 chunk S59 stored, rerank 0.875.
- Chore monthly 07-01: curate cicd L1 ~56KB + inv 32.9KB + STATUS/HANDOFF re-tier (uu tien).
This commit is contained in:
pqhuy1987
2026-06-11 18:49:21 +07:00
parent 792c0307e9
commit 6bf28bfdb4
10 changed files with 143 additions and 12 deletions

View File

@ -50,7 +50,7 @@ Read-only CI/CD + post-deploy verifier SOLUTION_ERP. Polls Gitea Actions API, ve
- **Tests baseline:** **228 PASS** (S56 Run #379 sha a20cde8; Domain 58 + Infra 170 = +12 golive-harden `ItTicketReassignAuthzTests`/`LeaveBalanceTests`/`WorkflowAppApproveV2Tests`/`DocxRendererTests` vs prev 216). CI gate runs both test projects BEFORE build/deploy status=success test gate passed (`tasks` endpoint reports terminal as `status:success`, `conclusion` field NOT populated). Local grep undercounts (Theory/InlineData) trust CI conclusion. Phase 9 UAT mode skip per chunk OK.
- **Mig latest repo:** **Mig 48 `20260609020759_AddProjectMasterFields`** (S55; AddColumn-only, Project +Year/Investor/Location/Package nullable, NO new table; kèm `SeedRealMasterDataAsync` ungated). Prev Mig 47 FilterMasterCatalog... + 46 AddSlaFieldsToItTicket. Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/`. Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC TOP 5`. Table-count: `sys.tables` (is_ms_shipped=0) count = **93** (S56 Run #379 verified, Mig 48 col-only no delta); narrative also 93 now reconciled. Don't FAIL on 9293 convention diff.
- **Bearer:** admin `admin@solutions.com.vn/Admin@123456` (full) · UAT `nv.test@solutions.com.vn/TestUser@123456` (Drafter CCM, gotcha #44 check)
- **Bundle hash live S56:** admin `4SUwDLD8` · user `XdKzt9LL` (Run #378/#379, FROZEN since S55 #378 FE redesign BE-only #379 kept both unchanged ✓). Prev admin `B-d6893W` · user `XdKzt9LL` (#377). Bundle size ~800KB/750KB gz. S50 mid-deploy transient lesson: pre-success snapshot can show intermediate FE copy in-flight re-confirm hash AFTER status=success ALWAYS (anti-pattern #3).
- **Bundle hash live S59 (CLOSE-OUT FINAL-v2):** admin `B1DtNT9C` · user `D6uF3Mln` (Run #282 sha 792c030, ROTATED from #280 `BKy_8OO9`/`XcZ6PRyA` supersede-chain #281`80b64dd`cancelled#282 ships paymentTerms-removal + "+Thêm hạng mục" drop ×2). Bundle size ~800KB/750KB gz. S50 mid-deploy transient lesson: pre-success snapshot can show intermediate FE copy in-flight re-confirm hash AFTER status=success ALWAYS (anti-pattern #3).
- **DB pw (S42, when `$PROD_DB_PASSWORD` empty):** `vrapp/buKL3TGBkD0wDDbYVw65QeX9` read from `C:\inetpub\solution-erp\api\appsettings.Production.json``ConnectionStrings.Default`. Skill-doc path `C:\inetpub\apps\SolutionErp\Api` is STALE real path `C:\inetpub\solution-erp\api`. sqlcmd over SSH works direct (no UTF-16 encode needed). sys-catalog string-concat queries hit collation conflict (`Latin1_General_CI_AS_KS_WS` vs `SQL_Latin1_General_CP1_CI_AS`) add `COLLATE DATABASE_DEFAULT` per concatenated column.
## 🔑 Critical config (flag commit nếu tái xuất)
@ -68,6 +68,13 @@ BE (test+build) ~90s · FE × 2 ~60s/app · deploy ~30s · **total ~3min code /
## 📅 Recent runs (FIFO — older → archive/git)
- **2026-06-11 S59-CLOSE Run #280 (run_number 280) sha=`69997da` PASS ~4m24s (FINAL đóng sổ session — FE-only ×2 PeDetailTabs+PeHeaderForm bỏ ô "Tên ngân sách" manual budget UAT vòng4):** Push `f21c55d..69997da` 4 `.tsx` (PeDetailTabs+PeHeaderForm ×2 app). **Run #279 (id393) sha=`f21c55d` (NCC table-fixed UAT vòng3) = `cancelled` @18:22:33 — supersede-BENIGN:** #280 push @18:22:34 (1s gap → Gitea concurrency-cancel in-flight) + `git merge-base --is-ancestor f21c55d 69997da`=TRUE ✓ (f21c55d preserved trong HEAD, ships via #280 — verified diff f21c55d→69997da chỉ +4 PeDetail/Header file, không re-touch 12 file vòng3). Tokens empty → anon Gitea API + prod appsettings DB. Poll iter4 status=success (18:22:34→18:26:58). **Bundle ROTATE BOTH FINAL (verified AFTER success +re-confirm STABLE no transient — anti#3): admin `BSh2fG2X→BKy_8OO9` + user `D22KfpPc→XcZ6PRyA`** ✓ session-close hash, brand `1F7DC1`+"Solutions ERP" preserved ×2. Health live+ready **200/200** + admin/eoffice root 200 + PE unauth 401 + control 404. **NO migration** (FE-only, Mig 49 held). LESSON (mirror Run #385 supersede-chain): same-SHA `cancelled` mid-flight = concurrency-supersede bởi newer push (1s HEAD-move), KHÔNG build/deploy-fault → ancestor-check TRUE = benign, verify prod qua SUCCESSFUL run #280 (NOT cancelled #279), KHÔNG escalate. Tag `[s59-close, run280-pass, run279-cancelled-benign, supersede-chain, fe-budget-name-remove-x2, bundle-rotate-both-FINAL, no-mig]`. **↳FINAL-v2 (tối): `80b64dd` (Run #281 cancelled-BENIGN) gỡ "Điều khoản thanh toán" 3-form ×2 → superseded bởi `792c030` Run #282 PASS ~4m (UAT vòng6 bỏ nút "+Thêm hạng mục" PeDetailTabs ×2). Ancestor 80b64dd⊂792c030=TRUE ✓ (792c030 chỉ re-touch PeDetailTabs, KHÔNG đụng PeHeaderForm/PeWorkspaceCreateView → paymentTerms-removal survives). Verify qua #282-success. Bundle ROTATE BOTH ĐÓNG-SỔ-THẬT (AFTER success +re-confirm STABLE no transient): admin `BKy_8OO9→B1DtNT9C` + user `XcZ6PRyA→D6uF3Mln` ✓, brand `1F7DC1` ok. Health live+ready 200/200 + 2 FE root 200. NO mig (FE-only). Lần thứ 3 liên tiếp supersede-chain (#279/#281 cancelled-benign) — pattern stable.**
- **2026-06-11 Run #278 (run_number 278) sha=`9c330d2` PASS ~3m45s (S59-đợt6 CROSS-STACK — BE SuppliersController POST hạ `[Authorize(Roles="Admin,CatalogManager")]` → class-level `[Authorize]` any-auth (anh chốt quick-add NCC đi-thầu phát sinh liên tục), PUT/DELETE GIỮ khóa Admin+CatalogManager; FE×2 PeDetailTabs AddSupplierDialog SearchableSelect+quick-create+upload-multi + PeWorkflowPanel ẩn Trả-lại/Từ-chối khi drafterUserId==currentUser):** Push `faed59f..9c330d2` 5 files: 4 FE `.tsx` (PeDetailTabs+PeWorkflowPanel ×2 app) + `SuppliersController.cs`. `.cs`+`.tsx` → full pipeline RAN. GITEA_TOKEN+PROD_DB_PW empty → anon Gitea API + DB pw từ prod appsettings.Production.json→`ConnectionStrings.Default` (`vrapp/buKL3...`). Run IN-PROGRESS first poll (running) — polled iter6 status=success. **Bundle ROTATE BOTH (load-bearing FE×2, verified AFTER status=success +re-confirm stable ×2 NO transient — anti-pattern#3): admin `ex7Tc92G→BSh2fG2X` + user `DzUeSk96→D22KfpPc`** ✓ both touched. Brand `1F7DC1`+"Solutions ERP" preserved. Health live+ready **200/200** + admin/eoffice root 200. **NO migration** — prod `__EFMigrationsHistory` top = Mig 49 `AddWorkItemToPurchaseEvaluation` == repo ✓. **★ AUTHZ PROBE 4-điểm (the change-point — asymmetric POST-open/DELETE-locked verify) ALL PASS:** (a) unauth POST /api/suppliers (no token) = **401** ✓ (vẫn phải login, KHÔNG anonymous — class `[Authorize]` giữ); (b1) nv.test (Drafter non-admin) POST `{code:ZZCICD-TEST,type:1}` = **201** ✓ id `bc64c0c0-...` (quick-add mở OK); (b2) nv.test DELETE same-id CÙNG token = **403** ✓ (Sửa/Xóa vẫn khóa Admin+CatalogManager — method-level attr giữ); cleanup admin DELETE = **204** + GET = **404** ✓ (probe gỡ sạch). Spot sqlcmd ground-truth: **WorkItems active=71 HELD** ✓ (no resurrect) + **Suppliers active=22** ✓ (==pre-probe; DELETE là SOFT `IsDeleted=1` → active count về 22, total=23 với 1 tombstone ZZCICD `IsDeleted=1` — by-design audit, KHÔNG leak: list/GET ẩn nó). ⚠️ API `/api/suppliers` list trả 20 (paginated/filtered default page — KHÔNG authoritative, dùng sqlcmd cho count thật). Test gate (CI both proj pre-deploy ⟹ success=passed). 0 regression. **LESSON: cross-stack authz-relax verify = probe CẢ asymmetry — (i) unauth vẫn 401 (relax ≠ anonymous), (ii) target-role action mở (201), (iii) SIBLING action vẫn locked (403 same token), (iv) cleanup soft-delete → active-count về baseline + tombstone total+1 (soft-delete ≠ rác nếu list/GET ẩn). API list-count KHÔNG tin (pagination) → sqlcmd `WHERE IsDeleted=0` cho count thật.** Tag `[s59-dot6, run278, pass, supplier-post-authz-relax, asymmetric-probe-401-201-403, soft-delete-cleanup, bundle-rotate-both, no-mig, wi71-held]`.
- **2026-06-11 Run #277 (run_number 277) sha=`faed59f` PASS ~4m09s (S59-đợt5 FE-only ×2 — NEW ui/SearchableSelect combobox gõ-lọc-bỏ-dấu + PeWorkspaceCreateView/PeHeaderForm Hạng mục+Dự án combobox + auto-fill Địa điểm từ Project.Location + PeDetailTabs paymentTerms Textarea; UAT 4-điểm screenshot 16:40):** Push `c869d26..faed59f` 8 files all `.tsx` (4 fe-admin + 4 fe-user, NEW SearchableSelect mirror ×2) → pipeline RAN. Tokens empty → anon API + prod appsettings pw. Run IN-PROGRESS first poll (running 17:40) — polled iter5 status=success (17:40:18→17:44:27). **Bundle ROTATE BOTH (verified AFTER success +re-confirm stable NO transient — anti-pattern#3): admin `BBA0KSWu→ex7Tc92G` + user `DzdTI18G→DzUeSk96`** ✓ both apps touched. Brand `1F7DC1` preserved both HTML. Health live+ready **200/200** + admin/eoffice root 200. **NO migration** (FE-only). Spot DB: **WorkItems active=71 HELD** (==#276 ✓ no resurrect — FE-only no restart risk) + PE=1 (info-only UAT leftover unchanged, NOT regression). Test gate (CI both proj pre-deploy ⟹ success=passed). 0 regression. LESSON: FE-only follow-up of a data-session needs only light WorkItems=71+PE re-confirm (no infra re-audit). SSH→sqlcmd pw-read: nested bash→ssh→PS strips `$vars` → use `iconv UTF-16LE|base64``powershell -EncodedCommand`. Tag `[s59-dot5, run277, pass, fe-searchableselect-x2, bundle-rotate-both, no-mig, wi71-held]`.
- **2026-06-11 Run #276 (run_number 276) sha=`c869d26` PASS ~4m33s (S59-đợt4 FINAL — rename 71 WorkItems theo format PMH anh Kiệt FDC: BE DbInitializer seed-tuple mới MAT-n/SUB-n/MEP-SUB-n/MEP-EQU-n + FE×2 sort numeric, SQL rename ran TAY prod TRƯỚC push giữ Id):** Push `bbd1554..c869d26` 9 files: 6 FE (`PeHeaderForm`+`PeWorkspaceCreateView`+`PurchaseEvaluationsListPage` ×2 app) + `DbInitializer.cs` + `s59-rename-workitems-pmh.sql` + generated.md. `.cs`+`.tsx` → full pipeline RAN. GITEA_TOKEN+PROD_DB_PW empty → anon API + prod appsettings pw `ConnectionStrings.Default`. Run IN-PROGRESS first poll (running 17:14) — polled iter5 status=success (17:14:14→17:18:47). **Bundle ROTATE BOTH (3 FE file both apps, verified AFTER success +re-confirm stable NO transient — anti-pattern#3): admin `DuU7OTym→BBA0KSWu` + user `DWyeTzf3→DzdTI18G`** ✓ both reachable 200, brand `1F7DC1`+title "Solutions ERP" preserved. Health live+ready **200/200** + admin/eoffice root 200 + PE unauth 401 + control 404. **NO migration** — prod top=Mig 49 `AddWorkItemToPurchaseEvaluation`==repo ✓. **★ RISK-POINT CLEARED (app restart ran SeedRealMasterDataAsync w/ NEW tuples — rename SQL ALREADY took → seed found all 71 new codes exist → added 0, NOT 142): WorkItems=ĐÚNG 71** (142=FAIL averted) + **old VT-/TP-/TB-=0** ✓ + **new MAT-/SUB-/MEP-=71** ✓ + spot `MEP-SUB-1`="1 MEP Sub MEP (Full)" EXACT ✓ + sample MAT-1/SUB-1/MEP-SUB-9/MEP-EQU-16 all present. PE=1 (info-only, UAT leftover A/001 — not resurrect). Test gate 240 (CI both proj pre-deploy ⟹ success=passed). 0 regression. **LESSON: rename-via-prod-SQL + seed-tuple-change verify = (a) target count EXACT (double = idempotent-seed re-added because SQL rename didn't take), (b) old-prefix=0 + new-prefix=full-count, (c) spot Code→Name exact match. Idempotent UNGATED seed re-runs on every restart → if hand-SQL rename succeeded BEFORE deploy, seed finds new codes present → adds 0 (safe); if rename failed → seed ADDS duplicates = 2× count = critical FAIL.** Tag `[s59-dot4, run276, pass, workitems-rename-pmh, bundle-rotate-both, no-mig, count-71-no-dup]`.
- **2026-06-11 Run #275 (run_number 275) sha=`bbd1554` PASS ~3m44s (S59-đợt3 BE-only DbInitializer GỠ seed 15 WorkItems demo — chị Trà Sol chốt giữ đúng 71 mã PMH + `scripts/s59-wipe-demo-workitems.sql` ran TAY prod TRƯỚC push 86→71):** Push `0eafcd3..bbd1554` 2 files `DbInitializer.cs` + wipe-sql ONLY, NO FE/Mig. `.cs` → full pipeline RAN. GITEA_TOKEN+PROD_DB_PW empty → anon API + prod appsettings pw `ConnectionStrings.Default`. Run IN-PROGRESS first poll (running 16:57) — polled iter6 status=success (16:57:41→17:01:25). **Bundle FROZEN admin `DuU7OTym` + user `DWyeTzf3`** (== #274 UNCHANGED ✓ CORRECT BE-only — verified AFTER status=success, no FE leak). **NO migration** — prod `__EFMigrationsHistory` top = Mig 49 `AddWorkItemToPurchaseEvaluation` == repo ✓. Health live+ready **200/200** + admin/eoffice root 200. **★ RESURRECT-VERIFY (risk point — app recycle post-deploy did NOT re-seed demo WorkItems, seed-block removal HELD): WorkItems=71 (ACTIVE=71 INACTIVE=0 DELETED=0 — hard-wipe not soft) + 4 categories EXACT: MEP 9 / Thầu phụ-Xây dựng 30 / Thiết bị 16 / Vật tư-Xây dựng 16** ✓ + **demo-codes DAO-MONG/SON-NUOC/VC-PHE-THAI = 0** ✓ (SeedRealMasterDataAsync idempotent re-ran, added 0 — 71 codes all exist). ⚠️ **PARTIAL item 5 — PE=1 không phải 0:** 1 row `PE/2026/A/001` Phase=10 created 09:46:42 **UTC = 16:46 chiều local** (CreatedAt lưu UTC — em main annotate S59-end kẻo đọc nhầm timeline; sau wipe Run #273 ~15:36 local, là phiếu UAT thật user tạo buổi test chiều, KHÔNG do deploy resurrect — BE-only bundle-frozen, DbInitializer KHÔNG seed transactional PE). INFO-flag, NOT deploy-fail. Test gate 240 (CI both proj pre-deploy ⟹ success=passed). 0 regression. **LESSON: seed-removal verify (mirror wipe-verify #273) = (a) target table count exact + category breakdown + demo-code spot-check 0 AFTER recycle (idempotent real-seed re-runs but adds 0), (b) ACTIVE/DELETED split proves hard-wipe vs soft-delete. PE=1 leftover-UAT ≠ regression: check CreatedAt timestamp vs wipe-time — pre-wipe-then-new-create is legit UAT activity, only assert PE=0 if no UAT happened between wipe and deploy.** Tag `[s59-dot3, run275, pass-partial, be-seed-removal, workitems-71-no-resurrect, bundle-frozen, no-mig, pe1-uat-leftover]`.
- **2026-06-11 Run #273 (run_number 273) sha=`56882ac` PASS ~3m34s (S59 FE×2 PE-list tree regroup "Dự án(Năm)→Hạng mục→Phiếu" bỏ tầng NCC + prod data WIPE):** Push `1577927..56882ac` 3 files: `PurchaseEvaluationsListPage.tsx` ×2 app (SHA256 mirror identical, Panel-1 tree drop NCC tier) + `scripts/s59-wipe-testing-data.sql` (ran TAY prod TRƯỚC push, NOT in pipeline). `.tsx` present → pipeline RAN. ⚠️ GITEA_TOKEN+PROD_DB_PASSWORD empty → anon Gitea API (works, public) + read DB pw from prod `appsettings.Production.json``ConnectionStrings.Default`. Run IN-PROGRESS first poll (running 15:36) — polled iter5 status=success (15:36:26→15:40:00). **Bundle ROTATE BOTH (load-bearing, verified AFTER success +6s stable NO transient — anti-pattern#3): admin `DMm9rtNA→R9uGRxvw` + user `BUkOMn_Y→DikfX1RD`** ✓ both apps touched. Brand `1F7DC1` preserved both HTML. Health live+ready **200/200** + admin/eoffice root 200. **NO migration** — prod top=Mig 49 `AddWorkItemToPurchaseEvaluation`==repo ✓. sys.tables(excl mighist)=**92**. **★ WIPE-VERIFY (the risk point — app restart post-deploy did NOT resurrect demo data, DemoSeed:Disabled gate HELD): PE=0 · Contracts=0 · Notifications=0 · PESeq=0** (all wiped clean, stayed clean post-recycle) + **infra preserved: ApprovalWorkflows=7 all IsActive=1 · Projects=70 · WorkItems=86 · Users=55** — ALL counts EXACT match expected. Test gate **240** (CI both proj pre-deploy ⟹ success=passed). 0 regression. **LESSON: post-wipe deploy verify = confirm both halves — (a) demo/transactional tables stay 0 after app-pool recycle (gate held, no re-seed) AND (b) infra/master tables (AW/Projects/WorkItems/Users) untouched (wipe was surgical, not nuke). Count-exact on both sides = PASS.** Tag `[s59, run273, pass, fe-list-regroup-x2, bundle-rotate-both, prod-wipe-verify, no-mig]`.
- **2026-06-11 Run #274 (run_number 274) sha=`0eafcd3` PASS ~4m51s (S59-đợt2 FE×2 PE-list tree 4-tầng "Năm>Dự án>Hạng mục>Phiếu" — follow-up Run #273 đổi từ 2-tầng-gộp-label sang 4-tầng explicit):** Push `56882ac..0eafcd3` 2 files `PurchaseEvaluationsListPage.tsx` ×2 app ONLY (SHA256 mirror identical `95d524ee`). `.tsx` → pipeline RAN. GITEA_TOKEN+PROD_DB_PW empty → anon API + prod appsettings pw. Run IN-PROGRESS first poll (running 16:37) — polled iter6 status=success (16:37:06→16:41:57). **Bundle ROTATE BOTH (verified AFTER success +re-confirm stable NO transient — anti-pattern#3): admin `R9uGRxvw→DuU7OTym` + user `DikfX1RD→DWyeTzf3`** ✓ both touched. Health live+ready **200/200** + admin/eoffice root 200. **NO migration** (FE-only). Spot-check **PE=0** held post-deploy (FE-only no restart-resurrection risk; wipe gate still HELD from #273). Test gate 240 (CI both proj pre-deploy ⟹ success=passed). 0 regression. LESSON: FE-only follow-up of a wipe-session needs only light PE=0 re-confirm (no full infra re-audit) — restart risk already cleared #273. Tag `[s59-dot2, run274, pass, fe-list-4tier-x2, bundle-rotate-both, no-mig, pe-zero-held]`.
- **2026-06-11 Run #385#386 SUPERSEDE-CHAIN sha=`ea793a4` CANCELLED(benign)→shipped-via `3ebaf84` #386 PASS ~4m25s (S58 brand-accent polish x2 app then PE-workitem-merge):** Target push `6e53e33..ea793a4` 8 files FE polish CẢ 2 app (Layout/TopBar/PageHeader/DataTable each — stripe đỉnh + logo-zone tint + PageHeader accent bar + thead brand-50/60), NO BE/Mig. **Run #385 (run_number 271) status=`cancelled` @14:14:22 — NOT a fail: superseded by newer push `3ebaf84` (#386 run_number 272) landed @14:14:31 (Gitea concurrency-guard cancels in-flight same-branch run).** HEAD moved ea793a4→`3ebaf84`. **Verified ea793a4 IS ancestor of 3ebaf84 + the 8 polish files NOT re-touched by 3ebaf84 → polish PRESERVED in tree, ships via #386.** #386 adds 4 PE files (PeHeaderForm/PeWorkspaceCreateView ×2 app, anh Kiệt FDC 14:06 — gộp Tên gói thầu=chọn Hạng mục) → both apps rebuilt anyway. Polled #386 to status=`success` (started 14:14:31→14:18:56). **Bundle ROTATE BOTH (load-bearing, verified AFTER #386 success — anti-pattern #3): admin `CP4CB1ym→DMm9rtNA` (css `vMtY6u47→DDlKud5i`) + user `CKjwqnGL→BUkOMn_Y` (css `CV0H5hnq→BgAUPcnL`)** ✓ both touched → both rotate. **Brand preserved both apps: `1F7DC1` in HTML + `Be Vietnam Pro`+`1f7dc1` in CSS bundle; BONUS polish landed: `brand-50`/`brand-60` Tailwind classes present in BOTH CSS bundles** (thead/tint/accent shipped). Health live+ready **200/200** + admin/eoffice root 200. **NO migration** — prod `__EFMigrationsHistory` top = Mig 49 `AddWorkItemToPurchaseEvaluation` == repo, GIỮ NGUYÊN ✓ (neither ea793a4 nor 3ebaf84 has Mig). Smoke PE+contracts unauth=**401** + control `/api/zzz-not-a-route`=**404** (auth gates real). Test gate (CI both proj pre-deploy ⟹ #386 success=passed). Prior today #382/#383/#384 all PASS. **LESSON (cancelled ≠ fail — supersede-chain verify): a same-SHA run flipping to `cancelled` mid-flight is almost always Gitea concurrency-supersede by a newer push, NOT a build/deploy fault → MUST (1) check tasks list for newer run + HEAD movement, (2) `git merge-base --is-ancestor` confirm target commit preserved in new HEAD, (3) `git diff target..newHEAD -- <target-files>` empty ⟹ target changes survive, (4) verify prod via the SUCCESSFUL superseding run not the cancelled one. Do NOT report FAIL/escalate on a benign supersede-cancel.** Tag `[s58, run385-cancelled-benign, run386-pass, supersede-chain, brand-polish-x2, bundle-rotate-both, no-mig]`.
- **2026-06-11 Run #384 (run_number 270) sha=`e959f72` PASS ~4m30s (S58 FE-USER visual redesign density-first per AI_INFRA UI/UX guide — keep brand #1F7DC1/Be Vietnam Pro/slate; FE-USER-ONLY, ZERO BE/Mig/fe-admin):** Push `6c5fd26..e959f72` 1 commit 16 files: 14 fe-user (`index.css` tokens + 6 ui primitives Button/Dialog/Input/Label/Select/Textarea + 6 shell DataTable/EmptyState/Layout/PageHeader/PhaseBadge/TopBar + LoginPage) + 2 broadcasts `.md`. NO fe-admin, NO `.cs`, NO Mig. `.tsx`/`.css` present → NOT docs-skip, pipeline RAN. ⚠️ GITEA_TOKEN empty both shells → unauth public API (200, no token needed). Run IN-PROGRESS at first poll (status=running 13:51) — correctly did NOT FAIL, polled iter6 status=success (started 13:51:18 → 13:55:48). **ASYMMETRIC bundle (load-bearing) PASS: user ROTATE `BmZ3VHnm→CKjwqnGL`** (redesign shipped, verified AFTER status=success, stable on +recheck no transient) **+ admin FROZEN `CP4CB1ym`** (=#382 UNCHANGED ✓ scope-correct, NO fe-admin leak — mirror Run #378 asymmetric fe-admin-only logic, inverted). user `.js` HEAD 200 app/js 1.47MB + CSS rotate `index-CV0H5hnq.css` 200 63KB. **Brand preserved: `1F7DC1` in HTML + `Be Vietnam Pro`+`1f7dc1` in CSS bundle** ✓; title "Solutions ERP". Health live+ready **200/200** + admin/eoffice root 200. **NO migration** — prod `__EFMigrationsHistory` top = Mig 49 `AddWorkItemToPurchaseEvaluation` == repo, GIỮ NGUYÊN ✓. sys.tables(excl mighist)=**92** (FE-only no new table). Smoke PE unauth=**401** + control `/api/zzz`=**404** (auth gates real). Test gate **240** (CI both proj pre-deploy ⟹ success=passed). 0 regression. Prior today #382(`5998163` lock-fix)+#383(`6c5fd26` hide-modules) both PASS as noted. **LESSON (single-app FE-USER redesign — asymmetric verify, inverse of #378):** PASS criteria asymmetric — user hash MUST rotate (ship-proof) AND admin hash MUST stay frozen (scope-proof, no accidental fe-admin redeploy). admin-unchanged is POSITIVE here. Visual-only CSS-token+className redesign rotates bundle exactly like logic change (Vite content-hash byte-sensitive). SSH→sqlcmd `<>`/`NOT LIKE '__%'` quoting traps: `<` mangled by PS redirect (use `!=`/CONCAT-CHAR), `_` is LIKE-wildcard (escape `'[_][_]%'`). Tag `[s58, run384, pass, fe-user-only-redesign, asymmetric-bundle-verify, no-mig, brand-preserved]`.
- **2026-06-11 Run #382 (run_number 268) sha=`5998163` PASS ~3m31s (S58 FIX the Run #381 lock NO-OP — DbInitializer.cs ONLY, BE-only, NO Mig/FE):** Push `dd117b7..5998163` 1 commit 1 file `DbInitializer.cs` (+28/-5). Fix: (1) `LockDemoSampleUsersAsync` union +20 UAT-matrix prod email (`{act,equ,fin,hra,pm,qs}.{nv,pp,tp}@`+`bod.{1,2}@`) into prior 14 named-person = 34-email list; (2) `DemoUserPassword` 11→12 chars (`User@123456``User@1234567`) fixing silent CreateAsync-fail vs prod `RequiredLength=12` (S56 helpdesk-inert root cause). `.cs` present → full pipeline RAN. Poll iter5 status=success (started 12:58:06 → 13:01:37). **Bundle FROZEN admin `CP4CB1ym` + user `BmZ3VHnm`** (= #381 UNCHANGED ✓ CORRECT for BE-only, verified AFTER status=success — NOT ship-fail). **NO migration** — prod `__EFMigrationsHistory` top = Mig 49 `AddWorkItemToPurchaseEvaluation` == repo, GIỮ NGUYÊN ✓. sys.tables=**93** unchanged. Health live/ready 200 + admin/eoffice root 200. **THE FIX VERIFIED prod (Users table — note: custom Identity table name `Users` NOT `AspNetUsers`):** total **55** users · **21 active** · **34 inactive==34 locked-future** (== lock-list size exactly). 12-sample UAT-matrix all `active=0 locked=1` (#381 NO-OP now RESOLVED — these exist in prod + got locked ✓). Named-person 14/14 found+locked (CREATED this startup via 12-char pw fix + locked same run). **Must-stay-active 6/6** admin·catalog.manager·nv.test·chuong.phan@solution.com.vn(typo-domain)·**nv.cao+nv.truong** ALL `active=1` (IT helpdesk pool ALIVE — S56 ops-pending RESOLVED by pw fix, created this startup not in lock-list). **5 new real staff** (thanh.lethanh/anh.nguyen/tring.le/truong.le/long.nguyen) all CREATED+`active=1` ✓ (12-char pw passes RequiredLength=12). Smoke nv.test login OK (token 477) + GET /api/menus 200 + /purchase-evaluations 200. 0 regression. **LESSON: lock-by-email NO-OP (#381) was a DATA-mismatch not code-bug → S58 reconciled email-list to actual prod population (UAT-matrix created via admin UI, never in seed) + the 11-vs-12 pw bug was a SECOND latent cause silently blocking ALL non-existing-user CREATE on prod (RequiredLength=12) — same fix resurrected 16 named + 5 staff + helpdesk pool. Verify lock-fix = dump Users cohorts (active/inactive split + named exact-IN), NOT just total count.** Tag `[s58, run382, pass, fix-lock-noop, pw-11to12, be-only-bundle-frozen]`.

View File

@ -31,3 +31,5 @@ H2 harvest-MD-integrity auditor **SOLUTION_ERP-self**. Read-only + **propose-onl
- **2026-06-11 (S57bis @start RE-REPORT + spawn-test post-restart ✅):** Self-report `claude-fable-5[1m]`**promote-tier `inherit` GIỮ Fable 5 runtime-VERIFIED** (H4.3c). Verdict 🟢 **KEEP-ALL-5** — 5 agent-memory delta uncommitted (harvest+2 · impl-backend+1 · investigator+3 · reviewer+1 · tooling+baseline-reground+3) ALL dated 06-10 S57/S57-resume, em-main-proxy-append B3, attribution mtime-cluster 21:5222:28 nhất quán, commit AS-IS. Corruption: 11/11 ≥4.4KB, 0-byte=0, tail sạch, mojibake=0. Wave-folder=0 tồn (S56 2 workflow harvest sạch). 3 untracked = em-main governance docs (KHÔNG phải harvest-MD) → vào commit bundle. Chore giữ: investigator-codebase 33.5KB>30KB cap → L2 @closeout/monthly (reviewer 29.6KB + cicd 29.2KB sát cap, watch). Tag [s57bis, spawn-test-verified, keep-all-5, promote-inherit-proof].
- **2026-06-11 (post-S57bis @start RE-REPORT — rushed-closeout 4 Coverage-MISS):** S57bis đóng vội (commit 12:12-13 → post-commit ghi 12:23-25 rồi dừng, KHÔNG end-GATE). Verdict 🟡: **Coverage 4 MISS / 9 role spawned** — implementer-backend+frontend (CẢ 2 return-truncated #53) · database-agent (Mig-49 design DELIVERED mà 0 delta — miss đau nhất) · reviewer (**die-0-byte ×2** resume-kill → em main self-gate) → propose 4 spawn-record on-behalf. 5 record có sẵn (inv-codebase·test-spec·tooling·harvest·cicd-dirty) 4-field PASS, fidelity ground-truthed (Mig 49 file `Persistence/Migrations/20260611044424` exists + count 240 consistent ×4 nguồn). **Method ⭐: commit-stat "có append" ≠ "có fanout-record"** — impl-backend/reviewer append trong 17b23a4 = carry 06-10 S57-resume (mtime 06-10 22:21-28); classify bằng grep tag `57bis` + mtime, KHÔNG tin stat. Mồ-côi ×2 sane (cicd +Run#381 PASS+1PARTIAL — escalation lock-14-user prod NO-OP email-stale · gotchas #59 PS5.1 quote→`-F`) → commit bundle; cicd entry chứa bundle-hash CP4CB1ym/BmZ3VHnm = resolve flag "unverified" của tooling. Wave=0 · stray=0 · 0-byte=0 (find -size 0 empty). Chore: cicd 32.3KB + inv-codebase 32.1KB ĐỀU >30KB (inv vừa curate 11:30 vẫn over). Wrote OWN diary only (em main explicit). Tag [post-s57bis, coverage-4-miss, carry-vs-fanout-classify, die-0-byte].
- **2026-06-11 (S58 `/session-end` 5-trục GATE — chiều, 8 spawn):** **GATE PASS 5/5** — Coverage 9 record/8 spawn (H1+H2 start · inv recon `:73` · cicd #382/#383/#384 + **#385#386 supersede-chain UNCOMMITTED mtime 14:20 — run-cuối 3ebaf84 đã về có record, nhắc commit bundle** · designer proxy `:39`) · Completeness 4-field 8/8 · Placement đúng nhà, stray=0, **NIT: cicd #383 nằm `:89` GIỮA khu archived (dưới #377, trên Run #232) thay vì slot FIFO :72-73 → propose MOVE trước curate kẻo archive nhầm entry 1-ngày-tuổi** · Corruption 0-byte=0 cả repo + user-memory, last-byte 11/11 `0a`, 9/9 entry mới close-Tag sạch, mojibake 1 hit = quoted-evidence `C<>ng` cicd:79 (#377 sqlcmd lesson, cố ý) · Fidelity 5 on-behalf/proxy marked tường minh ("on-behalf em main ghi hộ, H2-proposed" ×4 + designer "[em main proxy — truncated #53, 2nd consecutive]") + reviewer honest "KHÔNG DELIVER die-0-byte ×2", spot `git merge-base --is-ancestor ea793a4 3ebaf84`=YES khớp claim #386 → no-escalate. Wave=0 confirm (workflows chỉ README+hmw.js). **Chore: cicd 41.1KB (sáng 32.2 → +4 entry siêu dài/ngày!) + inv-codebase 32.9KB ĐỀU over-cap → curate-L2 P1 next session; reviewer 29.6KB + impl-be 27.9KB watch.** Method ⭐: diff-filter `grep -v "^[+-][+-]"` NUỐT dòng `+- **…` bullet-append → suýt false-MISS investigator; extract added-bullet phải dùng `grep "^+-"`. Trend: self-tag session-drift lần 3 (inv `:73` tag s57bis cho spawn S58; trước: cicd s50→s51, inv s56→s57). 12-vs-8 spawn-count để em main reconcile. Wrote OWN diary only. Tag [s58-end, gate-pass-5/5, 383-misplaced, cicd-41kb].
- **2026-06-11 (S59 @start RE-REPORT — post-S58 đóng-sạch):** Verdict 🟢 CLEAN cả 5 mục — tree clean HEAD `1577927` (commit 14:33:20), 11/11 agent-memory mtime ≤14:32 đều TRONG closeout → **0 delta mồ-côi**. Wave=0 (workflows/ chỉ README+hmw.js) · stray=0 (find prune node_modules) · 0-byte=0 (agent-memory + user-memory) · user-memory index 22 entry = 22 file khớp, MEMORY.md 5.6KB>0. Record-S58 hiện hữu: cicd `:71-74` (#385#386/#384/#382/#381) · designer proxy `:39` · inv `:73` (tag s57bis drift giữ nguyên). 4 on-behalf s57bis (db/impl-be `:77`/impl-fe `:45`/reviewer `:60`) mtime 13:00 = closeout đóng 4-MISS ✅. **cicd #383 VẪN `:89` khu archived NHƯNG em main đã ANNOTATE "[⚠️ VỊ TRÍ LẠC — entry MỚI 2026-06-11...]"** thay vì MOVE → guard chống archive-nhầm OK, relocate thật khi curate. Mojibake 2 hit ĐỀU quoted-evidence (cicd `:79` #377 + MY OWN `:33` self-quote khi tả hit cicd — các session sau đừng false-alarm file mình). Chore carry: **cicd 41.3KB + inv-codebase 32.9KB > cap → curate-L2 P1**; reviewer 29.6 + impl-be 27.9 watch. Method ⭐: `tail -c N` cắt giữa UTF-8 multi-byte in `<60>` GIẢ — corruption thật phải grep literal U+FFFD (chỉ 2 file). Brief em main liệt kê impl-fe+reviewer là "S58 spawn" nhưng on-disk 2 role chỉ có s57bis on-behalf — khớp GATE S58 8-spawn set, flag đối chiếu không phán. Tag [s59-start, clean, mojibake-self-quote].
- **2026-06-11 (S59 `/session-end` 5-trục GATE — tối, 9 body-spawn + closeout-floor):** **GATE PASS 5/5, 0 MISS** (lần đầu 0 on-behalf cần đề xuất kể từ chuỗi 4-MISS post-S57bis). Coverage: tooling ×2 (`:35` start + `:36` end-run mtime 18:15 NGOÀI brief 9-spawn = closeout-floor H1 → reconcile tổng 11) · harvest `:34` · inv recon `:73` · **cicd 6/6 entry RIÊNG #273-278 `:71-76`, sha-chain khớp git log 1:1** (56882ac→9c330d2, topic khớp commit-msg từng run) · 7 role không-spawn 0 phantom. Completeness 4-field 10/10 (#275 honest PASS-PARTIAL PE=1 UAT-leftover). Placement: đúng nhà, stray=0, inv S51→archive VERBATIM moved-not-cut + pointer "curated S59"; nit FIFO swap #273(`:75`)↔#274(`:76`) + archive double-blank. Corruption: 0-byte=0 ×2 nơi · mojibake 3 hit ĐỀU quoted-cũ (cicd:85 = #377 shift ĐÚNG +6 từ :79 — arithmetic shift = số dòng insert, method nhanh phân biệt cũ/mới) · **cicd 54KB/102-dòng (brief nói ~46) + inv 32.9KB over-cap → curate-L2 P1**. Fidelity: bundle BSh2fG2X/D22KfpPc triangulated 5 nguồn (cicd:71 + STATUS:6/:27 + HANDOFF:5 + log:4/:43) · WI=71 ×3 entry · gotcha #61/#62 disk `:1099/:1111` · tooling end-entry tree-state khớp git status độc lập — no-escalate. **2 flag content:** cicd `:53` "Bundle live S59" STALE 1 run (ghi #277 ex7Tc92G/DzUeSk96, live thật = #278 — entry :71 đúng, chỉ status-line lệch) → propose 1-line fix; #275 "09:46:42 sáng" nghi UTC-mislabel = 16:46 chiều local (STATUS:6 nói "chiều nay"; kết luận not-resurrect GIỮ). Tag [s59-end, gate-pass-5/5, 0-miss, cicd-54kb, line53-stale].

View File

@ -70,6 +70,8 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte
## 📅 Recent activity (FIFO — older → archive/git)
- **2026-06-11 (S59 recon — prod test-data wipe + PE tree Hạng mục, prod+on-disk):** ⭐ **Prod:** PE=10 active (1 Nháp + 1 DaDuyet(7) + 8 ChoDuyet(10), MaPhieu A/031-040, ALL WorkItemId NULL) + child 20/10/20/28/138/18/18 (Sup/Det/Quote/Appr/Chg/Att/LvlOp); Contracts=7 ALL `[DEMO]` 05-08 pin V1 (AwId NULL) + Appr15 + details15; Budgets/WorkflowApps/Proposals/Attendances/Meetings ALL 0; Notifications 64. Seq: PE/2026/A=40 B=1; CT=7 demo prefix LastSeq=1. **FK:** PE child CASCADE trừ `Quotes→PE NO_ACTION` (multi-path; Plan R S23 proved single `DELETE FROM PurchaseEvaluations` OK — NO_ACTION check end-of-statement sau cascade Details→Quotes). Contract child ALL CASCADE. PE.ApprovalWorkflowId Restrict → wipe PE trước khi xóa AW QT-DN-V2-001 v1 (inactive, còn 1 PE pin). AW V2=8: 7 ghim KEEP. **Uploads orphan:** purchase-evaluations/ 19 folder vs 10 PE → ~10 orphan từ S23 (file không xóa); contracts/ 1. **Demo gate OK:** SeedDemoContracts/PE TRONG `DemoSeed:Disabled` (DbInitializer:80,131-132) → wipe không resurrect. **Surprise:** Users 55 total / 21 active — 20 user THẬT batch 2026-06-11 06:01 (S58 seed fix ăn; thanh.lethanh NOW EXISTS — stale S57bis mem; chuong.phan typo-domain VẪN active song song twin). **FE tree:** `pe/PurchaseEvaluationsListPage.tsx:138-179` Project>Year(createdAt :150)>Supplier; SHA256 identical 2 app; PeListItem ĐÃ có workItemId/Name (types :116-118, BE Features :514/570/644) → đổi tree FE-only. Tag `[s59-recon, prod-wipe, pe-tree-workitem]`.
- **2026-06-11 (S57bis lock no-op — prod user census, on-disk+prod):** ⭐ `LockDemoSampleUsersAsync` (DbInitializer.cs:1552, chạy CUỐI :98) hardcode 14 named-person email (bod.huynh/pm.nguyen/fin.do/qs.hoang…) = population CHỈ CÓ TRÊN DEV. **Prod 34 user ALL-active:** 20 UAT-matrix placeholder hand-created batch 2026-05-13 15:04-05, scheme `{act,equ,fin,hra,pm,qs}.{nv,pp,tp}@` + `bod.{1,2}@` (FullName tự khai "ACT NV - Drafter+Accounting", "[Bypass]"/"[SkipFinal]" = test Mig 29-31 flags) + 9 real staff hand-created 05-04→05-12 + `binh.lethanh@` (người thật Lê Thanh Bình — seed dùng `thanh.lethanh@` KHÔNG tồn tại prod) + `chuong.phan@solution.com.vn` TYPO-domain dup (twin đúng tạo 05-12) + admin/catalog.manager/nv.test. **ROOT CAUSE seed-user never-on-prod:** prod `Identity:Password:RequiredLength=12` (appsettings.Production.json) vs `DemoUserPassword="User@123456"`=11 chars → CreateAsync silent-fail MỌI startup từ prod-init 04-21 (code comment :1675-79 đã biết); Dev fallback 8 (DependencyInjection.cs:67 `?? 8`, Development.json no Identity section) → Dev đủ 33 user named-person. `bod.1@` NEVER in git pickaxe = tạo tay qua admin UI, không phải seed. Surprise: _Dev hiện CŨNG chưa khóa (Locked=0; LockoutEnd=MaxValue sẽ persist qua reconcile re-activate :1714 nếu từng chạy) → lock chưa từng execute against _Dev runtime. Fix cần 20 email prod-thật; GIỮ binh.lethanh + 9 real + admin/catalog.manager; `nv.test@` = creds smoke-verify (khóa = vỡ cicd smoke). Tag `[s58, s57bis-lock-noop-recon, prod-user-census, pwd-policy-env-divergence]`.
- **2026-06-11 (S57bis PE recon — 4 đầu việc sếp, on-disk):** ⭐ PE entity NO Year, NO WorkItem link (`PurchaseEvaluation.cs:15` ProjectId req; Detail free-text `PurchaseEvaluationDetail.cs:10-13`). Create cmd `PurchaseEvaluationFeatures.cs:19-30`; MaPhieu gen-AT-CREATE `:114-116` format `PE/{YYYY}/{A|B}/{Seq:D3}` (`PurchaseEvaluationCodeGenerator.cs:23`). Main create UI = `PeWorkspaceCreateView.tsx` (:151 workflow-select isUserSelectable ĐẦU TIÊN → tenGoiThau → projectId → DiaDiem → MoTa → PaymentTerms → budget; canSubmit :129 = wf+project+ten). PE controller class-`[Authorize]` ONLY no policy → mở menu là đủ, no silent-403. Pe_* leaves NOT in `MenuKeys.All` (chỉ root :156); PE defaults 7 role × 11 key (root + 2type×{group,WfView,List,Create,Pending}) `DbInitializer.cs:2098-2160`. S57 `SeedAllRolesReviewReadPermissionsAsync:1993-2001` InReviewScope EXCLUDES Pe; extend đúng = `key == MenuKeys.PurchaseEvaluations` EXACT (prefix "Pe" sẽ dính PeWorkflows admin!) — root inherit cascade (`GetMyMenuTreeQuery.cs:49-82`). Demo gate: prod `appsettings.json:35 DemoSeed:Disabled=true` → 7 `[DEMO]` HĐ + 4 `[DEMO]` PE (MaPhieu `[DEMO]-A-001`) KHÔNG lên prod; UNGATED trên prod = 31 users + 18 demo NCC + 8 demo project (:2244-2315) + real 62/71/3 (:2329-2522). ⚠️ Clear-demo gotcha: seed re-add per-code idempotent MỖI startup → xóa DB-only sẽ resurrect, phải gỡ khỏi DbInitializer code. WorkItem write Admin-only (`CatalogsController:113-130`) — CatalogManager có menu-perm nhưng API write bị chặn. Tag `[s57bis, pe-recon, demo-inventory]`.
@ -88,9 +90,7 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte
- **2026-06-08 (S52 Phase 11-D/E/F product-close recon — 6 gap, on-disk):** ⭐ **GAP1 IT-pool KHÔNG TỒN TẠI:** AppRoles.All=13 role (`AppRoles.cs:23`) NO "IT"; 9 dept seed (`DbInitializer.cs:2066` PM/QS/CCM/PRO/FIN/ACT/EQU/HRA/BOD) NO dept IT; MenuKeys NO It_* group (chỉ `OffItTicket="Off_ItTicket"` 1 leaf :123). → round-robin pool PHẢI tạo signal mới: option (a) +AppRoles.ItStaff const + seed user, (b) +dept "IT" code, (c) per-user flag `User.IsItStaff`. Least-loaded query = `Users.Where(pool).OrderBy(u => Tickets.Count(AssignedToUserId==u.Id && Status!=Closed))``ItTicket.AssignedToUserId Guid?` SẴN (`ItTicket.cs:21`). **GAP2 HostedService:** đăng ký tại `Infrastructure/DependencyInjection.cs:46 AddHostedService<SlaExpiryJob>()` (KHÔNG Program.cs — grep Program.cs rỗng). Pattern `SlaExpiryJob.cs`: `BackgroundService` + ctor `(IServiceProvider sp, ILogger)` + `ExecuteAsync` Task.Delay(30s warmup)+while loop Interval 15min → `_sp.CreateAsyncScope()` resolve scoped `IApplicationDbContext`+`IDateTime`+`INotificationService` (:61-65). ItTicketSlaJob mirror: thêm dòng :47 + clone file. **GAP3 OtPolicy (`Hrm/OtPolicy.cs`):** 3 multiplier decimal(4,2) `MultiplierWeekday/Weekend/Holiday` (:21-23, seed 1.5/2.0/3.0) + 3 cap int `MaxHoursPer Day/Month/Year` (:26-28) + `Code` UNIQUE + `IsActive` (1 default công ty). `Attendance.OtHours decimal?` (`Office/Attendance.cs:37`) per-row, KHÔNG link OtPolicyId → join thủ công qua IsActive=true; công thức OT-pay = `OtHours × multiplier(dayType) × hourlyRate`, dayType phân loại từ AttendanceDate (Holiday tra Hrm_Holiday, Sat/Sun=Weekend, else Weekday). **GAP4 Excel reuse:** `IContractExcelExporter.ExportAsync→RenderResult` record `(byte[] Content, string FileName, string ContentType)` (`IFormRenderer.cs:3`); impl `ContractExcelExporter.cs` ClosedXML `XLWorkbook`+`Worksheets.Add`+`MemoryStream→ToArray()` (:103-109 content-type `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`); DI scoped :40; controller stream `return File(result.Content, result.ContentType, result.FileName)` (`ReportsController.cs:35`, mirror Forms/PE/Contracts). AttendanceExporter = clone + đổi columns + new CQRS command (mẫu `ExportContractsToExcelCommand`). **GAP5 Attendance API:** `AttendancesController.cs` 3 endpoint check-in/check-out/me (`[Authorize]` ko role); CQRS inline `Office/WorkflowAppsFeatures.cs` REGION 6 (:401-490) — `CheckInCommand`/`CheckOutCommand`/`GetMyAttendanceQuery(Year,Month)` chỉ trả LIST cá nhân (1 user/tháng). ❌ CHƯA có aggregate/monthly-report/all-users query → P11-E phải +`GetAttendanceReportQuery(year,month,deptId?)`. ItTicket CQRS cũng inline cùng file (:354 GetItTicketsQuery + CreateItTicketCommand + UpdateItTicketStatusCommand, controller `ItTicketsController.cs`). **GAP6 FE state:** ItTicketsPage + MyAttendancePage TỒN TẠI cả 2 app (fe-admin+fe-user, comment "MIRROR SHA256 identical"), routes `/it-tickets`+`/attendance` (`App.tsx:101-102`), menuKeys `OffItTicket`+`OffChamCong` (:65-66), Layout map :84-85. ❌ THIẾU: ItTicket = SKELETON read-only kanban (banner :32-34 "Form tạo + auto-assign + SLA timer defer Phase 11"), NO create form/assign-UI/SLA-badge; Attendance = check-in/out OK nhưng NO admin report page / Excel export button / OT-pay column. NO menuKey `Attendance_Report`/`It_Assign`. Surprise: ItTicket+Attendance KHÔNG dùng Workflow V2 (kanban status flow, comment `ItTicket.cs:6`) — khác Leave/OT/Travel/Vehicle (LevelOpinion). Tag `[p11-def-recon, it-pool-absent, otpolicy-multiplier, excel-reuse, s52]`.
- **2026-06-08 (S51 gotcha #57 EXTENSION reachability audit — 6 candidate, RAG down, on-disk only):** ⭐ Bug class = soft-delete + bare `.IsUnique()` on Code → recreate-after-delete throws DbUpdateException 500. Verdict 6 cand: **FIX 3 (Master)** Department/Supplier/Project (`Department/Supplier/ProjectConfiguration.cs:18/24/19` bare unique). ALL = AuditableEntity + **GLOBAL `HasQueryFilter(!IsDeleted)`** + Delete via `.Remove()``AuditingInterceptor.cs` (State Deleted→Modified, IsDeleted=true) + Create `AnyAsync(x=>x.Code==req.Code)` NO `!IsDeleted` BUT global filter auto-hides soft-deleted → check passes → unfiltered index 500. **CONFIRMED-reachable** (`DepartmentFeatures.cs:76+125`, `ProjectFeatures.cs:87+147`, `CreateSupplierCommand.cs:45`+`DeleteSupplierCommand.cs:20`). **SKIP 3:** (a) **ContractClause** (`ContractClauseConfiguration.cs:18`) — NO Create/Update/Delete handler ANYWHERE (only `IApplicationDbContext.cs:32` DbSet; FormsController = templates only) → not CRUD-reachable. (b) **MeetingRoom** (`MeetingRoomConfiguration.cs:20`) — Delete sets `IsActive=false` NOT IsDeleted (`MeetingFeatures.cs:178`, comment :175 "FK Restrict → NOT soft delete") → index never gets soft-deleted row; Create also checks `&& !IsDeleted` :113. (c) **EmployeeProfile** (`EmployeeProfileConfiguration.cs:24/26` EmployeeCode+UserId) — Delete soft (`EmployeeFeatures.cs:437`) BUT Create BLOCKS reuse by design: UserId check `AsNoTracking().FirstOrDefault(UserId==)` (no HRM global filter) sees soft-deleted → throws ConflictException "Cần khôi phục" :160-163; EmployeeCode auto-gen atomic (never user-supplied/reused) → no collision. **Completeness (grep ALL `.IsUnique()`):** beyond 3 Master + 6 HRM-fixed (LeaveType/Holiday/Shift/OtPolicy/Vehicle/Driver all `.HasFilter([IsDeleted]=0)`), every OTHER bare-unique is either composite junction (Permission RoleId+MenuKey, *LevelOpinion, MeetingBookingAttendee, LeaveBalance, Attendance UserId+Date), nullable-code already filtered (`[Ma*] IS NOT NULL`: Contract/PE/Proposal/Budget/WorkflowApps), or no-soft-delete (WorkflowDefinition/ApprovalWorkflow Code+Version, ContractTemplate FormCode, WorkflowTypeAssignment, DepartmentApprovals). **Mig 46 = exactly 3 indexes (Departments/Suppliers/Projects Code).** Surprise: Master GLOBAL query filter MAKES the bug (auto-hides soft-deleted from check) — opposite of HRM where bug needs manual `!IsDeleted`; either way unfiltered index = 500. Tag `[gotcha57-ext, reachability-audit, master-global-filter, s51]`.
- **[→ archive/2026-06.md]** S50 P11-C HrmConfigs add-kind 11-chỗ pattern · S50 wave h2-verify B6 gitignore ordering + POSIX-not-pwsh (curated S57bis).
- **[→ archive/2026-06.md]** S50 P11-C HrmConfigs add-kind 11-chỗ pattern · S50 wave h2-verify B6 gitignore ordering + POSIX-not-pwsh (curated S57bis) · S51 gotcha #57 EXT reachability 3-Master-fix/3-skip global-filter-makes-bug (curated S59).
- **2026-06-07 (Harness 1/2/3 adap-apply recon — 3 slice, HMW wave):** Governance recon AI_INFRA broadcast harness-1/2/3. **H1/H2 (Harness 1):** roster 8→10 — CREATE 2 sub TÁCH BIỆT `tooling-auditor` (H1 freshness 4-mặt skill/sub-role/plugin/docs) + `harvest-curator` (H2 integrity 5-trục). H2 PARTIAL sẵn: `session-end.md` Phase 1.5 §L.b(d) spawn-record 4-field + (f) double-check moved-not-cut + (c) 0-byte AS-8 = Coverage+Completeness+Corruption (3/5); THIẾU Fidelity-escalate + Placement. RE-REPORT @session-start = 0 (chỉ generic Phase 2.7). 2 sub mirror inv-codebase read-set + store_memory strip + NO Write/Edit; color brown+teal (8 màu cũ hết). **H2 wave (Harness 2):** SE `hmw.js` = OLD pre-wave (no subMdPath/writeGuard/wave-block); AI_INFRA `hmw.js` = canonical template. ⭐ `git check-ignore -v` = ground-truth B6: `.claude/workflows/wave-test/wave.md` HIỆN match `.gitignore:83 !.claude/**` = TRACKED → wave pattern PHẢI đặt AFTER `!.claude/**` (last-match-wins, mẫu `hmw-mode.on` :87). Read-only sub (4)=inv-cb/inv-api/reviewer/cicd; Write sub (4)=impl×2/test/fe-designer. B5 depends H2 harvest-curator. **H3 email (Harness 3):** broadcasts/ absent; id authoritative = `se` (NOT solution_erp), 6 others short `{ai_infra,vipix,dyd,namgroup,ashico,bvaau}` từ `AI_INFRA/broadcasts/sister-commands/send-email.md:13-22` (folder name = 2nd source-truth); `adap-apply.md:14` base-path STALE flat → `outbox/all/*.md` (latent bug). broadcasts/ ở root → commit OK (no gitignore rule). **Containment post-P2:** git-diff bắt 1 file-write (inv-api self-MEMORY), chunk-count 2414=2414 (0 RAG-write) = defense-in-depth proven. Tag [harness-recon, governance, hmw-wave, 2026-06-07].

View File

@ -5,3 +5,6 @@
- **2026-06-08 (S50 P11-C Vehicle+Driver — HrmConfigs add-kind pattern VERIFIED on-disk, RAG down):** ⭐ **HrmConfigs KHÔNG có "kind enum/registry" backend** — 4 entity RIÊNG (LeaveType/Holiday/ShiftPattern/OtPolicy), NOT discriminated table. "kind" chỉ FE: `HrmConfigKind` union `fe-admin/src/types/hrm-config.ts:4` + route param. **Add 1 kind = mirror FULL entity stack 11 chỗ:** BE (1) Domain `Hrm/{X}.cs` AuditableEntity soft-delete (2) `Configurations/{X}Configuration.cs` `.ToTable+.HasIndex(Code).IsUnique()` (3) `ApplicationDbContext.cs:95-98` DbSet (4) `IApplicationDbContext.cs:102-105` DbSet (5) `HrmConfigFeatures.cs` +Region N (DTO+List/Create/Update/Delete handler+validator, mega 4-region :30/125/222/328) (6) `HrmConfigsController.cs` +4 route hardcode `[HttpGet/Post/Put/Delete("{kind}")]` (Post/Put/Del `[Authorize(Roles="Admin")]`, Get chỉ `[Authorize]`) (7) `DbInitializer.cs:2329 SeedHrmConfigsAsync` +if-block + skip-guard :2331 phải +`&& OtPoliciesNew.AnyAsync()` (8) `MenuKeys.cs:88-92` +const + `:149 All[]` (Admin auto-grant `SeedAdminPermissionsAsync` loop idempotent). FE (9) `HrmConfigsPage.tsx:45 KIND_CONFIG` +entry + `:114 KINDS[]` + `:379 renderCells` branch + `:166 smart-defaults` + types/hrm-config.ts DTO (10) `App.tsx:90` route `/hrm/configs/:kind` SẴN catch-all → KHÔNG cần sửa, chỉ +menuKeys (11) `menuKeys.ts:38-42` + `Layout.tsx:60-63 staticMap`. **gotcha #57 CONFIRMED còn trần:** `LeaveTypeConfiguration.cs:19` + `ShiftPatternConfiguration.cs:19` + `OtPolicyConfiguration.cs:22` `.IsUnique()` CHƯA `.HasFilter("[IsDeleted]=0")` (chỉ `HolidayConfiguration.cs:18` đã fix Mig 43). → Vehicle/Driver Code UNIQUE PHẢI add filter ngay từ đầu. **Mig 44 BẮT BUỘC CREATE TABLE** (mỗi kind = bảng riêng, NOT discriminated → +2 bảng Vehicles+Drivers, không phải seed-only). **VehicleBooking** (`Office/VehicleBooking.cs:13-19`) pure free-text `VehicleLicense/VehicleName/DriverName` string, NO `VehicleId/DriverId` FK (grep empty) → P11-C catalog-only, FK link defer Mig sau. Latest Mig=43 `FilterHolidayUniqueIndexByIsDeleted` (`20260601064128`), next=44. Tag `[p11-c, hrmconfig-add-kind, gotcha57, on-disk-verify]`.
- **2026-06-07 (S50 wave `h2-verify` — B6 guardrail audit, read-only) [em main scribe from findings + H2 harvest]:** Verified B6 wave-isolation **3/3 PASS**. **B6 = TWO complementary rules:** (a) transient `wave-*/` + `agent-teams/` gitignored (`.gitignore:93-94`) → audit-noise=0; (b) canonical `agent-memory/**/MEMORY.md` TRACKED → rogue sub-write surfaces in `git status`. `git check-ignore -v` = ground-truth verifier BOTH directions (matched rule:line for ignored; empty for tracked). ⚠️ **Ordering gotcha:** wave/team patterns MUST sit AFTER `!.claude/**` (`.gitignore:82-83`) to win via last-match (`:91` documents intent) — else `!.claude/**` un-ignores everything. All 10 MEMORY.md tracked (roster 8→10). **Surprise (cross-cutting, both wave subs):** Bash tool = `/usr/bin/bash` NOT PowerShell despite env=PowerShell → `Get-ChildItem`/`Select-String`/`Test-Path` fail (exit 2/127); read-only Bash-only subs MUST use POSIX (`git ls-files`/`grep`/`ls`). Tag [wave-h2, b6-isolation, posix-not-pwsh].
- **2026-06-08 (S51 gotcha #57 EXTENSION reachability audit — 6 candidate, RAG down, on-disk only):** ⭐ Bug class = soft-delete + bare `.IsUnique()` on Code → recreate-after-delete throws DbUpdateException 500. Verdict 6 cand: **FIX 3 (Master)** Department/Supplier/Project (`Department/Supplier/ProjectConfiguration.cs:18/24/19` bare unique). ALL = AuditableEntity + **GLOBAL `HasQueryFilter(!IsDeleted)`** + Delete via `.Remove()``AuditingInterceptor.cs` (State Deleted→Modified, IsDeleted=true) + Create `AnyAsync(x=>x.Code==req.Code)` NO `!IsDeleted` BUT global filter auto-hides soft-deleted → check passes → unfiltered index 500. **CONFIRMED-reachable** (`DepartmentFeatures.cs:76+125`, `ProjectFeatures.cs:87+147`, `CreateSupplierCommand.cs:45`+`DeleteSupplierCommand.cs:20`). **SKIP 3:** (a) **ContractClause** (`ContractClauseConfiguration.cs:18`) — NO Create/Update/Delete handler ANYWHERE (only `IApplicationDbContext.cs:32` DbSet; FormsController = templates only) → not CRUD-reachable. (b) **MeetingRoom** (`MeetingRoomConfiguration.cs:20`) — Delete sets `IsActive=false` NOT IsDeleted (`MeetingFeatures.cs:178`, comment :175 "FK Restrict → NOT soft delete") → index never gets soft-deleted row; Create also checks `&& !IsDeleted` :113. (c) **EmployeeProfile** (`EmployeeProfileConfiguration.cs:24/26` EmployeeCode+UserId) — Delete soft (`EmployeeFeatures.cs:437`) BUT Create BLOCKS reuse by design: UserId check `AsNoTracking().FirstOrDefault(UserId==)` (no HRM global filter) sees soft-deleted → throws ConflictException "Cần khôi phục" :160-163; EmployeeCode auto-gen atomic (never user-supplied/reused) → no collision. **Completeness (grep ALL `.IsUnique()`):** beyond 3 Master + 6 HRM-fixed (LeaveType/Holiday/Shift/OtPolicy/Vehicle/Driver all `.HasFilter([IsDeleted]=0)`), every OTHER bare-unique is either composite junction (Permission RoleId+MenuKey, *LevelOpinion, MeetingBookingAttendee, LeaveBalance, Attendance UserId+Date), nullable-code already filtered (`[Ma*] IS NOT NULL`: Contract/PE/Proposal/Budget/WorkflowApps), or no-soft-delete (WorkflowDefinition/ApprovalWorkflow Code+Version, ContractTemplate FormCode, WorkflowTypeAssignment, DepartmentApprovals). **Mig 46 = exactly 3 indexes (Departments/Suppliers/Projects Code).** Surprise: Master GLOBAL query filter MAKES the bug (auto-hides soft-deleted from check) — opposite of HRM where bug needs manual `!IsDeleted`; either way unfiltered index = 500. Tag `[gotcha57-ext, reachability-audit, master-global-filter, s51]`.

View File

@ -32,3 +32,5 @@ H1 tooling-freshness auditor **SOLUTION_ERP-self**. Read-only + **propose-only**
- **2026-06-11 (S57bis @start RE-REPORT + spawn-test post-restart ✅):** Self-report nguyên văn `claude-opus-4-8[1m]` ("Opus 4.8 (1M context)") → **demote-pin ĂN runtime** (đóng 'pending-restart' entry trên) + `[1m]` 1M-resolve SE tự verify (hết lệ thuộc claim AI_INFRA s20). 4-mặt **ALL-PASS 0 drift mới** — 29 file dirty = Harness-4 closeout hợp lệ: ①3 skill-doc diff = freshness-fix đúng (48 mig/93 bảng/58 gotcha) ②roster 11=11=11, frontmatter grep = 7 pin + 4 inherit, 0 `[1m]` frontmatter ③plugin 18/15/3 identical, 0 new-alloc ④STATUS diff hợp lệ + 3 untracked governance đúng nấc → đề xuất promote PENDING-RESTART→runtime-verified (em main đã thực hiện cùng session). Carry-flag: docs/CLAUDE.md gotcha "(55)"→58 (defer monthly 07-01) · schema-diagram §16+ 14-mig ERD debt. Demote-watch data-point #1: verdict-quality trên Opus 4.8 tự đánh giá CHƯA suy giảm. Tag [s57bis, spawn-test-verified, 4-mat-pass, demote-watch-1].
- **2026-06-11 (post-S57bis @start RE-REPORT — count-drift S57bis CHƯA flush docs):** Working tree 2 dirty (cicd MEMORY +Run#381 · gotchas.md +#59) — S57bis code đã COMMIT (dd117b7+17b23a4 push). 4-mặt: ①SKILL 6+23 unchanged; ef-core SKILL STALE 4 cite "48"→49 (:3 desc · :19 H2 "48 migration hiện có" · :72 "§16+ Mig 27-48"→27-49 · :280 "48 migration") + :280/:289 "93 bảng" giữ (Mig 49 AddColumn-only no new table — KHÔNG đổi); skills/README:20 "48 migration"→49 + :90 "58 bẫy/#58"→59; dep-audit:153 "58 bẫy"→59. ②ROSTER **CLEAN 11=11=11** (disk/README/STATUS); model-tier frontmatter grep = **4 inherit (database-agent·harvest-curator·investigator-codebase·reviewer) + 7 pin claude-opus-4-8** ✅ khớp two-tier H4 chính xác. ③PLUGIN **CLEAN 18/15/3 identical** (3 OFF: pr-review-toolkit·code-modernization·hookify), 0 new-alloc. ④DOCS **MAJOR data-row drift**: STATUS row :24 sub-agent ĐÃ cập runtime-VERIFIED 06-11 NHƯNG data-rows CHƯA: :14 Mig "48"→49 · :20 Tests "228"→240 · :21 Gotchas "58"→59 · :27 bundle (S57bis FE-touched nhưng session-log KHÔNG ghi hash mới → CP4CB1ym/BmZ3VHnm anh-cite KHÔNG verify được, grep 0 match) · STATUS:38 In-Progress "(none S56)" stale (S57+S57bis shipped). HANDOFF:5 Last-updated 06-09 S56 + thiếu HẲN S57/S57bis section. Root CLAUDE.md:53 "48 mig"→49 · :66/:87 "228"→240 · :133 "58 bẫy"→59. **Method-learning:** test attr-count disk=225 (`[Fact]/[Theory]`) NHƯNG authoritative=240 (S57bis log :14 "228→240"; Theory expand runtime → KHÔNG dùng attr-count làm count, tin session-log/test-run) · bundle-hash anh-cite phải verify từ session-log/cicd-MEMORY trước khi tin (S57bis log không ghi → flag "unverified" KHÔNG copy). Top-5 patch propose → em main APPEND. Tag [post-s57bis, 4-mat, count-drift-flush-pending, bundle-hash-unverified].
- **2026-06-11 (S58 `/session-end` CHỐT 4-mặt — PARTIAL, return-cut giữa chừng, on-behalf em main ghi hộ):** Return bị cut sau finding chính (verdict 4-mặt đầy đủ KHÔNG kịp emit). FINDING ĐÃ GIAO: docs **KHÔNG stale như brief giả định** — STATUS lines 27/52/53 ĐÃ flush tới `ea793a4`+`3ebaf84`/Run #386 + bundle `DMm9rtNA`/`BUkOMn_Y` (em main flush song song lúc H1 chạy) → bài học brief: "chưa flush" là snapshot lúc spawn, auditor phải re-ground từ disk hiện tại (đã làm đúng). Em main tự chốt phần còn lại từ data sáng: ①SKILL — sáng patched đủ (ef-core ×5 + README + dep-audit), chiều không thêm skill; ②ROSTER 11 + two-tier frontmatter không đổi; ③PLUGIN 18/15/3 không đổi, 0 new-alloc (UI/UX guide AI_INFRA = reference doc, KHÔNG phải plugin/skill — đã cite trong frontend-designer MEMORY S58 entry); ④DOCS — session-end flush hoàn tất (STATUS/HANDOFF/session-log/error-ledger E-008+AS-12). SURPRISE: return-cut class này (chết giữa emit sau khi finding chính đã ra) = nhẹ hơn die-0-byte, finding salvageable từ partial return. Tag `[s58, session-end-chot, return-cut-partial, on-behalf]`.
- **2026-06-11 (S59 @start RE-REPORT — ALL-4-FRESH, 0 drift, tree clean):** Bootstrap sau S58 đóng-sạch (HEAD `1577927`, tree clean). 4-mặt **TẤT CẢ FRESH, 0 drift mới** — session đầu tiên 0-patch kể từ S57bis. ①SKILL 6 project + 23 standalone **unchanged** (list standalone identical S58); 0 skill mới/đổi/mất. ②ROSTER **CLEAN 11=11=11** — disk 11 .md (README.md=doc KHÔNG đếm) = README:3/:13 "11 sub" = STATUS:24 "11"; frontmatter grep = **4 inherit (database-agent·harvest-curator·investigator-codebase·reviewer) + 7 pin claude-opus-4-8** ✅ khớp two-tier H4 (README:3 list khớp chính xác). ③PLUGIN **CLEAN 18/15/3 identical** S58 (settings.json:17-35 verbatim; 3 OFF: pr-review-toolkit:20·code-modernization:22·hookify:27), README:166 "18(15/3)" khớp, 0 new-alloc. ④DOCS **ALL-COUNT-FRESH ground-truthed từ disk:** Mig **49**=49 (disk `Persistence/Migrations/*.cs` đếm 49, cao nhất `20260611044424_AddWorkItemToPurchaseEvaluation`) · menu keys **57**=57 (`MenuKeys.cs` const đếm 57) · gotcha **60**=60 (max `### 60.`) · test 240 (S57bis+S58 log authoritative, KHÔNG attr-count) · tables 93 (cicd Run #379). CLAUDE.md root :53/:66/:133 + STATUS :14/:15/:20/:21 + README roster ALL khớp disk. **Minor narrative-lag (KHÔNG phải drift, KHÔNG patch):** STATUS:6 header "Run #382/#383/#384" thiếu #386 NHƯNG body+bundle:27 đã đúng #386 → cosmetic, defer. Carry-flag bất biến: docs/CLAUDE.md gotcha "(55)" (monthly 07-01) · schema-diagram §16+ Mig 32-49 ERD debt (~17 mig). **Method:** Bash-tool nuốt `$`-var của inline PS → phải `powershell -NoProfile -Command "& {...}"` với escape `\$`; Migrations KHÔNG ở `Infrastructure/Migrations``Infrastructure/Persistence/Migrations` — verify path trước khi đếm. 0 delta đề xuất (clean baseline). Tag `[s59-start, 4-mat-all-fresh, 0-drift, clean-tree]`.
- **2026-06-11 (S59 `/session-end` CHỐT 4-mặt — ALL-FRESH, 0 drift, em main docs-flush verified):** 6 commit code S59 (`56882ac``9c330d2`, Gitea Run #273#278 — KHÁC đếm Run#38x S58, run_number reset) đã COMMIT+prod-verify; em main vừa flush docs (CHƯA commit, tree 5 MEMORY.md M + 4 docs M + 1 untracked session-log). 4-mặt **ALL-FRESH, 0 drift**: ①SKILL 6 project + 23 standalone **unchanged** (0 mới/đổi/mất); `SearchableSelect.tsx` ×2 app = code FE (UI primitive `components/ui/`), **KHÔNG phải skill/plugin** → confirm 0 new-alloc. ②ROSTER **CLEAN 11=11=11** (disk/README:3/STATUS:24); two-tier frontmatter UNCHANGED (4 inherit+7 pin). ③PLUGIN **CLEAN 18/15/3 identical** (3 OFF pr-review-toolkit·code-modernization·hookify), 0 new-alloc. ④DOCS **cross-count CONSISTENT, em main flush ĐÚNG**: gotcha **62**=62 (max `### 62.` = count 62 contiguous, #61/#62=S59 verified `gotchas.md:1099/:1111`) = STATUS:21 "62" = CLAUDE.md root:133 "62 bẫy"; bundle **`BSh2fG2X`/`D22KfpPc`** TRIANGULATED 4-source (STATUS:27 + HANDOFF:5 + session-log:4 + cicd-MEMORY:71 full Run#278 provenance — anti-pattern#3 stable-after-success verified) ✅; session-log `2026-06-11-S59-wipe-tree-pmh-uat-batch.md` EXISTS; HANDOFF:9 S59 section + HANDOFF:5 header 06-11 present; STATUS:16 master-row 71 WorkItems + STATUS:34/:48 In-Progress(none)/Recently-Done S59 present; spec `master-import-data.generated.md` 74 W-rows. **Cross-doc 0 LỆCH/SÓT.** Carry-flag bất biến: docs/CLAUDE.md gotcha "(55)" (monthly 07-01) · schema-diagram §16+ Mig 32-49 ERD debt. **Method-learning:** (a) bundle-hash KHÔNG tin 1-source — S59 triangulate 4 nguồn (đối lại S57bis bài học "session-log không ghi → unverified"); cicd-MEMORY:71 là nguồn provenance giàu nhất (Run#+sha+rotate-from+health). (b) Tool-gotcha PS: `Get-Content -Raw` + `-TotalCount` MUTUALLY EXCLUSIVE → frontmatter-read fail; dùng Grep tool `^model:` thay loop. (c) Run-number S59 reset #273-278 ≠ S58 #38x (run_number API đổi đếm cùng pipeline — KHÔNG nhầm regression). 0 delta đề xuất. Tag `[s59-end, 4-mat-all-fresh, 0-drift, bundle-triangulated-4src, searchableselect-not-skill]`.

View File

@ -130,7 +130,7 @@ Quy tắc:
| [`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 93 table (+ §11 PE + §12 Budget + §13 PEDeptOpinions + §14 Contract V2 LevelOpinions; §16+ Mig 32-49 pending) |
| [`docs/flows/README.md`](docs/flows/README.md) | Index 6 flow (auth, permission, contract, form, SLA) |
| [`docs/gotchas.md`](docs/gotchas.md) | ⭐ 60 bẫy đã gặp — đọc trước khi debug tương tự |
| [`docs/gotchas.md`](docs/gotchas.md) | ⭐ 62 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 |

View File

@ -2,7 +2,26 @@
> **Tiering rule (S40):** giữ **2-3 session gần nhất**. Cũ hơn → `docs/changelog/sessions/`. Full brief history pre-S40 → `docs/_archive/HANDOFF-preS40-fullhistory.md`.
**Last updated:** 2026-06-11 (Session 58 — **5 đợt prod-verified Run #382/#383/#384/#386** (#385 cancelled-supersede-benign): lock-demo-user fix (việc sếp deadline 15:00 ĐÓNG TRỌN — gotcha #60/E-008/AS-12, root cause password 11<12 từng phát hiện S22 nhưng const không fix) + tạm ẩn HRM/Office/ nhân + Danh mục cuối (`6c5fd26` #383) + **fe-user redesign theo UI/UX guide AI_INFRA giữ brand** (`e959f72` #384) + **brand polish ×2 app "thấy rõ"** (`ea793a4`: stripe 4px đỉnh + thead brand) + **PE gộp Tên-gói-thầu = chọn Hạng-mục** (anh Kiệt FDC chốt, `3ebaf84` #386 bundle final admin `DMm9rtNA`/user `BUkOMn_Y`). Email AI_INFRA processed (guide + ACK H4 ACCEPT). Test **240**. session log `2026-06-11-S58-lock-fix-hide-modules-redesign-pe-merge.md`. Root cause 2 tầng: lock-list = population Dev-only + `DemoUserPassword` 11 tự < prod RequiredLength=12 CreateAsync silent-fail từ trước tới giờ (= "helpdesk inert" S56). Fix union 20 UAT email + password 12 tự prod 55 user/34 locked, nv.cao+nv.truong sống, 5 real staff tạo. gotcha #59+#60. Commit `5998163`. Prev S57bis **PE gắn Hạng mục (Mig 49) + Pe all-role + menu Cá nhân + Harness-4 runtime-VERIFIED**. Test 228→**240**. Bundle `CP4CB1ym`/`BmZ3VHnm`. Commit `17b23a4`+`dd117b7` Run #381 PASS+1PARTIAL (lock NO-OP RESOLVED S58). Prev S56 **Pre-golive verify sweep + golive-harden 4 fix — Run #379 PASS, code golive-ready**. WF1 `pre-golive-verify` 7-stream + adversarial 6 PASS/1 CONCERN/0 blocker = GO (key finds = ops not code). WF2 `golive-harden` fix 4: #3 LeaveBalance lost-updateatomic ExecuteUpdate+Serializable tx (NO mig) · #5 ItTicket authz Forbidden-trước-NotFound · #6 DocxRenderer null-guard · #4 Travel/Vehicle ApproveV2 tests. Test 216→**228**. Bundle FROZEN `4SUwDLD8`/`XdKzt9LL`. `sys.tables` re-ground 92→**93**. gotcha **#58** NEW. reviewer StructuredOutput-failem main đỡ. **2 ops VPS pending** (gán user IT + tzutil UTC+7). FE Phase 2 redesign **deferred** (recon ready). Commit `a20cde8`. Prev S55 **Nạp master data thật từ Excel (62 dự án + 71 hạng mục + 3 NCC) + Project +4 cột (Mig 48) — prod-verified**. HMW-mode ON. Commit `69cb393` Run #377 PASS ~4m33s. Test 216 (compile-fix only). Bundle admin `B-d6893W`/user `XdKzt9LL`. `SeedRealMasterDataAsync` ungated idempotent coexist demo. 2 agent return truncated (BE+reviewer) em main disk/runtime-recover. Prev S54 IT staff tự reassign ticket (cross-stack authz) prod-verified. 1 code commit `ca4b602` Run #376 PASS ~4m18s. Test 203→**216**. Bundle admin `DfCfHUE9``DmjI8Cmn`/user `_3S0BPJ2``YxL_MljK` (cả 2 rotate). NO migration. Task 1 Phase 9 Ops anh dừng. residual: 3 agent ghi MEMORY nhầm `src/Backend/.claude` em main reconcile. Prev S53: gotcha #57 EXT Master Mig 47 + P11-D/E + database-agent verified-runtime.)
**Last updated:** 2026-06-11 tối (Session 59 — **6 đợt ship prod-verified Run #273→#278**: wipe transactional testing data (10 PE + 7 HĐ demo + 64 notif = 0, mã reset → phiếu thật đầu tiên team tạo = **PE/2026/A/001** ✓) `56882ac` #273 · PE tree Panel 1 chốt 4 tầng **Năm > Dự án > Hạng mục > Phiếu** `0eafcd3` #274 · dọn 15 mã hạng mục demo "tự đẻ" (chị Trà Sol) + gỡ seed gốc, WorkItems 86→**71** `bbd1554` #275 · **rename 71 mã đúng format PMH anh Kiệt** (`MAT-n`/`SUB-n`/`MEP-SUB-n`/`MEP-EQU-n` + tên "STT nhóm tên"; **DB-trước-code-sau** gotcha #62 + sqlcmd `-f 65001` gotcha #61) `c869d26` #276 · UAT vòng 1: NEW `ui/SearchableSelect` gõ-lọc bỏ dấu (Hạng mục/Dự án) + auto Địa điểm + điều khoản đa dòng `faed59f` #277 · UAT vòng 2 (anh chốt ×2): ẩn Trả lại/Từ chối khi tự duyệt phiếu mình soạn + quick-add NCC ngay form (POST /suppliers any-auth, authz probe 4/4) + NCC gõ-tìm A-Z + upload multi-file `9c330d2` #278 · UAT vòng 3-6 realtime (#279/#281 cancelled-supersede-benign): bảng NCC table-fixed `f21c55d` + bỏ ô Tên ngân sách `69997da` #280 + GỠ field Điều khoản TT mọi form `80b64dd` + bỏ nút Thêm hạng mục `792c030` **#282 FINAL**. Tổng 10 đợt (8 PASS + 2 cancelled-benign). Bundle FINAL admin **`B1DtNT9C`**/user **`D6uF3Mln`**. Test 240. Gotchas 62. 0/14 spawn truncated. → session log `2026-06-11-S59-wipe-tree-pmh-uat-batch.md`. Prev S58 — **5 đợt prod-verified Run #382/#383/#384/#386** (#385 cancelled-supersede-benign): lock-demo-user fix (việc sếp deadline 15:00 ĐÓNG TRỌN — gotcha #60/E-008/AS-12, root cause password 11<12 từng phát hiện S22 nhưng const không fix) + tạm ẩn HRM/Office/ nhân + Danh mục cuối (`6c5fd26` #383) + **fe-user redesign theo UI/UX guide AI_INFRA giữ brand** (`e959f72` #384) + **brand polish ×2 app "thấy rõ"** (`ea793a4`: stripe 4px đỉnh + thead brand) + **PE gộp Tên-gói-thầu = chọn Hạng-mục** (anh Kiệt FDC chốt, `3ebaf84` #386 bundle final admin `DMm9rtNA`/user `BUkOMn_Y`). Email AI_INFRA processed (guide + ACK H4 ACCEPT). Test **240**. session log `2026-06-11-S58-lock-fix-hide-modules-redesign-pe-merge.md`. Root cause 2 tầng: lock-list = population Dev-only + `DemoUserPassword` 11 tự < prod RequiredLength=12 CreateAsync silent-fail từ trước tới giờ (= "helpdesk inert" S56). Fix union 20 UAT email + password 12 tự prod 55 user/34 locked, nv.cao+nv.truong sống, 5 real staff tạo. gotcha #59+#60. Commit `5998163`. Prev S57bis **PE gắn Hạng mục (Mig 49) + Pe all-role + menu Cá nhân + Harness-4 runtime-VERIFIED**. Test 228→**240**. Bundle `CP4CB1ym`/`BmZ3VHnm`. Commit `17b23a4`+`dd117b7` Run #381 PASS+1PARTIAL (lock NO-OP RESOLVED S58). Prev S56 **Pre-golive verify sweep + golive-harden 4 fix — Run #379 PASS, code golive-ready**. WF1 `pre-golive-verify` 7-stream + adversarial 6 PASS/1 CONCERN/0 blocker = GO (key finds = ops not code). WF2 `golive-harden` fix 4: #3 LeaveBalance lost-updateatomic ExecuteUpdate+Serializable tx (NO mig) · #5 ItTicket authz Forbidden-trước-NotFound · #6 DocxRenderer null-guard · #4 Travel/Vehicle ApproveV2 tests. Test 216→**228**. Bundle FROZEN `4SUwDLD8`/`XdKzt9LL`. `sys.tables` re-ground 92→**93**. gotcha **#58** NEW. reviewer StructuredOutput-failem main đỡ. **2 ops VPS pending** (gán user IT + tzutil UTC+7). FE Phase 2 redesign **deferred** (recon ready). Commit `a20cde8`. Prev S55 **Nạp master data thật từ Excel (62 dự án + 71 hạng mục + 3 NCC) + Project +4 cột (Mig 48) — prod-verified**. HMW-mode ON. Commit `69cb393` Run #377 PASS ~4m33s. Test 216 (compile-fix only). Bundle admin `B-d6893W`/user `XdKzt9LL`. `SeedRealMasterDataAsync` ungated idempotent coexist demo. 2 agent return truncated (BE+reviewer) em main disk/runtime-recover. Prev S54 IT staff tự reassign ticket (cross-stack authz) prod-verified. 1 code commit `ca4b602` Run #376 PASS ~4m18s. Test 203→**216**. Bundle admin `DfCfHUE9``DmjI8Cmn`/user `_3S0BPJ2``YxL_MljK` (cả 2 rotate). NO migration. Task 1 Phase 9 Ops anh dừng. residual: 3 agent ghi MEMORY nhầm `src/Backend/.claude` em main reconcile. Prev S53: gotcha #57 EXT Master Mig 47 + P11-D/E + database-agent verified-runtime.)
---
## S59 (2026-06-11 chiều→tối) — Wipe testing + tree 4 tầng + 71 mã PMH + UAT 6 vòng (10 commit prod-verified #273→#282)
**Anh: forward Zalo anh Kiệt (xóa testing + tree theo hạng mục) → chốt tree "Năm chứa Dự án chứa Hạng mục" → forward chị Trà Sol (dọn mã tự chế, "không đẻ thêm mã công ty khác") → anh Kiệt chốt format mã ("MEP-SUB-1 — 1 MEP Sub MEP (Full), đúng kiểu vậy") → 6 vòng screenshot UAT realtime (11 điểm — 4 vòng cuối chen giữa session-end: table-fixed bảng NCC, bỏ Tên ngân sách, GỠ Điều khoản TT mọi form, bỏ nút Thêm hạng mục) → "Chốt làm đi nhé" (session-end).**
**Done (10 commit — 8 Run PASS + 2 cancelled-supersede-benign, đều prod-verify):** xem STATUS S59 entry / session log chi tiết. Điểm phải nhớ cho session sau:
- **Prod baseline SẠCH cho testing thật:** PE//Notif từ 0, từ `…/001`, WorkItems = ĐÚNG 71 PMH format mới (`MAT-1` "1 Mat tông"…), 7 workflow ghim, master 70 dự án/22 NCC nguyên. Phiếu UAT thật của team ĐÃ tồn tại (PE/2026/A/001+) **KHÔNG wipe nữa khi chưa hỏi**.
- **Quy trình rename natural-key (gotcha #62):** UPDATE DB prod+Dev TRƯỚC push seed mới SAU (per-code idempotent, sai thứ tự = nhân đôi). **sqlcmd file tiếng Việt (gotcha #61):** `-f 65001` + verify qua API JSON, đừng tin console VPS.
- **SearchableSelect** (`components/ui/SearchableSelect.tsx` ×2 app) = combobox chuẩn mới cho dropdown lớn fold bỏ dấu, tái dùng cho dropdown users/khác khi cần.
- **Suppliers authz asymmetric S59:** POST = any-auth (quick-add) · PUT/DELETE = Admin+CatalogManager (giữ S57) probe live 4/4 OK. WorkItems/Catalogs write vẫn khóa nguyên.
**🔴 NEXT SESSION (anh pick):**
- **Ops của anh (giữ từ S58):** `tzutil /g` VPS confirm `SE Asia Standard Time` · email anh Chương dọn typo `chuong.phan@solution.com.vn` · báo 5 real staff password `User@1234567` + đổi · gán người thật CNTT lock nv.cao/nv.truong.
- **🟪 test-after guard:** `LockDemoSampleUsersAsync` (S58) + suppliers asymmetric authz (S59) IdentityFixture sẵn.
- **PE polish sâu** (PeDetailTabs 111KB session riêng) · **PermissionGuard per-route** khi golive HRM/Office · **Phase 9 Ops** (SMTP/backup/creds/UAT).
- **Monthly audit 2026-07-01:** **STATUS/HANDOFF re-tier (defer ×2 — ƯU TIÊN)** · curate L1 cicd-monitor ~46KB + investigator-codebase 32.9KB · schema-diagram §16+ ERD Mig 32-49.
- **Cert** `api.solutions.com.vn` expire ~2026-07-23 (auto-renew ~06-23).
---

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,60 @@
# Session 59 — 2026-06-11 (chiều→tối) — Wipe testing data + PE tree 4 tầng + 71 mã PMH + 6 vòng UAT feedback (10 đợt ship prod-verified)
> **10 commit code → 8 Gitea Run PASS + 2 cancelled-supersede-benign (#273→#282), tất cả prod-verified.** Anh: `/session-start` → forward Zalo anh Kiệt FDC (2 việc) → chốt tree follow-up → forward chị Trà Sol (dọn mã tự chế) → anh Kiệt chốt format mã → 6 vòng screenshot UAT feedback realtime (4 vòng cuối chen giữa session-end) → "Chốt làm đi nhé" (session-end).
> Bundle FINAL: admin **`B1DtNT9C`** / user **`D6uF3Mln`** (Run #282 `792c030`). Test **240/240** (verify local ×2 + CI gate ×8). HMW-mode ON nguyên session nhưng mọi việc chạy Agent-tool spawn lẻ (không Workflow fan-out — task vừa, em main solo + recon/cicd spawn).
## Đợt 1 — Wipe transactional testing data prod (anh Kiệt: "xoá các cái testing trước đi em") — `56882ac` → Run #273
- 🟦 investigator-codebase recon prod: chỉ 3 cụm test data — **10 PE** (A/031-040, cả 10 WorkItemId NULL) + child 252 rows · **7 Contracts `[DEMO]`** + 30 child · **64 Notifications**; mọi module khác 0. Workflows: 7 ghim active + 1 V2 cũ inactive. Uploads: 19 folder PE vs 10 PE (~10 orphan từ Plan R S23). Generator PE/Contract đều INSERT-if-missing → DELETE sequence = reset mã an toàn.
- Anh chốt (AskUserQuestion): **wipe cả 3 cụm + reset mã về 0**.
- `scripts/s59-wipe-testing-data.sql` (pattern Plan R S23, QUOTED_IDENTIFIER ON): DELETE PE (cascade, Quotes NO_ACTION pass nhờ cascade Details→Quotes) → Contracts → Notifications → 1 AwV2 inactive (`IsActive=0 AND IsUserSelectable=0`) → PeSeq+CtSeq. AFTER exact: PE/child/Ct/Notif = 0 · AwV2 7/7 active · KEEP Projects 70 / WorkItems 86 / Suppliers 22 / Users 55 / Templates 9 / WfDefV1 10. Uploads orphan rd+md lại (ssh từng lệnh — quoting 3 lớp vỡ tại `&`, tách lệnh đơn).
- **Run #273 PASS** ~3m34s: bundle ×2 rotate (`R9uGRxvw`/`DikfX1RD`) + **app-recycle KHÔNG resurrect** (DemoSeed:Disabled gate held — verify THẬT qua recycle, không trên giấy). Team vào testing chiều: phiếu thật đầu tiên ra đúng **PE/2026/A/001** (sequence reset đúng thiết kế).
## Đợt 2+3 — PE Panel 1 tree regroup (2 vòng theo chỉ đạo) — `56882ac` (v1) + `0eafcd3` → Run #274
- Anh Kiệt v1: "Tên dự án (2026) → Hạng mục công việc → Phiếu cần duyệt" (thứ tự label "Dự án - Năm" — mirror folder Outlook FDC). Ship trong `56882ac`: node gộp `(Dự án, Năm-tạo-phiếu)` label "Tên (Năm)" → Hạng mục (`workItemId` Mig 49 — list DTO đã có sẵn `workItemName` S57bis nên FE-only) → phiếu. Bỏ tầng NCC (vẫn ở card/detail).
- Anh hỏi lại "Dự án→Năm hay Năm→Dự án?" → chốt follow-up: **"Năm chứa Dự án, Dự án chứa Hạng mục"** → `0eafcd3`: tree 4 tầng 📅 **Năm (DESC, bg-slate-50) → 📁 Dự án (A-Z vi) → 🧱 Hạng mục (A-Z vi) → phiếu (createdAt DESC)**. `yearGroups` useMemo thay `projectGroups`, expand-state localStorage key bump v3.
- **Run #274 PASS** ~4m51s: bundle ×2 rotate (`DuU7OTym`/`DWyeTzf3`), PE wipe held.
## Đợt 4 — Dọn 15 mã hạng mục tự chế (chị Trà Sol: "xóa cái đám phần thô phần hoàn thiện… MÀ ANH TỰ ĐẺ RA") — `bbd1554` → Run #275
- Prod 86 = 71 real PMH + **15 demo seed cũ** (Phần thô 5 + Hoàn thiện 6 + Cơ điện 3 + Khác 1 — DAO-MONG, SON-NUOC, TRAT-TUONG…). Đối chiếu **71/71 real khớp từng dòng bảng PMH** anh paste (4 nhóm 16/30/9/16 — S55 nạp từ chính Excel này).
- Fix kép: (a) **GỠ HẲN block seed demo** khỏi `DbInitializer` (guard `!AnyAsync()` vốn chống resurrect khi bảng còn data, nhưng DB mới tinh sẽ đẻ lại — diệt gốc theo "không đẻ thêm mã của công ty khác vô"); (b) `scripts/s59-wipe-demo-workitems.sql` DELETE 15 codes prod + LocalDB Dev → 71.
- **Run #275 PASS** ~3m44s: bundle ×2 FROZEN (BE-only đúng) + **app-recycle giữ 71** (demo codes = 0, seed real idempotent add 0). INFO: PE = 1 (phiếu UAT thật A/001 — không phải resurrect).
## Đợt 5 — Rename 71 mã theo format PMH anh Kiệt chốt ("MÃ CV gồm chữ MEP-SUB-1 rồi tên 1 MEP Sub MEP (Full) — đúng kiểu vậy") — `c869d26` → Run #276
- Mapping: `VT-nn→MAT-n` · `TP-nn→SUB-n` · `MEP-0n→MEP-SUB-n` · `TB-nn→MEP-EQU-n`; Name = `"STT nhóm tên"` (`1 Mat Bê tông`, `1 MEP Sub MEP (Full)`…). Category 4 nhóm giữ.
- **Thứ tự sống còn (gotcha #62 NEW):** SQL UPDATE rename (GIỮ Id) chạy prod + Dev **TRƯỚC** push — seed per-code idempotent mà deploy trước sẽ INSERT 71 mã mới cạnh 71 cũ = 142. Run #276 verify **đúng 71**.
- **Encoding (gotcha #61 NEW):** sqlcmd đọc file UTF-8 tiếng Việt PHẢI `-f 65001`; console VPS mojibake = display-only — verify data thật qua LocalDB console (đúng dấu) + **API JSON prod** (login admin → GET /catalogs/work-items → `"2 MEP Sub Hệ thống trung thế"` nguyên vẹn).
- FE sort numeric-aware 3 chỗ ×2 app (mã không pad → string-sort xếp "MAT-10" trước "MAT-2"): 2 dropdown (`select:` sort `localeCompare(…, {numeric:true})`) + tree workItemName. Spec provenance `master-import-data.generated.md` sync 71 dòng + note mapping.
- **Run #276 PASS** ~4m33s: bundle ×2 rotate (`BBA0KSWu`/`DzdTI18G`), spot MEP-SUB-1 đúng.
## Đợt 6 — UAT feedback vòng 1 (4 điểm form tạo phiếu, screenshot 16:40) — `faed59f` → Run #277
- **NEW `ui/SearchableSelect.tsx`** (~140 LOC, không lib ngoài): combobox gõ-để-lọc, **fold bỏ dấu tiếng Việt** (NFD strip U+0300-036F + đ→d — gõ "be tong" trúng "Bê tông"), keyboard ↑↓/Enter/Esc, clear ✕, listbox absolute z-50, style mirror ui/Input density S55.
- Áp: **Hạng mục + Dự án** ở PeWorkspaceCreateView + PeHeaderForm (HeaderForm giữ placeholder "Giữ nguyên: …" cho phiếu cũ). **Auto Địa điểm**: chọn dự án tự điền từ `Project.Location` (S55), chỉ ghi đè khi user chưa gõ tay (track `lastAutoLoc` ref). **Điều khoản thanh toán nhập tay**: Input 1 dòng → Textarea 3 dòng (CreateView + PeDetailTabs inline-edit; render detail đã `whitespace-pre-wrap` sẵn từ trước).
- **Run #277 PASS** ~4m09s: bundle ×2 rotate (`ex7Tc92G`/`DzUeSk96`).
## Đợt 7 — UAT feedback vòng 2 (3 điểm, screenshot 16:52) — `9c330d2` → Run #278
- Anh chốt 2 quyết định (AskUserQuestion): **(1) ẨN CẢ Trả lại + Từ chối** khi người duyệt = người soạn (`drafterUserId === currentUser.id` — PeWorkflowPanel skip 2 nút trong map; hủy phiếu = nhờ cấp khác Từ chối / Xóa phiếu Nháp); **(2) CHO PHÉP quick-add NCC**: `SuppliersController` POST hạ `Roles=Admin,CatalogManager``[Authorize]` any-auth (PUT/DELETE giữ khóa S57) + AddSupplierDialog nút "+ NCC mới" form nhanh (Mã/Tên/Loại/SĐT/Email) → POST → invalidate + auto-select vào phiếu.
- NCC dropdown → SearchableSelect sort A-Z theo mã. **Upload nhiều file 1 lần**: input `multiple` + `onPick` async upload tuần tự `mutateAsync` từng file (×2 chỗ: báo giá per-NCC + bảng so sánh — replace_all 2 occurrences identical).
- Test 240/240 local TRƯỚC push (BE authz + seed đổi trong session). **Run #278 PASS** ~3m45s: bundle ×2 rotate (`BSh2fG2X`/`D22KfpPc`) + **authz probe live 4/4**: unauth POST **401** (mở quyền ≠ anonymous) · nv.test POST **201** (id tạo thật) · nv.test DELETE **403** (khóa giữ) · admin cleanup 204→404 (tombstone soft-delete by-design). Suppliers active 22 giữ.
## Đợt 8-10 — UAT vòng 3-6 realtime (chen giữa session-end, anh forward liên tục) — `f21c55d`/`69997da`/`80b64dd`/`792c030` → Run #279-cancelled/#280/#281-cancelled/#282 FINAL
- **Vòng 3 — "thêm file giao diện bị thay đổi không cân xứng" (`f21c55d`):** bảng NCC tham gia auto-layout → cell File (chip tên dài 8.2MB) phình, bóp dọc cột NCC. Fix `table-fixed` + width % từng cột (NCC 24/SĐT 9/Email 14/ĐKTT 14/File 22/Tiền 12/action w-10) + `min-w-[860px]` (hẹp → scroll ngang wrapper) + email span block truncate. Chip file truncate sẵn — kích hoạt khi cell khóa width.
- **Vòng 4 — "chỗ tên ngân sách bỏ đi nhé" (`69997da` #280):** bỏ ô "Tên (không bắt buộc)" ngân sách nhập tay (user không hiểu "ý nghĩa dự phòng là gì") — chỉ còn Số tiền. Payload `budgetManualName: null`; PeHeaderForm `hasManual` detect thêm theo amount (phiếu mới name-null vẫn nhận đúng manual mode). Tên cũ hiện read-only, về null khi lưu lần tới.
- **Vòng 5 — "điều khoản thanh toán bỏ nốt ra luôn tất cả các form" (`80b64dd`):** GỠ field phiếu-level khỏi CẢ 3 form (CreateView: Select preset + Textarea custom + PAYMENT_PRESETS/PAYMENT_CUSTOM/paymentMode drop, 142 LOC · HeaderForm + DetailTabs inline-edit: bỏ Textarea, state giữ → save giữ nguyên data cũ). GIỮ: cột "Điều khoản TT" per-NCC bảng so sánh (data từng NCC, khác field) + display read-only phiếu cũ.
- **Vòng 6 — "bỏ luôn cái nút thêm hạng mục" (`792c030` #282):** gỡ nút "+ Thêm hạng mục" ItemsTab — 1 phiếu = 1 hạng mục chọn từ header (S57bis/S58), hạng mục đầu auto-seed khi tạo. AddItemDialog giữ dead-code flip lại dễ.
- **2 run cancelled (#279, #281) = supersede-BENIGN** (Gitea concurrency-cancel khi push đè lúc UAT góp ý realtime ~1s gap): cicd ancestor-verify `git merge-base --is-ancestor` TRUE cả 2 — mọi fix preserved trong HEAD, ships qua run kế (#280, #282). Pattern lặp #385 S58 — cicd-monitor giờ xử lý chuỗi này thành thạo (con final-v2 tự phát hiện supersede + verify run MỚI thay vì báo fail).
## Closeout & lessons
- **0/14 spawn truncated** (H1×2 + H2×2 bootstrap/closeout + investigator recon + cicd ×9) — lần đầu sau nhiều session; verdict-FIRST + entry gọn + prompt scoped works.
- **gotcha #61** (sqlcmd -f 65001 + verify-qua-API-JSON) + **#62** (rename natural-key: DB-trước-code-sau) NEW → 62 total.
- Quy trình "destructive prod" giữ chuẩn: recon → AskUserQuestion chốt scope → script committed vào repo → chạy → verify exact-count → cicd re-verify sau app-recycle.
- cicd-monitor MEMORY ~56KB > cap 30KB (9 cicd-spawn/ngày, H2 đo 54KB giữa session + 2 entry cuối) → chore-flag curate L2 monthly 2026-07-01 (FIFO top vẫn inject OK). H2 GATE PASS 5/5 + H1 ALL-4-FRESH (cross-count verified); 2 fix theo H2 flag: UTC-annotate entry #275 + bundle status-line tự cập bởi cicd final-v2.
- Ops note benign: `GET /api/suppliers` trả page đầu (20) — đếm thật qua DB (22); không UI nào dùng sai.
- Pending (carry): test-after guard cho `LockDemoSampleUsersAsync` (S58) + asymmetric authz suppliers POST/PUT-DELETE (S59) → test-specialist khi UAT ổn; 4 ops của anh (tzutil / email anh Chương / báo password 5 staff / lock nv.cao-truong khi gán thật); PermissionGuard per-route khi golive HRM/Office; Phase 9 Ops; monthly audit 2026-07-01.

View File

@ -1096,6 +1096,34 @@ for h in resp.points: # ← .points không phải iterable trực tiếp
---
### 61. sqlcmd chạy file .sql chứa tiếng Việt PHẢI `-f 65001` — console mojibake là display-only nhưng thiếu flag thì DATA hỏng thật (Session 59)
**Triệu chứng:** Output sqlcmd trên VPS hiện `H? th?ng trung th?`, `Ph?n th<74>` không phân biệt được "console hiển thị sai" ( hại) với "data trong DB đã hỏng" (thảm họa, nhất với UPDATE/INSERT chứa nvarchar tiếng Việt).
**Root cause 2 lớp:** (1) Console VPS codepage OEM mọi output Unicode đều mojibake = **display-only**, data vẫn đúng. (2) NHƯNG sqlcmd mặc định cũng đọc **input file** theo OEM codepage file `.sql` UTF-8 no-BOM (như Write tool tạo) chứa `N'Bê tông'` sẽ bị decode sai **ghi vào DB chuỗi hỏng THẬT**. Hai hiện tượng nhìn giống hệt nhau trên console.
**Fix + phòng tái diễn (S59 proven):** (1) Mọi lệnh `sqlcmd -i <file>` với file chứa tiếng Việt thêm **`-f 65001`** (đọc input UTF-8). (2) **KHÔNG kết luận data đúng/hỏng từ console VPS** verify độc lập: chạy cùng file trên LocalDB local (console local hiện tiếng Việt đúng) + curl API prod đọc JSON (UTF-8 end-to-end). S59 rename 71 WorkItems: console VPS mojibake nhưng API JSON trả `"2 MEP Sub Hệ thống trung thế"` nguyên vẹn data đúng.
**References:** `scripts/s59-rename-workitems-pmh.sql` (run với `-f 65001`) · verify pattern: login admin GET `/api/catalogs/work-items` JSON.
---
### 62. Đổi mã (natural-key) của data có seed per-code idempotent — PHẢI UPDATE DB prod TRƯỚC khi deploy seed mới, sai thứ tự = nhân đôi rows (Session 59)
**Triệu chứng tiềm năng (đã né):** Seed kiểu `SeedRealMasterDataAsync` so khớp theo `Code` (`if (existingCodes.Contains(code)) continue`). Đổi 71 WorkItems `VT-01→MAT-1` nếu **push code trước**: app restart chạy seed với tuples MỚI thấy 71 mới "chưa tồn tại" (DB còn ) INSERT 71 row mới = **142 rows trùng tên khác mã** trên prod.
**Quy trình đúng (S59 proven, Run #276 verify 71 — không phải 142):**
1. Viết SQL `UPDATE … SET Code=mới, Name=mới WHERE Code=cũ` (**GIỮ NGUYÊN Id** record đang được trỏ tới không gãy; phiếu PE/2026/A/001 vừa tạo vẫn đúng hạng mục).
2. Chạy SQL trên **prod + LocalDB Dev** trước.
3. Sửa seed tuples trong code commit + push SAU. App restart: seed thấy đủ mới add 0.
4. cicd verify count ĐÚNG N (N×2 = FAIL nghiêm trọng đưa vào prompt verify).
**Tổng quát:** idempotent-by-natural-key chỉ an toàn khi key bất biến mọi rename key phải đổi DB seed "cùng khoảnh khắc" theo thứ tự **DB-trước-code-sau** (với CI auto-deploy-on-push).
**References:** `scripts/s59-rename-workitems-pmh.sql` · `DbInitializer.cs` SeedRealMasterDataAsync · gotcha #57 họ hàng (soft-delete vs UNIQUE filtered) · Run #276 cicd verdict.
---
## Checklist debug bug mới
1. Build pass không? fail check using + package version compat