Files
solution-erp/.claude/agent-memory/cicd-monitor/MEMORY.md
2026-07-31 15:59:14 +07:00

105 lines
22 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CI/CD Monitor Agent — Persistent Memory
- **07-31 verify `50e6d8c` S164 K1 SP-002 danh-mục-loại-HĐ (20 file: 11 BE + 6 FE + 1 test + 2 docs, +Mig 70):** ✅ **PASS 6/6** — Run **#434** (id=547) success **6m31s** (dài nhất 4-run gần đây: #431/#432/#433 ~5m50; hợp lý vì +Mig+seed-86+8-test — chưa tới ngưỡng escalate). Gate **598 = 45D + 553I** (0 fail/skip) — Domain **GIỮ 45**, Infra **545→553 = +8** ⇒ delta rơi TRỌN vào Infra đúng nơi file test mới nằm (đối-chiếu TÁCH-PHẦN bắt được điều tổng-số giấu). Mig 70 `20260731072441_AddContractCatalogEntries` **TOP prod**, `sys.tables` 96→**97** khớp `grep -c CreateTable`=**1**. 🔑 **TAM-GIÁC 3 NGUỒN ĐỘC-LẬP** cho seed: source-parse `DbInitializer` == sqlcmd prod == **API materialize qua EF** — cả 3 ra `86` + `1:5·2:10·3:5·4:23·5:14·6:15·7:13·8:1` y hệt; nguồn 3 mạnh nhất vì đi trọn Domain→Infra→Api (200, 25.374 B, distinct-code 86). Serilog `Seeded 86 contract catalog entries (S164 SP-002)` @15:52:27 + control-ÂM findstr chuỗi-bịa 0 hit. Bundle **4/4 ROTATE** (admin `B43R6Y17``CKgq0YlH`, user `NLI5umBg``CHMCU35C`) + **4/4 hash CŨ rơi `text/html` 876/900 B** = ghi-đè thật; LM 15:51:06/15:52:07 in-window. Smoke 8/8: `/health` bare **404** (control) · `/health/{ready,live}` 200 · endpoint mới không-token **401** kèm **2 route BỊA 404** ⇒ 401 CÓ NGHĨA. w3wp PID 2644 StartTime 15:52:13 in-window + log dòng-đầu `Applying migrations...` ⇒ đo SAU recycle (né #423). ⚠️ **BÀI MỚI — 0-hit là DƯƠNG-GIẢ tới khi soi format**: grep `Passed!` lần đầu **0 hit** chỉ vì log dùng 2-khoảng-trắng (`Passed! - Failed: 0`); suýt báo "không thấy dòng test". Cùng class: parse seeder lần 1 ra **78** (regex line-anchored, tuple xuống dòng) — vứt số, parse lại ra 86 + cross-check `raw code-literal`=86. ⚠️ **hash CI ≠ hash local build** (local dự-báo `BE7zE81C`/`DSXJJbJq`, CI ra khác) ⇒ CẤM lấy hash local làm mốc kỳ-vọng prod, luôn re-snapshot LIVE. Evidence: `runs/2026-07-31-S164-4gd-khkk-fanout/sub-cicd-verify-k1.md`. Tag `[run-434, pass-6-6, tam-giac-3-nguon, 0-hit-la-duong-gia, gate-598, mig-70, hash-CI-khac-local]`
- _(**07-30 `bfc7b79` S162 cây-4-folder-GĐ FE-ONLY — PASS 5/5**: run #432 5m35s, gate 590. 🔴 **LUẬT CẤM `HEAD~1`** — Stop-hook WAL auto-commit giữa lúc verify làm `HEAD~1` đổi nghĩa ⇒ tao kết SAI "marker vô giá trị"; đo lại bằng SHA tuyệt đối `X^..X` thì 0 hit ⇒ marker hợp lệ. 🔑 **ĐẾM TRỌN HỌ bằng 1 REGEX** `pipeline-[a-z-]{0,24}index` ra đúng 3 phần tử khớp source element-wise (vừa vế DƯƠNG vừa tự chứng regex không quét bừa). ⚠️ suýt FAIL-OAN: nhãn cũ 8/app sống hợp lệ — control ÂM phải ĐỘC-QUYỀN. verbatim → `runs/2026-07-30-S162-cay-4-folder-gd/sub-cicd-monitor-2.md`)_
- **07-30 verify `bfc7b79` S162 cây-4-folder-GĐ (FE-ONLY, 17 file, 12 FE = 6+6 đối xứng ×2 app):** ✅ **PASS 5/5** — Run **#432** (id=545) success **5m35s**; gate **590 = 45D+545I** (0 fail/skip). 0 mig/0 BE ⇒ không chân EF. Bundle **4/4 ROTATE** (admin js `BBQKvUMa``DXoYDy7R` · user js `BV5--mPf``o8KDluD1`, css cả 2 đổi); `index.html` LM 10:09:07 in-window + `Cache-Control:no-cache`. 🔴 **BẪY MỚI — MOVING-TARGET `HEAD~1`:** phiên có Stop-hook WAL **tự commit giữa lúc verify**`HEAD~1` đổi nghĩa từ 'cha commit đích' thành 'chính commit đích' trong ~6 phút. Tao đã kết SAI '2 marker có sẵn ở parent ⇒ vô giá trị'; đo lại bằng SHA tuyệt đối `8eba137` thì **cả 2 = 0 hit** ⇒ marker hợp lệ. **LUẬT: verify commit X luôn neo `X^..X` bằng SHA, CẤM dùng `HEAD~1`** (mọi repo có hook auto-commit). 🔑 **Khuôn MỚI 'ĐẾM TRỌN HỌ bằng 1 REGEX'**: `pipeline-[a-z-]{0,24}index` quét bundle ra **đúng 3 phần tử** `{contract×2, khkk×1, pe×1}` khớp source element-wise ⇒ vừa là vế DƯƠNG, vừa tự chứng regex không quét bừa (mạnh hơn đếm chuỗi rời). Dự-đoán-trước-khi-đo khớp từng đồng: `contract-index`=2 (= số FILE trong diff) · VN `Kế hoạch Hợp đồng`=**1** (source 3 **2 comment**) · raw-UTF8 không escape. ⚠️ **suýt FAIL OAN lần nữa:** `Kế hoạch ký kết HĐ` (nhãn strip cũ) = **8/app** — KHÔNG dùng làm control ÂM được vì synthesis ghi rõ nhãn folder GĐ2 **cố ý khác** nhãn strip; 1-mới + 8-cũ cùng sống = chứng phân-biệt-phiên-bản. Control ÂM: chuỗi-BỊA `pipeline-hardcopy-index`=0 (source cũng 0) + hash BỊA & **hash CŨ cả 2 app** đều `ct=text/html` **876B/900B trùng khít size index.html** ⇒ bundle cũ biến mất = ghi đè thật. Smoke 4×200 + bare `/health` **404** (control). WAL-commit `a07b942` (3 file `.md`) bị `paths-ignore` nuốt ⇒ không đẻ run rác. Evidence: `runs/2026-07-30-S162-cay-4-folder-gd/sub-cicd-monitor-2.md`. Tag `[run-432, pass-5-5, CAM-HEAD~1-neo-SHA, dem-tron-ho-1-regex, control-am-DOC-QUYEN-lan-2, gate-590, fe-only]`
- _(**#427 S161 W1 KHKK `a8027c0` +Mig 69 `AddContractSigningPlans` — PASS 6/6**: gate 566, 5m40s; `sys.tables` **89→96** (+7 khớp 7 CreateTable), MenuItems 142 GIỮ. 🔑 **khuôn ĐO-CỜ không đếm ROW** (row tồn tại sẵn ⇒ đếm row = 0-bit; đo PRE/POST **cờ** 7 key 13/0/0/0→13/13/13/2) + 🔑 **control ÂM NỘI-HỌ: `Khkk_G1` bị seeder CỐ Ý bỏ khỏi tập** ⇒ phải đứng yên, và nó đứng yên ⇒ chứng 'đúng NGƯỜI, đúng TẬP'. Đọc seeder **dự đoán `0 added + 91 upgraded` TRƯỚC khi đo → log prod khớp từng đồng**. verbatim → `archive/2026-07.md` substring:"a8027c0` W1 KHKK")_
- _(**#426 S159 đợt-5 `ea962b1` menu 6-leaf + `GET /contracts/deleted` — PASS 9/9**: gate 562. 🔑 **LUẬT gốc control-ÂM-phải-ĐỘC-QUYỀN** (cứu false-fail: chuỗi brief bảo phải vắng vẫn sống hợp lệ ở `aria-label` ⇒ grep repo-wide TRƯỚC; chuỗi dùng-chung chỉ làm marker DƯƠNG). 🔑 **SEEDER-INSERT delta khớp TOÁN**: MenuItems **119→142 = +23 = 7+7+7+2**. Endpoint mới 401 **kèm route bịa 404** ⇒ 401 CÓ NGHĨA. ⚠️ bẫy phạm-vi query: `Ct_*` đẻ thêm 21 key ⇒ `LEFT(MenuKey,3)` không so được với đợt trước. verbatim → `archive/2026-07.md` substring:"#426 S159 đợt-5")_
- _(**S159 arc đợt-1→4 (#422 `b5799fc` · #423 `1a47a61` · #424 `2a72695` · #425 `a2bbcb9`) + S157 #419 `a52a91e`** — gate 562. 🔴 **ĐÍNH CHÍNH @S162 (H2 F-02 HIGH):** câu cũ ở đây viết *"verbatim → `archive/2026-07.md` via `_INDEX`"* cho CẢ 5 run — **SAI**: `#423`/`#424`/`#419` có trong archive ✅ nhưng **`#422 b5799fc``#425 a2bbcb9` CHƯA TỪNG vào archive** (`git log -S"b5799fc" -- .claude/agent-memory/cicd-monitor/archive/` **RỖNG toàn lịch sử**). Mất **lớp đã chưng cất**, KHÔNG mất nguyên-liệu — còn nguyên ở `runs/2026-07-29-S159-tong-quan-pipeline-menu/cicd-verify-b5799fc.md` (9.930 B) + `cicd-verify-a2bbcb9.md` (9.860 B); re-distill khi retro-harvest folder đó (HANDOFF NEXT-em #2). **Bài: stub tự khai "đã archive" là một CLAIM, phải đo mới được viết** — cùng class với F-03 (trích verbatim chuỗi không tồn tại) trong cùng phiên. Bài-học CÒN DÙNG: 🔴 **#423 PARTIAL 8/9 = phát hiện lớn nhất arc** — `RevokeTemporarilyHiddenModulesAsync` UNGATED lật 447/494 row grant SQL tay; tao sót vì **đo TRƯỚC recycle** (query lúc `running` = trạng thái CŨ) → đã nâng thành luật 3-CHÂN-KIỀNG ở 'Recurring bug patterns'; đóng ở #424 (guard 2-vế StillHidden/Reopened, 494/494 sống qua restart ×3). 🔑 #425 **comment-strip dự-đoán-trước-rồi-mới-đo** (source=2 đều trong comment → dự đoán bundle=0 → đúng 0); marker phổ-thông chỉ dùng '≥1' (`Không tìm thấy` bundle 10 > source 3). 🔑 #425 **FROZEN vẫn lành tính nếu LM in-window** (#69 mode-B). 🔑 #422 **marker PHÂN-BIỆT-PHIÊN-BẢN** (cặp chữ cũ/mới sau review: `Toàn trình`=1 & `Pipeline`=0 ⇒ prod chạy bản ĐÃ-FIX); ⚠️ **LỆCH-số phải truy PHẠM-VI-QUERY trước khi hô drift** (`LEFT(,3)` vs `LIKE 'Pe%'`). 🔑 #419 byte-marker **count = SỐ FILE trong diff** ('đúng-BỘI-SỐ' > 'tìm thấy ≥1') + control âm 2 tầng fake-hash & hash-CŨ → `text/html`)_
- _(**#416 S155 `b1bae77` Workflow duyệt-TẠI-CHỖ +Mig 68 APPLIED-PROD 6/6** [gate 551; FLAG 'mig rớt khỏi commit' loại-trừ 3 lớp — mạnh nhất `GET /approval-workflows-v2` trả cột ×54 **materialize qua EF từ DB thật**] · **#407 S135 `4510cea` mã-dự-án normalize 5/5** [gate 532] · **#399 S134 `6664a61` PE lũy-kế 0-mig 5/5** [gate 528; 🔑 `ct=text/html` discriminator SẠCH HƠN size-919B vì shell-size drift] · **#398 S133 `d4fbced` +Mig 67 budget-freeze 5/5** [gate 520; backfill 18/18; python text=True crash cp1252 → dùng bytes] · verbatim → `archive/2026-07.md` via `_INDEX`)_
> **Persistent diary cross-session.** Auto-injected first ~200 lines at spawn (L1 HOT).
> Update BEFORE every stop. Tiered Memory v1: L1 HOT soft-cap ~30KB · L2 `archive/` on-demand · L3 RAG `search_memory` just-in-time. Keep entry ≤ 1.5K chars (gotcha #53).
> Full verbatim run history pre-S40 → git `d2f52ba` + `archive/2026-05-{runs,q2,q3,q4}.md` + `archive/2026-06.md` + `archive/2026-07.md`. 🗺️ **Lookup map: `archive/_INDEX.md`** — 1 dòng/bản-ghi + con-trỏ substring (sha-keyed, Ctrl-F fallback); đọc verbatim + `2026-0{5,6}.gist.md` theo nhu cầu. See 🔄 Curate-trigger log for archive-move history.
---
## 🎯 Role baseline
Read-only CI/CD + post-deploy verifier SOLUTION_ERP. Polls Gitea Actions API, verifies test gate + deploy ship + prod health. Tools: Read, Grep, Glob, Bash, WebFetch + 5 RAG MCP. Output: PASS/FAIL + evidence <500 words. Skills: `iis-deploy-runbook` + `dependency-audit-erp` + `ef-core-migration`. Spawn ~150K trade-off catch fail tự động.
---
## ⚠️ cicd-lane return-garble tracker (#53)
cicd-lane đôi khi trả nhầm slice transcript thay verdict **tao TÁI PHẠM dai nhất roster** (×5/6 qua S114; S117/S118 ×3; all-agents ×66-cận-dưới [[feedback_agent_return_garble_recover]]). Từng **tự dán nhãn 'CLEAN-return' SAI** **KHÔNG tự phong return sạch**. 🔒 **Đối-sách đã chứng minh (S158, lần 5): ghi-đĩa TRONG LÚC LÀM** prompt đúng KHÔNG chặn được, artifact mới chặn (vai có-ép mất **0 B**, vai không-ép mất TOÀN BỘ). file evidence trong run-folder SẢN PHẨM CHÍNH, ghi từng mục ngay khi bằng chứng, kết bằng `END … VERDICT=`; return chỉ tóm tắt.
---
## 🚨 Recurring CI/CD bug patterns (catch priority)
- **#39 act_runner github.com TCP timeout** run hang "Set up job" 21s. Log `dial tcp github.com:443 i/o timeout`. Fix: manual checkout bypass hardcoded `.gitea/workflows/deploy.yml`. KHÔNG revert.
- **#40 npm cache `tsc not found`** `build_fe_admin` fail post `cache: npm`. DISABLED rolled back `a21790d`. KHÔNG re-enable.
- **#41 paths-ignore docs-only skip** code commit không trigger CI? Check `git diff --name-only HEAD~1 HEAD` vs `paths-ignore` **7-entry từ D10 S111 `8aa3869` (#495): `['docs/**','**/*.md','.claude/skills/**','.claude/agent-memory/**','.claude/workflows/runs/**','.gitignore','scripts/**.md']`**. Gitea evaluates push *range* — ≥1 commit có non-ignored file → toàn range build. ⚠️ **AS-6 BASELINE SHIFT: từ #495, memory-push chứa `memory-budget.json`/agent-memory-file/run-trace HẾT trigger CI (pattern #490/#492 DEAD).**
- **#25 IIS WebSocket** `notification-hub/negotiate` 401/404 prod. Fix: WebSocket module enable `web.config` site api (skill `iis-deploy-runbook`).
- **#48 SQLite tie-break** `OrderByDescending(CreatedAt).First()` pick wrong khi 2+ `.Add()` cùng frozen-clock. Fix: discriminator filter BEFORE OrderBy.
- **Bundle hash unchanged = ship FAIL** push+action success nhưng prod không đổi. Verify via INDEX.HTML ref (`curl -s https://admin.solutions.com.vn/ | grep -oE '/assets/index-[A-Za-z0-9_-]+\.(js|css)'`), NOT by GETting a hash-named asset directly. verify MUST sau status=success (Run #242 false-positive: check khi "running" stale hash).
- **🔴 #69 TWO-MODE FE hash vừa thể ROTATE vừa thể FROZEN.** deploy.yml copy `dist\*` UNCONDITIONALLY mọi run 0-FE-change vẫn rotate (mode-A); src y hệt Vite byte-identical FROZEN (mode-B). **Cả hai lành tính ⟹ hash-delta KHÔNG phải ship-proof.** Ship-proof THẬT = `Last-Modified` in deploy-window + real-size + byte-marker. 🔑 FROZEN-lành-tính vs bundle-cũ-kẹt: **xem LM** in-window = re-ship byte-identical (OK) · LM **cũ** = deploy không chạm file (cờ đỏ).
- **⚠ SPA-fallback 200 trap (S72):** server rewrite `/*``index.html` GET `/assets/index-<BỊA>.js` vẫn **200**. Discriminator sạch = **`Content-Type`** (`text/html` ~876-919B = trap · `application/javascript` ~1,6MB = thật); size drift per-build nên đừng neo số byte. **Hash CŨ rơi về text/html = bundle cũ biến mất khỏi đĩa = chứng ghi-đè (control âm tầng-2).**
- **🔴 Durability: đo SAU recycle + 3 CHÂN KIỀNG** pool restart CUỐI deploy-window query DB lúc `running` = trạng thái (tao sai đúng chỗ này #423). Khuôn: (i) **chứng minh restart thật** (`w3wp` StartTime in-window + dòng ĐẦU log `Applying migrations...`), (ii) đo chỉ-số đích SAU mốc đó, (iii) **control ÂM chứng checker còn sống** (thiếu (iii) thì 'fix' kiểu xoá checker cũng xanh). Data-change ngoài CI luôn re-verify SAU status=success.
- **Migration drift prod vs repo** compare `ls .../Persistence/Migrations/*.cs` vs `sqlcmd __EFMigrationsHistory`. Fix: check `Program.cs`/DbInitializer `app.MigrateDatabase()` + app pool recycle. Mig-applied proof = `__EFMigrationsHistory` top==repo-HEAD; stuck-old pool didn't recycle FAIL even if status=success+bundle-rotated.
---
## 📋 5-stage checklist (EVERY run)
- **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 **590 PASS** (45 Domain + 545 Infra; run #432 `bfc7b79` 07-30; climb 590/566/562/551/532/528/520/509/505/501/495/486/458/440/421). 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 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: record enum cần input SỐ (SOL không `JsonStringEnumConverter`). sqlcmd ssh Windows-auth `\\\\SQLEXPRESS` 4-backslash. INFRASTRUCTURE seed ungated / DEMO seed gated gotcha #51.
- **Stage 5 Report** PASS/FAIL + evidence + MEMORY update.
---
## ⚠️ Anti-patterns (DO NOT)
1. Push fix code READ only, escalate em main · 2. Speculate fail without log · 3. Skip post-deploy bundle hash (biggest catch) · 4. Skip MEMORY · 5. Poll forever (max 10 iter) · 6. Auto-rollback (escalate + recommend) · 7. Verify docs-only (SKIPPED-DOCS return ngay)
---
## 🧠 SOLUTION_ERP CI/CD essentials (S80 verified — re-ground từ docs/STATUS.md canonical)
- **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):** 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:** **590 PASS** (45 Domain + 545 Infra · 0 fail/skip; run #432 `bfc7b79` 07-30 đ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/545) chứ đừng chỉ khớp tổng. Delta test mới = so run trước.
- **Mig latest repo: Mig 69 `AddContractSigningPlans`** (`20260729122015`, S161 7 CreateTable, `sys.tables` 89→**96**, applied-prod #427). 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)=96** (sau Mig 69; 89 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` + `docs/STATUS.md`.
- **Bundle hash live:** ship-baseline = run **#432** (07-30 `bfc7b79`) admin js `DXoYDy7R`/css `BZ5F-g1w` · eoffice js `o8KDluD1`/css `yNZDmVNz` (cả 4 rotate, LM in-window). **SNAPSHOT-per-run, KHÔNG phải mốc ổn định** (#69 TWO-MODE) 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).
- **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.)*
## 🔑 Critical config (flag commit nếu tái xuất)
Node CI `20.x` (`feedback_node_cicd`) · MediatR `12.4.1` (gotcha #1, flag `Version="14`) · Swashbuckle `6.9.0` (gotcha #2) · act_runner manual checkout (#39) · npm cache DISABLED (#40, flag `cache: npm`)
---
## 🎯 Per-NV admin opt-in wire — 10-point checklist (cumulative S22→S23)
Cross-ref `feedback_per_nv_permission_scope` (10 điểm đầy đủ đó). 2 điểm HAY SÓT nhất: **(9) Lookup discrimination** (`FirstOrDefault` thêm `ApproverUserId==actorId` + admin fallback) · **(10) Controller body record count == Command record count**. Miss 9-10 bug prod im-lặng 2-3 ngày. Sau refactor OR-of-N: `grep -n "FirstOrDefault.*Order.*==" *.cs`.
## 📊 Run stats baseline
BE (test+build) ~90s · FE × 2 ~60s/app · deploy ~30s · **total ~3min code / 0s docs-only**. >5min → escalate. Recent runs all ~4m40-5m.
---
## 📅 Recent runs (compressed — verbatim → archive via `_INDEX.md`)
- _(**S98-S132 #383-#397/#485-#496 all GO** (gate 440→509): **AS-6 #41 soi TỪNG file vs 7-glob** (`.ps1`/`.json` thoát `scripts/**.md` ⇒ vẫn trigger CI) · `conclusion:None` dù success ⇒ tin `status` · **411-refine** (endpoint MỚI bodyless-POST = 411 IIS pre-auth; re-probe CÓ body → 401/415 = đã wire) · **LM mới hơn cửa-sổ đã verify = detector 'có run bỏ sót'** · Mig 63-67 applied-prod · verbatim → `archive/2026-07.md`)_
- _(**PASS-pattern library S69b→S104 #307-#494** all GO — recipe: **SCHEMA-ADD** [AddColumn×N-exact + table-count-invariant + DTO-live] · **DATA-BACKFILL** [Mig-top==HEAD + rows-flip-EXACT + control-untouched + derived-API-live] · **DATA-SEED** [pre/post row-delta + DLL-mtime + w3wp-recycle]; **#472 PROD Identity table NON-prefix `Roles`** · verbatim → git + `2026-06/07.md`)_
- **Older (S83 #325 ← S29 #232) → git `d2f52ba` + `archive/2026-06.md`** (incl #291 06-16 FAIL [gotcha #65]); pre-S38 → `archive/2026-05-*`.
---
## 🔄 Curate trigger
- >~30KB → archive recent runs → L2 `archive/<period>.md` (byte-exact append) + `_INDEX.md` substring pointer. Dup failure patterns → merge. Stale >3mo → remove.
- **Last curate: 2026-07-30 S162 (self #432-run: 26.9KB→<17.1KB #427+#426 verbatim`archive/2026-07.md` moved-not-cut; #422/#423/#424/#425/#419 merged-stub; baselines gate 562590 + bundle + Mig 69). **0-BYTE NEAR-MISS**: `io.open(mem,'w')` TRUNCATE trước khi `UnicodeEncodeError` (emoji viết bằng cặp surrogate `\ud83d\udd34`) file về 0 B; cứu bằng `git checkout HEAD --`. **LUẬT: script sửa MEMORY phải build chuỗi XONG → ghi temp → `os.replace`, và verify byte>0 ngay sau.**
- **Prev:** S118 07-14 (#387/#384/#383/#496/#495archive) · S111 20.517 · S107 20.416.9 · S104 20.517.9 · S98 19.917.06 (`2026-07.md` NEW) · S80 38.816 · S70 65.223.2 · S66 · S40.