690522:2125 ADR-028-228 #02
This commit is contained in:
+69
-25
@@ -1,7 +1,7 @@
|
||||
# 📚 LCBP3-DMS Specifications Directory
|
||||
|
||||
**Version:** 1.9.2 (AI Model Revision & Hybrid Staging)
|
||||
**Last Updated:** 2026-05-18
|
||||
**Version:** 1.9.5 (AI Intent/Tool Layer/Chat/Admin Console ADRs + Migration Arch Refactor)
|
||||
**Last Updated:** 2026-05-22
|
||||
**Project:** LCBP3-DMS (Laem Chabang Port Phase 3 - Document Management System)
|
||||
**Status:** ✅ Production Ready — 10/10 Documentation Gaps Closed • Hybrid Specs Structure Applied
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
---
|
||||
|
||||
## 📂 Directory Structure (v1.9.0)
|
||||
## 📂 Directory Structure (v1.9.5)
|
||||
|
||||
```text
|
||||
specs/
|
||||
@@ -48,11 +48,13 @@ specs/
|
||||
│ ├── 03-04-legacy-data-migration.md # Legacy Data Migration จาก Excel (ADR-017)
|
||||
│ ├── 03-05-n8n-migration-setup-guide.md # n8n Workflow Setup + Ollama Integration
|
||||
│ ├── 03-06-migration-business-scope.md # ★ Gap 7: Migration Scope, 3 Tiers, Go/No-Go Gates
|
||||
│ ├── 03-07-OpenRAG.md # OpenRAG Architecture & Implementation
|
||||
│ ├── lcbp3-v1.9.0-schema-01-drop.sql # Schema: DROP statements
|
||||
│ ├── lcbp3-v1.9.0-schema-02-tables.sql # Schema: CREATE TABLE (Source of Truth)
|
||||
│ ├── lcbp3-v1.9.0-schema-03-views-indexes.sql # Schema: Views + Indexes
|
||||
│ ├── lcbp3-v1.9.0-seed-basic.sql # Seed: Master Data
|
||||
│ ├── lcbp3-v1.9.0-seed-permissions.sql # Seed: CASL Permission Matrix
|
||||
│ ├── deltas/ # Schema delta files (ADR-009 incremental changes)
|
||||
│ └── README.md # ภาพรวม Data Strategy
|
||||
│
|
||||
├── 04-Infrastructure-OPS/ # โครงสร้างพื้นฐานและการปฏิบัติการ
|
||||
@@ -77,27 +79,47 @@ specs/
|
||||
│ ├── 05-03-frontend-guidelines.md # UI/UX, React Hook Form, State Strategy
|
||||
│ ├── 05-04-testing-strategy.md # Unit/E2E Testing ยุทธศาสตร์
|
||||
│ ├── 05-05-git-cheatsheet.md # การใช้ Git สำหรับทีมงาน
|
||||
│ ├── 05-05-git-conventions.md # Git Conventions (branch/commit naming)
|
||||
│ ├── 05-06-code-snippets.md # Reusable code patterns
|
||||
│ ├── 05-07-hybrid-uuid-implementation-plan.md # ADR-019 Implementation Guide
|
||||
│ ├── 05-08-i18n-guidelines.md # Localization rules
|
||||
│ └── README.md # ภาพรวมเป้าหมายงาน Engineering
|
||||
│
|
||||
├── 06-Decision-Records/ # Architecture Decision Records (23 ADRs)
|
||||
├── 06-Decision-Records/ # Architecture Decision Records (28 ADRs)
|
||||
│ ├── ADR-001 to ADR-017... # ไฟล์อธิบายสถาปัตยกรรม (ADR)
|
||||
│ ├── ADR-018-ai-boundary.md # ★ Patch 1.8.1: AI/Ollama Isolation Policy (Superseded by ADR-023)
|
||||
│ ├── ADR-019-hybrid-identifier-strategy.md # ★ Hybrid ID: INT PK + UUIDv7 Public API
|
||||
│ ├── ADR-021-integrated-workflow-context.md # ★ Workflow Engine & Step-specific Attachments
|
||||
│ ├── ADR-022-retrieval-augmented-generation.md # RAG Architecture
|
||||
│ ├── ADR-023-unified-ai-architecture.md # ★ Unified AI Architecture (Consolidates ADR-017/017B/018/020/022)
|
||||
│ ├── ADR-023A-unified-ai-architecture.md # ★ AI Model Revision: 2-Model Stack + BullMQ 2-Queue
|
||||
│ ├── ADR-024-intent-classification-strategy.md # ★ AI Intent Classification Strategy
|
||||
│ ├── ADR-025-ai-tool-layer-architecture.md # ★ AI Tool Layer Architecture
|
||||
│ ├── ADR-026-document-chat-ui-pattern.md # ★ Document Chat UI Pattern
|
||||
│ ├── ADR-027-ai-admin-console-and-dynamic-control.md # ★ AI Admin Panel & Dynamic Control
|
||||
│ ├── ADR-028-migration-architecture-refactor.md # ★ Migration Architecture Refactor (Staging Queue)
|
||||
│ └── README.md # รายชื่อ ADR ทั้งหมดพร้อมสถานะและวันที่
|
||||
│
|
||||
├── 100-Infrastructures/ # Feature Work: Infrastructure (Deployment, Monitoring, Docker Compose, Network)
|
||||
│ ├── 102-infra-ops/ # Infrastructure Operations & Deployment Automation
|
||||
│ ├── 103-node-upgrade/ # Node.js Upgrade Planning & Execution
|
||||
│ └── README.md # Category guide
|
||||
│
|
||||
├── 200-fullstacks/ # Feature Work: Fullstack Development (Backend + Frontend features, Workflow Engine, API)
|
||||
│ ├── 201-transmittals-circulation/ # Transmittals + Circulation Integration
|
||||
│ ├── 202-adr-021-integrated-workflow-conte/ # ADR-021 Integrated Workflow Context
|
||||
│ ├── 203-unified-workflow-engine/ # Unified Workflow Engine
|
||||
│ ├── 204-rfa-approval-refactor/ # RFA Approval Refactor
|
||||
│ ├── 224-intent-classification/ # AI Intent Classification
|
||||
│ ├── 225-ai-tool-layer-architecture/ # AI Tool Layer Architecture
|
||||
│ ├── 226-document-chat-ui-pattern/ # Document Chat UI Pattern
|
||||
│ ├── 227-ai-admin-console/ # AI Admin Console
|
||||
│ ├── 228-migration-arch-refactor/ # Migration Architecture Refactor
|
||||
│ └── README.md # Category guide
|
||||
│
|
||||
├── 300-others/ # Feature Work: Documentation, Research, Non-code tasks
|
||||
│ ├── 301-unified-ai-arch/ # Unified AI Architecture Research
|
||||
│ ├── 302-ai-model-revision/ # AI Model Revision Research
|
||||
│ └── README.md # Category guide
|
||||
│
|
||||
├── 08-Tasks/ # Task documents
|
||||
@@ -146,8 +168,16 @@ specs/
|
||||
| **UAT Criteria** | `01-Requirements/01-05-acceptance-criteria.md` | ตรวจความสมบูรณ์ Feature |
|
||||
| **Infra Hardening** | `04-Infrastructure-OPS/04-00-docker-compose/SECURITY-MIGRATION-v1.8.6.md` | Compose security runbook (v1.8.9) |
|
||||
| **ADR-009** | `06-Decision-Records/ADR-009-db-strategy.md` | Schema Change Process |
|
||||
| **ADR-018** | `06-Decision-Records/ADR-018-ai-boundary.md` | AI/Ollama Integration Rules |
|
||||
| **ADR-018** | `06-Decision-Records/ADR-018-ai-boundary.md` | AI/Ollama Integration Rules (Superseded by ADR-023) |
|
||||
| **ADR-019** | `06-Decision-Records/ADR-019-hybrid-identifier-strategy.md` | Hybrid ID Strategy (INT + UUIDv7) |
|
||||
| **ADR-021** | `06-Decision-Records/ADR-021-integrated-workflow-context.md` | Workflow Context & Step Attachments |
|
||||
| **ADR-023** | `06-Decision-Records/ADR-023-unified-ai-architecture.md` | Unified AI Architecture |
|
||||
| **ADR-023A** | `06-Decision-Records/ADR-023A-unified-ai-architecture.md` | 2-Model Stack + BullMQ 2-Queue |
|
||||
| **ADR-024** | `06-Decision-Records/ADR-024-intent-classification-strategy.md` | AI Intent Classification |
|
||||
| **ADR-025** | `06-Decision-Records/ADR-025-ai-tool-layer-architecture.md` | AI Tool Layer Architecture |
|
||||
| **ADR-026** | `06-Decision-Records/ADR-026-document-chat-ui-pattern.md` | Document Chat UI Pattern |
|
||||
| **ADR-027** | `06-Decision-Records/ADR-027-ai-admin-console-and-dynamic-control.md` | AI Admin Console & Dynamic Control |
|
||||
| **ADR-028** | `06-Decision-Records/ADR-028-migration-architecture-refactor.md` | Migration Arch Refactor (Staging Queue) |
|
||||
|
||||
---
|
||||
|
||||
@@ -163,7 +193,7 @@ specs/
|
||||
|
||||
5. **No `any` Types:** ไม่อนุญาตให้ใช้ `any` ในโค้ด พยายามใช้ Validation ผ่าน DTO / Zod แบบ Strongly-typed เสมอ — **Enforced ✅** (0 remaining in backend as of v1.9.0, ดูเทคนิคที่ `05-02-backend-guidelines.md`)
|
||||
|
||||
6. **AI Isolation (ADR-018):** Ollama ต้องรันบน **Admin Desktop** (i9-9900K, RTX 2060 SUPER 8GB) เท่านั้น — ห้ามรันบน QNAP/Production Server ห้ามมี Direct DB Access โดยเด็ดขาด AI Output ต้องผ่าน Backend Validation ก่อน Write ทุกครั้ง
|
||||
6. **AI Isolation (ADR-023/023A):** Ollama ต้องรันบน **Admin Desktop** (Desk-5439) เท่านั้น — ห้ามรันบน QNAP/Production Server ห้ามมี Direct DB Access โดยเด็ดขาด AI Output ต้องผ่าน Backend Validation ก่อน Write ทุกครั้ง ใช้ 2-Model Stack (gemma4:e4b Q8_0 + nomic-embed-text) + BullMQ 2-Queue (ai-realtime/ai-batch)
|
||||
|
||||
7. **UAT Sign-off Required:** ห้าม Close UAT โดยไม่มี Acceptance Criteria ✅ ครบทุกข้อ — ดู `01-05-acceptance-criteria.md`
|
||||
|
||||
@@ -171,25 +201,39 @@ specs/
|
||||
|
||||
---
|
||||
|
||||
## 🏛️ ADR Reference (All 17 + Patch + ADR-019)
|
||||
## 🏛️ ADR Reference (All 28 ADRs)
|
||||
|
||||
| ADR | Topic | Key Decision |
|
||||
| --------- | -------------------------- | -------------------------------------------------- |
|
||||
| ADR-001 | Workflow Engine | Unified state machine for document workflows |
|
||||
| ADR-002 | Doc Numbering | Redis Redlock + DB optimistic locking |
|
||||
| ADR-005 | Technology Stack | NestJS 11 + Next.js 16.2.0 + MariaDB + Redis |
|
||||
| ADR-006 | Redis Caching | Cache strategy and invalidation patterns |
|
||||
| ADR-008 | Email Notification | BullMQ queue-based email/LINE/in-app |
|
||||
| ADR-009 | DB Strategy | No TypeORM migrations — modify schema SQL directly |
|
||||
| ADR-010 | Logging/Monitoring | Prometheus + Loki + Grafana stack |
|
||||
| ADR-011 | App Router | Next.js 16.2.0 App Router with RSC patterns |
|
||||
| ADR-012 | UI Components | Shadcn/UI component library |
|
||||
| ADR-013 | Form Handling | React Hook Form + Zod validation |
|
||||
| ADR-014 | State Management | TanStack Query (server) + Zustand (client) |
|
||||
| ADR-015 | Deployment | Docker Compose + Gitea CI/CD |
|
||||
| ADR-016 | Security | JWT + CASL RBAC + Helmet.js + ClamAV |
|
||||
| ADR-017 | Ollama Migration | Local AI + n8n for legacy data import |
|
||||
| ADR-018 ★ | AI Boundary (Patch 1.8.1) | AI isolation — no direct DB/storage access |
|
||||
| ADR-019 ★ | Hybrid Identifier Strategy | INT PK (internal) + UUIDv7 (public API) |
|
||||
| ADR | Topic | Key Decision | สถานะ |
|
||||
| ---------- | ------------------------------- | --------------------------------------------------------- | -------- |
|
||||
| ADR-001 | Workflow Engine | Unified state machine for document workflows | ✅ Active |
|
||||
| ADR-002 | Doc Numbering | Redis Redlock + DB optimistic locking | ✅ Active |
|
||||
| ADR-003 | API Design | RESTful API design strategy | ✅ Active |
|
||||
| ADR-004 | DB Schema Design | Schema design patterns & normalization | ✅ Active |
|
||||
| ADR-005 | Technology Stack | NestJS 11 + Next.js + MariaDB + Redis | ✅ Active |
|
||||
| ADR-006 | Redis Caching | Cache strategy and invalidation patterns | ✅ Active |
|
||||
| ADR-007 | Error Handling | Layered error classification + user-friendly messages | ✅ Active |
|
||||
| ADR-008 | Email Notification | BullMQ queue-based email/LINE/in-app | ✅ Active |
|
||||
| ADR-009 | DB Strategy | No TypeORM migrations — modify schema SQL directly | ✅ Active |
|
||||
| ADR-010 | Logging/Monitoring | Prometheus + Loki + Grafana stack | ✅ Active |
|
||||
| ADR-011 | App Router | Next.js App Router with RSC patterns | ✅ Active |
|
||||
| ADR-012 | UI Components | Shadcn/UI component library | ✅ Active |
|
||||
| ADR-013 | Form Handling | React Hook Form + Zod validation | ✅ Active |
|
||||
| ADR-014 | State Management | TanStack Query (server) + Zustand (client) | ✅ Active |
|
||||
| ADR-015 | Deployment | Docker Compose + Gitea CI/CD + Blue-Green | ✅ Active |
|
||||
| ADR-016 | Security | JWT + CASL RBAC + Helmet.js + ClamAV | ✅ Active |
|
||||
| ADR-017 | Ollama Migration | Local AI + n8n for legacy data import | ✅ Active |
|
||||
| ADR-017B | AI Document Classification | ML classification for document categorization | ✅ Active |
|
||||
| ADR-018 ★ | AI Boundary (Patch 1.8.1) | AI isolation — no direct DB/storage access | Superseded by ADR-023 |
|
||||
| ADR-019 ★ | Hybrid Identifier Strategy | INT PK (internal) + UUIDv7 (public API) | ✅ Active |
|
||||
| ADR-020 | AI Intelligence Integration | AI integration pipeline architecture | ✅ Active |
|
||||
| ADR-021 ★ | Integrated Workflow Context | Workflow Engine & step-specific attachments | ✅ Active |
|
||||
| ADR-022 | Retrieval Augmented Generation | RAG architecture for document search | ✅ Active |
|
||||
| ADR-023 ★ | Unified AI Architecture | Consolidates ADR-017/017B/018/020/022 | ✅ Active |
|
||||
| ADR-023A ★ | AI Model Revision | 2-Model stack + BullMQ 2-Queue + OCR auto-detect | ✅ Active |
|
||||
| ADR-024 ★ | Intent Classification Strategy | AI intent classification for user queries (2026-05-19) | ✅ Active |
|
||||
| ADR-025 ★ | AI Tool Layer Architecture | Tool layer pattern for AI capability composition | ✅ Active |
|
||||
| ADR-026 ★ | Document Chat UI Pattern | Document-centric chat UI (2026-05-19) | ✅ Active |
|
||||
| ADR-027 ★ | AI Admin Console & Dynamic Ctrl | AI Admin Panel + dynamic model/prompt control (2026-05-20) | ✅ Active |
|
||||
| ADR-028 ★ | Migration Architecture Refactor | Staging Queue & post-migration cleanup (2026-05-22) | ✅ Active |
|
||||
|
||||
> **Priority:** `06-Decision-Records` > `05-Engineering-Guidelines` > others
|
||||
|
||||
Reference in New Issue
Block a user