📋 Architecture_Freeze_Checklist.md - Architecture Freeze Checklist (เช็คลิสต์ตรวจทานการแช่แข็งโครงสร้างสเปก)

This checklist defines the gates required to lock the SplitDee system design, database schemas, and interface agreements before starting Phase 2 production coding.
รายการเช็คลิสต์ตรวจสอบและสรุปความพร้อมสเปกการเข้าเลเยอร์ ข้อตกลงความปลอดภัย และอินเตอร์เฟสโมดูลระบบย่อยก่อนเริ่มเขียนรหัสจริงในเฟส 2


🇹🇭 ภาษาไทย (สำหรับผู้ใช้งาน)

🗄️ สรุปความคืบหน้าความพร้อมการแช่แข็งระบบ

  • Authentication & AuthN (ระบบรักษาความปลอดภัยยืนยันสิทธิ์): 🟡 พร้อมสำหรับการแช่แข็งโครงสร้าง (รวบรวมได้ 90%)
  • Database Schema (ERD - การจำลองฐานข้อมูล): 🟡 พร้อมสำหรับการแช่แข็งโครงสร้าง (รวบรวมได้ 95%)
  • API Specifications (ข้อตกลงพอร์ตส่งเข้า/ออก): 🟡 พร้อมสำหรับการแช่แข็งโครงสร้าง (รวบรวมได้ 90%)
  • Security & Deployment (ความปลอดภัยและการจัดส่ง DevOps): 🟢 แช่แข็งสเปกล็อกโครงสร้างถาวรเรียบร้อย (100%)
  • Testing Strategy (ยุทธศาสตร์การรันเคสทดสอบ): 🟢 แช่แข็งสเปกล็อกโครงสร้างถาวรเรียบร้อย (100%)
  • Gamification & Chat (กฎสัตว์เลี้ยงโมจิและแชทกลุ่ม): 🔴 ร่างเอกสารประเด็นรายละเอียด (รวบรวมได้ 40-50%)

🎯 รายละเอียดเช็คลิสต์แยกส่วน

  1. ส่วนระบบฐานข้อมูล (Database Schema Freeze Checklist):
    • ตรวจสอบสเปกแผนผังตาราง ERD (Mermaid) และคีย์ Junctions
    • บังคับกำหนด UUID เป็น Primary Key คีย์หลักของตารางสากลทั้งหมด
    • กำหนดและจดบันทึกดัชนีคีย์ระงับข้อมูลซ้ำ (slip_trans_id, email, invite_code)
    • ทดลองจำลองกระบวนการกู้คืนและสำรองฐานข้อมูล (pg_restore)
  2. ส่วนสเปกข้อตกลง API (API Contract Freeze Checklist):
    • กำหนดสเปก JSON ตอบรับกลาง (success, data, error)
    • ระบุข้อผิดพลาดกลางของตรรกะระบบ (เช่น SLIP_ALREADY_USED)
    • ดำเนินการขึ้น Mock APIs สปอยล์ระบบหน้าบ้าน Flutter ทดสอบ
  3. ส่วนมาตรฐานความปลอดภัย (Security Standards Freeze Checklist):
    • ล็อกนโยบาย Access Token 15 นาที และ Refresh Token HttpOnly 7 วัน
    • บังคับใช้ระบบแฮช Bcrypt rounds >= 12
    • ออกพิกัดจำกัด CORS whitelist หน้าบ้านทั้งหมด

🇬🇧 English (For AI Agents)

🗄️ Architecture Freeze Progress

  • Authentication & AuthN: 🟡 Ready for Freeze (90% Complete)
  • Database Schema (ERD): 🟡 Ready for Freeze (95% Complete)
  • API Specifications: 🟡 Ready for Freeze (90% Complete)
  • Security Standards: 🟢 Frozen (100% Complete)
  • Deployment & DevOps: 🟢 Frozen (100% Complete)
  • Testing Strategy: 🟢 Frozen (100% Complete)
  • Gamification Rules: 🔴 Draft (50% Complete)
  • In-App Chat Engine: 🔴 Draft (40% Complete)

🎯 Domain-Specific Checklists

  • 1. Database Schema Freeze Checklist
    • ERD relationship diagrams (Mermaid) verified.
    • UUID primary keys enforced on all PostgreSQL tables.
    • Unique index strategies documented (slip_trans_id, email, invite_code).
    • Composite indexes specified for junction tables (group_members, expense_shares).
    • Staging database backup and pg_restore procedures dry-run completed.
  • 2. API Contract Freeze Checklist
    • General response envelopes defined (success, data, error).
    • Request schemas and Field limits declared for all Auth paths.
    • Standard error codes documented (e.g. BILL_SPLIT_MISMATCH, SLIP_ALREADY_USED).
    • API versioning strategy defined (routes use /api/v1/).
    • Mock responses for all endpoints registered in frontend clients.
  • 3. Security Standards Freeze Checklist
    • Token rotation strategy approved (15m Access Token, 7d HttpOnly SameSite Refresh Token).
    • Password hashing cost factors defined (Bcrypt rounds >= 12, or Argon2id).
    • CORS whitelist domains mapped.
    • AES-256 encryption at rest defined for sensitive database PII columns.
    • S3 private media bucket Presigned-URL lifespan set.
  • 4. Playbook & Quality Gates Freeze Checklist
    • Definition of Done (DoD) checklist integrated.
    • PEP 8 and Dart style guides selected.
    • CI/CD pipeline triggers (lint, test, build, deploy) defined.