[CLAUDE] Docs: S97 Mig 61 backfill-wrong-table fix + gotcha #79 closeout (STATUS/HANDOFF/log + memory)

- fix-5: check A/005 "CEO duyệt chưa" → A/005/A/008 finalize-CCM (KHÔNG qua CEO), badge sai do Mig 60 backfill wrong-table; Mig 61 query đúng Changelogs; cicd #484 verified A/005/A/008 flag 0→1 + endsBeforeCeo-True, A/010 control
- gotcha #79: transition-marker ở Changelogs KHÔNG phải Approvals (PE 2 bảng lịch-sử tách vai)
- STATUS/HANDOFF Mig 60→61, gotcha 78→79, State Run #484; session-log Part 4
- Memory harvest: cicd-monitor (#484 verdict recover từ diary — #53 lần-6) + database-agent (điều tra prod A/005)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
pqhuy1987
2026-07-01 21:43:57 +07:00
parent fb2dfa9f7a
commit 5c914e4d8c
4 changed files with 31 additions and 14 deletions

View File

@ -51,8 +51,8 @@ Read-only CI/CD + post-deploy verifier SOLUTION_ERP. Polls Gitea Actions API, ve
- **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:** **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 60 `20260701120138_AddPeEndedByLevelFinalize`** (S98 #482; PE +1 AddColumn `EndedByLevelFinalize` bit NOT NULL default 0 + `Sql()` backfill Phase=7-marker→=1 [SQL-Server-only, tests skip-replay #63] VERIFIED-APPLIED-PROD history-HEAD + col-exists is_nullable=0 default CONVERT([bit],(0)) + backfill=0 fresh-UAT). Prev Mig 59 `AddCcmBudgetPeriodToPurchaseEvaluation` (S88 #345). Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/`. Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC TOP 5`. **`sys.tables` (is_ms_shipped=0) = 89** (S98 LIVE-verified pre AND post #482 narrative/spec-88 STALE, re-ground 89 = current truth; AddColumn-only migs don't change count when commit touches no schema, 89 correct don't FAIL. 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 (S98 Run #482/id=482 JS-rotated real-FE, CSS-frozen):** admin js **`DR9q2VUy`**/css `Bbtesa6B` · user js **`Bgz8u4E5`**/css `BmuPz_Dy` (JS rotated from S97 `Cf0o8dx8`/`x8rppRAK` = real PeWorkflowPanel 2-app endsBeforeCeo-gate FE change; CSS IDENTICAL = JSX-logic-only #69-REFINE byte-identical-CSSsame-hash). **id ≠ run_number(368); 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.
- **Mig latest repo:** **Mig 61 `20260701142752_BackfillEndedByLevelFinalizeFromChangelog`** (S97 #484; data-only NO-schema, `Sql()` UPDATE `EndedByLevelFinalize=1` cho phiếu finalize-marker `PurchaseEvaluationChangelogs` fix Mig 60 soi NHẦM bảng VERIFIED-APPLIED-PROD history-HEAD + A/005/A/008 flipped 01, A/010 stayed 0). Prev Mig 60 `AddPeEndedByLevelFinalize` (S98 #482 AddColumn bit default 0). Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/`. Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC TOP 5`. **`sys.tables` (is_ms_shipped=0) = 89** (S98 LIVE-verified pre/post #482 narrative/spec-88 STALE, 89=truth; AddColumn/data-only migs don't change count commit touches no schema 89 correct don't FAIL. Cross-ref COMMIT scope vs ambient count). enum-additive (e.g. `ApprovalAttachment=5`) = int-stored NO-mig history NOT-advance + empty `git diff -- '*Migrations*'`.
- **Bundle hash live (S98 #482 last-FE-ship JS-rotated real-FE, CSS-frozen):** admin js **`DR9q2VUy`**/css `Bbtesa6B` · user js **`Bgz8u4E5`**/css `BmuPz_Dy` (JS rotated real PeWorkflowPanel 2-app endsBeforeCeo-gate; CSS IDENTICAL=JSX-logic-only #69-REFINE byte-identicalsame-hash). Note #483 badge later rotated JS`CeTA7Z82`/`CGaAyXen` CSS-same; #484 data-fix NO-FE-change not snapshotted. **id ≠ run_number; 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 THAT run, NOT frozen baseline; ALWAYS re-snapshot LIVE pre-deploy (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,14 +70,11 @@ 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`)
- **🟢 S97-badge #483 (id=483, run_number 369) `9e12e80` GO ~5m13s (PASS) — FE-ONLY 8-file badge "✅ Đã được CEO duyệt" cho phiếu đi HẾT lên CEO (endsBeforeCeo=false), anh Kiệt FDC UAT.** Follow-up to #482 endsBeforeCeo runtime. 8 files ALL `fe-*/src`: `PeFinalizeChip.tsx`+`PeListPanel.tsx` 2-app + admin ListPage + user Inbox/Dashboard/ListPage. NO BE/Mig/test. Poll running→success 20:52:23→20:57:36 (~5m13s in-baseline). status=success ⟹ test-gate green (baseline **440** unchanged). 🎯 **FE JS ROTATED both apps**: admin `DR9q2VUy`→**`CeTA7Z82`** + user `Bgz8u4E5`→**`CGaAyXen`** (6 call-sites 2-app real diff) · **CSS FROZEN** Bbtesa6B/BmuPz_Dy (JSX-logic-only ⟹ #69-REFINE). Real-size admin 1,637,119 / user 1,543,467B `application/javascript` (SPA-trap control fake-hash→919B text/html) · Last-Modified admin 13:56:13GMT / user 13:57:09GMT =20:56/20:57+07 IN-WINDOW. 🔴 **BYTE-LEVEL grep #77 BOTH bundles**: new string `Đã được CEO duyệt` PRESENT count=1 admin AND user (matches source `PeFinalizeChip.tsx:26`) · prev-badge `Kết thúc tại` (S97 #481) still-present ⟹ additive no-regression ⟹ badge SHIPPED. 🔴 **Mig UNCHANGED (FE-only)**: history-top==`AddPeEndedByLevelFinalize`(Mig 60) NOT-advanced · sys.tables=88-excl-history [=89-incl; note: my SQL excluded `__EFMigrationsHistory` → count 88, memory-baseline 89 counts it; stable no-schema-change either frame]. Smoke: admin-root/eoffice-root 200, auth accessToken 468ch, `GET /api/purchase-evaluations` **200** items=9 (new FE prop did NOT break list serialization), api ready/live 200. 🔑 **FE-ONLY PASS = CI-success + JS-rotate-BOTH/CSS-frozen(#69) + real-size-vs-919b + LastMod-in-window + byte-grep-new-PRESENT-both(#77) + prev-badge-still-present(additive) + Mig-top-frozen + smoke-200 + PE-list-200-not-500**. ⚠️ tooling: busy-wait-spin ~5-15s/iter TOO-SLOW (poll timed-out mid-run twice) → run finished ~5m, single long-loop w/ 40×favicon-curl spacing worked; #69 hash-rotate held (real 2-app src diff).
- **🟢 S98 #482 (id=482, run_number 368) `8037fa0` GO ~4m (PASS) — CROSS-STACK BE+Mig60+FE+tests, endsBeforeCeo config→RUNTIME (phiếu lên CEO hết báo sai "không qua CEO", anh Kiệt FDC UAT).** 12 files: Domain PE +`EndedByLevelFinalize` · **Mig 60 `20260701120138_AddPeEndedByLevelFinalize`** (AddColumn bit NOT NULL default 0 + `Sql()` backfill Phase=7-marker→=1, SQL-Server-only tests-skip-replay #63) · Features list+detail ternary · WorkflowService · FE `PeWorkflowPanel.tsx` 2-app. Poll running→success 19:23→19:28. status=success ⟹ test-gate green (baseline **440**). 🔴 **Mig 60 APPLIED-PROD**: history-top==Mig60 (pre=Mig59, advanced) · col `EndedByLevelFinalize` bit is_nullable=0 default `CONVERT([bit],(0))` EXISTS · backfill=0 (fresh-UAT no-marker) · **sys.tables=89 pre AND post** (AddColumn no-new-table; ⚠️ spec/baseline-88 STALE, LIVE-truth=89 identical pre/post NOT regression). 🔴 **EF-TERNARY SQL-Server TRANSLATE LIVE-CONFIRMED (SQLite≠SQL Server)**: `GET /api/purchase-evaluations` **200** items=9 endsBeforeCeo-present (NOT 500 `Phase==DaDuyet?EndedByLevelFinalize:subquery.Any()` translates ✅) + PE-detail `31faef0d` **200** endsBeforeCeo=False phase=7 (runtime-path executed = exact-bug-fix) + `/inbox` 200 + `/approval-workflows-v2` 200 (`/approved` 404=wrong-route NOT regression). 🎯 **FE JS ROTATED (real 2-app diff)**: admin `Cf0o8dx8``DR9q2VUy` + user `x8rppRAK``Bgz8u4E5` · **CSS FROZEN** Bbtesa6B/BmuPz_Dy (JSX-logic-only ⟹ #69-REFINE). Real-size 1,636,753/1,543,074B `application/javascript` (control fake→919B text/html SPA-trap) · Last-Modified admin 12:27:07GMT/user 12:27:59GMT =19:27+07 in-window. 🔴 **BYTE-LEVEL grep #77 admin bundle**: `endsBeforeCeo`=PRESENT(1)+`allowApproverFinalize`=PRESENT(2) ⟹ shipped (`finalizeFlowStep`=0=local-const MINIFIED expected-absent). Smoke: api ready/live+admin/eoffice-root 200, auth 468ch. w3wp recycle-clean (transient 127.0.0.1:5443 refused mid-recycle 19:25 → public 200 by verify). 🔑 **CROSS-STACK+MIG PASS = CI-success + Mig-top==HEAD + col-correct-default + sys.tables-stable + EF-ternary-200-NOT-500-live + JS-rotate/CSS-frozen(#69) + real-size-vs-919b + LastMod-in-window + byte-grep-field-PRESENT(#77) + smoke-200**. ⚠️ tooling: busy-wait-spin TOO-SLOW this Win-setup → single-shot-recheck + DLL-mtime-cross-signal beats blind-loop; no-jq→Python-JSON.
- _(S97 #481 `1c8fb6a` GO ~5m10s PASS — FE-ONLY PE finalize 2-fix mirror 2-app SHA-identical PeWorkflowPanel [badge `không trình tới``Kết thúc tại {name}` + checkbox opt-out→opt-in] NO-BE/mig/test · baseline-440 · JS admin`COYAX-yQ``Cf0o8dx8`/user`0MU-kb4N``x8rppRAK` rotated **CSS FROZEN** Bbtesa6B/BmuPz_Dy · real-size 1636732/1543053B · #77 byte-grep BOTH-apps new-PRESENT/old-ABSENT · Mig59-frozen sys.tables-88[STALE→89] · full verbatim → git `1c8fb6a` + archive `2026-06.md` via `_INDEX`)_
- **🟢 S97 #484 (id=484, run_number 370) `fb2dfa9` GO ~5m (PASS) — DATA-FIX Mig 61 backfill EndedByLevelFinalize từ Changelogs (fix Mig 60 soi NHẦM bảng), phiếu finalize-CCM hết hiện sai "Đã được CEO duyệt", anh Kiệt FDC UAT.** 3 files: **Mig 61 `20260701142752_BackfillEndedByLevelFinalizeFromChangelog`**+Designer (data-only NO-schema, chỉ `Sql()` UPDATE set=1 cho phiếu có finalize-marker ở `PurchaseEvaluationChangelogs`) + docs/gotchas.md. Poll running→success ~21:31→21:36:28 (~5m in-baseline; ⚠️ `started_at/stopped_at`=None trong tasks API). status=success ⟹ test-gate green (baseline **440**). 🔴🔴 **BACKFILL EFFECT VERIFIED-PROD (điểm quan trọng nhất) sqlcmd `SELECT MaPhieu,EndedByLevelFinalize WHERE Phase=7`**: **A/005=1, A/008=1** (finalize-CCM set 0→1 = fix ăn) · **A/010=0** (CEO thật giữ nguyên = control OK, backfill KHÔNG over-reach). 🔴 **Mig 61 APPLIED-PROD**: `__EFMigrationsHistory` top==Mig61 (pre=Mig60, advanced). 🔴 **endsBeforeCeo FLIP LIVE (API)**: A/005 `3da9b890``endsBeforeCeo=True` (trước False = exact-bug-fix) · A/010 `31faef0d``False` (control). ⚠️ DTO field `endedByLevelFinalize`=None (không expose shape này) NHƯNG derived `endsBeforeCeo` phản-ánh col-DB=1 đúng ⟹ verify col qua sqlcmd NOT DTO. 🎯 **DATA-FIX ⟹ NO-FE-change**: không snapshot bundle (0 `fe-*/src` diff; #69 rotate benign nếu có ≠ ship-signal). Smoke: api-ready/admin-root/eoffice-root 200×3 + `GET /purchase-evaluations` **200** (list không vỡ). 🔑 **DATA-FIX-BACKFILL PASS = CI-success + Mig-top==HEAD + sqlcmd-target-rows-flip-EXACT(A/005+A/008=1) + control-untouched(A/010=0) + derived-API-field-FLIP-live + smoke-200**. ⚠️ tooling: busy-wait favicon-spin ~10s/iter(40×)=TOO-SLOW → 250×/iter≈50s hit terminal; integrated-auth `-E` `-h -1 -W`; A/010-id qua sqlcmd-inline-lookup.
- _(endsBeforeCeo-saga PE finalize UAT cluster anh Kiệt: **S98 #482 `8037fa0` CROSS-STACK + Mig60 `AddPeEndedByLevelFinalize`** [config→RUNTIME · Mig-APPLIED col-bit-default-CONVERT(0) backfill=0 sys.tables=89-pre/post · 🔴 EF-TERNARY-SQL-Server-TRANSLATE-LIVE list-200-NOT-500 + detail-endsBeforeCeo-False-runtime · JS `Cf0o8dx8`/`x8rppRAK``DR9q2VUy`/`Bgz8u4E5` CSS-frozen · #77 field-PRESENT] · **S97-badge #483 `9e12e80` FE-ONLY 8-file badge "✅ Đã được CEO duyệt"** [JS→`CeTA7Z82`/`CGaAyXen` CSS-frozen · #77 new-str-BOTH+prev-additive · Mig60-frozen list-200] · **S97 #481 `1c8fb6a` FE-ONLY 2-fix** [badge `không trình tới``Kết thúc tại {name}`+opt-out→opt-in · JS→`Cf0o8dx8`/`x8rppRAK` CSS-frozen · #77 new-PRESENT/old-ABSENT] — all baseline-440 all PASS, full verbatim → git + `2026-06.md` via `_INDEX`)_
- _(S96 #480 `0c2f9f6` cross-stack PE 3-commit-range khóa-giá+mark-read+opt-out NO-mig baseline-440+new-PeSuggestedPriceSetterAuthzTests JS-rotate/CSS-frozen · S96 #479 `36cbf8b` PE 2-commit mark-read-stale-noti baseline-436 JS-rotate/CSS-frozen · all PASS Mig59-frozen · full verbatim → git + archive `2026-06.md` via `_INDEX`)_
- _(S96 #477 `ba4b8e0` Infra data-seed NCC `DONGDUONG` ungated-idempotent 🎯 pre=3→post=4 suppliers total=21-EXACT Type=2 **FE-FROZEN** 0-fe-src(#69) · 🔑 **DATA-SEED-PASS = pre/post-DB-row-EXACT-delta + DLL-mtime + w3wp-recycle + Mig-frozen + API-payload-contains-row** · ⚠️ sqlcmd `-W` diacritic-LIKE false-NEG use `_`-wildcard; base64-EncodedCmd-FAIL→`.ps1`-File · S95 #476 `18a17f5` GOVERNANCE-ONLY .ps1-triggers-CI JS-rotate/CSS-frozen 🔑 GOVERNANCE-PASS=CI-green+JS-rotate(#69)+3×200+Mig-frozen — all PASS full verbatim → git + archive `2026-06.md` via `_INDEX`)_
- _(S93 #473 `8ee8f3e` PE tree-node show-CODE NO-MIG · S92 #472 `1408d4e` BE permission-revoke +5-menu VERIFY-PROD [non-Admin CanRead=0, Pe_* untouched; ⚠️ **PROD Identity tables NON-prefixed `Roles` NOT `AspNetRoles`**] · S91 #470 `55494ad` GO-LIVE no-resurrect demo-seed-gate [**PATTERN go-live-no-resurrect = pre+post-DB-count-diff + dll-in-window + w3wp≥run-window**; integrated-auth `-E`] · S90 #465 `a71753b` 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`)_
- _(**S96 #477 `ba4b8e0` Infra data-seed NCC `DONGDUONG`** pre=3→post=4 total=21-EXACT · 🔑 **DATA-SEED-PASS = pre/post-DB-row-EXACT-delta + DLL-mtime + w3wp-recycle + Mig-frozen + API-payload-contains-row** · ⚠️ sqlcmd `-W` diacritic-LIKE false-NEG use `_`-wildcard; base64-EncodedCmd-FAIL→`.ps1`-File · S95 #476 GOVERNANCE-ONLY .ps1-triggers-CI 🔑 GOVERNANCE-PASS=CI-green+JS-rotate(#69)+3×200+Mig-frozen · S93 #473 PE tree-CODE · S92 #472 permission-revoke [⚠️ **PROD Identity tables NON-prefixed `Roles` NOT `AspNetRoles`**] · **S91 #470 GO-LIVE 🔑 PATTERN no-resurrect = pre+post-DB-count-diff + dll-in-window + w3wp≥run-window** [integrated-auth `-E`] · S90 #465 PE draft-private → all PASS, full verbatim → git + `2026-06.md` via `_INDEX`)_
- _(S89 #348 `1aa3bdb` PE 1→N multi-winner endpoint-411→401 · S88-quad #347 `73cce1f` PE D1 re-key+CEO-notify · S88-bis #346 `0d3c0cf` FE-only js+css-BOTH-rotate · **S88 #345 `9b1ee0c` Mig 59 `AddCcmBudgetPeriodToPurchaseEvaluation`** PATCH-401+7-authz · **S87 #344 `f1b10e9` FULL-STACK + Mig 58 `AddPeMultiWinnerAndLevelFinalize`** backfill-winners=13 · S86 #343 BE-only notify-exclude ship-proof=Infra.dll-mtime · S85 #342 DOCS+SQL-no-op INVERTED-PASS-FROZEN [#73 TZ+#69] · S83 #333 BE-only guard-V2 hash-FROZEN-shipped · S78 #330 enum-attach · S76 #318 Mig56-ProInitial · S74-bis #315 Mig55 · S73 #313 Mig54-401-not-404 · S69b #307 Office-seed-16/16 → all PASS, full verbatim → git + `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`.
---

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -90,4 +90,24 @@ Mig 59 · 88 bảng · 440 test (45D+395I) · gotcha 77 · menu 54 · **bundle a
**Verify:** implementer-frontend build ×2 PASS 0-TS-err (bắt `PeListItem.phase: number` → prop `phase?: number` không narrow-union, gotcha type-plumbing) + SHA mirror. cicd #483 PASS: bundle admin `CeTA7Z82`/user `CGaAyXen`, **byte-#77 "Đã được CEO duyệt" PRESENT cả 2 app** + prev-badge additive, Mig 60 frozen, smoke 200×3 + PE-list 200.
**State cuối S97:** Mig 60 · 89 bảng · 440 test · gotcha 78 · menu 54 · bundle admin `CeTA7Z82`/user `CGaAyXen` (Run #483) · prod 21 NCC/17 user. **4 fix PE** (badge-wording + default-flip + endsBeforeCeo-runtime + CEO-duyệt-badge).
**State sau Part 3:** Mig 60 · 89 bảng · 440 test · gotcha 78 · bundle `CeTA7Z82`/`CGaAyXen` (Run #483).
---
## Part 4 (cùng ngày S97) — check CEO-duyệt A/005 → phát hiện Mig 60 backfill WRONG-TABLE (gotcha #79)
**Anh Kiệt:** PE/2026/A/005 "7 Mat Nắp gang" — CEO đã duyệt chưa, nếu rồi hiển thị lịch sử đàng hoàng.
**Điều tra (API + sqlcmd prod):** A/005+A/008 Phase=7, endsBeforeCeo=False, con-trỏ NULL (terminal ran), lịch-sử 4 record dừng ở "[Bước 2 — Cấp 2]" (Phan Văn Chương), KHÔNG có record CEO. Đối chứng A/010: 9 record có "[Bước 3 — Cấp 1]" CEO. Verify Changelogs: A/005/A/008 fin_marker=1 (terminal Changelog "...không trình CEO]"), A/010=0.
**Chẩn đoán:** A/005/A/008 **KHÔNG qua CEO** — finalize tại CCM Cấp 2 (Phan Văn Chương duyệt-thay-CEO, auto-finalize code cũ). Lịch sử 4 record ĐÚNG. Sai = badge "Đã được CEO duyệt" (fix-4) do `EndedByLevelFinalize=0`.
**Root-cause (gotcha #79):** Mig 60 backfill query `PurchaseEvaluationApprovals.Comment` cho marker "[Duyệt KẾT THÚC tại]", nhưng marker do `LogTransitionAsync:1073` ghi vào `PurchaseEvaluationChangelogs.ContextNote` (2 bảng tách vai: Approvals=per-approver :745 · Changelogs=transition+marker) → match 0 → phiếu finalize pre-Mig60 giữ flag=0.
**Fix (Mig 61 `fb2dfa9`):** backfill ĐÚNG `Changelogs.ContextNote LIKE N'%Duyệt KẾT THÚC tại%'` + PhaseAtChange=7, idempotent, SQL-Server-only. database-agent điều tra prod + em-main verify (marker-count prod) + viết migration + reviewer-skip (đã prod-verify signal).
**Verify (cicd #484 prod):** Mig 61 applied · **backfill: A/005=1, A/008=1 (0→1) · A/010=0 (control)** · **endsBeforeCeo FLIP: A/005 True (trước False), A/010 False** · smoke 200×3 · NO-FE (data-fix). → A/005/A/008 giờ đúng "⚑ Kết thúc · CCM — không qua CEO".
**Lessons:** **#79** backfill/query transition-marker phải xác định ĐÚNG bảng writer (PE Approvals≠Changelogs) + verify marker-count prod trước · **#53 lần-6** cicd garble → recover diary #484 (cicd = 5/6 offender, structural curate-at-return).
**State cuối S97:** Mig 61 · 89 bảng · 440 test · gotcha 79 · menu 54 · bundle admin `CeTA7Z82`/user `CGaAyXen` (Run #484 data-fix no-FE) · prod 21 NCC/17 user. **5 fix PE** (wording + default-flip + endsBeforeCeo-runtime + CEO-badge + backfill-wrong-table).