# sub-cicd-monitor-0 — S133 pe-budget-freeze deploy verify (commit d4fbced)

> Read-only CI/CD verifier. Evidence dồn dần (anti-#53). VERDICT ở cuối khi đủ 5 mục.
> Target commit: `d4fbced02f6a24df7177c33adc21b8ca89140a0c`
> Subject: `[CLAUDE] PurchaseEvaluation: freeze ngân sách phiếu DaDuyet — Mig 67 snapshot 11 cột + display-gate budgetFrozen + 2 terminal-guard (UAT anh Kiệt 07-16)`

## Stage 1 — Push + path-filter (DONE)
- `git rev-parse origin/main` = `d4fbced02f6a24df7177c33adc21b8ca89140a0c` → d4fbced IS on origin/main. PASS.
- `git branch -r --contains d4fbced` → `origin/main`. PASS.
- Local HEAD = `bf79842 wal: flush 20260717T1116` (1 commit ahead, unpushed docs/WAL — NOT the target, irrelevant).
- Files changed `9e874ca..d4fbced` (28 files): FULL-STACK
  - BE: PeBudgetAccumulator.cs, PeWorkItemBudgetFeatures.cs, PurchaseEvaluationFeatures.cs, PurchaseEvaluationDtos.cs, Domain/PurchaseEvaluation.cs, PurchaseEvaluationConfiguration.cs, DbInitializer.cs, PurchaseEvaluationWorkflowService.cs
  - Mig 67: `20260717032812_AddPeApprovedBudgetSnapshot.cs` + .Designer.cs + ApplicationDbContextModelSnapshot.cs
  - FE: fe-admin/{PeDetailTabs.tsx, types/purchaseEvaluation.ts}, fe-user/{PeDetailTabs.tsx, types/purchaseEvaluation.ts} → 4 real fe-src files → bundle MUST rotate ×2
  - Tests: PeBudgetFreezeTests.cs
  - Governance/memory/run-trace: .claude/WAL.md, agent-memory×4, run.md, spec + 4 sub-*.md
- Non-docs code present → CI MUST trigger (NOT docs-skip). CONFIRMED triggered (run #398 exists).

## Stage 1b — Migration file review (Mig 67, DONE)
- `20260717032812_AddPeApprovedBudgetSnapshot.cs`: 11 AddColumn on PurchaseEvaluations, 0 CreateTable:
  1. ApprovedBudgetProInitialAmount decimal(18,2) null
  2. ApprovedBudgetProAdjustmentAmount decimal(18,2) null
  3. ApprovedBudgetProNote nvarchar(1000) null
  4. ApprovedBudgetCcmInitialAmount decimal(18,2) null
  5. ApprovedBudgetCcmAdjustmentAmount decimal(18,2) null
  6. ApprovedBudgetCcmNote nvarchar(1000) null
  7. ApprovedBudgetPrevSubmittedTotal decimal(18,2) null
  8. ApprovedBudgetPrevSubmittedCount int null
  9. ApprovedBudgetPrevSelectedTotal decimal(18,2) null
  10. ApprovedBudgetPrevSelectedCount int null
  11. ApprovedBudgetSnapshotAt datetime2 null
- Backfill `Sql()`: `UPDATE ... SET ... SnapshotAt=SYSUTCDATETIME() WHERE pe.Phase=7 AND pe.ApprovedBudgetSnapshotAt IS NULL AND pe.IsDeleted=0`. Idempotent. → post-apply ALL Phase=7 rows have SnapshotAt NOT NULL → expected chua=0.
- NO CreateTable → sys.tables invariant 89 should hold.

## Stage 2 — Gitea CI poll (IN PROGRESS)
- API: `/api/v1/repos/vietreport-admin/solution-erp/actions/tasks?limit=8` (anon, GITEA_TOKEN empty — public repo OK). NOT /runs (404, gotcha #46).
- Run #398 | head_sha d4fbced02f | status=running | conclusion=None (prev #397 72f68d1 success — matches SPEC baseline).
- Polling until terminal status... (conclusion stays None even on success per memory — trust `status`).

### Stage 2 RESULT — CI PASS
- Run #398 (d4fbced02f) → `status=success` @ updated_at `2026-07-17T11:20:02+07:00` (conclusion=None = Gitea tasks-API norm, trust status). Prev #397 success — baseline OK.
- Poll note: python subprocess `capture_output=True` (text) crashed cp1252 on Vietnamese titles ×14 iters; re-fetch with `text=False`(bytes)+`json.loads(bytes)` → clean. Elapsed ~6min covered the run.
- Test gate (web-UI log `runs/398/jobs/0/logs`, 17936 bytes, NO /api/v1):
  - `Passed!  - Failed: 0, Passed: 45, Skipped: 0, Total: 45` — SolutionErp.Domain.Tests
  - `Passed!  - Failed: 0, Passed: 475, Skipped: 0, Total: 475` — SolutionErp.Infrastructure.Tests
  - 45 + 475 = **520**, 0 fail/skip → matches SPEC baseline. **PASS.**

## Item 2 — Mig prod (ssh vietreport-vps sqlcmd, DONE)
- `__EFMigrationsHistory` TOP3: `20260717032812_AddPeApprovedBudgetSnapshot` (top) · `20260714035636_AddPeApprovedPriceRange` · `20260712142652_Backfill...` → top == SPEC target. **PASS.**
- sys.columns ApprovedBudget* on PurchaseEvaluations = **11** (all 11 names present, exact match to Mig 67 file). **PASS.**
- Backfill `WHERE Phase=7 AND IsDeleted=0`: total=**18**, chua(SnapshotAt IS NULL)=**0** → all 18 DaDuyet phiếu snapshotted. **PASS.**
- sys.tables is_ms_shipped=0 = **89** (no new table — AddColumn-only). **PASS.**

## Item 3 — Bundle FE rotate + byte-verify #77 (DONE)
- ADMIN index.html: js `/assets/index-3NCdyODe.js` css `/assets/index-B--dUHcm.css` (was S129 js `yCkX-2Bp` css `CXD7q9xH`) → JS+CSS ROTATED.
- EOFFICE index.html: js `/assets/index-CKsoiNCI.js` css `/assets/index-BuntB63r.css` (was S129 js `DKSD4p9k` css `CjwZwYJo`) → JS+CSS ROTATED.
- Real-size + LM: admin.js 1,657,025 B, LM `Fri 17 Jul 2026 04:18:42 GMT` (11:18:42 +07) · eoffice.js 1,563,373 B, LM `04:19:36 GMT` (11:19:36 +07) — both application/javascript, LM in CI window (run done 11:20:02 +07). NOT SPA-trap.
- Byte-verify markers (python bytes-search): admin.js `budgetFrozen`=1, `Ngân sách chốt tại thời điểm duyệt`=1 · eoffice.js both=1.
- CONTROL old admin `yCkX-2Bp` → 900 B text/html (SPA-fallback trap), markers=0 → confirms markers are NEW not fallback. **PASS.**

## Item 4 — Smoke (DONE)
- api/health/live=200 · api/health/ready=200 (body "Healthy") · admin=200 · eoffice=200 · GET /api/purchase-evaluations no-token=**401** (secured). **PASS.**

## Item 5 — Traps handled
- S116: polled CI to `success` BEFORE bundle snapshot ✓ · #69: rotate benign (4 real fe-src changed → rotate expected) ✓ · #77: curl byte-level + old-hash control (900b SPA-trap) not browser ✓.

---

## VERDICT | GO (5/5 PASS)
| # | Item | Verdict | Key evidence |
|---|------|---------|--------------|
| 1 | CI run #398 + gate 520 | PASS | status=success; Domain 45/45 + Infra 475/475, 0 fail |
| 2 | Mig 67 prod applied | PASS | history top=AddPeApprovedBudgetSnapshot; 11 cols; backfill 18/18 chua=0; 89 tables |
| 3 | Bundle rotate ×2 + byte-verify | PASS | admin js 3NCdyODe / eoffice js CKsoiNCI; markers present; old-control 0; real-size+LM-in-window |
| 4 | Smoke 5-probe | PASS | live/ready 200, admin/eoffice 200, PE no-token 401 |
| 5 | Traps (S116/#69/#77) | PASS | poll-then-snapshot; benign rotate; byte-level+control |

Run URL: https://git.baocaogiaoduc.vn/vietreport-admin/solution-erp/actions/runs/398
Token cost: ~90K. No production file modified (only this run-trace sub-file).
