wal: flush 20260801T1211

This commit is contained in:
pqhuy1987
2026-08-01 12:11:32 +07:00
parent 5f2d5098d8
commit e7a4a4a58d
5 changed files with 262 additions and 30 deletions

View File

@ -1,6 +1,10 @@
# CI/CD Monitor Agent — Persistent Memory
- **S166 (08-01) `88e7ecf` K4a+K4b sidebar 8-nhóm × 6-leaf + nối `?group=` (0-mig) — PASS 7/7** (#438 6m23s · gate **621=45+576** · Mig GIỮ 71 · menu 151→**200** · perm 1584→**2221**). 🔑 **PHỦ 2 RUN 1 LƯỢT ⇒ delta KHÉP KÍN**: #437 F-1 = 614 (Infra +0) ⇒ trọn **+7** quy được về K4. 🔑 **MỐC PRE ĐỀ BÀI SAI, bắt bằng ĐO**: lead giao `143⇒192`, đo LIVE lúc còn `running` ra **151** → truy phạm-vi thay vì hô drift (K3 đẻ 8 row `AwV2_KhkkN1..N8`) ⇒ đúng là **200**. **Mốc PRE lão hoá sau MỖI deploy.** 🔑 **phân rã 49+588=637 khớp cơ-chế 2-site skip-existing** (588=49×12 role còn-lại) — KHÔNG suy được từ tổng ⇒ bit thật (tam-giác source ⟂ sqlcmd ⟂ Serilog). ⚠️ **PERM row ≠ policy** (1 row/cặp 4 cờ; "49×4=196" là POLICY). 🔑 **A5 restart ×2 THẬT** (PID 7020→220→6636): 8 chỉ số ĐỨNG IM + **soi ĐIỀU KIỆN log trong source TRƯỚC khi đọc im-lặng** (`if (added>0)`) ⇒ vắng dòng ⟺ 0 added; control #84 `Hrm*/Off*` giữ **29/377**. 🔴 **MARKER LEAD GỢI Ý BỊ BÁC BẰNG ĐO** (`Kết cấu…` có sẵn từ `7a903cf` ⇒ đo **1/1** = 0 bit) → thay bằng POS `/khkk/list?group=1` 4/4 element-wise · NEG `/khkk/list?view=deleted` 0/0 · 🔑 **DIFFERENTIAL admin 0 / eoffice 2** (bất-đối-xứng CỐ Ý ship + tự chứng comment-strip). 🔑 `?group=abc` no-token=**401 (authz chặn TRƯỚC bind)** → bearer re-probe **400 bind-error**. ⚠️ Treo: bảng **0 dòng**chứng ống+bind KHÔNG chứng lọc-đúng-nhóm; `?group=999`→200. Evidence `runs/2026-07-31-S164-4gd-khkk-fanout/sub-cicd-verify-k4ab.md`. Tag `[run-438, phu-2-run, moc-PRE-sai, marker-0-bit, differential-marker]`
- **S167 (08-01) `1c6d77a` K6 admin thu-gọn menu `ADMIN_HIDDEN_KEYS` 12-key (FE-admin 1 file, 0-mig) — PASS 5/5** (#440 6m29s · gate **622=45+577** delta 0 · Mig GIỮ 71 · tables 97 · menu 200/perm 2221 đứng im). 🔴 **BÀI TO NHẤT: 0-hit marker SAI 2 LẦN LIÊN TIẾP do CƠ-CHẾ REGEX, cả 2 lần trông y hệt "code không ship" ⇒ suýt FAIL-OAN.** (a) **rolldown/Vite 8 minify string → BACKTICK** (`new Set([\`PurchaseEvaluations\`,…])`), regex neo `["']` không bao giờ khớp; (b) vá xong truyền pattern-chứa-backtick qua biến trong `"…"` → shell nuốt, `grep -cE` gãy (`Unmatched (`) trả **0 gần như im lặng** trong vòng lặp. ⇒ **LUẬT: marker chuỗi trên bundle dùng `grep -F` fixed-string + LUÔN trích byte thật `.{90}X.{90}` TRƯỚC khi kết luận vắng-mặt.** 🔑 **KỸ THUẬT MỚI — COUNT-DELTA**: literal đã có từ K4a ⇒ *có/không* = 0 bit, nhưng *số lần xuất hiện* PRE→POST đo được: **12/12 key đều +1**; ngoại lệ duy nhất `Workflows` **+2** giải-thích-được (substring ⊂ `PeWorkflows`) ⇒ thành kiểm-tra-nhất-quán MIỄN PHÍ. 🔑 **LOG CI IN THẲNG `dist/assets/index-<hash>.js <size>`** = nhân chứng THỨ 4 độc lập curl, khớp LM prod **tới từng giây** ⇒ rẻ nhất để phân biệt **FROZEN-lành-tính** (eoffice: LM 11:14→**12:00:41** đổi + log in CÙNG hash `DFOCQ2ks` = rebuild deterministic) với bundle-kẹt (LM cũ). 🔑 **2-TẦNG #82 đo bằng SỐ**: `/api/menus` trả **12/12 key bị ẩn** ⇒ ẩn client KHÔNG thu quyền. Marker-ÂM display-only: route `/purchase-evaluations` **68→68** nguyên vẹn. Evidence `runs/2026-07-31-S164-4gd-khkk-fanout/sub-cicd-verify-k6.md`. Tag `[run-440, 0-hit-gia-2-lan, grep-F, count-delta, frozen-lanh-tinh, log-CI-nhan-chung-4]`
- _(**08-01 `e202393` S166 K5+K4c FE-only — PASS 5/5**: #439 6m16s, gate **622=45+577** (+1 = đúng 1 Fact mới). 🔑 marker differential 4/4 element-wise (K5 vào CẢ 2 app · K4c CHỈ eoffice) + Δsize cùng chiều = nhân chứng ⟂ grep. 🔴 **recipe đếm mig trong MEMORY có FALSE-NEGATIVE**: `grep -v Snapshot` ăn nhầm `AddPeApprovedBudgetSnapshot` (Mig 67) → phải neo đuôi `Designer\.cs$|ModelSnapshot\.cs$`; ưu tiên **set-diff repo↔prod 2 chiều** thay khớp-tổng. ⚠️ **bar "FE route 200" KHÔNG CÓ RĂNG** với SPA-fallback (POS ≡ NEG byte-identical 876B). verbatim → `runs/…/sub-cicd-verify-k5-k4c.md`)_
- _(**08-01 `88e7ecf` S166 K4a+K4b — PASS 7/7**: #438, gate 621=45+576, menu 151→**200**, perm 1584→**2221**. 🔑 **PHỦ 2 RUN 1 LƯỢT ⇒ delta khép kín**. 🔑 **MỐC PRE ĐỀ BÀI SAI, bắt bằng ĐO** (lead giao 143⇒192, đo LIVE ra 151 → truy phạm-vi thay vì hô drift) — **mốc PRE lão hoá sau MỖI deploy**. 🔑 phân rã 49+588 khớp cơ-chế 2-site skip-existing (588=49×12 role). ⚠️ **PERM row ≠ policy**. 🔑 A5 restart ×2 thật + **soi ĐIỀU KIỆN log trong source TRƯỚC khi đọc im-lặng** (`if (added>0)`). 🔴 **marker lead gợi ý BỊ BÁC BẰNG ĐO** (`Kết cấu` có sẵn ⇒ 1/1 = 0 bit). verbatim → `runs/…/sub-cicd-verify-k4ab.md`)_
- _(**07-31 `15349e8` S164 K3 8 workflow KHKK-N1-8 (0-mig) — PASS 6/6**: #436, gate 614=45+569. 🔑 **dự-đoán-TRƯỚC-khi-đo** (seeder → 8wf×3step×11level + finalize 2+8=10 → khớp từng đồng + shape element-wise từng email + control ÂM OUTSIDE=2/OUTOFSET=0). 🔑 **FROZEN = hệ-quả BẮT BUỘC** (diff toàn `//` → Vite strip); ❌ marker `earlyFinalizeLocked` LOẠI vì **tên biến local bị minifier đổi = 0 bit**. ⚠️ tao chết #53 ×2. verbatim → `archive/2026-07.md`)_
@ -50,7 +54,7 @@ cicd-lane trả nhầm slice transcript thay verdict — **tao TÁI PHẠM dai n
- **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 **621 PASS** (45 Domain + 576 Infra; run #438 `88e7ecf` 08-01; climb 621/614/609/598/590/566/562/551/532/528/520/509/458/440). CI chạy cả 2 proj TRƯỚC build/deploy `status:success` = gate passed (`tasks` KHÔNG populate `conclusion` tin `status`). Local grep undercount (Theory/InlineData). Phase 9 UAT skip OK.
- **Stage 3 Test gate:** baseline **622 PASS** (45 Domain + 577 Infra; run #440 `1c6d77a` 08-01; climb 622/621/614/609/598/590/566/562/551/532/528/520/509/458/440). CI chạy cả 2 proj TRƯỚC build/deploy `status:success` = gate passed (`tasks` KHÔNG populate `conclusion` tin `status`). Local grep undercount (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):** sqlcmd seed verify post-deploy (NOT chỉ schema) seed = runtime-row-insert (history/tables KHÔNG nhích) verify bằng DB-query, không bằng bundle-frozen.
- enum cần input SỐ (no `JsonStringEnumConverter`). INFRASTRUCTURE seed ungated / DEMO seed gated #51.
@ -68,10 +72,10 @@ cicd-lane trả nhầm slice transcript thay verdict — **tao TÁI PHẠM dai n
- **Gitea:** `git.baocaogiaoduc.vn/vietreport-admin/solution-erp` · workflow `.gitea/workflows/deploy.yml` · paths-ignore 7-entry (D10 S111 #495): `['docs/**','**/*.md','.claude/skills/**','.claude/agent-memory/**','.claude/workflows/runs/**','.gitignore','scripts/**.md']`. 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).
- **SSHPS quoting (S42):** bashsshpowershell nuốt `$var`/`\"` viết `.sql`/`.ps1` rồi `scp` + `sqlcmd -i` / `powershell -File` (đừng nhét inline). sqlcmd `-W -h -1` pw-inline. sys-catalog concat `COLLATE DATABASE_DEFAULT`.
- **Tests baseline:** **621 PASS** (45 Domain + 576 Infra · 0 fail/skip; run #438 `88e7ecf` 08-01 đo LIVE web-UI log). 🔑 **Số cụ thể lấy ở web-UI log `https://git.baocaogiaoduc.vn/vietreport-admin/solution-erp/actions/runs/{run_number}/jobs/0/logs` (~18KB, KHÔNG có `/api/v1/` — api/v1 runs+tasks logs đều 404)** mỗi project 1 dòng `Passed! - Failed: 0, Passed: N, Skipped: 0`; đối chiếu TÁCH-PHẦN (45/576) chứ đừng chỉ khớp tổng. Delta test mới = so run trước.
- **Mig latest repo: Mig 71 `AddKhkkApprovalGroupCatalogAndFinalizeRuntime`** (`20260731085624`, S164 K2 AddColumn+index-swap, 0 CreateTable; applied-prod #435, GIỮ qua #436-#438). Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/` (đếm `.cs` excl Designer/Snapshot). Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC`. **`sys.tables`(is_ms_shipped=0)=97** (sau Mig 70; 96 trước đó) AddColumn/data-only KHÔNG đổi số no-new-table commit giữ nguyên, đừng FAIL. **NO-Mig proof = history NOT-advance + empty `git diff <base>..<head> -- '*Migrations*'`.** Bảng mig đầy đủ skill `ef-core-migration`.
- **Bundle hash live:** baseline #438 (08-01) admin `qOcoitOr`/`Cf3iCOOv` · eoffice `D9J3BbcA`/`DX1FRk5n`. **SNAPSHOT-per-run, KHÔNG phải mốc ổn định** (#69) LUÔN re-snapshot LIVE sau status=success; ship-proof = LM-in-window + real-size + marker, KHÔNG phải hash-delta. id run_number (key theo head_sha).
- **Prod DB anchor (POST #438, đo 08-01):** `MenuItems`=**200** · `Permissions`=**2221** · `Roles`=**13** · họ `Khkk%` = 56 menu / 728 perm (=56×13, CanRead=1 hết) · control revoker `Hrm*/Off*` CanRead=1 = **29**/377. PK `MenuItems` = **`[Key]`** (KHÔNG `MenuKey`); `Permissions(Id,RoleId,**MenuKey**,CanRead,CanCreate,CanUpdate,CanDelete)` = 1 row/cặp.
- **Tests baseline:** **622 PASS** (45 Domain + 577 Infra · 0 fail/skip; run #440 `1c6d77a` 08-01 đo LIVE web-UI log). **Flaky đã khai** `DeleteContractSigningPlan_SoftDeletes` (1/12 theo commit-msg K4c) #439+#440 đều XANH; nếu đỏ run sau, đối chiếu 2 mốc này trước khi hồi-quy. 🔑 **Số cụ thể lấy ở web-UI log `https://git.baocaogiaoduc.vn/vietreport-admin/solution-erp/actions/runs/{run_number}/jobs/0/logs` (~18KB, KHÔNG có `/api/v1/` — api/v1 runs+tasks logs đều 404)** mỗi project 1 dòng `Passed! - Failed: 0, Passed: N, Skipped: 0`; đối chiếu TÁCH-PHẦN (45/576) chứ đừng chỉ khớp tổng. Delta test mới = so run trước.
- **Mig latest repo: Mig 71 `AddKhkkApprovalGroupCatalogAndFinalizeRuntime`** (`20260731085624`, S164 K2 AddColumn+index-swap, 0 CreateTable; applied-prod #435, GIỮ qua #436-#440). Path `src/Backend/SolutionErp.Infrastructure/Persistence/Migrations/`. 🔴 **Đếm phải NEO ĐUÔI**: `grep -vE 'Designer\.cs$|ModelSnapshot\.cs$'` recipe `grep -v Snapshot` **ăn nhầm** `AddPeApprovedBudgetSnapshot` (Mig 67 chữ "Snapshot" trong TÊN) đếm hụt 1 im lặng. Mạnh hơn khớp-tổng = **set-diff repo↔prod 2 chiều**. Prod check `sqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC`. **`sys.tables`(is_ms_shipped=0)=97** (sau Mig 70; 96 trước đó) AddColumn/data-only KHÔNG đổi số no-new-table commit giữ nguyên, đừng FAIL. **NO-Mig proof = history NOT-advance + empty `git diff <base>..<head> -- '*Migrations*'`.** Bảng mig đầy đủ skill `ef-core-migration`.
- **Bundle hash live:** baseline #440 (08-01) admin `Ig1R5tAh`/`DqXm5Hpn` · eoffice `DFOCQ2ks`/`DlN3yZ5L`. 🔑 **Ship-proof rẻ nhất = so LM prod với dòng `dist/assets/index-<hash>.js <size>` IN TRONG LOG CI** (khớp tới từng giây tách FROZEN-lành-tính khỏi bundle-kẹt). marker chuỗi: **rolldown/Vite 8 minify ra BACKTICK** không phải `"`/`'` dùng `grep -F`. **SNAPSHOT-per-run, KHÔNG phải mốc ổn định** (#69) LUÔN re-snapshot LIVE sau status=success; ship-proof = LM-in-window + real-size + marker, KHÔNG phải hash-delta. id run_number (key theo head_sha).
- **Prod DB anchor (POST #438, re-verify đứng im #440 08-01):** `MenuItems`=**200** · `Permissions`=**2221** · `Roles`=**13** · họ `Khkk%` = 56 menu / 728 perm (=56×13, CanRead=1 hết) · control revoker `Hrm*/Off*` CanRead=1 = **29**/377. PK `MenuItems` = **`[Key]`** (KHÔNG `MenuKey`); `Permissions(Id,RoleId,**MenuKey**,CanRead,CanCreate,CanUpdate,CanDelete)` = 1 row/cặp.
- **Bearer:** admin `admin@solutions.com.vn/Admin@123456` (full) · UAT `nv.test@solutions.com.vn/TestUser@123456` (Drafter CCM, gotcha #44 check).
- **API Serilog:** sink THẬT `C:\inetpub\solution-erp\api\logs\solution-erp-YYYYMMDD.log` (skill-runbook `…\Logs\log-*.txt` STALE). Level=Information (seed/revoke lines ghi). deploy xoá luôn `logs/` chỉ còn từ deploy cuối. Grep revoke-line + seeder-line cùng-giây để audit seed-race. *(S162: bản cũ dòng này chứa byte BEL 0x07 do `\a` bị nuốt — đã sửa.)*