S129D Fix Report — Restore Post-Deploy E2E + Fix DRY
S129D — FIX REPORT: Khôi phục Post-Deploy E2E + Fix DRY
Agent: Claude Code | Phiên: S129D | Ngày: 2026-03-23 Tiếp nối: S129C (điều tra) → S129D (fix) PR: #574 (web-test repo) TD: TD-342 (restore post-deploy E2E), TD-343 (fix DRY)
Assembly Gate
- Q0 PG: Không
- Q1 Directus: Không
- Q2 Nuxt: Không
- Q3 Code mới: Khôi phục
workflow_runtrigger + fix DRY - Q4 Test: Deploy → workflow_run trigger → E2E chạy
- Q5 Rollback:
git revert
Phân tích trước khi code
smoke-test.sh chạy từ đâu?
Script chỉ dùng curl to public URLs (https://vps.incomexsaigoncorp.vn/..., https://directus.incomexsaigoncorp.vn/...) → chạy từ GH runner OK, không cần SSH vào VPS.
deploy-vps.yml rsync excludes
Deploy-vps.yml KHÔNG rsync scripts/ folder lên VPS (rsync chỉ sync .output/, dot/bin/, dot/config/). Đây là lý do Codex PR #573 dùng workaround scp-action để copy script.
Thay đổi
TD-342: post-deploy-e2e.yml (NEW — 27 lines)
Tạo file mới .github/workflows/post-deploy-e2e.yml:
- Trigger:
workflow_runon "Deploy to VPS" (completed, main branch) - Condition: Chỉ chạy khi deploy SUCCESS hoặc manual dispatch
- Action:
bash scripts/smoke-test.sh— chạy từ GH runner, không SSH - Wait: 30s cho deployment propagation
Khôi phục từ: Code gốc commit d2d3e78 (trước PR #567). Cải tiến: dùng smoke-test.sh (đã có sẵn, PR #537) thay vì inline curl — Assembly First.
TD-343: deploy-vps.yml (REMOVE — -48 lines)
Xóa 4 steps duplicate từ PR #573 (Codex S129A):
- "Copy smoke script to VPS" (scp-action) — job deploy-direct
- "Post-deploy smoke test" (ssh-action) — job deploy-direct
- "Copy smoke script to VPS" (scp-action) — job deploy-artifact
- "Post-deploy smoke test" (ssh-action) — job deploy-artifact
Lý do xóa:
- Redundant:
post-deploy-e2e.ymlđã handle production smoke - DRY violation: 4 steps copy-paste giống hệt
- Workaround: scp+ssh thay vì chạy curl từ runner (script chỉ dùng public URLs)
if: success()redundant (GH Actions mặc định)
Deploy-vps.yml vẫn giữ inline health checks (Nuxt port, Nginx+SSL, rollback on failure).
Kiểm chứng
| # | Câu hỏi | Kết quả |
|---|---|---|
| 1 | Đã đọc SSOT + Điều 30 + S129C report? | ✅ |
| 2 | smoke-test.sh: chạy từ runner hay cần SSH? | Runner (curl public URLs) |
| 3 | post-deploy-e2e.yml khôi phục từ code cũ? | ✅ commit d2d3e78 + Assembly First (dùng smoke-test.sh) |
| 4 | workflow_run trigger đúng format? | ✅ workflows: ["Deploy to VPS"], types: [completed] |
| 5 | deploy-vps.yml: DRY fix xong? | ✅ -48 lines, 4 steps removed |
| 6 | CI GREEN? | ✅ ALL PASS (build, e2e, smoke, quality-gate, pass-gate, guard, contract-check, critical-files) |
| 7 | Deploy → post-deploy E2E tự chạy + PASS? | ✅ Xem Mũ 2 Evidence bên dưới |
| 8 | Report S129D lưu Agent Data + verified full? | ✅ get_document_for_rewrite confirmed (3153 chars, truncated=false) |
Git Evidence
- Branch:
fix/s129d-restore-post-deploy-e2e - Commit:
67eae98—fix(s129d): restore post-deploy E2E + fix DRY (TD-342, TD-343) - PR: https://github.com/Huyen1974/web-test/pull/574
- Pre-commit checks: 4/4 PASS (data-flow, cloud-url, secrets, gc-law)
- Files changed: 2 (1 new, 1 modified) — +27, -48 lines
Mũ 2 Evidence — Merge + Deploy + Verify
Merge: PR #574 squash-merged vào main (commit 5dc0d59)
Full workflow chain (tất cả workflow_run trigger):
| # | Workflow | Run ID | Trigger | Status | Thời gian |
|---|---|---|---|---|---|
| 1 | Nuxt 3 CI | 23419937128 | push (main) | ✅ SUCCESS | ~1m |
| 2 | Deploy to VPS | 23419980711 | workflow_run (Nuxt 3 CI) | ✅ SUCCESS | ~2m |
| 3 | Post-Deploy E2E | 23420045298 | workflow_run (Deploy to VPS) | ✅ SUCCESS | ~30s |
Pattern khôi phục thành công:
Push main → Nuxt 3 CI ✅ → Deploy to VPS ✅ → Post-Deploy E2E ✅
Đúng pattern trước PR #567 (S160). Post-Deploy E2E tự trigger qua workflow_run, KHÔNG phải manual.