# Session 2026-04-25 ~14:30 — Chốt session 3 final cleanup

**Focus:** Tái cấu trúc + cleanup MD docs theo yêu cầu user "review cập nhật và
tái cấu trúc lại MD sao cho phù hợp nhất với hiện tại". Audit toàn bộ + archive
phần thừa + compact.

## Cleanup outcomes

### 1. Archive Phase 0 raw dump

| File | Trước | Sau |
|---|---|---|
| `forms-spec-raw.md` (657 line) | `docs/` | `docs/_archive/` |
| `workflow-raw.md` (62 line) | `docs/` | `docs/_archive/` |

Update reference link trong `forms-spec.md` + `workflow-contract.md`.

### 2. Compact docs

| File | Trước | Sau | Δ |
|---|---:|---:|---:|
| `migration-todos.md` | 386 line | 114 line | **-71%** |
| `STATUS.md` § In Progress | 17 row ✅ done + 12 pending | 5+ task pending only | -50% |
| Tổng docs active | ~8480 | ~7660 | -800 line |

### 3. Update outdated references

- `database/database-guide.md`: header note "47 bảng 13 migration" + redirect schema-diagram. Email demo `@solutionerp.local` → `@solutions.com.vn`
- `guides/runbook.md`: reset-password command email mới
- `flows/README.md`: 6 flow tất cả ✅ Implemented + thêm row PE module
- `docs/CLAUDE.md`: project layout + Roadmap thêm Phase 6 + 7. Login prod thêm `admin@solutions.com.vn` + 3 domain.

### 4. Skill audit

| Skill | Status | Update |
|---|---|---|
| `contract-workflow` | ✅ Active | (đã có Phase 6 cross-ref note session 2) |
| `form-engine` | ✅ Active | OK |
| `permission-matrix` | ✅ Active | (đã có Pe_*/PeWf_* note session 2) |
| `dependency-audit-erp` | ✅ Active | OK |
| `ef-core-migration` | ✅ Updated | 13 migration label + Phase 6 update note |
| `iis-deploy-runbook` | ✅ Active | (đã có G-084 hardening session 2) |

Cron audit `solution-erp-skill-audit-monthly` next 2026-05-01.

## Stats cuối session 3 (cộng dồn 3 phiên 23-24-25)

| Metric | Đầu session 3 | Cuối |
|---|---:|---:|
| BE LOC | ~11100 | ~11900 |
| DB tables | 46 | **47** |
| Migrations | 12 | **13** |
| API endpoints | ~110 | ~113 (+3 PE attachments) |
| Gotchas | 33 | **38** |
| Commits session 3 | 0 | ~30 (a667665..e71e0eb) |

## Session 4 — đọc thứ tự

```
1. docs/STATUS.md                                   (compact, In Progress 5+ task)
2. docs/HANDOFF.md                                  (TL;DR session 3 + Priority 0)
3. docs/changelog/sessions/2026-04-25-1430-chot-session-3-final-cleanup.md (file này)
4. docs/changelog/migration-todos.md §Phase 7       (3 PE feature gap + ops)
5. docs/gotchas.md §34-38                           (NavLink/inheritance/Vite/PS/Email gotcha mới)
```

## Priority 0 session 4 — 3 PE feature gap

1. **PE Workflow admin designer UI** `/system/pe-workflows/:typeCode`
   - BE `PeWorkflowAdminFeatures.cs` + `PeWorkflowsController.cs` (mirror Contract)
   - FE `PeWorkflowsPage.tsx` + `PeWorkflowDesigner.tsx`
   - Route + menu PeWf_* + resolver đã sẵn
2. **Section "Ý kiến 4 phòng ban"** (Phê duyệt/CCM/MuaHàng/SM-PM) ở tab Thông tin
   - Option A: 4 text field + signoff date + UserId vào header
   - Option B: dùng PurchaseEvaluationApprovals với roleKind extra field
3. **Export phiếu PDF/Excel** — tái dùng IDocumentConverter + template `PE-TrinhDuyet.docx`

## Ops blockers còn

- Remove binding `.huypham.vn` sau verify stable (script `migrate-domains.ps1 -RemoveOld -SkipCert`)
- Fix win-acme scheduled task unhealthy (cert expire 2026-06-18)
- UAT thật 1 tuần với 2-3 user
- SMTP config → Email outbox
- Rotate creds (admin + 16 demo + SA + vrapp + JWT)
- Schedule SQL backup Task Scheduler

## Notes cho session 4

1. **Login email mới:** `admin@solutions.com.vn` / `Admin@123456`. Old email 401.
2. **3 domain prod live:** api/admin/eoffice.solutions.com.vn (HTTPS Let's Encrypt).
3. **Old domains `.huypham.vn`** vẫn fallback active — chưa remove.
4. **VPS shared với VietReport** — gotcha #33 G-084 IPv4/IPv6 port hijack.
5. **PE module hoàn thiện UX** — feature gap còn 3 task không-blocker (Designer UI optional, Ý kiến 4 phòng ban scope tùy user, Export PDF nice-to-have).
6. **SSH config sẵn:** `ssh vietreport-vps` (key id_ed25519).
