Files
goodgo-platform/docs
Ho Ngoc Hai abeb8fd322 feat(auth): complete MFA grace period for required roles + ops monitoring
Finishes the half-implemented MFA enforcement work and ships the SLO
monitoring rules at the same time.

MFA grace period (auth):
- New `mfa-policy.ts` central source of truth: `MFA_REQUIRED_ROLES = [ADMIN]`,
  `MFA_GRACE_PERIOD_DAYS = 14`, `MFA_REAUTH_WINDOW_MINUTES = 15`.
- New columns `User.mfaGraceStartedAt` + `User.mfaLastVerifiedAt`
  (migration `20260429000000_add_mfa_grace_columns`).
- `JwtPayload.mfa: 'none' | 'grace' | 'enrollment_required'` claim now
  carried in every access token so the FE + admin guards can react.
- `LoginUserHandler.resolveMfaGraceClaim()`:
  * If role requires MFA and user has not enrolled, lazy-stamp
    `mfaGraceStartedAt` on first login (returns `mfa: 'grace'`,
    `remainingDays: 14`).
  * After window expires → `mfa: 'enrollment_required'`, `remainingDays: 0`
    (callers must force enrolment on sensitive routes).
  * Otherwise → `mfa: 'none'`.
- `LocalStrategy` now passes `totpEnabled` + `mfaGraceStartedAt` through
  to the command so the handler can branch without an extra query.
- `IUserRepository` + `PrismaUserRepository` get
  `updateMfaGraceStartedAt` / `updateMfaLastVerifiedAt`.
- `UserEntity` carries the two new fields end-to-end (props, getters,
  `createNew` + `createPasswordless` factories). Fixed an orphan-property
  syntax bug in `createPasswordless` that was breaking typecheck.
- `oauth.service.ts` `UserEntity` construction now includes `deletedAt`
  + the two MFA fields (was missing required props).
- Add missing `jsonwebtoken` + `@types/jsonwebtoken` to `apps/api`
  (transitively pulled in via `jwt-rotation.ts` from commit 3705193 but
  never declared, so `tsc --noEmit` was failing).
- Update `login-user.handler.spec.ts` + `local.strategy.spec.ts` to cover
  grace-window + enrolment-required branches. 338/338 auth tests pass.

Ops monitoring:
- New `monitoring/prometheus/slo-rules.yml` with recording + alerting
  rules for the agreed SLOs.
- Wire it into `prometheus.yml` + alertmanager routing.
- Capture the SLO soak-test results in
  `docs/audits/slo-soak-test-log.md`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 12:00:23 +07:00
..

Tài liệu GoodGo Platform

Mục lục tổng hợp cho toàn bộ tài liệu dưới docs/. Sau đợt consolidate ở TEC-3094, mọi exploration / audit / design-system đã được gom vào đây, không còn file .md dự án ở repo root ngoài 4 file chuẩn (README.md, CHANGELOG.md, CONTRIBUTING.md, CLAUDE.md) hoặc ngoài workspace (~/Desktop).

Bắt đầu

Tài liệu Mô tả
Môi trường phát triển Cài đặt Docker, dịch vụ cục bộ, xử lý sự cố
Kiến trúc Thiết kế hệ thống, luồng dữ liệu, cấu trúc module
Quick Start Reference Lối đi nhanh cho dev mới
Quick Reference Quy ước, path alias, command phổ biến

Tham chiếu API

Tài liệu Mô tả
Các endpoint API Tài liệu tham chiếu đầy đủ các endpoint REST API
Mã lỗi API Định dạng phản hồi lỗi và tất cả mã lỗi
api/market-index-ticker-contract.md Contract sàn giao dịch (TEC-3043)

Vận hành

Tài liệu Mô tả
Triển khai Hướng dẫn triển khai sản xuất
Sao lưu & Khôi phục Quy trình DR
Runbook Runbook vận hành
Production Readiness Checklist sẵn sàng production
Production Readiness Assessment Báo cáo đánh giá
Project Tracker Theo dõi milestone tổng

Audit

Xem audits/README.md. Các báo cáo audit chính (post-consolidate):

Design System

Tokens/mockup bàn giao bởi UX/UI Designer nằm trong document của issue TEC-3037 (tokens, mockup).

Exploration & Module Deep Dives

Toàn bộ exploration report được gom dưới docs/explorations/:

Analytics

API surface

Frontend (Next.js)

Listings

Tổng hợp

Recovered from ~/Desktop

Trước đây các sub-agent exploration đã ghi nhầm ra ~/Desktop. Tất cả đã được gom về explorations/from-desktop/:

  • 00_SUMMARY.md, 01_analytics_architecture_guide.md, 02_quick_reference.md, 03_file_paths_reference.md
  • FRONTEND_EXPLORATION_REPORT.md, INDEX_frontend_exploration.md, NOTIFICATIONS_EXPLORATION.md
  • README_analytics_package.md (vốn là Desktop/README.md)
  • ARCHITECTURE_OVERVIEW.txt, FRONTEND_QUICK_REFERENCE.txt, README_EXPLORATION.txt

Frontend docs (bản cũ)

Quy ước

  • Không tạo file .md dự án ở repo root (ngoài README.md, CHANGELOG.md, CONTRIBUTING.md, CLAUDE.md).
  • Không ghi file dự án ra ngoài workspace (ví dụ ~/Desktop). Mọi output của exploration/audit phải relative trong docs/….
  • Đặt file audit theo mẫu AUDIT_<topic>_<YYYY_MM_DD>.md trong docs/audits/.
  • Đặt exploration theo <MODULE>_<TOPIC>.md trong docs/explorations/.