[CLAUDE] Docs: S96 session-end closeout — UAT PE fixes + monthly audit + memory flush

- STATUS/HANDOFF: prepend S96 mega-line (5 commit: monthly-audit 881783c + NCC ba4b8e0 + 3 PE fix e657faa/36cbf8b/0c2f9f6) · Tests 434->440 · gotcha 76->77 · bundle COYAX-yQ/0MU-kb4N · prod 21 NCC · In-Progress S95->S96
- gotchas: +#77 SPA deploy bundle cache-lag (verify byte-level cache!=deploy; incognito golden)
- session log 2026-07-01-S96-uat-pe-fixes-monthly-audit.md
- user-memory (ngoài repo): +2 feedback (verify-deployed-artifact-byte-level · agent-return-garble-recover)
- agent-memory: cicd-monitor S-tag drift S97/S98->S96 reconcile (11x; facts correct) · investigator-codebase Supplier-audit diary

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-01 16:49:16 +07:00
parent 0c2f9f630f
commit 791ec5544d
7 changed files with 98 additions and 30 deletions

View File

@ -32,7 +32,7 @@ Read-only CI/CD + post-deploy verifier SOLUTION_ERP. Polls Gitea Actions API, ve
- **Stage 0 RAG infra:** `Get-Service Qdrant` Running + `http://localhost:6333/healthz`. Collection `proj_solution_erp`.
- **Stage 1 Push+filter:** `git log -1 --format='%H %s'` + `git log origin/main..HEAD` empty + diff vs paths-ignore (docs-only SKIPPED-DOCS return).
- **Stage 2 Gitea poll** (max 10 iter × 60s): API `.../actions/tasks?limit=5` (NOT `/runs` 404). Match `head_sha` (NOT run_number cancelled runs shift numbering). `updated_at` stale ~2min (gotcha #46) cross-check VPS mtime. Foreground-sleep BLOCKED Windows Monitor-style busy-wait-curl-spin ~30s/iter.
- **Stage 3 Test gate:** baseline **421 PASS** (45 Domain + 376 Infra; S90 #465 419 + 2 new `PeDraftVisibilityTests` [phiếu nháp riêng người tạo, chặn leak role + V2-approver]; prior S89 #348 419, S88-quad #347 413). CI runs both proj BEFORE build/deploy status=success test gate passed (`tasks` terminal=`status:success`, `conclusion` NOT populated trust success NOT log-numeric). Local grep undercounts (Theory/InlineData). Phase 9 UAT skip OK.
- **Stage 3 Test gate:** baseline **440 PASS** (45 Domain + 395 Infra; S96 #480 `0c2f9f6` 436 + new `PeSuggestedPriceSetterAuthzTests` [price-lock-after-submit authz]; prior S96 #479 436, S96/S95 434, S90 #465 421). CI runs both proj BEFORE build/deploy status=success test gate passed (`tasks` terminal=`status:success`, `conclusion` NOT populated trust success NOT log-numeric). Local grep undercounts (Theory/InlineData). Phase 9 UAT skip OK.
- **Stage 4 Post-deploy** (if SUCCESS): auth login bearer (admin + nv.test gotcha #44; token=`accessToken` route `/api/auth/login`) 3-5 endpoint smoke 2XX (incl new NEW-endpoint bodyless-POST returns **411 IIS Length-Required pre-auth NOT 404**; re-probe WITH body 401 confirms wired) FE bundle hash 2 app (per #69 = real-size-vs-fake not hash-delta) SignalR negotiate (gotcha #25) EF mig prod==repo.
- **Stage 4.6 (S29 CRITICAL):** sqlcmd seed sample verify post-deploy (NOT chỉ schema). Seed=runtime-row-insert (no history/tables advance) verify via DB-query (e.g. Permissions count), NOT bundle-frozen-alone.
- Discovery: ASP.NET 10 record enum needs numeric input unless `JsonStringEnumConverter` (SOL has NO converter FE sends numeric). sqlcmd ssh Windows-auth `\\\\SQLEXPRESS` 4-backslash. INFRASTRUCTURE seed MUST run (NOT inside `if(!demoSeedDisabled)`); DEMO seed gated gotcha #51.
@ -50,9 +50,9 @@ Read-only CI/CD + post-deploy verifier SOLUTION_ERP. Polls Gitea Actions API, ve
- **Gitea:** `git.baocaogiaoduc.vn/vietreport-admin/solution-erp` · workflow `.gitea/workflows/deploy.yml` · paths-ignore `['docs/**','**/*.md','.claude/skills/**']`. Anon API works (public repo) when GITEA_TOKEN absent.
- **Prod:** api/admin/eoffice `.solutions.com.vn` · SSH `ssh vietreport-vps` (Administrator, id_ed25519) · IIS phys paths: API `C:\inetpub\solution-erp\api` · admin `\fe-admin` · user `\fe-user`. DB `.\SQLEXPRESS`/`SolutionErp`/`vrapp` SQL-auth. **Conn key = `ConnectionStrings.Default` (NOT `DefaultConnection`)**. DB pw = `buKL3TGBkD0wDDbYVw65QeX9` (User Id=`vrapp`; Password field has NO `vrapp/` prefix S89 login-failed when prefix included; read verbatim from prod `appsettings.Production.json` ConnectionStrings.Default when `$env:PROD_DB_PASSWORD` empty). skill-doc path `C:\inetpub\apps\SolutionErp\Api` STALE.
- **SSHPS quoting (S42):** nested bashsshpowershell mangles `$var`/`\"` use `iconv UTF-16LE | base64` `powershell -EncodedCommand $B64`; OR write ps1-file + `powershell -File $(cygpath -w)`. sqlcmd over SSH direct `-W -h -1` pw-inline. sys-catalog string-concat `COLLATE DATABASE_DEFAULT` (collation conflict).
- **Tests baseline:** **421 PASS** (45 Domain + 376 Infra · 0 fail/skip; S90 Run #465 sha a71753b 419 + 2 `PeDraftVisibilityTests` [draft-private-to-creator, chặn leak role + V2-approver]; prior S89 #348 419, S88-quad #347 413). Phase 9 UAT skip per chunk OK.
- **Tests baseline:** **440 PASS** (45 Domain + 395 Infra · 0 fail/skip; S96 Run #480 sha 0c2f9f6 436 + new `PeSuggestedPriceSetterAuthzTests`; prior S96 #479 436, S96/S95 434, S90 #465 421). Phase 9 UAT skip per chunk OK.
- **Mig latest repo:** **Mig 59 `20260624084608_AddCcmBudgetPeriodToPurchaseEvaluation`** (S88 #345; PE +1 AddColumn `CcmBudgetPeriodAmount` decimal(18,2) NULL no-backfill VERIFIED-APPLIED-PROD history-HEAD + col-exists 0-nonnull). Prev Mig 58 `AddPeMultiWinnerAndLevelFinalize` (S87 #344). Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/`. Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC TOP 5`. **`sys.tables` (is_ms_shipped=0) = 88** (S61 Budget-replace DROPPED 9388 narrative-93 STALE; when commit touches no schema, 88 correct, don't FAIL on 88. Always cross-ref COMMIT scope vs ambient count). enum-additive (e.g. `ApprovalAttachment=5`) = int-stored NO-mig expect history NOT-advance + empty `git diff -- '*Migrations*'`.
- **Bundle hash live (S90 Run #465/id=465):** admin js `BXixQDuS`/css `DWQ-DgfZ` · user js `BMgckUPd`/css `Dr0-ikKX` (JS BOTH ROTATED from pre-deploy live `BeyLzf5i`/`CPe970sY` by real fe-src PeDetailTabs ×2; **css FROZEN `DWQ-DgfZ`/`Dr0-ikKX` — correct, FE logic-only [gỡ !readOnly gate] no new utility class**). **#465 run_number; head_sha-keyed.** pre-deploy baseline was `BeyLzf5i`/`CPe970sY` (Run #350 web.config rotated since #348 `BQq2eTP6`/`dHa64I59` always re-snapshot LIVE before deploy, brief's stale prev-hash misleads). **PER #69: hash MAY rotate per deploy OR stay frozen if 0 fe-src diff (byte-identical) — SNAPSHOT for THIS run, NOT a frozen baseline.** Real FE ship = diff `fe-*/src` in commit/range + real-size-vs-fake (1.6/1.5MB vs ~919b SPA-trap), NOT hash delta. ASYMMETRIC-deploy framing (S66) RETIRED by #69.
- **Bundle hash live (S96 Run #480/id=480 JS-rotated real-FE, CSS-frozen):** admin js **`COYAX-yQ`**/css `Bbtesa6B` · user js **`0MU-kb4N`**/css `BmuPz_Dy` (JS rotated from S96 `kL1-N1Zq`/`BRCrr80A` = real PeWorkflowPanel+PeDetailTabs FE change; CSS IDENTICAL S96/S96 = logic+gate-only #69-REFINE byte-identical-CSSsame-hash). **id ≠ run_number(365); head_sha-keyed.** **PER #69: hash MAY rotate per deploy (real src-diff) OR stay frozen if 0 fe-src diff (byte-identical) — SNAPSHOT for THIS run, NOT a frozen baseline; ALWAYS re-snapshot LIVE pre-deploy (brief prev-hash=hint NOT truth).** Real FE ship = diff `fe-*/src` in commit/range + real-size-vs-fake (1.6/1.5MB vs ~919b SPA-trap) + Last-Modified-in-window, NOT hash delta alone.
- **Bearer:** admin `admin@solutions.com.vn/Admin@123456` (full) · UAT `nv.test@solutions.com.vn/TestUser@123456` (Drafter CCM, gotcha #44 check).
## 🔑 Critical config (flag commit nếu tái xuất)
@ -70,15 +70,14 @@ BE (test+build) ~90s · FE × 2 ~60s/app · deploy ~30s · **total ~3min code /
## 📅 Recent runs (compressed — full verbatim → `archive/2026-06.md` via `archive/_INDEX.md`)
- **🟢 S95 #476 (id=476, run_number 362) `18a17f5` GO ~5m08s (adopt Harness-17 memory-self-improve loop — GOVERNANCE-ONLY 0 prod code, CI-triggered-by-.ps1)** — 10-file: 8 docs/md/broadcasts (paths-ignored) + **2 `.ps1` `scripts/governance-detectors.ps1`+`scripts/memory-selfimprove-audit.ps1`** NOT in paths-ignore (`scripts/**.md` ignores MD-under-scripts ONLY) ⟹ CI runs despite 0 .NET/FE impact (✅ path-filter as-designed, NOT docs-skip). `git diff --name-only 707b632 18a17f5` empty for `.cs`/`.csproj`/`.tsx`/`*Migrations*`/fe-src. status=success ⟹ test gate passed (baseline **434**=45 Dom+389 Infra; tasks-API `conclusion:None` even-on-success — trust terminal-success NOT numeric). run 09:15:17→09:20:25+07. Smoke 3×200 (api /health/ready, admin+eoffice root). **FE ship-proof (0 fe-src ⟹ #69 cosmetic-rotate)**: admin JS `CkZ1MjC1``0T6vVJST` + user `_-gpX7_Y``BGXEVZO6` rotated; **CSS FROZEN** admin `Bbtesa6B`/user `BmuPz_Dy` (0 new Tailwind, mirrors S90/S93). Last-Modified admin `02:19:03Z`/user `02:19:57Z` in-window (02:15→02:20 UTC) + size 1,636,195b/1,542,518b real · SPA-trap fake-hash=200-but-919b-html (large=genuine). **Mig prod=59 UNCHANGED** (0 mig-file ⟹ NO sqlcmd needed, repo-scope sufficient: nothing CAN drift w/ 0-schema + repo-HEAD known-applied). ⚠️ brief prev-hash S94 `CDn40vpV`/`CoPmPBg7` STALE — LIVE pre-deploy already `CkZ1MjC1`/`_-gpX7_Y` (#69 intermediate rotate); **always re-snapshot LIVE, brief prev-hash=hint NOT truth**. 🔑 **GOVERNANCE-ONLY PASS = CI-green + terminal-success + JS-rotate/CSS-frozen-benign(#69) + 3×200 + Mig-59-frozen** — 0 anomaly.
- _(S93 #473 `8ee8f3e` FULL-STACK PE tree-node Dự-án show-CODE-not-name DTO+3-projection NO-MIG baseline-434 · admin JS `xz8FdmLN``CDn40vpV`+user `CA8Rla2w``CoPmPBg7` rotated, **css FROZEN** `DWQ-DgfZ`/`Dr0-ikKX` logic-only ✅ · Mig59 frozen · pre-deploy-live==brief-prev-hash no-drift; 🔑 css-frozen-on-logic-FE=NOT-fail — full verbatim → git `8ee8f3e` + archive `2026-06.md` via `_INDEX`)_
- _(S92 #472 `1408d4e` BE-ONLY DbInitializer permission-revoke +5-menu-groups non-Admin VERIFY-PROD-EFFECT baseline-434 · 3-evidence ship-proof Infrastructure.dll+Api.dll in-window + w3wp PID10060 recycle-AT-END-window · **PROD-EFFECT PROVEN**: hidden-key non-Admin CanRead=0, Admin-retained=5, Pe_* untouched=120, leak=0 · ⚠️ **PROD Identity tables NON-prefixed `Roles` NOT `AspNetRoles`** (Permissions cols RoleId/MenuKey/CanR/C/U/D) · JS-rotate-css-FROZEN #69 harmless — full verbatim → git `1408d4e` + archive `_INDEX`)_
- _(S91 #470 `55494ad` GO-LIVE no-resurrect demo-NCC seed-gate `DemoSeed:Disabled` baseline-422 — pre+post-restart demo-code=0 + 3-evidence dll-mtime+w3wp-recycle; **NEW PATTERN go-live no-resurrect = (a) pre+post DB-count diff + (b) dll in-window + (c) w3wp StartTime ≥ run-window**; integrated-auth `-E`; full verbatim → archive `2026-06.md` via `_INDEX`)_
- _(S90 #465 `a71753b` FULL-STACK PE draft-private+un-gate-suggested-price js-rotate-css-FROZEN · S89 #348 `1aa3bdb` PE create-contract-1→N multi-winner endpoint-411→401 · S88-quad #347 `73cce1f` PE D1 Block-B re-key+CEO-notify · S88-bis #346 `0d3c0cf` FE-only PE-layout js+css-BOTH-rotate · **S88 #345 `9b1ee0c` = Mig 59 `AddCcmBudgetPeriodToPurchaseEvaluation` AddColumn-no-backfill VERIFIED-PROD** setter PATCH-401 + 7 authz-test → all PASS, full verbatim → git + archive `2026-06.md` via `_INDEX`)_
- _(S87 #344 `f1b10e9` FULL-STACK PE CCM 3-fix + **Mig 58 `AddPeMultiWinnerAndLevelFinalize`** 2-AddColumn-bit+backfill winners=13 VERIFIED-PROD, select-winner endpoint-411→401-wired, baseline-395 · S86 #343 `ae4f106` BE-only notify-exclude-drafter baseline-377 ship-proof=Infrastructure.dll-Last-Modified · S85 #342 `d4f6021` DOCS+SQL-no-op INVERTED-PASS-when-FROZEN baseline-374 (gotcha #73 TZ + #69-REFINE) · S83 #333 `fc1f19d` BE-only PE-guard-V2-workflow-required hash-FROZEN-but-shipped baseline-356 · S78 #330 `7886fd0` cross-stack enum-attach-on-approve · S76 #318 `e33481e` Mig56-ProInitial/Adjust backfill-4rows → all PASS, full verbatim → archive `2026-06.md` via `_INDEX`)_
- _(S83 #325 `e29391e` FE-only budget-subitem indent js-rotate-css-FROZEN test351 · S77 #329 `e823694` FE-only banner Trả-lại · #328 `424131d` BE-only notify-block test-gate-KEY · #327 `fa6654b` FE-list-restructure · #326 `b5aa72d` BE-authz asymmetric · #323 #322 #321 #320 PE UX batch → all PASS, FIFO-trimmed, full verbatim git + archive `_INDEX`)_
- _(S74-bis #315 `8655ebf` Mig55 CcmNote · S73 #313 `1d86abc` Mig54 5-cols + endpoint-401-not-404-probe · S69b #307 `1f8947e` Office-golive seed-16/16-DB-query-proof → archive `_INDEX` + git)_
- **Older runs (S75 #301 ← S62 #286 ← … → S29 #232) full verbatim → git `d2f52ba` + `archive/2026-06.md`** (incl #291 06-16 FAIL forensic [gotcha #65]); pre-S38 → `archive/2026-05-{runs,q2,q3,q4}.md`.
- **🟢 S96 #480 (id=480, run_number 366) `0c2f9f6` GO ~5m25s (PASS) — cross-stack PE 3-commit range (`ba4b8e0`→HEAD): (a) `e657faa` opt-out KẾT-THÚC checkbox [BE+FE `PeWorkflowPanel` 2-app] + (b) `36cbf8b` mark-read stale-noti [BE-only] + (c) `0c2f9f6`=HEAD khóa-sửa-giá-đề-xuất-PRO/CCM-sau-gửi-duyệt [BE `PeSuggestedPriceFeatures` phase-guard + FE `PeDetailTabs.tsx` 2-app gate + test `PeSuggestedPriceSetterAuthzTests`], NO migration (cả 3)** — 3 runs sequential id=478 `e657faa`@15:46 → id=479 `36cbf8b`@15:52**id=480 `0c2f9f6`✅@16:12:59=HEAD=canonical=ship-tất**. Poll running→success ~5m25s (start 16:07:34→16:12:59; busy-wait-spin, `updated_at` fresh-advancing=alive-NOT-hung; foreground-sleep-BLOCKED Windows). status=success ⟹ test-gate green (baseline **440** = 45D+395I, +new `PeSuggestedPriceSetterAuthzTests`; tasks-API terminal-success trust-NOT-log-numeric). 🎯 **FE JS ROTATED (real FE proof — e657faa PeWorkflowPanel + 0c2f9f6 PeDetailTabs 2-app)**: admin `0T6vVJST`(S96)→**`COYAX-yQ`** + user `BGXEVZO6`(S96)→**`0MU-kb4N`** ✅. **CSS FROZEN** admin `Bbtesa6B`/user `BmuPz_Dy` = IDENTICAL S96/S96 (logic+gate-only-FE, 0-style-diff ⟹ #69-REFINE byte-identical-CSS-source⟹same-hash; matches S93/S95/S96 JS-rotate-CSS-frozen; NOT-fail). Real-size-verify (guard SPA-trap): admin JS **1,636,639B** + user **1,542,960B** (control fake-hash `ZZfakehash0.js`→919B text/html=SPA-fallback ⟹ real-bundles-genuine-not-trap); Last-Modified admin 09:11:38GMT=16:11:38+07 / user 09:12:34GMT=16:12:34+07 (=disk-mtime EXACT-match, in-window). **BE ship-proof**: Infrastructure.dll `16:08:35`+Application.dll `16:08:10`+Api.dll `16:10:20` all-in-window · w3wp fresh PID=3184@`16:12:39` + PID=11104@`16:12:21` AT-END-window (pool recycled ⟹ new DLL; 6 w3wp total=3-site pools, 2-newest bracket deploy-end). **Mig prod=59 `AddCcmBudgetPeriodToPurchaseEvaluation` UNCHANGED** (=repo-HEAD; 0-mig-file range `ba4b8e0..0c2f9f6`⟹correct-frozen). Smoke: api ready/live+admin/eoffice-root ALL 200, **auth accessToken 468ch, GET /api/purchase-evaluations 200 items[]-valid (PE-not-broken by price-lock-guard) + /approval-workflows-v2 + /notifications 200**. ⚠️ UI checkbox/chuông/khóa-giá NOT curl-verifiable (login+phiếu-thật → anh Kiệt UAT); scope=deploy-ship+test-gate+bundle-rotate+smoke. 🔑 **REAL-FE-CHANGE PASS = JS-hash-rotate(vs prev-snapshot) + real-size-vs-919b-trap + Last-Modified-in-window + CSS-frozen-OK-if-logic-only(#69-REFINE) + BE-DLL-mtime-in-window + w3wp-recycle + Mig-frozen + smoke-200-payload-valid**. base64-EncodedCommand-over-ssh WORKED this run (CLIXML-wrapper = PS-remoting-noise, `grep -v`; contradicts S96-note base64-FAIL — both methods situational, try base64 first fallback `.ps1`-File S42).
- _(S96 #479 `36cbf8b` GO ~5m40s PASS — PE 2-commit e657faa opt-out-checkbox+36cbf8b mark-read-stale-noti NO-mig · baseline-436 · JS admin`0T6vVJST``kL1-N1Zq`/user`BGXEVZO6``BRCrr80A` rotated **CSS FROZEN** Bbtesa6B/BmuPz_Dy · real-size 1636619/1542940B · Mig59-frozen · w3wp PID3024@15:52:19 · full verbatim → git `36cbf8b` + archive `2026-06.md` via `_INDEX`)_
- _(S96 #477 `ba4b8e0` Infra data-only seed import NCC `DONGDUONG` Excel anh-Kiệt NO-mig ungated-idempotent · baseline-434 · 🎯 DONGDUONG-LANDED pre=3→post=4 suppliers total=21 EXACT+1-idempotent Type=2-NhaThauPhu · **FE bundle FROZEN** admin `0T6vVJST`/user `BGXEVZO6` 0-fe-src-diff(#69-REFINE) · Mig59-frozen · w3wp PID13660@14:54:28 recycle+DLL-in-window · 🔑 **DATA-SEED-PASS = pre-vs-post-DB-row-EXACT-delta + DLL-mtime + w3wp-recycle + Mig-frozen + API-payload-contains-row** · ⚠️ sqlcmd `-W` diacritic-LIKE false-NEG use `_`-wildcard; base64-EncodedCommand-FAIL→`.ps1`-File-method reliable — full verbatim → git `ba4b8e0` + archive `2026-06.md` via `_INDEX`)_
- _(S95 #476 `18a17f5` GOVERNANCE-ONLY adopt Harness-17 — 2 `.ps1` scripts/ trigger CI despite 0-prod-code · baseline-434 · JS→`0T6vVJST`/`BGXEVZO6` rotated **CSS FROZEN** · Mig59 frozen · brief-prev-hash STALE→re-snapshot-LIVE · 🔑 GOVERNANCE-PASS=CI-green+JS-rotate/CSS-frozen(#69)+3×200+Mig-frozen — full verbatim → git `18a17f5` + archive `2026-06.md` via `_INDEX`)_
- _(S93 #473 `8ee8f3e` FULL-STACK PE tree-node show-CODE DTO+3-proj NO-MIG · S92 #472 `1408d4e` BE-only permission-revoke +5-menu-group VERIFY-PROD-EFFECT [hidden-key non-Admin CanRead=0, Admin-retained, Pe_* untouched, leak=0; ⚠️ **PROD Identity tables NON-prefixed `Roles` NOT `AspNetRoles`**] · S91 #470 `55494ad` GO-LIVE no-resurrect demo-NCC seed-gate [pre+post-restart demo-code=0; **PATTERN go-live-no-resurrect = pre+post-DB-count-diff + dll-in-window + w3wp≥run-window**; integrated-auth `-E`] · S90 #465 `a71753b` FULL-STACK PE draft-private js-rotate-css-FROZEN → all PASS baseline-422→434, full verbatim → git + archive `2026-06.md` via `_INDEX`)_
- _(S89 #348 `1aa3bdb` PE create-contract-1→N multi-winner endpoint-411→401 · S88-quad #347 `73cce1f` PE D1 Block-B re-key+CEO-notify · S88-bis #346 `0d3c0cf` FE-only PE-layout js+css-BOTH-rotate · **S88 #345 `9b1ee0c` = Mig 59 `AddCcmBudgetPeriodToPurchaseEvaluation` AddColumn-no-backfill VERIFIED-PROD** setter PATCH-401 + 7 authz-test → all PASS, full verbatim → git + archive `2026-06.md` via `_INDEX`)_
- _(S87 #344 `f1b10e9` FULL-STACK PE CCM 3-fix + **Mig 58 `AddPeMultiWinnerAndLevelFinalize`** backfill-winners=13 VERIFIED-PROD select-winner-411→401 · S86 #343 `ae4f106` BE-only notify-exclude-drafter ship-proof=Infrastructure.dll-Last-Modified · S85 #342 `d4f6021` DOCS+SQL-no-op INVERTED-PASS-when-FROZEN [gotcha #73 TZ + #69-REFINE] · S83 #333 `fc1f19d` BE-only guard-V2-required hash-FROZEN-but-shipped · S78 #330 `7886fd0` enum-attach-on-approve · S76 #318 `e33481e` Mig56-ProInitial/Adjust · S74-bis #315 Mig55 · S73 #313 Mig54-endpoint-401-not-404-probe · S69b #307 Office-golive-seed-16/16 → all PASS, full verbatim git + archive `2026-06.md` via `_INDEX`)_
- **Older runs (S83 #325 FE-budget-indent ← S77 #329 banner ← S75 #301 ← S62 #286 ← … → S29 #232) full verbatim → git `d2f52ba` + `archive/2026-06.md`** (incl #291 06-16 FAIL forensic [gotcha #65]); pre-S38`archive/2026-05-{runs,q2,q3,q4}.md`.
---

View File

@ -70,18 +70,10 @@ 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-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.
- **2026-06-25 PE S89 AllowApproverFinalize NOTE feasibility (anh Kiệt FDC — "phiếu kết thúc cấp X không CEO" 3 surface):** ⭐ **GAP CONFIRMED — BE field MỚI cần.** `AllowApproverFinalize` (Mig 58 per-Level bool `ApprovalWorkflow.cs:142`) HIỆN CHỈ expose qua `currentLevelOptions` (CURRENT level only) `PurchaseEvaluationFeatures.cs:981` + DTO `PurchaseEvaluationDtos.cs:123` + FE type `purchaseEvaluation.ts:412`. **`approvalFlow` DTO KHÔNG carry flag**: flow-level record `PurchaseEvaluationApprovalFlowLevelDto` (`Dtos.cs:154-158`) chỉ {Order,Name,Approvers,Status}; build loop `PurchaseEvaluationFeatures.cs:1050-1065` KHÔNG project `l.AllowApproverFinalize`. **LIST DTO KHÔNG có** (`PurchaseEvaluationListItemDto:6-45`, 0 finalize field). **DASHBOARD = reuse list** → cũng thiếu. ⇒ FE detail CHỈ biết finalize khi actor LÀ approver cấp finalize (current). Để render "phiếu này kết thúc ở Bước Y/Cấp X — không CEO" cho MỌI người (kể cả non-approver, list, dashboard) → BE PHẢI expose field mới: bundle `bool EndsBeforeCeo`+`string? FinalizeStepName/FinalizeLevelName` (compute = first Step/Level có AllowApproverFinalize=true trong aw.Steps loop đã load `:985`) + mirror lên list-item + dashboard. BE finalize logic `PurchaseEvaluationWorkflowService.cs:861` (AUTO khi matchingLevel.AllowApproverFinalize → DaDuyet bỏ CEO, NO threshold/role-gate). **FE detail placement (cả 2 app SHA-IDENTICAL** sha `e477c939` PeWorkflowPanel + `49b39404` PeDetailTabs): note nên đặt đầu `PeWorkflowPanel.tsx` flow `<ol>` (sau h3 "Quy trình duyệt" :245, trước :256) — banner emerald mirror style :599 existing approverFinalize callout (chỉ trong dialog hiện). Detail đã có precedent: TraLai banner `PeDetailTabs.tsx:370-378`, V2 current-level banner `PeWorkflowPanel.tsx:346-365`. Edge: phiếu **DaDuyet** → đổi copy "đã kết thúc tại <X>, không qua CEO" (past-tense); copy đề xuất "⚑ Quy trình này duyệt tới <StepName/Cấp X> là KẾT THÚC — không trình CEO". MIRROR 2-app bắt buộc. → _INDEX.
- **2026-06-25 PE FROZEN patchwork audit AREA-6 (FE consumers BOTH apps — multi-winner + mirror-drift + dead-code + #70):** ⭐ Post-Mig58 multi-winner (`isWinner` bool) NOW implemented (supersedes 06-24 "SINGLE" recon). **All 6 PE components + 3 PE pages SHA-IDENTICAL fe-admin↔fe-user** (PeDetailTabs/PeHeaderForm/PeUrgentChips/PeListPanel/PeWorkspaceCreateView/PeWorkflowPanel). type files DIFFER but ONLY badge-tint (-700→-800 ink) + comments (intentional per-app UX, struct fields identical incl ccmBudgetPeriodAmount/isWinner/8 Allow flags). **RESIDUAL single-winner BUG (low):** `PeListPanel.tsx:168` renders `p.selectedSupplierName` (list-card winner label) → BLANK when ≥2 joint winners (BE list-DTO `PurchaseEvaluationFeatures.cs:615,706` projects from `SelectedSupplierId` which BE sets null when count≠1 `PurchaseEvaluationDetailFeatures.cs:431`). List DTO has NO isWinner/winner-list field; detail-view multi-winner correct everywhere (8 detail consumers all converted: computeGiaChaoThau:78, missingForApproval:195, submitChecklist:229, ThongTinChonThau:1949/1970, Section-B row4:1578, CreateContractDialog:2171 fallback `||selectedSupplierName`, HangMucCard toggle:2560). **#70 stale-echo ASYMMETRY:** budget Section-B CCM-period editor gates `ccmPeriodMut.isPending||peFetching` (`PeDetailTabs.tsx:1563`) but PRO sibling row3/row8 `adjustMut` gates `.isPending` ONLY (`:1548,:1649`, NO peFetching) — rapid PRO row3→row8 absolute-set pair can echo stale ev.* pre-refetch (same #70 class CCM guards). 3 peFetching sites exist (945/1268/1736). **Stale comment** PeDetailTabs:2507 references `AddItemDialog` "giữ(dead)" but function DELETED (grep 0 def) — misleading comment only, not dead code. PeWorkflowsPage admin-only = by-design (workflow config not mirrored). → _INDEX.
- **2026-06-25 PE FROZEN patchwork audit AREA-2 (budget matrix + Section B 3-col, Mig 56/59):** ⭐ **BAND-AID CONFIRMED** `SetPeCcmBudgetPeriodCommand+Validator+Handler` (`PeSuggestedPriceFeatures.cs:153-199`) is a BUDGET setter (writes `pe.CcmBudgetPeriodAmount`) MISPLACED in a price-feature file; SHOULD live in `PeWorkItemBudgetFeatures.cs` (where UpdatePeBudgetPro/Ccm sit). Test+comments already self-flag (PeCcmBudgetPeriodSetterAuthzTests.cs:14). ⚠️ **Role-gate ASYMMETRY (intentional, NOT a bug — but inconsistent surface):** CCM budget setters = flat role-gate (CostControl|Admin fail-closed): UpdatePeBudgetCcm `PeWorkItemBudgetFeatures.cs:160-165` + SetPeCcmBudgetPeriod `PeSuggestedPriceFeatures.cs:176-181`. BUT the PRO sibling `/budget-adjust``AdjustPurchaseEvaluationBudgetCommandHandler` `PurchaseEvaluationFeatures.cs:349-394` = **phase/drafter/workflow-slot gate** (Drafter when Nháp/TraLai; Approver+AllowApproverEditBudget F4 when ChoDuyet) NOT role-PRO. So "PRO col" & "CCM col" of same Section-B row 3 have DIFFERENT authz models (PRO=drafter-flow on `pe.BudgetPeriodAmount`; CCM=role-flow on `pe.CcmBudgetPeriodAmount`). Both per-PE fields (NOT PeWorkItemBudget per-pair — that's the matrix rows Initial/Adjustment). Section-B **"Dự án" col = intentional FE-only "—"** hardcoded (`PeDetailTabs.tsx:1520,1542,1596,1606`; Domain `PeWorkItemBudget.cs:19` "chưa wire BE — sau mới có người dự án nhập") — documented, NOT a stub-bug. Controller class-level `[Authorize]` only (`PurchaseEvaluationsController.cs:15`) → handler gates ARE the boundary. Tests solid (PeWorkItemBudgetTests 30+ cases, PeCcmBudgetPeriodSetterAuthzTests 7). → _INDEX.
- **2026-06-24 PE 3-change recon (Lưu Trần/anh Kiệt CCM — multi-winner + budget=0-valid + per-step terminal):** ⭐ (A1 winner) cardinality=**SINGLE** scalar `PE.SelectedSupplierId Guid?` (`PurchaseEvaluation.cs:28`); cmd `SelectPurchaseEvaluationWinnerCommand(PEId,Guid?)` `PurchaseEvaluationDetailFeatures.cs:392` handler `:398-423` (null=clear S85-C5); ctrl `/select-winner` `PurchaseEvaluationsController.cs:167-172`. winnerQuoteTotal=**DERIVED** SUM `Quote.ThanhTien WHERE SupplierId==Selected` 3 sites: read `PurchaseEvaluationFeatures.cs:1089` + submit-guard `PurchaseEvaluationWorkflowService.cs:191` + ccm-delegate `:868`. ⚠️ Quote ALREADY has `IsSelected bool` (`PurchaseEvaluationQuote.cs:15` per-item winner, UNUSED by total). Multi-winner = NEW junction OR reuse IsSelected + change predicate `==Selected``IN selectedSet`. FE single `<Select>` `PeDetailTabs.tsx:961-991` (NccSelectorRow). (A2 budget=0) BLOCKED 2 layers: validator `.GreaterThan(0).When(HasValue)` create `:55` + UpdateDraft `:233` + budget-adjust `:339`; submit-guard `effectiveBudget<=0`→missing `PurchaseEvaluationWorkflowService.cs:213-216` (effective=`BudgetPeriodAmount??ProInitialAmount` S85-D3). FE `effBudget<=0` `PeDetailTabs.tsx:211,237` canSubmit `:242`. To allow 0: relax `>0``>=0` validator + submit `<0` + FE. winnerQuoteTotal-gate SEPARATE `:194`. (A3 terminal) `ApprovalWorkflowLevel` already has 6 per-slot bool flags (`ApprovalWorkflow.cs:104-131`: AllowReturnOneLevel/OneStep/ToAssignee/ToDrafter/EditDetails/EditBudget/**SkipToFinal**); `CeoApprovalThreshold decimal?` on WORKFLOW `:43`. Finalize branches `ApproveV2Async`: terminal `nextIdx>=steps.Count` `:905-916` + ccm-delegate opt-in `:854-891` + skipToFinal `:803-844`. "Approve-ends-here" = NEW per-Level bool mirror SkipToFinal but set Phase=DaDuyet (like ccm-delegate but no threshold). Designer FE = `fe-admin/ApprovalWorkflowsV2Page.tsx`. **schema-decision forks→em-main:** (1) multi-winner storage: reuse Quote.IsSelected vs new PE↔Supplier winner-junction (2) budget=0 vs budget-null distinction post-relax (3) terminal flag scope per-Level vs per-Step + interaction w/ CeoApprovalThreshold (both finalize → ordering). → _INDEX.
- **2026-06-25 PE AREA-4 UpdatePeDraft edit-preserve audit (gotcha #73-class hunt, FROZEN Mig 59):** ⭐ **LATENT #73-CLASS BUG FOUND:** `UpdatePeDraftHandler` absolute-sets `entity.HoSoLink = request.HoSoLink` (`PurchaseEvaluationFeatures.cs:280`) BUT `PeHeaderForm.tsx` PUT payload (admin+user `:112-120`) OMITS hoSoLink → editing header CLEARS HoSoLink (Mig 52) to null. HoSoLink set separately in `PeDetailTabs.tsx:2012-2020` HoSoLinkRow (re-sends all absolute fields but only IT edits link). Two PUT call-sites to SAME /purchase-evaluations/{id} endpoint are mutually destructive. PeHeaderForm reachable as EDIT (`PurchaseEvaluationCreatePage.tsx:13,26` editId from URL `?id=`, deep-link "Sửa header"). Field table: TenGoiThau/DiaDiem/MoTa/PaymentTerms absolute-set BUT PeHeaderForm re-sends all (safe); HoSoLink absolute-set + OMITTED (BUG); ApprovalWorkflowId/Budget/ExpectedRemaining/WorkItemId all null-safe `if(x is not null)` `:285-297` (S85 fix). ExpectedRemaining absolute-set in budget-adjust `:423-424` (FE sends both, OK). Require-workflow NOT duplicated: CREATE-validator `:48` + submit-guard `PurchaseEvaluationWorkflowService.cs:237` = different lifecycle (coherent defense-in-depth); UPDATE-validator correctly omits. Tests SOLID: PeUpdateDraftWorkflowPreserveTests (3 null-safe cases incl ApprovalWorkflowId+Budget) + PeSubmitGuardAndBypassTests (14) + PurchaseEvaluationDraftGuardTests (8). NO HoSoLink-preserve test (test-gap for the bug). → _INDEX.
- **2026-06-25 PE AREA-3 finalize/price audit (FROZEN Mig 59 Run#346 — patchwork hunt):** ⭐ TWO finalize mechanisms COEXIST + BOTH LIVE (NOT dead): (1) `AllowApproverFinalize` per-Level AUTO config (Mig 58) `PurchaseEvaluationWorkflowService.cs:861-877` + (2) `finalizeByCcmDelegation` OPT-IN param threshold-gated (Mig 54) `:879-915`. AUTO runs FIRST + returns → if both eligible, OPT-IN flag silently ignored (coherent, no double). `finalizeByCcmDelegation` FULLY wired E2E (ctrl `:141`+`:351` · Feature `:474,:526` · IPe…Service:32 · FE both `PeWorkflowPanel.tsx:184,584` ô-tích) — NOT orphan. ALL 3 DaDuyet paths bind giá chốt via `ApplyApprovedPriceOnFinalize` (private static `:956-971`, allow-list `{Ncc,ProMin,ProMax,Ccm}` `:955`): terminal `:933` + AllowApproverFinalize `:863` + ccm-delegate `:901`. isSystem-exempt branch (`:961-964`) = DEAD via public ApproveV2Async (needs decision=AutoApprove but APPROVE-STEP gates Approve; PE has NO SLA-job — only Contract) — tested-only-via-reflection (PeApprovedPriceFinalizeTests:238-295, header DISCLOSES "defensive/dead"). **MISPLACED-CODE CONFIRMED (known band-aid):** `SetPeCcmBudgetPeriodCommand` (Mig 59 Section-B BUDGET setter) lives in `PeSuggestedPriceFeatures.cs:153-199` (a SUGGESTED-PRICE file) — wrong file, own header admits Section-B. Has test `PeCcmBudgetPeriodSetterAuthzTests.cs` (NOT test-gap). DTO `currentLevelOptions` per-NV-discriminated `PurchaseEvaluationFeatures.cs:950-963` = same source as service `matchingLevel` (coherent). 4 finalize test files all present + green-design. → _INDEX.
- **2026-06-25 PE AREA-5 urgent/notify/TZ audit (FROZEN Mig 59 — gotcha #72):** ⭐ (a-TZ) `UtcDateTimeJsonConverter` registered ONLY on `AddControllers().AddJsonOptions` `Program.cs:33-34` — covers REST. ⚠️ **SignalR push BYPASSES it** (`AddSignalR()` no `.AddJsonProtocol`, separate STJ): `NotificationPushInterceptor.cs:77` pushes `createdAt=n.CreatedAt` over `SendAsync`. BENIGN at runtime: `n.CreatedAt=clock.UtcNow`=Kind.Utc (DateTimeService.cs:7) → default STJ writes 'Z' for Utc-kind, FE `new Date(iso)` NotificationBell.tsx:23 OK. Latent: any future SignalR push of an EF-READ (Unspecified) DateTime would skew. NOT a bug now, inconsistency-low. Converter handles DateTime? auto (non-null) — no double-convert. (b-authz) Urgent SET/UNSET branches `PurchaseEvaluationUrgentFeatures.cs:54-73` SYMMETRIC + fail-CLOSED both (`if(!allowed)throw` BEFORE mutate); 14 tests `PeUrgentToggleAuthzTests` cover plain/TP/Admin/drafter×set/unset. No fail-open. Controller class-`[Authorize]` only `:91` → handler IS boundary. (c-notify) Drafter excluded 2 sites: advance `:1138` (`!=DrafterUserId`) + terminal-result KEPT `:1085`; tests `PeApproverNotifyExcludesDrafterTests` RED-on-remove. ⚠️ **POSSIBLE double-notify-then-skip:** submit `:252` LogTransition notifies Cấp-1 approvers (excl drafter+actor) THEN `:260` ApplyDrafterBypass advances pointer + `:650/660` re-notifies new level — if drafter=Cấp1 w/ co-approver, co-approver pinged for a level immediately bypassed. Low-sev (extra ping, not wrong recipient); no de-dup across the 2 LogTransition calls. → _INDEX.
- **2026-06-23 PE UAT recon D2/D4/D5 (anh Kiệt FDC go-live):** ⭐ (D2-urgent authz) `PurchaseEvaluationUrgentFeatures.cs:49-50` BẤT-ĐỐI-XỨNG `isPro=IsUrgent?hasPro:(hasPro&&isDeptManager)` — GẮN=role-only / GỠ=DeptManager-only. NO DrafterUserId match (handler chỉ load entity, never reads DrafterUserId). Để drafter gỡ cờ mình: sửa :49-50 OR `actor.Id==entity.DrafterUserId`. Endpoint `PUT /purchase-evaluations/{id}/urgent` (controller:91). ⚠️ cờ KHÔNG split-by-drafter (PRO/CCM = role, drafter ≠ tất nhiên PRO/CCM). (D5) FE PE-create dropdown=`PeWorkspaceCreateView.tsx:94-104` GET `/approval-workflows-v2?applicableType={1|2}` filter `isUserSelectable`. **Dev DB: PE type1/type2 selectable=0** (6 selectable đều type3-9 Contract/Proposal/Leave/OT/Xe/Ticket NOT PE) → prod UNVERIFIED (SSH-paren-quote-trap). Validator REQUIRE workflow CẢ 2 tầng: `PurchaseEvaluationFeatures.cs:48` create NotEmpty (S83) + submit-guard `PurchaseEvaluationWorkflowService.cs:225` ConflictException. (D4 required) create-validator `:35-57`: Type/TenGoiThau≤500/ProjectId/WorkItemId/ApprovalWorkflowId NotEmpty + BudgetPeriodAmount>0-when-present. Submit-guard `:174-228`: SelectedSupplierId + winnerQuoteTotal>0 + BudgetPeriodAmount>0 + Bảng-so-sánh-attachment + ApprovalWorkflowId. → _INDEX.
- **PE FROZEN-Mig59 patchwork + go-live recon cluster (S87→S89, 8 entries → `archive/2026-06.md`):** AREA-2 budget-matrix (`SetPeCcmBudgetPeriodCommand` band-aid misplaced in `PeSuggestedPriceFeatures.cs:153-199`; PRO=drafter-flow vs CCM=role-flow authz asymmetry Section-B row3; "Dự án" col intentional FE-only "—") · AREA-3 finalize/price (AllowApproverFinalize AUTO Mig58 + finalizeByCcmDelegation OPT-IN Mig54 coexist, AUTO-first; ApplyApprovedPriceOnFinalize allow-list {Ncc,ProMin,ProMax,Ccm}; isSystem-branch DEAD via public ApproveV2Async) · AREA-4 UpdatePeDraft (**LATENT #73-class BUG:** HoSoLink absolute-set `PurchaseEvaluationFeatures.cs:280` but PeHeaderForm PUT OMITS → clears; 2 PUT call-sites mutually destructive; no HoSoLink-preserve test) · AREA-5 urgent/notify/TZ (SignalR push BYPASSES UtcDateTimeJsonConverter benign-Kind.Utc; urgent SET/UNSET symmetric fail-closed; possible double-notify-then-skip drafter=Cấp1) · AREA-6 FE-consumers (all 6 PE-comp+3 pages SHA-identical 2-app; residual single-winner `PeListPanel.tsx:168` blank ≥2 joint; #70 stale-echo PRO row3/8 no-peFetching) · S89 AllowApproverFinalize-NOTE feasibility (**GAP: BE field MỚI cần** — flag chỉ ở `currentLevelOptions` current-level; approvalFlow+list+dashboard DTO KHÔNG carry → expose `EndsBeforeCeo`+FinalizeStep/LevelName; FE note đầu `PeWorkflowPanel.tsx` flow `<ol>`) · 06-24 3-change (winner=SINGLE `SelectedSupplierId`, winnerQuoteTotal DERIVED 3-site; budget=0 blocked 2-layer; terminal=NEW per-Level bool mirror SkipToFinal) · 06-23 D2/D4/D5 UAT (urgent authz BẤT-ĐỐI-XỨNG gắn-role/gỡ-DeptMgr; PE-create dropdown `PeWorkspaceCreateView.tsx:94`; workflow-required 2-tầng).
- **2026-06-20 governance-landing map (RC-sig + User-Mark H12/13 + objective-criteria):** ⭐ WHERE-to-land 3 AI_INFRA gov broadcasts. `harness-11-engine.md` = CANONICAL engine (D5/D6/D7 safety-tier + D8 one-direction-lock + D9 single-writer + D10 Bash-residual + CAVEAT no-OS-hook). `error-ledger.md` = §L.a AS-1..13 + §L.b 7-step. adap-report FORMAT richest = `2026-06-18-Governance-harness-11.md`. rules.md §6.6 = objective-criteria. **report-before-stamp ⊂ D7 (extend, đừng duplicate → C3 vocab-fork).** → _INDEX.
- **2026-06-20 Harness-14 Eval/Budget/Outcome audit:** ⭐ H-14 = time/age/recency-decay KHÔNG được làm căn-cứ cắt feature. (1) BUDGET aligned: `memory-budget.json` 0 decay/TTL/age hit; `keep_floor=5`=newest-protection (drains OLDEST), cap seed-by-MEASURE. (2) detectors = canonical-anchor-vs-STATUS + disk-cross-check, ZERO age-window. (3) EVAL genuine: `eval/golden-set-solution_erp.jsonl` (14q) + `evaluator.md` recall@5≥0.7 — weekly-manual no-automation. (4) anti-downgrade = Harness-8 "all-inherit chất-lượng>chi-phí" PARTIAL (no generic rule in rules.md, grep 0). → _INDEX.
- **PE recon cluster (S69→S76, → _INDEX):** "Giá chào thầu" mục-c = `WinnerQuoteTotal`=SUM(Quote.ThanhTien WHERE supplier==Selected) DERIVED (3 nơi đồng-predicate) — PRO-Min/Max+CCM-proposed = Mig 54 NEW field. **Budget gate = PURE ROLE no-phase** (`canEditPro=Admin||Procurement`/`canEditCcm=Admin||CostControl` `PurchaseEvaluationFeatures.cs:800-801`; comment "bảng NS=tài-liệu-sống như Excel"); **submission-count-lock NEXISTS** (grep 0) → "khóa Initial sau lần-trình-đầu" = feature-MỚI. **Value-threshold HOOK B** = `ApproveV2Async` advance `:816-845` (reuse skipToFinal mechanic); **urgent flag** = AddColumn mirror `ItTicketPriority`. Badge ✎NS = +2 bool DTO via `GetUsersInRoleAsync` batch (no-N+1) both sites. PRO/CCM/CEO = `Procurement/CostControl/Director` (domain-shorthand NOT constants); V2 routing IGNORES roles (= specific ApproverUserId), 100% LINEAR no value/threshold config.

View File

@ -75,3 +75,15 @@
- **Archived S29-S37 → `archive/2026-05-q4.md` + git d2f52ba (S40 curate):** S36 G-O2 Phòng họp clean-room + FullCalendar v6 MIT eval · S36 startup MEMORY-size audit · S35 G-H2 HRM clean-room verdict · S33 G-H1 NamGroup TblNhanVien 10-bảng (105 cols main) · S33 startup RAG verify · S32 Plan G 11-module backlog · S29 Plan CA+B pre-flight (3 patterns: 9-menu terrain, V1+V2 coexist, reference-template-paths cite line-range ROI). KEY absorbed: **clean-room > NamGroup port verified 4×** · Pattern 12-bis cross-module mirror · FK+freetext dual-write.
- **2026-06-18 (S71 audit — Harness-9 PART B adap-2workflow trung-thuc, on-disk):** ⭐ **VERDICT B substantially-LANDED, ZERO nac-inflation (reports UNDER-state via honest hedge).** B1/B2 ok-runtime: 2 adap cycle ran SEPARATE workflows distinct run-id — S70 impl `wf_a58e0d15-beb`≠audit `wf_9520d8cd-4fe`; S71 impl `wf_e4e46725-231`≠review `wf_636bc95b-939` (review caught real C5-L1 over-claim impl-self-check missed). B2.5 ok: reverse-findings non-empty both reports (3+4 items)+both emails. B3 ok: 2 emails `broadcasts/outbox/ai_infra/{2026-06-17,2026-06-18}-se-to-ai_infra-*.md` carry true-nac+findings+BOTH run-ids. B4 **partial/convention-met**: rule codified `adap-apply.md:38` (short-but-confirm→review) BUT no runtime instance (no short-decision task arose S70/S71) → pure-convention, lead-discipline. ⚠️ **3 PRECISION-flaws (not protocol-gap):** (1) reviewer-agent StructuredOutput unreliable both sessions → em-main self-gate git/sha (disclosed, valid-branch per feedback memory). (2) **PATH-TRAP:** S71 report/email self-verify cited bare `git ls-files runs/`=14 — WRONG; actual = `.claude/workflows/runs/` (22 tracked files, 5 runs: invest/implement/review + h910-finalize `wf_73de399d-753` + h910-curate `wf_f32987b8-03f`). Auditor running bare `runs/` from repo-root gets 0 → false "not-committed". Folder genuinely committed `8c47bd0` + NOT-ignored at correct path. (3) hmw.js RUN-TRACE runtime honest-flagged pending-restart. adap-apply.md:33-36 codify 2-workflow mandate (auto-loaded). Tag `[s71-audit, harness-9-partB, adap-2workflow, path-trap-runs-folder, b4-convention-gap, no-nac-inflation]`.
- **2026-06-25 PE FROZEN patchwork audit AREA-2 (budget matrix + Section B 3-col, Mig 56/59):** ⭐ **BAND-AID CONFIRMED** `SetPeCcmBudgetPeriodCommand+Validator+Handler` (`PeSuggestedPriceFeatures.cs:153-199`) is a BUDGET setter (writes `pe.CcmBudgetPeriodAmount`) MISPLACED in a price-feature file; SHOULD live in `PeWorkItemBudgetFeatures.cs` (where UpdatePeBudgetPro/Ccm sit). Test+comments already self-flag (PeCcmBudgetPeriodSetterAuthzTests.cs:14). ⚠️ **Role-gate ASYMMETRY (intentional, NOT a bug — but inconsistent surface):** CCM budget setters = flat role-gate (CostControl|Admin fail-closed): UpdatePeBudgetCcm `PeWorkItemBudgetFeatures.cs:160-165` + SetPeCcmBudgetPeriod `PeSuggestedPriceFeatures.cs:176-181`. BUT the PRO sibling `/budget-adjust``AdjustPurchaseEvaluationBudgetCommandHandler` `PurchaseEvaluationFeatures.cs:349-394` = **phase/drafter/workflow-slot gate** (Drafter when Nháp/TraLai; Approver+AllowApproverEditBudget F4 when ChoDuyet) NOT role-PRO. So "PRO col" & "CCM col" of same Section-B row 3 have DIFFERENT authz models (PRO=drafter-flow on `pe.BudgetPeriodAmount`; CCM=role-flow on `pe.CcmBudgetPeriodAmount`). Both per-PE fields (NOT PeWorkItemBudget per-pair — that's the matrix rows Initial/Adjustment). Section-B **"Dự án" col = intentional FE-only "—"** hardcoded (`PeDetailTabs.tsx:1520,1542,1596,1606`; Domain `PeWorkItemBudget.cs:19` "chưa wire BE — sau mới có người dự án nhập") — documented, NOT a stub-bug. Controller class-level `[Authorize]` only (`PurchaseEvaluationsController.cs:15`) → handler gates ARE the boundary. Tests solid (PeWorkItemBudgetTests 30+ cases, PeCcmBudgetPeriodSetterAuthzTests 7). → _INDEX.
- **2026-06-24 PE 3-change recon (Lưu Trần/anh Kiệt CCM — multi-winner + budget=0-valid + per-step terminal):** ⭐ (A1 winner) cardinality=**SINGLE** scalar `PE.SelectedSupplierId Guid?` (`PurchaseEvaluation.cs:28`); cmd `SelectPurchaseEvaluationWinnerCommand(PEId,Guid?)` `PurchaseEvaluationDetailFeatures.cs:392` handler `:398-423` (null=clear S85-C5); ctrl `/select-winner` `PurchaseEvaluationsController.cs:167-172`. winnerQuoteTotal=**DERIVED** SUM `Quote.ThanhTien WHERE SupplierId==Selected` 3 sites: read `PurchaseEvaluationFeatures.cs:1089` + submit-guard `PurchaseEvaluationWorkflowService.cs:191` + ccm-delegate `:868`. ⚠️ Quote ALREADY has `IsSelected bool` (`PurchaseEvaluationQuote.cs:15` per-item winner, UNUSED by total). Multi-winner = NEW junction OR reuse IsSelected + change predicate `==Selected``IN selectedSet`. FE single `<Select>` `PeDetailTabs.tsx:961-991` (NccSelectorRow). (A2 budget=0) BLOCKED 2 layers: validator `.GreaterThan(0).When(HasValue)` create `:55` + UpdateDraft `:233` + budget-adjust `:339`; submit-guard `effectiveBudget<=0`→missing `PurchaseEvaluationWorkflowService.cs:213-216` (effective=`BudgetPeriodAmount??ProInitialAmount` S85-D3). FE `effBudget<=0` `PeDetailTabs.tsx:211,237` canSubmit `:242`. To allow 0: relax `>0``>=0` validator + submit `<0` + FE. winnerQuoteTotal-gate SEPARATE `:194`. (A3 terminal) `ApprovalWorkflowLevel` already has 6 per-slot bool flags (`ApprovalWorkflow.cs:104-131`: AllowReturnOneLevel/OneStep/ToAssignee/ToDrafter/EditDetails/EditBudget/**SkipToFinal**); `CeoApprovalThreshold decimal?` on WORKFLOW `:43`. Finalize branches `ApproveV2Async`: terminal `nextIdx>=steps.Count` `:905-916` + ccm-delegate opt-in `:854-891` + skipToFinal `:803-844`. "Approve-ends-here" = NEW per-Level bool mirror SkipToFinal but set Phase=DaDuyet (like ccm-delegate but no threshold). Designer FE = `fe-admin/ApprovalWorkflowsV2Page.tsx`. **schema-decision forks→em-main:** (1) multi-winner storage: reuse Quote.IsSelected vs new PE↔Supplier winner-junction (2) budget=0 vs budget-null distinction post-relax (3) terminal flag scope per-Level vs per-Step + interaction w/ CeoApprovalThreshold (both finalize → ordering). → _INDEX.
- **2026-06-25 PE AREA-4 UpdatePeDraft edit-preserve audit (gotcha #73-class hunt, FROZEN Mig 59):** ⭐ **LATENT #73-CLASS BUG FOUND:** `UpdatePeDraftHandler` absolute-sets `entity.HoSoLink = request.HoSoLink` (`PurchaseEvaluationFeatures.cs:280`) BUT `PeHeaderForm.tsx` PUT payload (admin+user `:112-120`) OMITS hoSoLink → editing header CLEARS HoSoLink (Mig 52) to null. HoSoLink set separately in `PeDetailTabs.tsx:2012-2020` HoSoLinkRow (re-sends all absolute fields but only IT edits link). Two PUT call-sites to SAME /purchase-evaluations/{id} endpoint are mutually destructive. PeHeaderForm reachable as EDIT (`PurchaseEvaluationCreatePage.tsx:13,26` editId from URL `?id=`, deep-link "Sửa header"). Field table: TenGoiThau/DiaDiem/MoTa/PaymentTerms absolute-set BUT PeHeaderForm re-sends all (safe); HoSoLink absolute-set + OMITTED (BUG); ApprovalWorkflowId/Budget/ExpectedRemaining/WorkItemId all null-safe `if(x is not null)` `:285-297` (S85 fix). ExpectedRemaining absolute-set in budget-adjust `:423-424` (FE sends both, OK). Require-workflow NOT duplicated: CREATE-validator `:48` + submit-guard `PurchaseEvaluationWorkflowService.cs:237` = different lifecycle (coherent defense-in-depth); UPDATE-validator correctly omits. Tests SOLID: PeUpdateDraftWorkflowPreserveTests (3 null-safe cases incl ApprovalWorkflowId+Budget) + PeSubmitGuardAndBypassTests (14) + PurchaseEvaluationDraftGuardTests (8). NO HoSoLink-preserve test (test-gap for the bug). → _INDEX.
- **2026-06-25 PE AREA-3 finalize/price audit (FROZEN Mig 59 Run#346 — patchwork hunt):** ⭐ TWO finalize mechanisms COEXIST + BOTH LIVE (NOT dead): (1) `AllowApproverFinalize` per-Level AUTO config (Mig 58) `PurchaseEvaluationWorkflowService.cs:861-877` + (2) `finalizeByCcmDelegation` OPT-IN param threshold-gated (Mig 54) `:879-915`. AUTO runs FIRST + returns → if both eligible, OPT-IN flag silently ignored (coherent, no double). `finalizeByCcmDelegation` FULLY wired E2E (ctrl `:141`+`:351` · Feature `:474,:526` · IPe…Service:32 · FE both `PeWorkflowPanel.tsx:184,584` ô-tích) — NOT orphan. ALL 3 DaDuyet paths bind giá chốt via `ApplyApprovedPriceOnFinalize` (private static `:956-971`, allow-list `{Ncc,ProMin,ProMax,Ccm}` `:955`): terminal `:933` + AllowApproverFinalize `:863` + ccm-delegate `:901`. isSystem-exempt branch (`:961-964`) = DEAD via public ApproveV2Async (needs decision=AutoApprove but APPROVE-STEP gates Approve; PE has NO SLA-job — only Contract) — tested-only-via-reflection (PeApprovedPriceFinalizeTests:238-295, header DISCLOSES "defensive/dead"). **MISPLACED-CODE CONFIRMED (known band-aid):** `SetPeCcmBudgetPeriodCommand` (Mig 59 Section-B BUDGET setter) lives in `PeSuggestedPriceFeatures.cs:153-199` (a SUGGESTED-PRICE file) — wrong file, own header admits Section-B. Has test `PeCcmBudgetPeriodSetterAuthzTests.cs` (NOT test-gap). DTO `currentLevelOptions` per-NV-discriminated `PurchaseEvaluationFeatures.cs:950-963` = same source as service `matchingLevel` (coherent). 4 finalize test files all present + green-design. → _INDEX.
- **2026-06-25 PE AREA-5 urgent/notify/TZ audit (FROZEN Mig 59 — gotcha #72):** ⭐ (a-TZ) `UtcDateTimeJsonConverter` registered ONLY on `AddControllers().AddJsonOptions` `Program.cs:33-34` — covers REST. ⚠️ **SignalR push BYPASSES it** (`AddSignalR()` no `.AddJsonProtocol`, separate STJ): `NotificationPushInterceptor.cs:77` pushes `createdAt=n.CreatedAt` over `SendAsync`. BENIGN at runtime: `n.CreatedAt=clock.UtcNow`=Kind.Utc (DateTimeService.cs:7) → default STJ writes 'Z' for Utc-kind, FE `new Date(iso)` NotificationBell.tsx:23 OK. Latent: any future SignalR push of an EF-READ (Unspecified) DateTime would skew. NOT a bug now, inconsistency-low. Converter handles DateTime? auto (non-null) — no double-convert. (b-authz) Urgent SET/UNSET branches `PurchaseEvaluationUrgentFeatures.cs:54-73` SYMMETRIC + fail-CLOSED both (`if(!allowed)throw` BEFORE mutate); 14 tests `PeUrgentToggleAuthzTests` cover plain/TP/Admin/drafter×set/unset. No fail-open. Controller class-`[Authorize]` only `:91` → handler IS boundary. (c-notify) Drafter excluded 2 sites: advance `:1138` (`!=DrafterUserId`) + terminal-result KEPT `:1085`; tests `PeApproverNotifyExcludesDrafterTests` RED-on-remove. ⚠️ **POSSIBLE double-notify-then-skip:** submit `:252` LogTransition notifies Cấp-1 approvers (excl drafter+actor) THEN `:260` ApplyDrafterBypass advances pointer + `:650/660` re-notifies new level — if drafter=Cấp1 w/ co-approver, co-approver pinged for a level immediately bypassed. Low-sev (extra ping, not wrong recipient); no de-dup across the 2 LogTransition calls. → _INDEX.
- **2026-06-23 PE UAT recon D2/D4/D5 (anh Kiệt FDC go-live):** ⭐ (D2-urgent authz) `PurchaseEvaluationUrgentFeatures.cs:49-50` BẤT-ĐỐI-XỨNG `isPro=IsUrgent?hasPro:(hasPro&&isDeptManager)` — GẮN=role-only / GỠ=DeptManager-only. NO DrafterUserId match (handler chỉ load entity, never reads DrafterUserId). Để drafter gỡ cờ mình: sửa :49-50 OR `actor.Id==entity.DrafterUserId`. Endpoint `PUT /purchase-evaluations/{id}/urgent` (controller:91). ⚠️ cờ KHÔNG split-by-drafter (PRO/CCM = role, drafter ≠ tất nhiên PRO/CCM). (D5) FE PE-create dropdown=`PeWorkspaceCreateView.tsx:94-104` GET `/approval-workflows-v2?applicableType={1|2}` filter `isUserSelectable`. **Dev DB: PE type1/type2 selectable=0** (6 selectable đều type3-9 Contract/Proposal/Leave/OT/Xe/Ticket NOT PE) → prod UNVERIFIED (SSH-paren-quote-trap). Validator REQUIRE workflow CẢ 2 tầng: `PurchaseEvaluationFeatures.cs:48` create NotEmpty (S83) + submit-guard `PurchaseEvaluationWorkflowService.cs:225` ConflictException. (D4 required) create-validator `:35-57`: Type/TenGoiThau≤500/ProjectId/WorkItemId/ApprovalWorkflowId NotEmpty + BudgetPeriodAmount>0-when-present. Submit-guard `:174-228`: SelectedSupplierId + winnerQuoteTotal>0 + BudgetPeriodAmount>0 + Bảng-so-sánh-attachment + ApprovalWorkflowId. → _INDEX.
- **2026-06-25 PE S89 AllowApproverFinalize NOTE feasibility (anh Kiệt FDC — "phiếu kết thúc cấp X không CEO" 3 surface):** ⭐ **GAP CONFIRMED — BE field MỚI cần.** `AllowApproverFinalize` (Mig 58 per-Level bool `ApprovalWorkflow.cs:142`) HIỆN CHỈ expose qua `currentLevelOptions` (CURRENT level only) `PurchaseEvaluationFeatures.cs:981` + DTO `PurchaseEvaluationDtos.cs:123` + FE type `purchaseEvaluation.ts:412`. **`approvalFlow` DTO KHÔNG carry flag**: flow-level record `PurchaseEvaluationApprovalFlowLevelDto` (`Dtos.cs:154-158`) chỉ {Order,Name,Approvers,Status}; build loop `PurchaseEvaluationFeatures.cs:1050-1065` KHÔNG project `l.AllowApproverFinalize`. **LIST DTO KHÔNG có** (`PurchaseEvaluationListItemDto:6-45`, 0 finalize field). **DASHBOARD = reuse list** → cũng thiếu. ⇒ FE detail CHỈ biết finalize khi actor LÀ approver cấp finalize (current). Để render "phiếu này kết thúc ở Bước Y/Cấp X — không CEO" cho MỌI người (kể cả non-approver, list, dashboard) → BE PHẢI expose field mới: bundle `bool EndsBeforeCeo`+`string? FinalizeStepName/FinalizeLevelName` (compute = first Step/Level có AllowApproverFinalize=true trong aw.Steps loop đã load `:985`) + mirror lên list-item + dashboard. BE finalize logic `PurchaseEvaluationWorkflowService.cs:861` (AUTO khi matchingLevel.AllowApproverFinalize → DaDuyet bỏ CEO, NO threshold/role-gate). **FE detail placement (cả 2 app SHA-IDENTICAL** sha `e477c939` PeWorkflowPanel + `49b39404` PeDetailTabs): note nên đặt đầu `PeWorkflowPanel.tsx` flow `<ol>` (sau h3 "Quy trình duyệt" :245, trước :256) — banner emerald mirror style :599 existing approverFinalize callout (chỉ trong dialog hiện). Detail đã có precedent: TraLai banner `PeDetailTabs.tsx:370-378`, V2 current-level banner `PeWorkflowPanel.tsx:346-365`. Edge: phiếu **DaDuyet** → đổi copy "đã kết thúc tại <X>, không qua CEO" (past-tense); copy đề xuất "⚑ Quy trình này duyệt tới <StepName/Cấp X> là KẾT THÚC — không trình CEO". MIRROR 2-app bắt buộc. → _INDEX.
- **2026-06-25 PE FROZEN patchwork audit AREA-6 (FE consumers BOTH apps — multi-winner + mirror-drift + dead-code + #70):** ⭐ Post-Mig58 multi-winner (`isWinner` bool) NOW implemented (supersedes 06-24 "SINGLE" recon). **All 6 PE components + 3 PE pages SHA-IDENTICAL fe-admin↔fe-user** (PeDetailTabs/PeHeaderForm/PeUrgentChips/PeListPanel/PeWorkspaceCreateView/PeWorkflowPanel). type files DIFFER but ONLY badge-tint (-700→-800 ink) + comments (intentional per-app UX, struct fields identical incl ccmBudgetPeriodAmount/isWinner/8 Allow flags). **RESIDUAL single-winner BUG (low):** `PeListPanel.tsx:168` renders `p.selectedSupplierName` (list-card winner label) → BLANK when ≥2 joint winners (BE list-DTO `PurchaseEvaluationFeatures.cs:615,706` projects from `SelectedSupplierId` which BE sets null when count≠1 `PurchaseEvaluationDetailFeatures.cs:431`). List DTO has NO isWinner/winner-list field; detail-view multi-winner correct everywhere (8 detail consumers all converted: computeGiaChaoThau:78, missingForApproval:195, submitChecklist:229, ThongTinChonThau:1949/1970, Section-B row4:1578, CreateContractDialog:2171 fallback `||selectedSupplierName`, HangMucCard toggle:2560). **#70 stale-echo ASYMMETRY:** budget Section-B CCM-period editor gates `ccmPeriodMut.isPending||peFetching` (`PeDetailTabs.tsx:1563`) but PRO sibling row3/row8 `adjustMut` gates `.isPending` ONLY (`:1548,:1649`, NO peFetching) — rapid PRO row3→row8 absolute-set pair can echo stale ev.* pre-refetch (same #70 class CCM guards). 3 peFetching sites exist (945/1268/1736). **Stale comment** PeDetailTabs:2507 references `AddItemDialog` "giữ(dead)" but function DELETED (grep 0 def) — misleading comment only, not dead code. PeWorkflowsPage admin-only = by-design (workflow config not mirrored). → _INDEX.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,52 @@
# S96 — 2026-07-01 — Buổi UAT LỚN anh Kiệt/team live + Monthly-audit (5 commit prod-verified)
> em-main-led. HMW-mode ON (1 prep-workflow monthly-audit + spawn-lẻ, chủ-yếu solo/reliable). Session dài: `/session-start` → monthly audit → NCC import → 3 PE bug-fix theo UAT anh Kiệt/chị Trà/anh Chương → `/session-end`.
## 5 commit (đều pushed + deployed + cicd-verified)
| # | SHA | Scope | Run |
|---|---|---|---|
| 1 | `881783c` | Docs: monthly drift audit + FD distill + mega-line re-tier | docs-only CI-skip |
| 2 | `ba4b8e0` | Infra: import NCC DONGDUONG + Supplier-field backlog | #477 |
| 3 | `e657faa` | PE: ô "KẾT THÚC quy trình" → opt-out bỏ-tick-được | #478 |
| 4 | `36cbf8b` | PE: mark-read noti "cần duyệt" cũ (fix chuông stale) | #479 |
| 5 | `0c2f9f6` | PE: khóa sửa giá đề xuất PRO/CCM sau gửi-duyệt | #480 |
## (1) Monthly drift audit `881783c` (đúng hạn cron ngày 1)
- **ef-core-migration/SKILL.md:** latest-mig 56→**59** + append bảng rows 57/58/59 + Mig 14/Phase-7 Budget annotate `DROPPED Mig 50`.
- **skills/README.md:** ef-core Mig 55→59 + gotcha cite #69→**76** (heading gốc gotchas.md).
- **docs/CLAUDE.md:** Budget module `REMOVED Mig 50 (S61)` strike-through (§1 item 6 + roadmap Phase 7/8).
- **`docs/governance/vocab-alias-map.md` MỚI:** 3 vocab-fork (run-trace/Ngân-sách-PRO/all-inherit canonical) + thêm vào `$ExcludeExact` governance-detectors (anti self-match; detector pure-grep nên flag stay "documented-known").
- **Re-tier STATUS/HANDOFF mega-line** 5→3 blurb (S92/S91 → archive tier-S94, byte-exact conservation **delta=0**, BOM-preserved) + **hoist 3 UAT-carry** (S92 non-admin-menu · S91 change-pw · S91 NCC-demo) vào blockers (reviewer flag conservation).
- **FD memory distill** (H17 loop strike-1 → **CLEARED**): frontend-designer L1 **26129→21492B**, 5 war-story (S66/S65/S58/S55/S47) → `archive/2026-06.md` + `_INDEX` + gist; Lessons value-protect (anti-#53/Tailwind-v4-stop/rig-#3/lucide) lên L1. budget.json measured refreshed.
- **Workflow `wf_2d687d27`** 4-cluster draft→adversarial-verify: reviewer bắt **#74 paraphrase-drift** (em sửa từ heading gốc) + **AS-10 residual reviewer self-write reverted** (git-diff backstop). detector **27→25** (2 real drift clear; còn lại module-local false-pos).
## (2) Import NCC DONGDUONG `ba4b8e0`
- Excel anh Kiệt "Database NCC & Nhà thầu phụ" — 4 NCC, ~30 field. **Phát hiện:** 3 NCC (TRUONGGIANG/TANPHU/TGN) **đã seed sẵn** S55/S59 (data khớp) → chỉ **DONGDUONG** mới.
- Scope anh chốt = **option-3** (9 field entity + gói extras Loại/NĐD/TK/GUQ/Trạng-thái vào `Note`). **KHÔNG migration** (data-only seed). `SeedRealMasterDataAsync` ungated idempotent → prod 20→**21 NCC** (cicd #477: sqlcmd 21 rows, DONGDUONG type=2, Note "Thang máy").
- **Backlog "15-18 field note-lại-từ-từ-tính"** (bank tách/link GUQ-GPKD-HSNL/địa-chỉ-VP/PMH... + enum SupplierType thêm "Cả hai") → `docs/STATUS` Maintenance backlog.
## (3-5) 3 PE bug-fix theo UAT anh Kiệt/chị Trà/anh Chương
- **`e657faa` — ô "Cấp này KẾT THÚC quy trình" opt-out bỏ-tick-được** (anh Kiệt "cái này option thôi"): AllowApproverFinalize (Mig 58, S89 auto-finalize im-lặng) NAY = **2-tier** — Designer tick = **cấp quyền** (level được phép finalize), phiếu = **thực-thi** (mặc-định tick=kết-thúc, bỏ-tick=trình-CEO). +param `applyLevelFinalize` (default-true backward-compat) xuyên interface→service (guard `&& applyLevelFinalize`)→command→handler→controller + FE checkbox 2-app. +test #6 (opt-out→advance-CEO). Run #478.
- **`36cbf8b` — chuông tự-sạch noti "cần duyệt"** (chị Trà/anh Kiệt "chuông không bỏ ra được"): noti "Phiếu cần bạn duyệt" cũ KHÔNG tự xóa khi phiếu được duyệt-thay/hoàn-tất bởi người khác. Fix: `LogTransitionAsync` (chạy MỌI transition) mark-read `ReadAt` mọi noti Generic+RefId=phiếu unread TRƯỚC block notify-cấp-mới. `ExecuteUpdateAsync` best-effort BE-only. +test #7 (finalize→noti CEO cũ mark-read). Run #479.
- **`0c2f9f6` — khóa sửa giá đề xuất PRO/CCM sau gửi-duyệt** (anh Kiệt/chị Trà "duyệt là fix"): screenshot drafter=PRO điền Min/Max SAU khi chị Trà duyệt. Root: 2 handler cố-ý "KHÔNG ràng Phase" (Mig 54). Fix ĐẢO: non-admin chỉ sửa Nháp/TraLai, đã-gửi-duyệt/đã-duyệt/từ-chối → ConflictException; Admin override. BE (PeSuggestedPriceFeatures) + FE (PeDetailTabs `SuggestedPriceRows` gate `&& isEditablePhase` 2-app) + **4 test** (spec-change: sửa `SeedPeAsync` default ChoDuyet→DangSoanThao). Run #480.
- **Delete-sau-duyệt = ĐÃ chặn sẵn** — không cần fix: FE nút Xóa chỉ hiện `DangSoanThao` + BE delete-guard block non-draft. chị Trà chắc test phiếu Nháp.
- **Checkbox "ko được"** (anh Chương) = **browser cache** (gotcha #77): verify prod bundle `0MU-kb4N` BYTE-LEVEL chứa fix ("BỎ tick"), "✅ static" cũ MẤT; index.html no-cache đúng + no-service-worker → **incognito = golden-test**.
## Lessons
1. **verify-deployed-artifact-byte-level** (gotcha #77 + `feedback_verify_deployed_artifact_byte_level`): cache≠deploy — curl-grep bundle prod tìm marker fix; incognito golden. Tiết-kiệm giờ debug sai hướng.
2. **#53 return-garble ×3** (`feedback_agent_return_garble_recover`): investigator + cicd×2 trả text-memory-curation thay verdict; WORK + diary ĐÚNG → recover từ agent-memory KHÔNG re-spawn; instruction-fix "return verdict" ăn lần-3 (không 100%).
3. **2-tier-permission** (grant-vs-exercise): config = cấp quyền, runtime = thực-thi — tách rõ (Designer AllowApproverFinalize vs phiếu applyLevelFinalize).
4. **spec-change→update-test-cũ** (rules §7): đảo "KHÔNG ràng Phase" → sửa SeedPeAsync seed-phase để 15 test cũ sống + 4 test mới.
## State (verified)
Mig **59** · **88** bảng · **440** test (45D+395I, +6 S96) · gotcha **77** · menu 54 · bundle admin `COYAX-yQ`/user `0MU-kb4N` (Run #480) · prod **21 NCC** / 17 user.
## Carry / NEXT
- **🔴 anh:** restart CLI · UAT **incognito** checkbox anh Chương · cho **số-phiếu + user** vụ "lỗi phân quyền vào phiếu" (nhiều khả năng config: user chưa gán approver Cấp phiếu đang chờ).
- **🔴 em:** cicd-monitor S-tag-drift S97/S98→S96 reconcile (closeout này) · monthly re-tier mega-line (giờ 4-blurb S96/S95/S94/S93) · Supplier-schema-mở-rộng backlog (khi anh chốt).
- **Pending product (carry):** Section B cột Dự-án · Ngưỡng giá CEO Mig 54 · "C" chuyển phiếu→dự án.

View File

@ -1298,6 +1298,18 @@ for h in resp.points: # ← .points không phải iterable trực tiếp
**Fix/Quy tắc:** đổi prod config = sửa `.example` (tracked) HOẶC `appsettings.json`, KHÔNG file local gitignored. `.example` KHÔNG `DemoSeed` prod fallback `appsettings.json DemoSeed:Disabled=true` (đúng fallback đã giữ Contracts/PE gated nhiều tháng gate #75 hiệu-lực prod).
### 77. SPA deploy bundle cache-lag — user thấy UI CŨ dù đã deploy (index.html cache / tab-SPA-mở) (Session 96)
**Triệu chứng:** Deploy FE xong (bundle rotate verified prod), nhưng user (anh Chương UAT) VẪN thấy UI Ctrl+F5 + logout/login checkbox opt-out mới không hiện, vẫn "✅ Cấp này KẾT THÚC" static . Team " tay rồi".
**Cơ chế:** Vite đặt hash trong TÊN file (`index-<hash>.js`, `Cache-Control: immutable max-age=1năm` = ĐÚNG). `index.html` = `Cache-Control: no-cache` (ĐÚNG chuẩn revalidate ETag mỗi load). Nhưng: (a) tab SPA đang-mở chạy JS trong RAM (cần reload thật, không chỉ F5-nửa-vời); (b) browser đôi khi giữ `index.html` cached bất-chấp no-cache trỏ file JS (tên hash ). KHÔNG service-worker (fe-user grep `serviceWorker|workbox|VitePWA` = 0) không phải SW-cache.
**Chẩn-đoán (phân-biệt cache-vs-deploy — QUAN TRỌNG, đừng đoán):** **verify bundle prod BYTE-LEVEL**: `JS=$(curl -s $BASE/ | grep -oE '/assets/index-[A-Za-z0-9_-]+\.js')` `curl -s "$BASE$JS" | grep -ao "<string-fix-mới>"` + `grep "<string-cũ>"`. Fix-string PRESENT + old-string GONE = deploy OK **100% client-cache** (KHÔNG phải deploy-fail). S96: prod `0MU-kb4N` chứa "BỎ tick"/"Đã BỎ tick", "bạn duyệt xong" MẤT xác nhận cache.
**Fix (client):** **incognito window (Ctrl+Shift+N) = golden-test** (không dùng cache, chắc-chắn bundle mới nếu incognito OK = 100% cache). Hoặc F12ApplicationClear site datareload. **Đừng chỉ Ctrl+F5** (đôi khi không xóa index.html cached). **Server ĐÃ đúng chuẩn** (index.html no-cache + JS hash-immutable) KHÔNG cần fix infra.
**Quy tắc:** UAT báo "fix chưa ăn" sau deploy verify bundle prod byte-level TRƯỚC khi nghi deploy-fail; **incognito = phép-thử vàng** tách cache khỏi bug. Liên-quan #69 (bundle non-determ) · `feedback_verify_deployed_artifact_byte_level`.
**An toàn prod:** chỉ XEM/scroll/screenshot KHÔNG bấm nút mutate (Gửi duyệt/Duyệt/Trả lại/Tạo ). Mở `+ Thêm mới` (form `?mode=new`) KHÔNG tạo draft cho tới khi sửa field (auto-save on-edit).
**References:** `$env:TEMP\guideshots\capture.ps1` (session-scratch) · `docs/Huong-dan-Duyet-NCC.docx`. Pattern reusable user-memory `pattern_prod_screenshot_to_docx`.