STATUS/HANDOFF +blurb S109 (In-Progress S109 table, S108 collapse details) · session log mới · cicd MEMORY +Run #492 record (AS-6: budget.json .json ngoài paths-ignore → run trigger dù 0-code, PASS 5m21s, bundle FROZEN-streak ×3 BVyH-FY7/EDsZebvn, Mig 62/89 frozen, smoke 3/3) · user-memory +feedback_resume_premise_reverify (ngoài repo). 4 file toàn .md → CI-skip #41. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
18 KiB
CI/CD Monitor Agent — Persistent Memory
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.
🚨 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-ignore: ['docs/**','**/*.md','.claude/skills/**']. Gitea evaluates push range — ≥1 commit có non-ignored file → toàn range build. - #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 (S72 Run #312) — FE bundle hash NON-DETERMINISTIC per rebuild.
deploy.ymlRemove-Item fe-*\* -Exclude web.config+Copy-Item dist\*runs UNCONDITIONALLY every run (path-filter gates whole-workflow trigger, NOT per-step). Identical FE source ⟹ DIFFERENT hash each deploy (Vite/rolldown non-reproducible chunk-id). PROVEN: governance-only18fced6(0 files in fe-*/src) rotated BOTH bundles. ⟹ "BE-only/governance ⟹ bundle frozen" is FALSE; rotation EXPECTED every deploy. To detect REAL FE change, difffe-*/srcin commit/range, NOT hash delta. - ⚠️ SPA-fallback 200 trap (S72): server rewrites
/*→/index.htmlso GET/assets/index-<ANYTHING>.jsreturns 200 even for fake hash (controlZZdoesnotexist0.js→200, size~919b text/html). Old-hash-still-200 MEANINGLESS. RELIABLE signal = parse index.html<script src>, GET that exact path + checksize_downloadLARGE (real ~1.6MB vs fake ~919b) +Last-Modifiedin deploy window + 2nd-fetch byte-stable (no mid-deploy transient). - 🟢 #69-REFINE (S83 Run #333) — hash can stay IDENTICAL across deploy when fe-*/src 0-change. #69 said "rotates EVERY deploy" — NOT absolute. Run #333 (BE+tests+governance, ZERO
fe-*/srcdiff) shipped FE (Last-Modified 17:10:35/17:11:27 BOTH in run-window 17:06→17:11) but hash UNCHANGED (adminCsJetgZH/userBVS0ApIm= #330 baseline). ⟹ identical Vite source ⟹ byte-identical output ⟹ same content-hash. Rolldown chunk-id apparently MORE deterministic than #69 feared (or only rotates on real src delta). MOST RELIABLE ship-proof =Last-Modifiedheader on the real bundle file IN deploy-window, NOT hash-delta (hash-delta has false-NEGATIVE when src unchanged + false-POSITIVE risk noted in #69). Cross-refgit diff fe-*/srcscope: 0-FE-change ⟹ hash EITHER same (#333/#485-487) OR rotated (#312/#489 S107) — both benign; ship-proof = fresh LM-in-window + real-size.
- 🔴 #69 (S72 Run #312) — FE bundle hash NON-DETERMINISTIC per rebuild.
- 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 440 PASS (45 Domain + 395 Infra; S96 #480
0c2f9f6— 436 + newPeSuggestedPriceSetterAuthzTests[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 (tasksterminal=status:success,conclusionNOT 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=
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: ASP.NET 10 record enum needs numeric input unless
JsonStringEnumConverter(SOL has NO converter → FE sends numeric). sqlcmd ssh Windows-auth\\\\SQLEXPRESS4-backslash. INFRASTRUCTURE seed MUST run (NOT insideif(!demoSeedDisabled)); 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['docs/**','**/*.md','.claude/skills/**']. 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). ⚠️ skill-doc pathC:\inetpub\apps\SolutionErp\ApiSTALE.- 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: 440 PASS (45 Domain + 395 Infra · 0 fail/skip; S96 Run #480 sha
0c2f9f6— 436 + newPeSuggestedPriceSetterAuthzTests; prior S96 #479 436, S96/S95 434, S90 #465 421). Phase 9 UAT skip per chunk OK. - Mig latest repo: Mig 62
20260706084342_ExpandSupplierFields(S104 #488; AddColumn ×18 onSuppliers[17 nullable string +Statusint] + guardedSql()UPDATENote=NULL WHERE Code IN (4 NCC) AND Note LIKE N'Loại:%'— un-cram legacy concat Note; NO CreateTable ⟹ sys.tables stays 89 — VERIFIED-APPLIED-PROD history-HEAD + 18-cols-present + Suppliers-total-35-cols + 4-row Note=NULL/Pkg/Bank/LegalRep-populated/Status=1 + Note-still-Loại-count=0). Prev Mig 61BackfillEndedByLevelFinalizeFromChangelog(S97, data-only). Pathsrc/Backend/SolutionErp.Infrastructure/Persistence/Migrations/. Prod checksqlcmd __EFMigrationsHistory ORDER BY MigrationId DESC TOP 5. ⚠️sys.tables(is_ms_shipped=0) = 89 (S104 LIVE-verified post-#488 — AddColumn/data-only migs don't change count → commit touches no new table ⟹ 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 + emptygit diff -- '*Migrations*'. - Bundle hash live (S109 #492 re-verified 2026-07-10 — FROZEN-streak ×3 #490→#492): admin js
BVyH-FY7/cssBbtesa6B· user jsEDsZebvn/cssBmuPz_Dy— JS ROTATED-benign tại #489 (0 fe-src governance-only, Vite non-determinism #69) từ #488ChSNAJBK/Bn2w1znH; CSS frozen. LM-in-window 17:25:26/17:26:22+07 + real-size 1.64/1.55MB = ship-proof. ⚠️ id ≠ run_number; head_sha-keyed. ⚠️ PER #69 TWO-MODE: hash MAY rotate (real src-diff #488, HOẶC 0-fe-src #489/#312) OR freeze (0 fe-src #485-487) — SNAPSHOT per-run, NOT baseline; ALWAYS re-snapshot LIVE pre-deploy. Real FE ship = difffe-*/srcin range + real-size-vs-fake (1.64/1.55MB vs ~919b SPA-trap 200-text/html) + Last-Modified-in-window + content-marker-grep, NOT hash delta alone. - Bearer: admin
admin@solutions.com.vn/Admin@123456(full) · UATnv.test@solutions.com.vn/TestUser@123456(Drafter CCM, gotcha #44 check).
🔑 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. Per-NV/per-Level refactor MUST verify: 1 Domain field · 2 EF HasDefaultValue(false) · 3 Mig 3-file · 4 Service read · 5 Domain+App DTO mirror · 6 Designer FE checkbox · 7 AwLevelDto+ToDto · 8 CreateAwLevelInput+Update mutation · 9 Lookup discrimination (FirstOrDefault ADD ApproverUserId==actorId + admin fallback) · 10 Controller body record count == Command record count. Bug latency 2-3 days prod silent khi miss 9-10. Scan grep -n "FirstOrDefault.*Order.*==" *.cs after OR-of-N refactor.
📊 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)
- 🟢 S109 #492 (rn 378, id 492)
f5a5c3eGO 5m21s (17:21:34→17:26:55+07, found-completed 0-poll) — MEMORY-ONLY 10-file (9 .md ignored +memory-budget.jsonnon-ignored → #41 CI-run, AS-6 prediction VERIFIED): status=success (gate 440) · 0 fe/BE/mig src ⟹ Mig FROZEN 62 history-topExpandSupplierFields+ MIGCOUNT=62 + sys.tables=89 ✓ · smoke 3×200 (health/ready + 2 FE roots) · bundle FROZEN ×3-streak (adminBVyH-FY7/Bbtesa6B· userEDsZebvn/BmuPz_Dy= #489→#491) + LM-in-window 17:25:26/17:26:22+07 + real-size 1,644,931/1,551,280b vs fake-919b = ship-proof. 🔑memory-budget.jsontrigger-pattern lặp #490 — single non-.md file trong memory-push đủ CI-run (#41 range-eval); frozen-streak ×3 củng cố #69-REFINE (0-fe-src ⟹ byte-identical output, LM+size = signal duy nhất). - 🟢 S108 #491 (rn 377, id 491)
69957fdGO 5m06s (14:35:12→14:40:18+07, iter7) — GOVERNANCE 9-file (hmw.jscomment-fix non-ignored → #41 CI-run; archive-carryf1af05c2-file .md-only → 0-run ✓ #41 2-chiều VERIFIED cùng-đợt): status=success (gate 440) · 0 fe/BE/mig src ⟹ Mig FROZEN 62 history-top + sys.tables=89 ✓ · smoke 3×200 · bundle FROZEN ×2 (adminBVyH-FY7/Bbtesa6B· userEDsZebvn/BmuPz_Dy= #489/#490) + LM-in-window 14:38:50/14:39:44+07 + real-size 1,644,931/1,551,280b vs fake-919b = ship-proof. 🔑 #69 FROZEN-streak ×2 (#490→#491) sau ROTATE #489 — cùng 0-fe-src 3-run liên-tiếp cho cả 2 mode; LM+size vẫn signal duy nhất. - 🟢 S107-closeout #490 (rn 376, id 490)
d74f67fGO 5m32s (10:39:30→10:45:02+07, iter6) — GOVERNANCE-CLOSEOUT 7-file (6 .md +memory-budget.jsonnon-ignored → #41 CI-run): status=success (gate 440) · 0 BE/FE src ⟹ Mig FROZEN 62 history-top + sys.tables=89 ✓ · smoke 3×200 · bundle FROZEN ×2 (adminBVyH-FY7/Bbtesa6B· userEDsZebvn/BmuPz_Dy= #489) + LM-in-window 10:43:38/10:44:36+07 + real-size 1.64/1.55MB app-js vs fake-919b = ship-proof. 🔑 #69 TWO-MODE back-to-back cùng-phiên: #489 ROTATE → #490 FROZEN trên cùng 0-fe-src — LM+size là signal duy nhất. Orphan-record OK (precedent #485). - (S107 #489
21387cdGOVERNANCE-ONLY (+office-document 12th sub) GO 5m33s — JS ROTATED-benignChSNAJBK→BVyH-FY7/Bn2w1znH→EDsZebvnCSS-frozen, 🔑 #69 TWO-MODE CONFIRMED (0-fe-src ROTATE #312/#489 hoặc FROZEN #333/#485-487 — ship-proof = LM-in-window + real-size, hash-delta phụ) · S104 #488778fc98FULL-STACK Supplier 9→27 + Mig 62ExpandSupplierFieldsAPPLIED-PROD — AddColumn×18-exact + sys.tables-89-invariant + un-cram 4-NCC Note=NULL/Pkg/Bank/LegalRep-populated-EXACT + DTO-18-new-keys-live + JS-rotate-real-src + 🔑 FULL-STACK-SCHEMA-ADD+DATA-UN-CRAM PASS-pattern — full verbatim →archive/2026-07.mdvia_INDEX) - (S103 #487 + S100 #486 + S98 #485 GOVERNANCE/SCRIPTS-ONLY GO ×3 [.ps1/.json/.md-mix non-ignored → #41] — bundle FROZEN #69-REFINE ×4, GOVERNANCE-PASS stable [#476/#485-487] · 🔧 python
time.sleepforeground-OK (chỉ bash-sleep-block) · full verbatim →archive/2026-07.md(+#485 gitc112be9) via_INDEX) - (S96+S97 FINAL-REVIEW #478-#484 11-commit ALL-HEALTHY whole-session-GO [backfill A/005=1/A/008=1/A/010=0-exact + 88-excl/89-incl reconcile; #69 rotation≠ship-signal] · S97 #484
fb2dfa9DATA-FIX Mig61 🔑 DATA-FIX-BACKFILL PASS = CI + Mig-top==HEAD + target-rows-flip-EXACT + control-untouched + derived-API-field-FLIP-live — verbatim →archive/2026-07.mdvia_INDEX) - (endsBeforeCeo-saga anh Kiệt: S97 #482
8037fa0CROSS-STACK Mig60AddPeEndedByLevelFinalize[config→RUNTIME · 🔴 EF-TERNARY-SQL-translate-LIVE list-200-NOT-500 · #77 field-PRESENT] · #483 FE-ONLY badge CEO-duyệt [#77 new-str-BOTH] · #481 FE-ONLY 2-fix [#77 new-PRESENT/old-ABSENT] — all 440 PASS, verbatim → git +2026-06.mdvia_INDEX) - (S96 #480
0c2f9f6cross-stack PE 3-commit-range khóa-giá+mark-read+opt-out NO-mig baseline-440+new-PeSuggestedPriceSetterAuthzTests JS-rotate/CSS-frozen · S96 #47936cbf8bPE 2-commit mark-read-stale-noti baseline-436 JS-rotate/CSS-frozen · all PASS Mig59-frozen · full verbatim → git + archive2026-06.mdvia_INDEX) - (S96 #477
ba4b8e0Infra data-seed NCCDONGDUONGpre=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-Wdiacritic-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-prefixedRolesNOTAspNetRoles] · 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.mdvia_INDEX) - (S89 #348
1aa3bdbPE 1→N multi-winner endpoint-411→401 · S88-quad #34773cce1fPE D1 re-key+CEO-notify · S88-bis #3460d3c0cfFE-only js+css-BOTH-rotate · S88 #3459b1ee0cMig 59AddCcmBudgetPeriodToPurchaseEvaluationPATCH-401+7-authz · S87 #344f1b10e9FULL-STACK + Mig 58AddPeMultiWinnerAndLevelFinalizebackfill-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.mdvia_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.
🔄 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-07-10 S107 (self, PostToolUse 20.4→16.9KB): #489+#488 content-exact →
archive/2026-07.md+_INDEX+2 pointers (count=1) → 1 stub; merge #485-487 stubs; nén curate-log 4→2. - Prev: S104 07-06 self 20.5→17.9KB (#487/#486→archive) · S98 07-02 em-main 19.9→17.06 (2 S97 entries→
2026-07.mdNEW, V3 PASS) · S80 06-20 em-main 38.8→16 (#330/#318/#325→2026-06.md+ stale-fix 354-test/Mig57) · S70 06-17 Harness-9 65.2→23.2 (_INDEX/gist gen:1) · earlier S66 · S40.