18 KiB
CI/CD Monitor Agent — Persistent Memory
-
S166 (08-01)
88e7ecfK4a+K4b sidebar 8-nhóm × 6-leaf + nối?group=(0-mig) — PASS 7/7 (run #438 6m23s · gate 621=45D+576I · 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 giao143⇒192, đo LIVE lúc run cònrunningra 151 → truy phạm-vi thay vì hô drift (K3 đẻ 8 rowAwV2_KhkkN1..N8) ⇒ đúng là 200. Mốc PRE lão hoá sau MỖI deploy. 🔑 TAM-GIÁC 3 NGUỒN + 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. ⚠️ PERM row ≠ policy (1 row/cặp 4 cờ; "49×4=196" là POLICY, cấm cộng). 🔑 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 #84Hrm*/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=14/4 element-wise · NEG/khkk/list?view=deleted0/0 · 🔑 DIFFERENTIAL admin 0 / eoffice 2 (bất-đối-xứng CỐ Ý ship + tự chứng comment-strip). 🔑?group=abcno-token=401 (authz chặn TRƯỚC bind) → bearer re-probe 400 bind-error ⇒ gỡ giới-hạn phép đo. ⚠️ Treo: bảng 0 dòng ⇒ chứng ống+bind KHÔNG chứng lọc-đúng-nhóm;?group=999→200. Evidenceruns/2026-07-31-S164-4gd-khkk-fanout/sub-cicd-verify-k4ab.md. Tag[run-438, pass-7-7, phu-2-run, moc-PRE-sai, marker-0-bit, differential-marker] -
(07-31
15349e8S164 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); ❌ markerearlyFinalizeLockedLOẠI vì tên biến local bị minifier đổi = 0 bit. ⚠️ tao chết #53 ×2. verbatim →archive/2026-07.md) -
(07-31
0779f2dS164 K2 +Mig 71 — PARTIAL 5/6: #435, gate 609. 🔴 ACCEPTANCE RƠI VÀO CHÂN-LÝ-RỖNG — bảng 0 dòng cả PRE/POST ⇒0==0/NULL==NULL"xanh" mà 0 bit, backfill hụt trông Y HỆT ⇒ CẤM đọc thành PASS. 🔑 Đối-sách KHÔNG-phụ-thuộc-số-dòng:INFORMATION_SCHEMA· LIỆT KÊ TRỌN HỌ 14 index (vắng-mặt suy từ danh-sách-đầy-đủ = ĐO ĐƯỢC) · wire-proof bind-error 400. 🔑 map PID→pool bằngappcmd list wp. verbatim →archive/2026-07.md) -
(07-31
50e6d8cS164 K1 +Mig 70 — PASS 6/6: #434, gate 598,sys.tables96→97. 🔑 TAM-GIÁC 3 NGUỒN (source-parse ⟂ sqlcmd ⟂ API materialize qua EF — nguồn 3 mạnh nhất vì đi trọn Domain→Infra→Api). ⚠️ 0-hit là DƯƠNG-GIẢ tới khi soi format. ⚠️ hash CI ≠ hash local build. verbatim →archive/2026-07.md) -
(07-30
bfc7b79S162 FE-ONLY — PASS 5/5: #432, gate 590. 🔴 LUẬT CẤMHEAD~1(Stop-hook WAL auto-commit đổi nghĩa ⇒ kết SAI; đo bằng SHA tuyệt đốiX^..X). 🔑 ĐẾM TRỌN HỌ bằng 1 REGEX. ⚠️ suýt FAIL-OAN: control ÂM phải ĐỘC-QUYỀN. verbatim →runs/2026-07-30-S162-cay-4-folder-gd/) -
(Arc S155→S161 (#416 · #419 · #422-#427) — gate 551→566. 🔑 #427 ĐO-CỜ không đếm ROW + control ÂM NỘI-HỌ (
Khkk_G1bị seeder CỐ Ý bỏ khỏi tập ⇒ phải đứng yên, và nó đứng yên). 🔑 #426 delta khớp TOÁN +23=7+7+7+2; 401 mới kèm route bịa 404. 🔴 #423 PARTIAL 8/9 revoker UNGATED lật 447/494 row, sót vì đo TRƯỚC recycle → luật 3-CHÂN-KIỀNG. 🔑 #422 marker PHÂN-BIỆT-PHIÊN-BẢN; #419 count = SỐ FILE trong diff. verbatim →archive/2026-07.mdvia_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 RAGsearch_memoryjust-in-time. Keep entry ≤ 1.5K chars (gotcha #53). Full verbatim run history pre-S40 → gitd2f52ba+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.mdtheo 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 trả nhầm slice transcript thay verdict — tao TÁI PHẠM dai nhất roster (×5/6 qua S114; S117/S118 ×3; → 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 (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 trong run-folder là SẢN PHẨM CHÍNH, ghi từng mục ngay khi có bằng chứng, kết bằng END … VERDICT=; return chỉ là 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_adminfail postcache: npm. DISABLED rolled backa21790d. KHÔNG re-enable. - #41 paths-ignore docs-only skip — code commit không trigger CI? Check
git diff --name-only HEAD~1 HEADvspaths-ignore7-entry từ D10 S1118aa3869(#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ứamemory-budget.json/agent-memory-file/run-trace HẾT trigger CI (pattern #490/#492 DEAD). - #25 IIS WebSocket —
notification-hub/negotiate401/404 prod. Fix: WebSocket module enableweb.configsite api (skilliis-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 có thể ROTATE vừa có 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-Modifiedin 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>.jsvẫ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).
- 🔴 #69 TWO-MODE — FE hash vừa có thể ROTATE vừa có thể FROZEN. deploy.yml copy
- 🔴 Durability: đo SAU recycle + 3 CHÂN KIỀNG — pool restart ở CUỐI deploy-window ⇒ query DB lúc
running= trạng thái CŨ (tao sai đúng chỗ này ở #423). Khuôn: (i) chứng minh restart thật (w3wpStartTime in-window + dòng ĐẦU logApplying 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/*.csvssqlcmd __EFMigrationsHistory. Fix: checkProgram.cs/DbInitializerapp.MigrateDatabase()+ app pool recycle. Mig-applied proof =__EFMigrationsHistorytop==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 QdrantRunning +http://localhost:6333/healthz. Collectionproj_solution_erp. - Stage 1 Push+filter:
git log -1 --format='%H %s'+git log origin/main..HEADempty + diff vs paths-ignore (docs-only → SKIPPED-DOCS return). - Stage 2 Gitea poll (max 10 iter × 60s): API
.../actions/tasks?limit=5(NOT/runs404). Matchhead_sha(NOT run_number — cancelled runs shift numbering). ⚠️updated_atstale ~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
88e7ecf08-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 (tasksKHÔNG populateconclusion— tinstatus). 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=
accessTokenroute/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 có
JsonStringEnumConverter). sqlcmd ssh Windows-auth\\\\SQLEXPRESS4-backslash. INFRASTRUCTURE seed ungated / DEMO seed gated → gotcha #51.
- Stage 5 Report PASS/FAIL + evidence + MEMORY update.
⚠️ Anti-patterns (DO NOT)
- ❌ 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· SSHssh vietreport-vps(Administrator, id_ed25519) · IIS phys paths: APIC:\inetpub\solution-erp\api· admin\fe-admin· user\fe-user. DB.\SQLEXPRESS/SolutionErp/vrappSQL-auth. Conn key =ConnectionStrings.Default(NOTDefaultConnection). DB pw =buKL3TGBkD0wDDbYVw65QeX9(User Id=vrapp; ⚠️ Password field has NOvrapp/prefix — S89 login-failed when prefix included; read verbatim from prodappsettings.Production.jsonConnectionStrings.Default when$env:PROD_DB_PASSWORDempty).- SSH→PS quoting (S42): nested bash→ssh→powershell mangles
$var/\"→ useiconv UTF-16LE | base64→powershell -EncodedCommand $B64; OR write ps1-file +powershell -File $(cygpath -w). sqlcmd over SSH direct-W -h -1pw-inline. sys-catalog string-concat →COLLATE DATABASE_DEFAULT(collation conflict).
- SSH→PS quoting (S42): nested bash→ssh→powershell mangles
- Tests baseline: 621 PASS (45 Domain + 576 Infra · 0 fail/skip; run #438
88e7ecf08-01 đo LIVE ở web-UI log). 🔑 Số cụ thể lấy ở web-UI loghttps://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òngPassed! - 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). Pathsrc/Backend/SolutionErp.Infrastructure/Persistence/Migrations/(đếm.csexcl Designer/Snapshot). Prod checksqlcmd __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 + emptygit diff <base>..<head> -- '*Migrations*'. Bảng mig đầy đủ → skillef-core-migration. - Bundle hash live: ship-baseline = run #438 (08-01
88e7ecf) admin jsqOcoitOr/cssCf3iCOOv· eoffice jsD9J3BbcA/cssDX1FRk5n(JS rotate ×2, CSS frozen-lành-tính, 4 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). - 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 revokerHrm*/Off*CanRead=1 = 29/377. PKMenuItems=[Key](KHÔNGMenuKey);Permissions(Id,RoleId,**MenuKey**,CanRead,CanCreate,CanUpdate,CanDelete)= 1 row/cặp. - Bearer: admin
admin@solutions.com.vn/Admin@123456(full) · UATnv.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-*.txtSTALE). Level=Information (seed/revoke lines CÓ ghi). ⚠️ deploy xoá luônlogs/⇒ 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\abị 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/.jsonthoátscripts/**.md⇒ vẫn trigger CI) ·conclusion:Nonedù success ⇒ tinstatus· 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.mdsubstring pointer. Dup failure patterns → merge. Stale >3mo → remove. - **Last curate: 2026-08-01 S166 (self #438-run: 27.3KB→~16.5KB — K2/K3/K4ab verbatim→
archive/2026-07.mdmoved-not-cut + 3_INDEXpointer; #416/#419/#422-#427 gộp 1 stub arc; baselines gate 621 + bundle #438 + Mig 71 + prod-DB-anchor MỚI). ⚠️ giữ luật: script sửa MEMORY phải build chuỗi XONG → temp →os.replace→ verify byte>0. - Prev: S162 07-30 (26.9→17) · S118 · S111 20.5→17 · S107 · S104 · S98 (
2026-07.mdNEW) · S80 38.8→16 · S70 65.2→23.2 · S66 · S40. - Prev: S118 07-14 (#387/#384/#383/#496/#495→archive) · S111 20.5→17 · S107 20.4→16.9 · S104 20.5→17.9 · S98 19.9→17.06 (
2026-07.mdNEW) · S80 38.8→16 · S70 65.2→23.2 · S66 · S40.