wal: flush 20260714T1033
This commit is contained in:
@ -75,7 +75,7 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte
|
||||
|
||||
## 📅 Recent activity (compressed — full verbatim → `archive/2026-06.md` via `archive/_INDEX.md`)
|
||||
|
||||
- **2026-07-13 PE quote-NEGATIVE feature LENS Budget-consumers (ensemble, RETURN-only):** anh Kiệt: cho nhập SỐ ÂM ô `form.thanhTien` (báo giá/hạng mục) dialog "Thêm NCC"; RULE = âm=khoản-TRỪ NCC, **ngân sách GIỮ NGUYÊN**. ⭐ **CRITICAL confirm: quote KHÔNG mutate `PeWorkItemBudgets`** — budget chỉ ghi bởi `UpdatePeBudgetPro/CcmCommandHandler` (role-gated PRO/CCM, `PeWorkItemBudgetFeatures.cs:105-107/175-177`) + Adjust/SetCcmBudget; quote write-site (`PurchaseEvaluationDetailFeatures.cs:308-345`) chỉ đụng quote-field + re-derive `IsWinner`, NEVER budget. **5 consumer đọc `SUM(ThanhTien WHERE IsSelected)`:** (1) winnerQuoteTotal DISPLAY `PeFeatures.cs:1188-1191` no-clamp (2) CCM-threshold `PeWorkflowService.cs:884-893` guard `>=ceoThreshold` reject HIGH ko-reject-âm→âm cho CCM-finalize dễ hơn (3) giaTri CreateContract PER-WINNER `CreateContractFromEvaluation:88-90,100` → Contract.GiaTri CÓ THỂ ÂM, **BYPASS** `CreateContractCommandValidator.GiaTri>=0` (`ContractFeatures.cs:46`, chỉ áp manual-create path) (4) "So-với-ngân-sách" block-B DISPLAY `PeFeatures.cs:904-947` budget read AsNoTracking untouched, soft-warn only (5) **submit-guard `PeWorkflowService.cs:196-209` = GUARD DUY NHẤT REJECT: `if Sum()<=0 → "chưa có giá chào thầu"`** — WHOLE-phiếu total, per-item âm OK miễn net>0. **NO quote validator tồn tại** (grep⌀ `UpsertPurchaseEvaluationQuoteCommandValidator`) → âm đã flow BE 0-block, chỉ FE chặn. Keep-≥0 fields có validator: BudgetPeriodAmount/ApprovedPriceAmount/ProInitial/InitialAmount. ĐÃ allow-âm sẵn (unrelated): ProAdjustment/Adjustment/ExpectedRemainingAmount (`PeFeatures.cs:345-348` mirror-LeaveBalance). Tag `[s115?, pe-negative-quote, budget-not-mutated, submit-guard-sum-le-0, giaTri-negative-bypass-validator, no-quote-validator]`.
|
||||
- **[→ archive/2026-07.md] 2026-07-13 PE negative-quote 2× LENS (Budget-consumers + edge/precedent/test)** — key giữ: budget-not-mutated-by-quote (architectural) · submit-guard `Sum()<=0` `:206` duy-nhất reject · no-quote-validator · parseVnd strip-minus · giaTri-âm bypass validator · gotcha #81 orthogonal-dấu. Executed S116; anchors sống trong S116/S117 entries.
|
||||
- **[→ git 07-12 · superseded by S115 entry above] PE per-HANGMUC multi-winner LENS BE-consumer-audit:** 3 cardinality axes — `SelectedSupplierId` single (legacy) · Mig58 `IsWinner`=WHOLE-SUPPLIER liên-danh · `Quote.IsSelected` per hangmuc×supplier (S114 made LIVE). 5 money consumers keyed off IsSelected now (winnerQuoteTotal/submit-guard/ccm-threshold/giaTri/budget-block-B). ~6 test files. Tag `[pe-multiwinner, per-hangmuc, quote-isselected, cardinality]`.
|
||||
- **[→ git 07-12] Supplier-import-v2 LENS-3 FE-dialog-UX:** SupplierImportDialog+SuppliersPage SHA-identical 2-app; dialog 2-step preview→confirm round-trips `preview.rows` → per-row edit feasible; `ExpectedHeaderTokens` 30-token baked `SupplierExcelImportService.cs:35-68` = template single-source; Mã NCC=Code; import authz-mismatch BE `[Roles=Admin,CatalogManager]` vs FE `Suppliers/Create` open. Tag `[s112, supplier-import-v2, fe-lens3, import-authz-mismatch]`.
|
||||
- **[→ git+session-log 07-07] S105 BVAAU cross-repo auth RCA:** Q1 root-cause = FE Home MÙ session (bundle cũ relative `/api` trên site TĨNH `web.config` loại `^/api/` → `/api/auth/me` 404 → anonymous); fix API_BASE-absolute `51c69fb` LIVE. Q2 CRM1 hở 2 tầng (FE soft + API `enforceCrmGate:false`) → flip `AUTH_ENFORCE_CRM_GATE=true`. Q3 Zalo "User_ID" KHÔNG có UI. Class **"hub+site-tĩnh relative-`/api` chết im prod"**; #53-garble-7 → SendMessage-resume recover. *(verbatim → archive/2026-07.md)*
|
||||
@ -94,17 +94,18 @@ Bearer từ `POST api.solutions.com.vn/api/auth/login` → status matrix expecte
|
||||
- **[→ archive/2026-06.md + git]** S52 P11-D/E/F 6-gap recon · S50 HrmConfigs add-kind 11-spot · S51 gotcha #57 EXT reachability (curated S59).
|
||||
- **[→ archive/2026-05-q4.md + git d2f52ba]** S29-S37: clean-room > NamGroup-port verified 4× · Pattern 12-bis cross-module mirror · FK+freetext dual-write.
|
||||
|
||||
- **2026-07-13 PE negative-quote LENS edge/precedent/test (fable-clone, RETURN-only; complements Budget-consumers entry ↑):** ⭐ BE+DB đã cho âm; blocker = FE helper + submit-guard. (a) `parseVnd` `PeDetailTabs.tsx:51` strip `[^\d]` → minus mất; `formatVndInput:52` `n>0?:''` → âm+0 đều blank (lẫn "chưa báo giá"); AddSupplier gate `thanhTien>0` :2226 skip quote khi ≤0 (empty≡0 by-design); inline QuoteCellDialog :2870 always-POST (store 0 OK); fe-admin SHA-identical :51/:52/:2226. (b) precedent = OMIT validator: `ExpectedRemainingAmount` PurchaseEvaluationFeatures.cs:348 + LeaveBalance `AdjustmentDays` LeaveBalanceFeatures.cs:107; Quote `UpsertPurchaseEvaluationQuoteCommand` DetailFeatures.cs:272 = NO validator (grep⌀) → BE nhận âm sẵn. (c) 0 test assert ThanhTien≥0. (d) gotcha #81 orthogonal (IsWinner==Any(IsSelected) bool≠sign → no phantom). (e) NO DB CHECK (`HasCheckConstraint` grep⌀ whole Infra; col decimal(18,2) config:131). HARD-INTERACTION submit-guard `Sum()<=0` `PurchaseEvaluationWorkflowService.cs:206`+FE:201 → net-≤0 BLOCKED "chưa có giá"; che CCM-threshold:891. NS-giữ-nguyên architectural (quote never write PeWorkItemBudgets; âm chỉ shift winnerQuoteTotal:1188). Tag `[pe-neg-quote,parsevnd-strip-minus,sum<=0-guard,no-check-constraint,omit-validator,iswinner-orthogonal]`.
|
||||
- **[→ git 07-10] S108 first-real-run H19 cite-audit:** 103/111 exact; class = worker-draft cite lệch ±1-2 quanh code-fence (audit MỞ ĐÚNG DÒNG đừng tin range) + drift-note-stale + email-fact honesty-trap. 0 garble.
|
||||
|
||||
- **2026-07-12 (S111 H22 WAL deep-pass) `[engine: fable-real-single · Fable-S111]`:** H22 WAL adopt → READY_WITH_NUANCES + spec 3-mục (em-main gov/settings · w1 pause+tiep · w2 start/end delta · w3 hook+README). Chốt: (1) `.claude/settings*.json` KHÔNG tồn tại → hooks-entry CREATE mới; hook = STAGED-until-verified (S100 ghost-wire, chỉ claim khi thấy `wal:` commit phiên mới). (2) engine`:402` no-OS-hook = MÔ-TẢ (CAVEAT) không phải luật cấm; `:116` E.3 "hook fails-open ≠ gate" → persist-only TƯƠNG THÍCH, update :402; ACTIVE-MARKS 0 mark cấm-hook; H5 start`:41` chỉ cấm hook-switch MODEL. (3) AS-6 KHÔNG tăng: 2 runtime .json gitignored (`.gitignore:124-125`), hook commit LOCAL — push-set ≡ hôm nay. (4) cmd-PATH Git Bash trước WSL, bash 5.2.26 OK. (5) `.gitattributes` exists broadcasts-scoped → append `*.sh`; repo 0 .sh = zero churn. (6) 16 command 0 trùng pause/tiep. (7) Stop-hook fire chỉ TURN-boundary → chết giữa workflow-turn = vật-liệu DISK uncommitted, /tiep đọc cả git status/disk. (8) run.md thiếu taskList snapshot. Learned: "luật cấm hook" phải phân MÔ-TẢ vs LUẬT trước khi đòi carve-out. L1@19.8KB → suggest em-main curate.
|
||||
|
||||
- **2026-07-11 (S110 H21+MTv3 deep-pass) `[engine: fable-real-single · Fable-S110]`:** Task ground-truth 2 broadcast (H21 spec-file+per-invocation · MTv3 owner-choice) + inventory TOKEN toàn repo + SPEC 3-mục. Verdict **PASS**: (1) **12 persona file SẠCH 0-hit** fable/engine-token (grep 2 vòng cả `engine-đắt|top-model|ensemble`) — NGƯỢC hub vòng-1 bắt persona-phụ lỗi; (2) MTv3 self-check regex §5 chính-thức **0-hit** nhưng extended "lead LUÔN top-model" bắt 5 ACTIVE (engine:332 K.D · runbook:140/:455 · fable-real.md:17 · mark ACTIVE-MARKS:19) = **regex-heuristic-miss class** — sister diễn-đạt khác cụm regex; (3) **hmw.js:38 comment "tier:'fable' khi hệ-trọng" = xung-đột MTv3 §1.3/H21 §3** (đường nâng hạng-nhất DUY NHẤT = owner gõ; comment cho lead-discretion) — comment-only fix; (4) hmw-mode.on = HỆ KHÁC (consent fan-out T3 `ultracode-hmw-mem-governance`, content tự khai /ultra-on) — ngoài scope H21; (5) mega-line "VẪN ON" class = **standing-imperative-trong-history-blurb** (S109-header + HANDOFF NEXT-anh = ACTIVE cần sửa; blurb-body = snapshot giữ). Bẫy fidelity lớn nhất: MTv3 §1.2/1.3 "sub gán cứng hạng-hai" đọc như floor → tưởng phá H8 all-inherit; triage-reply S2 CÙNG NGÀY waive đích-danh ("không đổi gì với form all-inherit"). ⚠️ #53 garble lượt return đầu (trả status-line giữa-chừng thay verdict) → coordinator SendMessage re-emit trong-session = recover OK, diary ghi trước re-emit.
|
||||
- **[→ archive/2026-07.md] S111 (07-12) H22 WAL deep-pass `[fable-real-single]`** — READY_WITH_NUANCES; hook=STAGED-until-verified (S100 ghost-wire class); engine:402 = MÔ-TẢ không phải luật cấm; Stop-hook fire TURN-boundary only. (H22 nay VERIFIED-RUNTIME per project memory.)
|
||||
- **[→ archive/2026-07.md] S110 (07-11) H21+MTv3 deep-pass `[fable-real-single]`** — PASS; 12 persona 0-hit; regex-heuristic-miss class (sister diễn-đạt khác cụm); hmw.js:38 comment-conflict; standing-imperative-trong-history-blurb class; #53 garble→SendMessage re-emit recover OK.
|
||||
|
||||
---
|
||||
|
||||
## S116 — PE negative-quote invest (on-behalf, fable-clone ensemble)
|
||||
- **2026-07-13** `/fable-clone investigator-codebase` 4-lane (`wf_eaf52972-d18`: FE-surface/BE-surface/Budget-consumers/Edge-precedent-tests) điều tra PE cho-nhập-giá-âm ô báo giá. **Kết luận hội-tụ = FE-ONLY:** BE/DB nhận âm SẴN (0 validator `UpsertPurchaseEvaluationQuoteCommand` `PurchaseEvaluationDetailFeatures.cs:272`, `ThanhTien decimal(18,2)` no CHECK constraint — grep `HasCheckConstraint`=0); **ngân sách GIỮ NGUYÊN bằng kiến-trúc** (`PeWorkItemBudgets` chỉ ghi bởi command budget role-gated `:105/175/242`, quote write-path `:308-343` KHÔNG đụng budget). Chặn âm = 3 chốt FE (`parseVnd:51` strip `-`, `formatVndInput:52` n>0→blank, submit-gate `:2226` `>0`); pattern sign-aware `VndInlineEdit:1003` (allowNegative + neg-state + ±toggle) có SẴN cùng file → tái dùng. Precedent LeaveBalance `PurchaseEvaluationFeatures.cs:348` cho số-dư-âm. 5 consumer SUM(ThanhTien WHERE IsSelected): winnerQuoteTotal/CCM-threshold/giaTri/so-ngân-sách/submit-guard — chỉ submit-guard `:206` hard-reject. gotcha #81 độc-lập dấu (IsSelected boolean). **⚠️ Lesson:** quote sống ở `details[].quotes` KHÔNG `suppliers[].quotes` (`PeSupplier` no quotes-field) — FE-impl-agent verify-on-disk sửa spec-shape-error. **Detail đầy đủ:** `.claude/workflows/runs/2026-07-13-pe-negative-quote/` (run.md+spec) + session-log `2026-07-13-S116`. `[engine: fable-clone-ensemble · Opus-S116]`
|
||||
## S117 — PE lũy-kế "không bắt sau duyệt" RCA (fable-real single deep-pass)
|
||||
- **2026-07-14** VERDICT: phiếu nguồn A/018 KHÔNG hề DaDuyet — Chương (Bước2 Cấp2 `AllowApproverFinalize`, badge "Duyệt thay CEO" = CONFIG-display `PeWorkflowPanel.tsx:364`) duyệt KHÔNG tick ô OPT-IN "Cấp này KẾT THÚC" (S97 Part1 đảo default UNCHECKED `PeWorkflowPanel.tsx:57` useState(false); FE gửi tường minh :203) → advance thường lên Bước3 CEO, Phase=10 ChoDuyet. Prod ground-truth: StepIdx=2 LvlOrd=1 EndedFin=0; changelog 13/07 12:23Z "Hoàn tất Bước 2/3, sang Bước 3 (Cấp 1)" no-finalize-marker; IsWinner=1 SelQ=1 (749.564M) → RC-2 refuted. Lũy-kế Row2 filter `Phase==DaDuyet` (`PeFeatures.cs:906`) ĐÚNG nguyên tắc Kenny "duyệt rồi mới bắc"; tính LIVE :886-918 no-store → xóa+tạo-lại phiếu-XEM vô ích. ⭐ Residual = DISPLAY-LIE nửa-còn-lại gotcha #78: non-DaDuyet `endsBeforeCeo`=config TRUE bất chấp pointer (detail `:1152-1154` literal `: true`; list `:647-651` subquery `.Any()`) → Bước3 mờ "Kết thúc tại Cấp 2" + chip list "⚑ Kết thúc·CCM" NGAY KHI phiếu nằm inbox CEO → user tưởng xong. 3 cơ chế chồng phân biệt: AllowApproverFinalize (Mig58 + opt-in S97) ≠ finalizeByCcmDelegation (Mig53/54 threshold — v04 CeoThresh=NULL không dùng) ≠ skipToFinal (Mig31 pointer-jump giữ ChoDuyet). Fix rec: vận-hành CEO-duyệt hoặc trả-lại→Chương tick; code = pointer-aware endsBeforeCeo (detail in-memory trivial, list EF-subquery kềnh), KHÔNG nới filter lũy kế. `[engine: fable-real-single · Fable-S117]`
|
||||
|
||||
## S116 — PE negative-quote invest (fable-clone ensemble, 07-13)
|
||||
- Hội-tụ **FE-ONLY**: BE/DB nhận âm sẵn (no validator/CHECK); NS giữ-nguyên architectural; 3 chốt FE parseVnd/format/gate; sign-aware `VndInlineEdit:1003` tái dùng; chỉ submit-guard `:206` hard-reject. ⚠️ Lesson: quote sống `details[].quotes` KHÔNG `suppliers[].quotes`. **Detail:** `.claude/workflows/runs/2026-07-13-pe-negative-quote/` + session-log S116 + archive/2026-07.md 2×LENS. `[Opus-S116]`
|
||||
|
||||
## 🔄 Curate trigger
|
||||
- >~30KB → archive recent → L2 `archive/<period>.md` (byte-exact append) + `_INDEX.md` substring pointer. Stale >3mo → remove.
|
||||
|
||||
@ -9,3 +9,15 @@
|
||||
- **2026-07-01 S97 session-end feedback-audit (VERDICT CLEAN):** Grep-verified capture readiness pre-close. ✅ gotcha #77/#78/#79 present `docs/gotchas.md:1301/1317/1325` (format `### N.` count=79 = STATUS header — no self-count drift; all 3 have Triệu-chứng+Cơ-chế+Fix+**Quy-tắc** root-cause). ✅ #53 return-garble **x6 (cicd 5/6)** in BOTH `feedback_agent_return_garble_recover.md` (Why-line ×5→×6 + **structural root-cause: cicd MEMORY self-target ~17.1KB→curate-at-return→thinking-step=message-cuối=return-value**; fix=archive-cicd-sớm NOT instruction) AND S97-log Parts 1/2/4 (lần-4/5/6). cicd MEMORY LIVE=17.5KB (confirms self-target). ✅ Mig 60 wrong-table BUG = 2-fix present: code (Mig 61 `20260701142752` query Changelogs) + guard (gotcha #79 "xác định ĐÚNG bảng writer" + "verify marker-count prod trước"). Mig 60 code `:29-31` confirmed `PurchaseEvaluationApprovals a...a.Comment LIKE` = wrong. Both Mig 60/61 have 3-file rule. ✅ git status CLEAN, 0 stray `.claude` misland, 0 `git add -A` in log, S97 workflows HMW-ephemeral (NOT persisted run-folders — consistent S94+ pattern, runs/ only old 06-18). ✅ Product decisions captured (STATUS/HANDOFF/log + commit-msg): "duyệt là fix"→#480 price-lock, "fix trọn"→Mig 60 endsBeforeCeo-runtime, "hiện luôn CEO duyệt"→#483 badge, Supplier-backlog "15-18 field"→STATUS Next-up. **MINOR only:** S97-log per-Part State footers show progression (Part-1 `:47` "88 bảng gotcha 77" stale vs session-end "89/79" Part-4 `:113`) — intentional per-part snapshot but mid-log reader sees stale count. No BLOCKING/MAJOR gaps.
|
||||
- **2026-07-01 Supplier Excel-import GAP audit (anh Kiệt FDC — 30-col "Database NCC & Nhà thầu phụ" cho bên Pro):** ⭐ **Entity CỰC LEAN 9 domain-prop** (`Domain/Master/Supplier.cs:5-16`: Code·Name·Type·TaxCode·Phone·Email·Address·ContactPerson·Note) + 8 audit inherited (Base/AuditableEntity). EF `SupplierConfiguration.cs`: Code len50 UNIQUE-filtered `[IsDeleted]=0`(:24, Mig47 #57), Name200, TaxCode20, Phone30, Email100, Address500, ContactPerson200, Note1000. **enum `SupplierType.cs:3-10` = NhaCungCap1/NhaThauPhu2/ToDoi3/DonViDichVu4/ChuDauTu5 — KHÔNG có "Cả hai/Both"** (FE mirror `fe-admin/types/master.ts:11-16` identical). **GAP 30→entity: 6✅ · 7⚠️collision · 17❌ no-home** — Excel splits Address×2(invoice/office), Phone×2(company/contact), ContactPerson+role; ❌ Fax·Bank-acct×2·Legal-rep+role·GUQ+3-NAS-links·Status/blacklist·Referral·PMH-owner. ⚠️ **S55 seed `SeedRealMasterDataAsync` (`DbInitializer.cs:2768-2787`) crams NĐD/bank/status/category vào free-text `Note`** (:2771-73 TRUONGGIANG/TANPHU/TGN) — proof entity thiếu home. Seed **UNGATED** (called :128, idempotent-key=`Code` :2780) — KHÁC demo-master (`SeedDemoMasterDataAsync` GATED `DemoSeed:Disabled` :117, #75). POST any-auth (`SuppliersController.cs:37-42` S59). FE SHA-identical 2-app (`c1760788`, 253L, 9 fields). **Prod 20 NCC** (Type1×3+Type2×17; type3/4/5 wiped go-live S91 → "Cả hai" enum genuinely-needed). Precedent NAS-link = `PE.HoSoLink nvarchar(1000)` Mig52. Fork→em-main: core-widen ~15col+CaHai=6 vs satellite `SupplierDetail`. → _INDEX pending.
|
||||
- **2026-06-29 S93 Harness-16 MFE ground-truth (WF1 `wf_4c63e1bd`):** ⭐ MFE denominator extraction (deterministic, status-field KHÔNG grep): marks Active(-High) (`ACTIVE-MARKS.md`) + AS-class + Active-Guards (`error-ledger.md` Verified✅) + recurring-gotcha (`gotchas.md`); **dedup-by-AS-cross-reference** (gotcha/guard mà AS-row trỏ `#N`/`AS-N` → gộp) = **29 item**. Per-role sub-coverage: denom = numbered anti-pattern/NEVER trong `agents/<role>.md`; numer = diary `agent-memory/<role>/MEMORY.md` (KHÔNG project/user — bẫy trùng-tên H15-v3) match exact-id OR ≥2 content-word sau stop-list (đánh bại leading-verb-9/9-giả). Codified `scripts/mfe-eval.ps1` + engine §H. (WF1 self-write reverted AS-10; em-main harvest single-writer.) → _INDEX.
|
||||
|
||||
---
|
||||
|
||||
## Moved from L1 2026-07-14 (S117 hook-triggered curate @22.7KB — investigator-codebase self, mirror em-main 07-06 pattern)
|
||||
|
||||
- **2026-07-13 PE quote-NEGATIVE feature LENS Budget-consumers (ensemble, RETURN-only):** anh Kiệt: cho nhập SỐ ÂM ô `form.thanhTien` (báo giá/hạng mục) dialog "Thêm NCC"; RULE = âm=khoản-TRỪ NCC, **ngân sách GIỮ NGUYÊN**. ⭐ **CRITICAL confirm: quote KHÔNG mutate `PeWorkItemBudgets`** — budget chỉ ghi bởi `UpdatePeBudgetPro/CcmCommandHandler` (role-gated PRO/CCM, `PeWorkItemBudgetFeatures.cs:105-107/175-177`) + Adjust/SetCcmBudget; quote write-site (`PurchaseEvaluationDetailFeatures.cs:308-345`) chỉ đụng quote-field + re-derive `IsWinner`, NEVER budget. **5 consumer đọc `SUM(ThanhTien WHERE IsSelected)`:** (1) winnerQuoteTotal DISPLAY `PeFeatures.cs:1188-1191` no-clamp (2) CCM-threshold `PeWorkflowService.cs:884-893` guard `>=ceoThreshold` reject HIGH ko-reject-âm→âm cho CCM-finalize dễ hơn (3) giaTri CreateContract PER-WINNER `CreateContractFromEvaluation:88-90,100` → Contract.GiaTri CÓ THỂ ÂM, **BYPASS** `CreateContractCommandValidator.GiaTri>=0` (`ContractFeatures.cs:46`, chỉ áp manual-create path) (4) "So-với-ngân-sách" block-B DISPLAY `PeFeatures.cs:904-947` budget read AsNoTracking untouched, soft-warn only (5) **submit-guard `PeWorkflowService.cs:196-209` = GUARD DUY NHẤT REJECT: `if Sum()<=0 → "chưa có giá chào thầu"`** — WHOLE-phiếu total, per-item âm OK miễn net>0. **NO quote validator tồn tại** (grep⌀ `UpsertPurchaseEvaluationQuoteCommandValidator`) → âm đã flow BE 0-block, chỉ FE chặn. Keep-≥0 fields có validator: BudgetPeriodAmount/ApprovedPriceAmount/ProInitial/InitialAmount. ĐÃ allow-âm sẵn (unrelated): ProAdjustment/Adjustment/ExpectedRemainingAmount (`PeFeatures.cs:345-348` mirror-LeaveBalance). Tag `[s115?, pe-negative-quote, budget-not-mutated, submit-guard-sum-le-0, giaTri-negative-bypass-validator, no-quote-validator]`.
|
||||
|
||||
- **2026-07-13 PE negative-quote LENS edge/precedent/test (fable-clone, RETURN-only; complements Budget-consumers entry ↑):** ⭐ BE+DB đã cho âm; blocker = FE helper + submit-guard. (a) `parseVnd` `PeDetailTabs.tsx:51` strip `[^\d]` → minus mất; `formatVndInput:52` `n>0?:''` → âm+0 đều blank (lẫn "chưa báo giá"); AddSupplier gate `thanhTien>0` :2226 skip quote khi ≤0 (empty≡0 by-design); inline QuoteCellDialog :2870 always-POST (store 0 OK); fe-admin SHA-identical :51/:52/:2226. (b) precedent = OMIT validator: `ExpectedRemainingAmount` PurchaseEvaluationFeatures.cs:348 + LeaveBalance `AdjustmentDays` LeaveBalanceFeatures.cs:107; Quote `UpsertPurchaseEvaluationQuoteCommand` DetailFeatures.cs:272 = NO validator (grep⌀) → BE nhận âm sẵn. (c) 0 test assert ThanhTien≥0. (d) gotcha #81 orthogonal (IsWinner==Any(IsSelected) bool≠sign → no phantom). (e) NO DB CHECK (`HasCheckConstraint` grep⌀ whole Infra; col decimal(18,2) config:131). HARD-INTERACTION submit-guard `Sum()<=0` `PurchaseEvaluationWorkflowService.cs:206`+FE:201 → net-≤0 BLOCKED "chưa có giá"; che CCM-threshold:891. NS-giữ-nguyên architectural (quote never write PeWorkItemBudgets; âm chỉ shift winnerQuoteTotal:1188). Tag `[pe-neg-quote,parsevnd-strip-minus,sum<=0-guard,no-check-constraint,omit-validator,iswinner-orthogonal]`.
|
||||
|
||||
- **2026-07-12 (S111 H22 WAL deep-pass) `[engine: fable-real-single · Fable-S111]`:** H22 WAL adopt → READY_WITH_NUANCES + spec 3-mục (em-main gov/settings · w1 pause+tiep · w2 start/end delta · w3 hook+README). Chốt: (1) `.claude/settings*.json` KHÔNG tồn tại → hooks-entry CREATE mới; hook = STAGED-until-verified (S100 ghost-wire, chỉ claim khi thấy `wal:` commit phiên mới). (2) engine`:402` no-OS-hook = MÔ-TẢ (CAVEAT) không phải luật cấm; `:116` E.3 "hook fails-open ≠ gate" → persist-only TƯƠNG THÍCH, update :402; ACTIVE-MARKS 0 mark cấm-hook; H5 start`:41` chỉ cấm hook-switch MODEL. (3) AS-6 KHÔNG tăng: 2 runtime .json gitignored (`.gitignore:124-125`), hook commit LOCAL — push-set ≡ hôm nay. (4) cmd-PATH Git Bash trước WSL, bash 5.2.26 OK. (5) `.gitattributes` exists broadcasts-scoped → append `*.sh`; repo 0 .sh = zero churn. (6) 16 command 0 trùng pause/tiep. (7) Stop-hook fire chỉ TURN-boundary → chết giữa workflow-turn = vật-liệu DISK uncommitted, /tiep đọc cả git status/disk. (8) run.md thiếu taskList snapshot. Learned: "luật cấm hook" phải phân MÔ-TẢ vs LUẬT trước khi đòi carve-out. L1@19.8KB → suggest em-main curate.
|
||||
|
||||
- **2026-07-11 (S110 H21+MTv3 deep-pass) `[engine: fable-real-single · Fable-S110]`:** Task ground-truth 2 broadcast (H21 spec-file+per-invocation · MTv3 owner-choice) + inventory TOKEN toàn repo + SPEC 3-mục. Verdict **PASS**: (1) **12 persona file SẠCH 0-hit** fable/engine-token (grep 2 vòng cả `engine-đắt|top-model|ensemble`) — NGƯỢC hub vòng-1 bắt persona-phụ lỗi; (2) MTv3 self-check regex §5 chính-thức **0-hit** nhưng extended "lead LUÔN top-model" bắt 5 ACTIVE (engine:332 K.D · runbook:140/:455 · fable-real.md:17 · mark ACTIVE-MARKS:19) = **regex-heuristic-miss class** — sister diễn-đạt khác cụm regex; (3) **hmw.js:38 comment "tier:'fable' khi hệ-trọng" = xung-đột MTv3 §1.3/H21 §3** (đường nâng hạng-nhất DUY NHẤT = owner gõ; comment cho lead-discretion) — comment-only fix; (4) hmw-mode.on = HỆ KHÁC (consent fan-out T3 `ultracode-hmw-mem-governance`, content tự khai /ultra-on) — ngoài scope H21; (5) mega-line "VẪN ON" class = **standing-imperative-trong-history-blurb** (S109-header + HANDOFF NEXT-anh = ACTIVE cần sửa; blurb-body = snapshot giữ). Bẫy fidelity lớn nhất: MTv3 §1.2/1.3 "sub gán cứng hạng-hai" đọc như floor → tưởng phá H8 all-inherit; triage-reply S2 CÙNG NGÀY waive đích-danh ("không đổi gì với form all-inherit"). ⚠️ #53 garble lượt return đầu (trả status-line giữa-chừng thay verdict) → coordinator SendMessage re-emit trong-session = recover OK, diary ghi trước re-emit.
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
# Spec — PE lũy kế "không bắt sau khi duyệt" (root cause = display-lie, KHÔNG phải lũy kế bug)
|
||||
|
||||
> `/fable-real investigator-codebase` engine-đắt deep-pass — run 2026-07-14 (S117).
|
||||
> Model lane: `fable` requested (lead=Opus 4.8). ⚠️ #53 return-garble lần 1 → SendMessage-resume recover (verdict đầy đủ lần 2). Cross-verified bằng em-main độc-lập đọc code + investigator query prod DB (sqlcmd).
|
||||
|
||||
## ① Tính-năng / đề-bài
|
||||
Anh Kiệt/Kenny + Bích Phượng báo (Zalo): phiếu PE/2026/A/018 "8 Mat Gạch xây…" (work-item MAT-8) **anh Chương duyệt rồi** nhưng phiếu MỚI cùng hạng mục (A/028, Nháp) hiển thị Row **"2. Ký trước đã chọn thầu" = "Chưa chọn"** → "duyệt rồi mà không bắt lũy kế", xóa+tạo lại vẫn không được. Nguyên tắc Kenny: **"duyệt rồi mới bắc lũy kế"**.
|
||||
|
||||
## ② Cách implement (verified root cause + fix)
|
||||
|
||||
**ROOT CAUSE (CONFIRMED, đảo chiều giả thuyết ban đầu):**
|
||||
- Prod DB (sqlcmd): A/018 `Phase=10 (ChoDuyet)`, `EndedByLevelFinalize=0`, pointer `StepIdx=2/LvlOrd=1` = **đang chờ CEO (Bước 3)**; `IsWinner=1`, `SelSum=749.564.000đ`.
|
||||
- Anh Chương (Bước 2 Cấp 2, `AllowApproverFinalize=1`) duyệt với `applyLevelFinalize=false` (S97 đảo default ô "Cấp này KẾT THÚC" → bỏ-tick/opt-in) → rơi xuống **advance thường** (`PurchaseEvaluationWorkflowService.cs:912-943`) → lên CEO, KHÔNG finalize.
|
||||
- Changelog A/018 mới nhất: "Hoàn tất Bước 2/3, sang Bước 3 (Cấp 1)" — KHÔNG có marker "[Duyệt KẾT THÚC tại…]" (`:869`).
|
||||
- `CeoApprovalThreshold=NULL` cho QT-DN-V2-001 v04 → nhánh `finalizeByCcmDelegation` (`:874-909`) không dùng được.
|
||||
- Filter lũy kế Row 2 (`PurchaseEvaluationFeatures.cs:906-907`) `Phase==DaDuyet && Any(IsWinner)` **loại A/018 ĐÚNG** (chưa duyệt xong). Tính LIVE (`:886-918`), không store → xóa/tạo lại A/028 vô ích.
|
||||
- ⇒ **Lũy kế KHÔNG có bug.** Bug thật = **display-lie**: `endsBeforeCeo` cho phiếu non-DaDuyet trả config `true` mù (`PurchaseEvaluationFeatures.cs:1152-1154` literal `: true`; list `:647-651` subquery `.Any()`) → sơ đồ làm mờ Bước 3 "Kết thúc tại Cấp 2" + chip "Kết thúc·CCM" NGAY KHI phiếu đang nằm inbox CEO → user tưởng đã xong (gotcha #78 nửa-còn-lại).
|
||||
|
||||
**FIX (2 tầng, chờ owner chốt direction):**
|
||||
- **C1 — vận hành (giải quyết A/018 NGAY, 0 code):** để A/018 đạt DaDuyet → CEO Nguyễn Văn Trường duyệt Bước 3, HOẶC trả-lại → Chương duyệt lại CÓ tick "Cấp này KẾT THÚC". Xong là lũy kế bắt tự động (live) — KHÔNG cần xóa/tạo lại A/028.
|
||||
- **C2 — code (chống tái diễn, display-lie):** `endsBeforeCeo` pointer-aware cho phiếu non-DaDuyet: nếu `CurrentWorkflowStepIndex` đã QUA cấp finalize (không dừng ở đó) → `endsBeforeCeo=false` → Bước 3 hiện "đang chờ CEO" thay vì mờ "Kết thúc". Detail projection (in-memory, trivial) + list projection (EF-subquery, kềnh hơn) + FE gate.
|
||||
|
||||
**BÁC:** Option A (ép finalize→DaDuyet — phá opt-in S97) · Option B (nới filter lũy kế nhận phiếu chưa-DaDuyet — vi phạm nguyên tắc Kenny).
|
||||
|
||||
## ③ Checklist (đo được — chờ owner chốt C2 hay chỉ C1)
|
||||
- [ ] (C1) UAT: CEO duyệt A/018 (hoặc Chương re-approve tick-finalize) → verify `Phase=DaDuyet` → mở A/028 kiểm Row 2 = 749.564.000đ.
|
||||
- [ ] (C2 nếu làm) Detail `PurchaseEvaluationFeatures.cs:1149-1154` endsBeforeCeo pointer-aware (in-memory).
|
||||
- [ ] (C2) List `:645-651` endsBeforeCeo pointer-aware (EF-subquery — cân so IsWinner-subquery hiện có).
|
||||
- [ ] (C2) FE gate PeFinalizeChip + PeWorkflowPanel mờ-bước theo cờ mới.
|
||||
- [ ] (C2) Test `PeFinalizeProjectionTests`: ChoDuyet + config-finalize + pointer QUA cấp finalize → `endsBeforeCeo=false` (test-before, bug-fix).
|
||||
- [ ] Edge multi-winner S114: Row 2 = SUM Quote.IsSelected per Detail×Supplier — độc lập số winner (OK).
|
||||
- [ ] Edge negative-quote S116: Row 2 SUM có thể âm — không clamp, xác nhận đúng ý.
|
||||
- [ ] Edge phiếu cũ WorkItemId=null: khối lũy kế skip — không hồi quy.
|
||||
|
||||
## ✅ EXECUTED (S117 — owner chọn "Sửa hiển thị + giữ opt-in", BE-only)
|
||||
- Fix `PurchaseEvaluationFeatures.cs` 3 site `endsBeforeCeo` non-DaDuyet → **pointer-aware** (chỉ true khi CÒN cấp finalize ở-hoặc-SAU con-trỏ): detail `:1152` (in-memory, robust index) + list `:647` + inbox `:767` (EF subquery, rank=Step.Order-1). DaDuyet giữ `EndedByLevelFinalize` (S97).
|
||||
- **0 FE** (FE = pure consumer of flag: `PeFinalizeChip`/`PeWorkflowPanel:124` gate trên `endsBeforeCeo`) · **0 migration**.
|
||||
- Test-before: `PeFinalizeProjectionTests.ListPe_EndsBeforeCeo_ChoDuyet_PointerAware_PastFinalizeIsFalse` (repro A/018 con-trỏ QUA finalize → false; +2 case before/at → true) → RED trước fix (found True) → GREEN sau. EF subquery translate SQLite OK.
|
||||
- Full suite **496 PASS** (Domain 45 + Infra 451, +1). `Sum()`/negative-quote/multi-winner không đụng (chỉ đổi cờ hiển thị).
|
||||
- A/018 (C1 operational) = chờ anh: CEO duyệt Bước 3 hoặc trả-lại→Chương tick-finalize.
|
||||
|
||||
## Cross-impact + confidence
|
||||
- C1 = zero code-risk. C2 = chạm `endsBeforeCeo` (dùng ở list-chip + workflow-panel + banner); HĐ-gen (`CreateContractFromEvaluation`) KHÔNG đọc endsBeforeCeo → an toàn; KHÔNG đụng filter lũy kế → nguyên tắc Kenny giữ; chỉ mở rộng runtime-read sang nhánh ChoDuyet (KHÔNG phá S97).
|
||||
- Confidence: **CAO** (prod DB + changelog + code-path gate rõ; điểm chưa 100% = không thấy UI-state lúc Chương bấm, suy từ default-unchecked + kết quả advance).
|
||||
Reference in New Issue
Block a user