diff --git a/.claude/agent-memory/test-specialist/MEMORY.md b/.claude/agent-memory/test-specialist/MEMORY.md index 1b7625f..7d12458 100644 --- a/.claude/agent-memory/test-specialist/MEMORY.md +++ b/.claude/agent-memory/test-specialist/MEMORY.md @@ -15,7 +15,7 @@ WRITE specialist độc quyền `tests/**`. xUnit + FluentAssertions 7.2 + EF SQ - ❌ NOT: production code `src/Backend/**` + `fe-*/**` → test reveal bug → REPORT em main, KHÔNG fix - ❌ NOT: decide WHAT to test (test plan) → em main + reviewer chốt priority -## 📊 Baseline 374 tests = 374 PASS (45 Domain + 329 Infra) ← S85b +3 PE UpdateDraft WF-preserve ROOT-FIX bug-class S42 (test-after BUG-FIX disc): em main fix `UpdatePurchaseEvaluationDraftCommandHandler` (PurchaseEvaluationFeatures.cs:285) ABSOLUTE-SET→NULL-SAFE `if(request.ApprovalWorkflowId is not null) entity.ApprovalWorkflowId=...` (form Sửa header KHÔNG gửi WF → trước = CLEAR WF → kết submit "chưa chọn quy trình" whack-a-mole). NEW `PeUpdateDraftWorkflowPreserveTests.cs` 3: (1) PRESERVE phiếu Nháp WF=W + UpdateDraft ApprovalWorkflowId=null (field text có giá trị) → entity GIỮ W (reproduce: trước-fix null, sau-fix W) + sanity TenGoiThau/DiaDiem vẫn update / (2) CHANGE WF=W1 + gửi W2 (≠null) → đổi W2 (null-safe chỉ chặn null KHÔNG chặn đổi) / (3) bonus mirror BudgetPeriodAmount null-safe S61 (cùng pattern bug-class S42). ⚠️GOTCHA: `PurchaseEvaluation.ApprovalWorkflowId` FK Restrict thật → PE seed PHẢI ref WF row thật (random Guid → SQLite Error 19 FK fail; lần đầu RED). Fix: `SeedWorkflowAsync(db, code)` ApplicableType=DuyetNcc khớp PE Type (CHANGE case validate block line 253-266 cũng cần WF thật); PRESERVE case request-null short-circuit validate NHƯNG seed vẫn cần FK hợp lệ. IdentityFixture (Changelog Add). No prod bug — code đúng spec sau fix. Tag [s85b, pe-updatedraft, wf-preserve, root-fix-bug-class-s42, null-safe-guard, absolute-set→null-safe, approvalworkflowid-fk-restrict-seed-real, mirror-budget-nullsafe, test-after-bugfix]. Prev 371 (S85 +5 PE urgent DRAFTER-self-unset) ← S85 +5 PE urgent DRAFTER-self-unset (test-after authz, mirror PeUrgentToggle): em main S85 restructure handler `PurchaseEvaluationUrgentFeatures.cs` thêm nhánh UNSET cho NGƯỜI KHAI (`isDrafter = currentUser.UserId == entity.DrafterUserId`) → drafter GỠ clear CẢ 2 cờ (giống Admin), SET vẫn role-only (drafter KHÔNG tự gắn). EXTEND `PeUrgentToggleAuthzTests.cs` 11→16: FakeCurrentUser.UserId→`init` (settable) + SeedPeAsync +`drafterUserId` opt param. NEW 5: (10) Drafter role-thường UNSET→clear cả 2 no-Forbidden (pre-seed ByPro để prove CLEAR) / (11) Finance(non-drafter non-TP) UNSET→Forbidden`*GỠ*`+no-mutate cả 2 / (12) Drafter SET→Forbidden`*đánh dấu*` (drafter chỉ gỡ, không gắn) / (13) Drafter UNSET chỉ-ByCcm-bật→clear cả 2 (drafter-clear độc lập cờ-đang-bật) / (14) Drafter+Procurement-no-DeptManager UNSET→clear CẢ 2 qua nhánh isDrafter (đối chứng test6 TP-PRO chỉ clear cờ-vai — isDrafter ưu tiên/độc lập isProTp). 11 test S77c cũ vẫn xanh (không động nhánh drafter). No prod bug — code đúng spec S85. Prev baseline 366 (task-stated, S78-S84 thêm test MEMORY chưa ghi). Tag [s85, pe-urgent, drafter-self-unset, clear-both, set-role-only, isdrafter-priority-over-isProTp, no-mutate-on-forbidden, test-after] ← S77c CORRECTION urgent-toggle SYMMETRIC→ASYMMETRIC (S77b symmetric tests RED vs prod): anh chốt FINAL gate BẤT-ĐỐI-XỨNG theo `request.IsUrgent` — em main đã sửa prod `PurchaseEvaluationUrgentFeatures.cs:49-55` `isPro = IsUrgent ? hasPro : (hasPro && isDeptManager)` + `isCcm = IsUrgent ? hasCcm : (hasCcm && isDeptManager)`; Forbidden-msg nhánh-theo-IsUrgent (SET `*đánh dấu phiếu gấp*` / UNSET `*GỠ cờ gấp*`). REWRITE `PeUrgentToggleAuthzTests.cs` 12→11: **SET = role-chức-năng-đủ** (plain Procurement SET→OK ByPro / plain CostControl SET→OK ByCcm / Admin SET→both) — bỏ hết 2b/2c/2d DeptManager-alone-restriction của S77b (không còn áp cho SET); **UNSET = role AND DeptManager** (plain-PRO UNSET→Forbidden`*GỠ*`+no-mutate flag-still-true pre-seed urgent / plain-CCM UNSET→Forbidden / PRO+DM UNSET→clear-ByPro CCM-preserved / CCM+DM UNSET→clear-ByCcm PRO-preserved / Admin UNSET→both-clear); 9a Drafter-SET→Forbidden`*đánh dấu*` / 9b Finance-SET→Forbidden / 9c UnknownPe→NotFound TRƯỚC authz. No prod touch — prod ĐÃ asymmetric, test theo CODE (S34). Prev S77b 354 (symmetric, superseded) ← S77 +7 PE Mig 57 suggested-price NOTE (test-after, mirror S74 §4b CcmNote): `UpdatePeSuggestedPricePro/CcmCommand` +`Note` (string?) absolute-set→`Pro/CcmSuggestedPriceNote` (overwrite always incl null=clear); rides SAME role-gate as price (PRO/Admin · CCM/Admin) fail-closed TRƯỚC side-effect; validator `Note.MaximumLength(1000)`. Handler ctor `(db, ICurrentUser)` 2-dep + record arity UNCHANGED on existing args (Note=null default → 5 existing `new UpdatePeSuggestedPrice*Command(...)` call-sites still compile, KHÔNG cần vá). NEW 7 → `PeSuggestedPriceSetterAuthzTests.cs`: PRO-note+Min/Max persist (note KHÔNG clobber price) / Admin-PRO-note / CCM-note+price persist / null-clear PRO (pre-seed note→null=cleared) / null-clear CCM / non-priv→Forbidden+note&price unchanged (no partial-write) / PRO↔CCM note independent + validator 1001-char invalid·1000 valid. No prod bug — code đúng spec (note absolute-set + rides price gate, intentional). Prev 344 ← S76 +5 PE Mig 56 PRO-column-split (spec-change+compile-fix arity): UpdatePeBudgetProCommand record 3→4 param `(PeId, ProInitialAmount, ProAdjustmentAmount, ProNote)`; handler set ProInitial+ProAdjust absolute-set (KHÔNG còn ProEstimateAmount). Vá 5 PRO call-site `new UpdatePeBudgetProCommand(...)` thêm arg ProAdjust + rename assert `.ProEstimateAmount`→`.ProInitialAmount` (handler giờ set ProInitial). Capability `FullAmount`: hasCcm?CCM:proFull(ProInitial+ProAdjust); FullIsEstimate=!hasCcm&&hasPro; DTO +2 field cuối ProInitial/ProAdjust. NEW 5: PRO set both incl ProAdjust ÂM persist / validator ProInitial<0 invalid + ProAdjust ÂM valid (mirror CCM no-sign-constraint) / full=proFull(100+50=150)+DTO-surface / full=proFull ÂM-adjust(100-30=70 no-clamp). Full-fallback seed `ProEstimateAmount=500`→`ProInitialAmount=500` (capability đọc ProInitial). **Handler ctor `(db, ICurrentUser)` 2-dep UNCHANGED**. ProEstimateAmount=LEGACY (Mig 56 backfill→ProInitial, FE bỏ). No prod bug. Prev 339 ← S74 +5 PE Mig 55 CcmNote (compile-fix arity + test-after): UpdatePeBudgetCcmCommand record +`string? CcmNote` (4 param) → fix 3 existing `new UpdatePeBudgetCcmCommand(...)` thêm `null` arg4 (PeWorkItemBudgetTests.cs line 388/407/421); NEW 5 test mirror ProNote: CostControl-set / Admin-set / null=clear-absolute-set (pre-seed prove not vốn-dĩ-null) / Procurement→Forbidden no-mutate (fail-closed role-gate TRƯỚC EnsureTrackedAsync+side-effect, AsNoTracking re-read) / Initial+Adjustment+CcmNote all-persist-together. **Handler ctor `(db, ICurrentUser)` 2-dep UNCHANGED** — chỉ COMMAND record +CcmNote. No prod bug. Prev 334 ← S72 +28 PE Mig 54 (spec-change+test-after): PeCcmThresholdFinalizeTests 6→11 (AUTO→OPT-IN finalizeByCcmDelegation) + NEW PeApprovedPriceFinalizeTests 10 (giá chốt) + NEW PeSuggestedPriceSetterAuthzTests 13 (2 setter role-gate). Prev 306 ← S69b +14 PE 2 feature anh Kiệt FDC (test-before-merge SECURITY/FINANCIAL): `PeCcmThresholdFinalizeTests.cs` (5, Services ns, value-threshold CCM-finalize ApproveV2Async) + `PeUrgentToggleAuthzTests.cs` (9, Application ns, urgent-toggle role authz). Prev 292 ← S69 +6 Office golive permission-seed (`OfficeModulePermissionSeedTests.cs`, test-after, mirror HrmProfilePermissionSeedTests S67). Prev 286 ← S67 +23 HRM test-after [DepartmentTreeTests 8 cycle-guard/rollup/orphan + PeHoSoLinkTests 9 absolute-set (⚠️spec-drift: HoSoLink gửi null=CLEAR, KHÔNG null-safe như Budget*/WorkItemId) + HrmProfilePermissionSeedTests 6 reflection private-static revoke→seed chain]. **em main PROXY-RECORD** — return truncated #53 (chết lúc update MEMORY), 3 file delivered + `dotnet test` 286 PASS verify-on-disk. Prev 263 (S61 +22 PeWorkItemBudget −14 BudgetPolicy; Domain 58→45 drop Budget module). Pre = 254 (S60). +## 📊 Baseline 377 tests = 377 PASS (45 Domain + 332 Infra) ← S86 +3 PE drafter-notify-exclusion REGRESSION (bug-fix test-alongside, anh Kiệt FDC UAT Zalo): em main fix `PurchaseEvaluationWorkflowService.LogTransitionAsync` (~:1083-1135) khối notify "Phiếu cần bạn duyệt" (`:1117` NotifyManyAsync) +filter `&& l.ApproverUserId != evaluation.DrafterUserId` → NGƯỜI TẠO phiếu KHÔNG nhận chuông cần-duyệt phiếu mình tạo (kể cả khi config làm approver 1 Cấp). NEW `PeApproverNotifyExcludesDrafterTests.cs` (Services ns) 3: (1)⭐CORE 1-Step-2-Level: Cấp1=approverL1(actor) Cấp2={drafter,otherL2}; actorL1(≠drafter) Approve→advance Cấp2→assert NeedApproval recipients EXCLUDE drafter INCLUDE otherL2 / (2) Cấp2=CHỈ drafter→advance→recipients EMPTY (lọc xong rỗng→NotifyMany ko gọi) / (3) SANITY terminal DaDuyet: drafter VẪN nhận chuông KẾT-QUẢ "đã duyệt" (NotifyAsync block :1060 untouched) + ko NeedApproval (chống over-broad misfix). ⚠️**KEY: actor-exclusion (`!= actorUserId`) KHÔNG che bug** vì actor=approver-Cấp1, drafter=Cấp2 → identity riêng. **RED-on-old-code EMPIRICALLY PROVEN** (git stash prod file→rebuild→Test1+2 FAIL "recipients contains drafter", Test3 PASS; stash pop restore). Spy=`CapturingNotificationService` (records NotifyAsync/NotifyManyAsync recipients+title, KHÁC NoOpNotificationService nuốt) — DI ctor nhận INotificationService trực tiếp, ko cần WebApplicationFactory. Harness mirror PeCcmThresholdFinalizeTests (IdentityFixture + SQLite + SeedWorkflowAsync). Test3 terminal cần `approvedPriceAmount`+source (Mig 54 ApplyApprovedPriceOnFinalize buộc human chọn giá). ⚠️PROD-FIX uncommitted working-tree (em main) — `git diff -- file` empty/grep false-neg là artifact em main edit ĐỒNG-THỜI (gotcha #68-like + Bash-grep-VN-text), authoritative=Read-tool. No prod touch (chỉ verify qua stash, restore exact). Tag [s86, pe-drafter-notify-exclusion, notify-recipients-spy, capturing-notification-fake, actor-exclusion-not-cover-bug, red-proven-via-stash, mirror-ccm-harness, test-alongside-bugfix]. Prev 374 ← S85b +3 PE UpdateDraft WF-preserve ROOT-FIX bug-class S42 (test-after BUG-FIX disc): em main fix `UpdatePurchaseEvaluationDraftCommandHandler` (PurchaseEvaluationFeatures.cs:285) ABSOLUTE-SET→NULL-SAFE `if(request.ApprovalWorkflowId is not null) entity.ApprovalWorkflowId=...` (form Sửa header KHÔNG gửi WF → trước = CLEAR WF → kết submit "chưa chọn quy trình" whack-a-mole). NEW `PeUpdateDraftWorkflowPreserveTests.cs` 3: (1) PRESERVE phiếu Nháp WF=W + UpdateDraft ApprovalWorkflowId=null (field text có giá trị) → entity GIỮ W (reproduce: trước-fix null, sau-fix W) + sanity TenGoiThau/DiaDiem vẫn update / (2) CHANGE WF=W1 + gửi W2 (≠null) → đổi W2 (null-safe chỉ chặn null KHÔNG chặn đổi) / (3) bonus mirror BudgetPeriodAmount null-safe S61 (cùng pattern bug-class S42). ⚠️GOTCHA: `PurchaseEvaluation.ApprovalWorkflowId` FK Restrict thật → PE seed PHẢI ref WF row thật (random Guid → SQLite Error 19 FK fail; lần đầu RED). Fix: `SeedWorkflowAsync(db, code)` ApplicableType=DuyetNcc khớp PE Type (CHANGE case validate block line 253-266 cũng cần WF thật); PRESERVE case request-null short-circuit validate NHƯNG seed vẫn cần FK hợp lệ. IdentityFixture (Changelog Add). No prod bug — code đúng spec sau fix. Tag [s85b, pe-updatedraft, wf-preserve, root-fix-bug-class-s42, null-safe-guard, absolute-set→null-safe, approvalworkflowid-fk-restrict-seed-real, mirror-budget-nullsafe, test-after-bugfix]. Prev 371 (S85 +5 PE urgent DRAFTER-self-unset) ← S85 +5 PE urgent DRAFTER-self-unset (test-after authz, mirror PeUrgentToggle): em main S85 restructure handler `PurchaseEvaluationUrgentFeatures.cs` thêm nhánh UNSET cho NGƯỜI KHAI (`isDrafter = currentUser.UserId == entity.DrafterUserId`) → drafter GỠ clear CẢ 2 cờ (giống Admin), SET vẫn role-only (drafter KHÔNG tự gắn). EXTEND `PeUrgentToggleAuthzTests.cs` 11→16: FakeCurrentUser.UserId→`init` (settable) + SeedPeAsync +`drafterUserId` opt param. NEW 5: (10) Drafter role-thường UNSET→clear cả 2 no-Forbidden (pre-seed ByPro để prove CLEAR) / (11) Finance(non-drafter non-TP) UNSET→Forbidden`*GỠ*`+no-mutate cả 2 / (12) Drafter SET→Forbidden`*đánh dấu*` (drafter chỉ gỡ, không gắn) / (13) Drafter UNSET chỉ-ByCcm-bật→clear cả 2 (drafter-clear độc lập cờ-đang-bật) / (14) Drafter+Procurement-no-DeptManager UNSET→clear CẢ 2 qua nhánh isDrafter (đối chứng test6 TP-PRO chỉ clear cờ-vai — isDrafter ưu tiên/độc lập isProTp). 11 test S77c cũ vẫn xanh (không động nhánh drafter). No prod bug — code đúng spec S85. Prev baseline 366 (task-stated, S78-S84 thêm test MEMORY chưa ghi). Tag [s85, pe-urgent, drafter-self-unset, clear-both, set-role-only, isdrafter-priority-over-isProTp, no-mutate-on-forbidden, test-after] ← S77c CORRECTION urgent-toggle SYMMETRIC→ASYMMETRIC (S77b symmetric tests RED vs prod): anh chốt FINAL gate BẤT-ĐỐI-XỨNG theo `request.IsUrgent` — em main đã sửa prod `PurchaseEvaluationUrgentFeatures.cs:49-55` `isPro = IsUrgent ? hasPro : (hasPro && isDeptManager)` + `isCcm = IsUrgent ? hasCcm : (hasCcm && isDeptManager)`; Forbidden-msg nhánh-theo-IsUrgent (SET `*đánh dấu phiếu gấp*` / UNSET `*GỠ cờ gấp*`). REWRITE `PeUrgentToggleAuthzTests.cs` 12→11: **SET = role-chức-năng-đủ** (plain Procurement SET→OK ByPro / plain CostControl SET→OK ByCcm / Admin SET→both) — bỏ hết 2b/2c/2d DeptManager-alone-restriction của S77b (không còn áp cho SET); **UNSET = role AND DeptManager** (plain-PRO UNSET→Forbidden`*GỠ*`+no-mutate flag-still-true pre-seed urgent / plain-CCM UNSET→Forbidden / PRO+DM UNSET→clear-ByPro CCM-preserved / CCM+DM UNSET→clear-ByCcm PRO-preserved / Admin UNSET→both-clear); 9a Drafter-SET→Forbidden`*đánh dấu*` / 9b Finance-SET→Forbidden / 9c UnknownPe→NotFound TRƯỚC authz. No prod touch — prod ĐÃ asymmetric, test theo CODE (S34). Prev S77b 354 (symmetric, superseded) ← S77 +7 PE Mig 57 suggested-price NOTE (test-after, mirror S74 §4b CcmNote): `UpdatePeSuggestedPricePro/CcmCommand` +`Note` (string?) absolute-set→`Pro/CcmSuggestedPriceNote` (overwrite always incl null=clear); rides SAME role-gate as price (PRO/Admin · CCM/Admin) fail-closed TRƯỚC side-effect; validator `Note.MaximumLength(1000)`. Handler ctor `(db, ICurrentUser)` 2-dep + record arity UNCHANGED on existing args (Note=null default → 5 existing `new UpdatePeSuggestedPrice*Command(...)` call-sites still compile, KHÔNG cần vá). NEW 7 → `PeSuggestedPriceSetterAuthzTests.cs`: PRO-note+Min/Max persist (note KHÔNG clobber price) / Admin-PRO-note / CCM-note+price persist / null-clear PRO (pre-seed note→null=cleared) / null-clear CCM / non-priv→Forbidden+note&price unchanged (no partial-write) / PRO↔CCM note independent + validator 1001-char invalid·1000 valid. No prod bug — code đúng spec (note absolute-set + rides price gate, intentional). Prev 344 ← S76 +5 PE Mig 56 PRO-column-split (spec-change+compile-fix arity): UpdatePeBudgetProCommand record 3→4 param `(PeId, ProInitialAmount, ProAdjustmentAmount, ProNote)`; handler set ProInitial+ProAdjust absolute-set (KHÔNG còn ProEstimateAmount). Vá 5 PRO call-site `new UpdatePeBudgetProCommand(...)` thêm arg ProAdjust + rename assert `.ProEstimateAmount`→`.ProInitialAmount` (handler giờ set ProInitial). Capability `FullAmount`: hasCcm?CCM:proFull(ProInitial+ProAdjust); FullIsEstimate=!hasCcm&&hasPro; DTO +2 field cuối ProInitial/ProAdjust. NEW 5: PRO set both incl ProAdjust ÂM persist / validator ProInitial<0 invalid + ProAdjust ÂM valid (mirror CCM no-sign-constraint) / full=proFull(100+50=150)+DTO-surface / full=proFull ÂM-adjust(100-30=70 no-clamp). Full-fallback seed `ProEstimateAmount=500`→`ProInitialAmount=500` (capability đọc ProInitial). **Handler ctor `(db, ICurrentUser)` 2-dep UNCHANGED**. ProEstimateAmount=LEGACY (Mig 56 backfill→ProInitial, FE bỏ). No prod bug. Prev 339 ← S74 +5 PE Mig 55 CcmNote (compile-fix arity + test-after): UpdatePeBudgetCcmCommand record +`string? CcmNote` (4 param) → fix 3 existing `new UpdatePeBudgetCcmCommand(...)` thêm `null` arg4 (PeWorkItemBudgetTests.cs line 388/407/421); NEW 5 test mirror ProNote: CostControl-set / Admin-set / null=clear-absolute-set (pre-seed prove not vốn-dĩ-null) / Procurement→Forbidden no-mutate (fail-closed role-gate TRƯỚC EnsureTrackedAsync+side-effect, AsNoTracking re-read) / Initial+Adjustment+CcmNote all-persist-together. **Handler ctor `(db, ICurrentUser)` 2-dep UNCHANGED** — chỉ COMMAND record +CcmNote. No prod bug. Prev 334 ← S72 +28 PE Mig 54 (spec-change+test-after): PeCcmThresholdFinalizeTests 6→11 (AUTO→OPT-IN finalizeByCcmDelegation) + NEW PeApprovedPriceFinalizeTests 10 (giá chốt) + NEW PeSuggestedPriceSetterAuthzTests 13 (2 setter role-gate). Prev 306 ← S69b +14 PE 2 feature anh Kiệt FDC (test-before-merge SECURITY/FINANCIAL): `PeCcmThresholdFinalizeTests.cs` (5, Services ns, value-threshold CCM-finalize ApproveV2Async) + `PeUrgentToggleAuthzTests.cs` (9, Application ns, urgent-toggle role authz). Prev 292 ← S69 +6 Office golive permission-seed (`OfficeModulePermissionSeedTests.cs`, test-after, mirror HrmProfilePermissionSeedTests S67). Prev 286 ← S67 +23 HRM test-after [DepartmentTreeTests 8 cycle-guard/rollup/orphan + PeHoSoLinkTests 9 absolute-set (⚠️spec-drift: HoSoLink gửi null=CLEAR, KHÔNG null-safe như Budget*/WorkItemId) + HrmProfilePermissionSeedTests 6 reflection private-static revoke→seed chain]. **em main PROXY-RECORD** — return truncated #53 (chết lúc update MEMORY), 3 file delivered + `dotnet test` 286 PASS verify-on-disk. Prev 263 (S61 +22 PeWorkItemBudget −14 BudgetPolicy; Domain 58→45 drop Budget module). Pre = 254 (S60). > Pattern S67: private-static seed/init → invoke qua REFLECTION (`GetMethod(name, NonPublic|Static)` + `Invoke(null, [db, roleManager, NullLogger.Instance])`); seed MenuItem rows TRƯỚC Permission (FK MenuKey→MenuItem.Key Cascade, SQLite Error 19 nếu thiếu). Cycle-guard test: SqliteDbFixture đủ (no User); rollup-count test cần IdentityFixture (đếm User.DepartmentId active). Run: `dotnet test SolutionErp.slnx --nologo --verbosity minimal -p:BuildInParallel=false -maxcpucount:1` (MSBuild OOM → serialize build) diff --git a/docs/STATUS.md b/docs/STATUS.md index 543b97c..3a50e4b 100644 --- a/docs/STATUS.md +++ b/docs/STATUS.md @@ -17,14 +17,14 @@ | API endpoints | **~253** | +1 S54 `GET /it-tickets/assignable-staff` (capability endpoint); +3 S52 (attendances/report + report/excel + it-tickets/{id}/assign) | | FE pages | **68** | unchanged S54 (ItTicketsPage reassign = in-place 2 app); +1 S52 AttendanceReportPage | | Menu keys | **54** | +1 S69 `Off_Dashboard` (landing Văn phòng số). Prev re-ground S61 (`MenuKeys.cs` const — Mig 50 gỡ 4 `Bg_*` Budget menu cũ). Prev 57 (S58) | -| Tests | **356 PASS** | 45 Domain + 311 Infra · 0 fail / 0 skip · **S83 +2** (PE require-workflow: `PeWorkItemGuardTests` ApprovalWorkflowId `NotEmpty` ×2 validator + submit-guard rewrite test 7/13 `PeSubmitGuardAndBypass` V1-submit-deprecated, no-count-change) · **S77 +10** (+7 `PeSuggestedPriceSetterAuthzTests` ghi chú PRO/CCM Mig 57 absolute-set/role-gate/null-clear/max-1000 · +3 `PeUrgentToggleAuthzTests` rewrite cờ-gấp **BẤT ĐỐI XỨNG** SET=function role / UNSET=function+DeptManager, plain-PRO-unset Forbidden) · **S76 +5** (`PeWorkItemBudgetTests` PRO split: set ProInitial+ProAdjust gồm âm · validator ProInitial≥0/ProAdjust-cho-âm · full=proFull khi CCM empty · full=CCM khi CCM present) · **S74 +5** (`PeWorkItemBudgetTests` §4b CcmNote: set CCM/Admin · null-clear absolute-set · non-priv Forbidden+no-mutate · all-3-persist) · **S73 +28** (PE opt-in finalize spec 6→11 + 10 giá-chốt `PeApprovedPriceFinalizeTests` + 13 setter-authz `PeSuggestedPriceSetterAuthzTests`) · **S69 +20** (Office-golive OfficeModulePermissionSeed 6 + PE PeCcmThresholdFinalize 5 + PeUrgentToggleAuthz 9) · **S67 +23 HRM test-after** (DepartmentTreeTests 8 cycle-guard/rollup + PeHoSoLinkTests 9 absolute-set + HrmProfilePermissionSeedTests 6 reflection-seed) → 286 · S61 +22 `PeWorkItemBudgetTests` −14 `BudgetPolicyTests` −1 → 263 · S60 +14 `PeSubmitGuardAndBypassTests` +2 spec → 256 (Domain 58→45 do drop Budget module tests) | -| Gotchas | **71** | +1 S78 **#71** (thêm enum value vào entity DÙNG-CHUNG → pollute UI/guard phân-loại theo PROXY-predicate `supplierId===null` thay vì enum tường minh; file-khi-duyệt purpose=5 lẫn "Bảng so sánh" + false-pass submit-guard → grep mọi field-proxy predicate loại value mới + build-verify TỪNG app; em-main grep no-leak bắt trước deploy). +1 S76 **#70** (FE absolute-set echo field anh-em từ server-snapshot + `invalidate()` fire-and-forget → cửa-sổ stale-echo mất-dữ-liệu khi lưu 2 ô liên-tiếp; guard `useIsFetching` gate nút Lưu tới khi refetch land; reviewer workflow bắt, impl self-review sót). +1 S72 **#69** FE bundle-hash non-deterministic + `deploy.yml` rebuild-FE-unconditional → bundle rotate kể cả commit governance (SPA-fallback-200 trap; cicd Run #312). +2 S69: **#67** Tailwind v4 accent palette thiếu stop (teal/violet/amberx/greenx chỉ 50/100/500/600/700; dùng -300 → teal/violet rơi DEFAULT Tailwind sai-hệ, amberx/greenx drop hẳn — build PASS, phải soi dist CSS) · **#68** IDE TS diagnostic giữa background-agent/workflow = snapshot dở-dang (TS server bắn mỗi save), chỉ tin build SẠCH sau-cùng (2× session này: re-skin + PE-FE đều false-alarm). Prev +1 S68 **#66** Tailwind v4 rule element thô `h1-h4{color:#0b1220}` viết NGOÀI `@layer` thắng utility `text-white` → heading render đen; fix ĐIỂM `text-white!` (important, grep dist confirm), KHÔNG move `@layer` (load-bearing ~30+ heading toàn app). Prev +1 S65 **#65** build csproj con (vd `SolutionErp.Api.csproj`) ≠ `dotnet build SolutionErp.slnx` (gồm tests) → miss test-compile khi đổi chữ ký record command (CreateDepartmentCommand +ParentId) → CI CS7036 FAIL-gated Run #291 (deploy chặn, prod nguyên — test-gate làm đúng việc). Fix: build full slnx trước push BE signature-change. Prev +2 S61: **#63** EF scaffold tự sinh `RenameColumn` SAI-semantics khi drop+add cùng type (test xanh không bắt — SQLite EnsureCreated không replay migration) · **#64** `dotnet ef database update` áp Design-DB 0-rows ≠ Dev-DB → data-migrate `Sql()` chạy thật lần đầu trên prod. Prev +2 S59 (#61 sqlcmd `-f 65001` · #62 rename natural-key UPDATE trước deploy) | +| Tests | **377 PASS** | 45 Domain + 332 Infra · 0 fail / 0 skip · **S86 +3** (`PeApproverNotifyExcludesDrafterTests` — notify "cần duyệt" loại NGƯỜI TẠO phiếu: drafter-excluded · co-approver-vẫn-nhận · drafter-vẫn-nhận-chuông-kết-quả) · **S85 +18** (PE CV PRO C5 hủy/đổi NCC winner +10 · urgent drafter-self-unset +5 · workflow-preserve bug-class S42 +3 `PeUpdateDraftWorkflowPreserveTests`) · **S83 +2** (PE require-workflow: `PeWorkItemGuardTests` ApprovalWorkflowId `NotEmpty` ×2 validator + submit-guard rewrite test 7/13 `PeSubmitGuardAndBypass` V1-submit-deprecated, no-count-change) · **S77 +10** (+7 `PeSuggestedPriceSetterAuthzTests` ghi chú PRO/CCM Mig 57 absolute-set/role-gate/null-clear/max-1000 · +3 `PeUrgentToggleAuthzTests` rewrite cờ-gấp **BẤT ĐỐI XỨNG** SET=function role / UNSET=function+DeptManager, plain-PRO-unset Forbidden) · **S76 +5** (`PeWorkItemBudgetTests` PRO split: set ProInitial+ProAdjust gồm âm · validator ProInitial≥0/ProAdjust-cho-âm · full=proFull khi CCM empty · full=CCM khi CCM present) · **S74 +5** (`PeWorkItemBudgetTests` §4b CcmNote: set CCM/Admin · null-clear absolute-set · non-priv Forbidden+no-mutate · all-3-persist) · **S73 +28** (PE opt-in finalize spec 6→11 + 10 giá-chốt `PeApprovedPriceFinalizeTests` + 13 setter-authz `PeSuggestedPriceSetterAuthzTests`) · **S69 +20** (Office-golive OfficeModulePermissionSeed 6 + PE PeCcmThresholdFinalize 5 + PeUrgentToggleAuthz 9) · **S67 +23 HRM test-after** (DepartmentTreeTests 8 cycle-guard/rollup + PeHoSoLinkTests 9 absolute-set + HrmProfilePermissionSeedTests 6 reflection-seed) → 286 · S61 +22 `PeWorkItemBudgetTests` −14 `BudgetPolicyTests` −1 → 263 · S60 +14 `PeSubmitGuardAndBypassTests` +2 spec → 256 (Domain 58→45 do drop Budget module tests) | +| Gotchas | **73** | +2 S85 (**#72** lệch giờ +7h — DateTime lưu UTC nhưng serialize thiếu 'Z' → FE `new Date()`=local → `UtcDateTimeJsonConverter` global ép UTC-with-Z · **#73** UpdateDraft absolute-set CLEAR field SÓT khỏi pattern null-safe = bug-class S42 → guard `if (request.X is not null)`). +1 S78 **#71** (thêm enum value vào entity DÙNG-CHUNG → pollute UI/guard phân-loại theo PROXY-predicate `supplierId===null` thay vì enum tường minh; file-khi-duyệt purpose=5 lẫn "Bảng so sánh" + false-pass submit-guard → grep mọi field-proxy predicate loại value mới + build-verify TỪNG app; em-main grep no-leak bắt trước deploy). +1 S76 **#70** (FE absolute-set echo field anh-em từ server-snapshot + `invalidate()` fire-and-forget → cửa-sổ stale-echo mất-dữ-liệu khi lưu 2 ô liên-tiếp; guard `useIsFetching` gate nút Lưu tới khi refetch land; reviewer workflow bắt, impl self-review sót). +1 S72 **#69** FE bundle-hash non-deterministic + `deploy.yml` rebuild-FE-unconditional → bundle rotate kể cả commit governance (SPA-fallback-200 trap; cicd Run #312). +2 S69: **#67** Tailwind v4 accent palette thiếu stop (teal/violet/amberx/greenx chỉ 50/100/500/600/700; dùng -300 → teal/violet rơi DEFAULT Tailwind sai-hệ, amberx/greenx drop hẳn — build PASS, phải soi dist CSS) · **#68** IDE TS diagnostic giữa background-agent/workflow = snapshot dở-dang (TS server bắn mỗi save), chỉ tin build SẠCH sau-cùng (2× session này: re-skin + PE-FE đều false-alarm). Prev +1 S68 **#66** Tailwind v4 rule element thô `h1-h4{color:#0b1220}` viết NGOÀI `@layer` thắng utility `text-white` → heading render đen; fix ĐIỂM `text-white!` (important, grep dist confirm), KHÔNG move `@layer` (load-bearing ~30+ heading toàn app). Prev +1 S65 **#65** build csproj con (vd `SolutionErp.Api.csproj`) ≠ `dotnet build SolutionErp.slnx` (gồm tests) → miss test-compile khi đổi chữ ký record command (CreateDepartmentCommand +ParentId) → CI CS7036 FAIL-gated Run #291 (deploy chặn, prod nguyên — test-gate làm đúng việc). Fix: build full slnx trước push BE signature-change. Prev +2 S61: **#63** EF scaffold tự sinh `RenameColumn` SAI-semantics khi drop+add cùng type (test xanh không bắt — SQLite EnsureCreated không replay migration) · **#64** `dotnet ef database update` áp Design-DB 0-rows ≠ Dev-DB → data-migrate `Sql()` chạy thật lần đầu trên prod. Prev +2 S59 (#61 sqlcmd `-f 65001` · #62 rename natural-key UPDATE trước deploy) | | User memory | **31** | +S84 `feedback_derived_flush_execution` (derived→canonical flush = em-main execution KHÔNG gate user-confirm; monitor INFORM-only ≠ cần-anh-duyệt; chỉ ĐỔI-con-số/policy = quyền anh). +S79 `feedback_canonical_spec_over_broadcast` (adap pull canonical-command/§P đừng phỏng-theo broadcast + report-before-stamp dogfood + residual own-diary OK). +S75 `feedback_harness11_engine` (engine governance tự-bảo-trì + gotcha #30-via-Edit + multi-workflow-verify + git-add-specific lesson). re-ground S71 (H1 disk-count: 25 `feedback_*` + 3 `project_*`; STATUS "21" stale từ S64). +S71 `feedback_harness10_run_trace` (run-trace + 3 lesson). Prev +1 S64 `feedback_harness7_outward_writing_quality`; re-grounded S54 base 19 | | Skills | 6 | 3 domain + 3 ops | | Sub-agents | **11** | **all-inherit top-tier (Harness-8 S66 06-16 — thay thế two-tier H4):** em main Fable 5 (1M) Max (fallback Opus 4.8 1M, Fable suspended H5) · **cả 11 sub `model: inherit`** (7 demoted `claude-opus-4-8` flip S66; SE không có helper/gopher rẻ → cả 11 lên top-tier) · effort Max. 9 product/quality + 2 monitor INFORM-only. Nấc H8 = **executed-file VERIFIED-pending-restart**. Prev two-tier H4 runtime-verified S57bis (spawn-test 2 chiều). | | RAG chunks | **2429** | re-verify S80 (`list_projects` — alive, +6 vs S63's 2423). Stale `last_indexed 05-29` (S42-S62 via store_memory stopgap; full re-index = AI_INFRA op cần VOYAGE_API_KEY). | -**Bundle hash live (prod):** admin **`CsJetgZH`** · user **`BVS0ApIm`** (S78 — **Run #330** `7886fd0` PE attach-file khi duyệt; bundle ROTATE từ S77 `BqKD3Y23`/`Cn-i349D` dù NO migration enum-only — gotcha #69 non-determ rebuild; cicd ship-proof byte-stable + fake-hash control). **Prev S77** — admin **`BqKD3Y23`** · user **`Cn-i349D`** (S77 — **Run #329** `e823694` banner Trả-lại; cuối chuỗi 10 deploy #320→#329 cùng ngày, cicd PASS each: #320 pill `DsSg6RRz`-era → #321 focus → #322 revert → #323 Mig57+notes `CPm4LTqm`/`BWJUAqEI` → #324 số-âm-đỏ `C6fx-0ea`/`N3sW4Div` → #325 indent `BhnNMucS`/`B1VebpXc` → #326 cờ-gấp-asymmetric `DwXqn37C`/`COXMCv7E` → #327 decouple `B0gboSAg`/`DbDg7pM-` → #328 notify (BE-only, FE frozen) → #329 banner **`BqKD3Y23`**/**`Cn-i349D`**). **Prev S76** — admin **`jOqxW4-p`** · user **`DbsznVvR`** (S76 — **Run #319** `21d1f4e` bảng lưới `