KB-31A0 rev 2

Handoff S186 → S187 — P9 Complete + P10A Plan + Roadmap

9 min read Revision 2

Handoff S186 → S187

Phiên: S186 | Ngày: 2026-04-28 → 2026-04-29 Opus: thiết kế + điều hành + patch prompts GPT: review/phản biện (nhiều vòng) Codex: thực thi trên VPS


1. Tóm tắt 1 câu

S186 hoàn thành P9 12/12 (GPT technical approval) — triển khai toàn bộ TAC foundation lên production: DDL + collections + seed + roles/permissions + tokens. P10A pilot plan v0.3 đã soạn, chờ GPT final review để bắt đầu cắt thử tài liệu thật.


2. Roadmap tổng — vị trí hiện tại

0. ĐÃ XONG — Không quay lại ✅

LSL-01, L1–L5, C1/C1A/C2/C3, P5/P5b/P6/P7, P7B/P7C sandbox, P8, G6 dry-run, Gate A DDL, Trigger Guard DROP repair.

1. Gate B — Gắn bảng điều khiển Directus ✅ DONE (S186)

Register 14 tac_* collections meta-only. Directus thấy schema PG.

2. Gate C — Nạp từ điển nền ✅ DONE (S186)

Seed 61 vocab/config rows. Hệ thống có lifecycle/type/config chuẩn.

3. G8B — Cấp thẻ vận hành ✅ DONE (S186)

Roles, policies, permissions, tokens cho TAC. Agent/admin biết ai được thao tác gì.

4. G11 — Chủ tịch nghiệm thu ✅ DONE (S186 — GPT technical approval)

GPT chịu trách nhiệm kỹ thuật. User không audit SQL — User sẽ xem kết quả visible ở P10.

5. P9 Closeout — Khóa dây chuyền production ✅ DONE (S186)

P9 12/12 PASS. Index updated. Follow-ups logged: registry/birth/catalog sync, DOT/checker automation ngoài scope.

6. P10 Pilot Cut-and-Render — Cắt thử tài liệu thật ← ĐANG Ở ĐÂY

Lấy 1 điều luật thật (Điều 35 v5.2), cắt thành miếng TAC, đưa vào PG, ghép lại cho User xem.

P10A-1 = segmentation candidate (read-only). P10A-2 = insert + render. P10B = thêm 2 documents nếu P10A PASS.

7. Nuxt Laws Page — Mở showroom ghép tài liệu từ miếng PG ⏳ FUTURE

Tạo/ghép page mới vào https://vps.incomexsaigoncorp.vn/knowledge/laws

Không phải hiển thị từng miếng riêng lẻ. Mục tiêu: ghép các miếng PG lại thành tài liệu/file — ví dụ 1 tài liệu có 10 miếng → page kéo 10 miếng → ghép thành 1 tài liệu đọc được.

Về sau có thể ghép theo các Pivot khác: theo chủ đề, quy trình, component, workflow, bộ luật/phụ lục, nhu cầu vận hành. Pivot-based rendering cần tài liệu thiết kế riêng. Read-only trước; chưa mở edit nếu chưa có review/change-set.

8. Migration rộng — Đưa corpus vào kho miếng thông tin ⏳ FUTURE

Chuyển luật/SOP/KB từ text lớn sang PG unit system. Làm dần, có review/change-set, không bulk overwrite chân lý.

9. KG/Vector sync — Gắn mắt thần cho AI ⏳ FUTURE

Qdrant/KG chỉ là projection/retrieval. PostgreSQL vẫn là SSOT.


Hình tượng cực ngắn:

0. ✅ Đã xây xong nhà máy thử và móng nhà máy thật.
1. ✅ Gate B: gắn bảng điều khiển.
2. ✅ Gate C: nạp từ điển vận hành.
3. ✅ G8B: phát thẻ nhân viên.
4. ✅ G11: chủ đầu tư nghiệm thu (kỹ thuật).
5. ✅ P9 Closeout: khóa dây chuyền.
6. → P10: cắt thử 1 tài liệu thật thành miếng, ghép lại xem đúng không.
7. ⏳ Nuxt Laws Page: mở showroom ghép tài liệu từ miếng PG.
8. ⏳ Migration rộng: đưa toàn bộ nguyên liệu tri thức vào dây chuyền.
9. ⏳ KG/Vector: lắp mắt thần tìm kiếm, nhưng không thay kho gốc.

3. Quyết định kỹ thuật cụ thể (S186)

Quyết định Giá trị
Gate A DDL prompt v0.5 FINAL, 5 vòng GPT, 20+ patches
Trigger guard DROP fix Option A+: object_identity + COALESCE + schema-qualify, DEFINER trên incomex_metadata
Gate B registration PATCH meta (Directus auto-introspected từ Gate A)
Gate C seed retarget source/ giữ nguyên, retargeted/ riêng, candidate SHA logged
G8B-RP permissions 84 tuples (28 agent + 56 admin), full matrix verified (missing=0, extra=0)
G8B-Token emails @incomexsaigoncorp.vn (registry convention), không .local
G8B-Token flow GSM-first → create user without token → PATCH token
GSM secrets DIRECTUS_TAC_AGENT_TOKEN (****3a31), DIRECTUS_TAC_ADMIN_TOKEN (****f7ec)
GSM project github-chatgpt-ggcloud
Directus container name incomex-directus (không phải "directus")
Token env var DIRECTUS_ADMIN_TOKEN (proven Gate B run2)
Execution role DDL directus (psql -U directus -d directus)
Execution role trigger guard workflow_admin (function owner)
P9 closeout GPT technical approval (User không audit SQL)
P10A plan v0.3, tách P10A-1 (read-only) / P10A-2 (insert+render)
P10A pilot document Điều 35 v5.2 FINAL (knowledge/dev/laws/dieu35-dot-governance-law.md)

4. Sai lầm + bài học (S186)

Sai lầm Bài học
Gate A blind sed Controlled transform: xóa scaffold trước, thay tokens sau
Gate A stale CHECK=115 Post-check SQL = source of truth, không dùng số ngoài canonical prompt
Token env var ADMIN_TOKEN sai Đọc infrastructure context pack TRƯỚC soạn prompt
Trigger guard run1 role sai Đọc repair log cũ lấy execution path đã proven
G8B-RP enforce_tfa undocumented API discovery (§1e) mandatory trước mọi POST
G8B-Token .local email rejected Registry convention = @incomexsaigoncorp.vn
GSM secretVersionManager ≠ secrets.create Cần pre-create secrets nếu SA chỉ có version manager
Codex hỏi "chưa có GO" 2 lần Prompt dispatch ghi AUTHORIZED — execute immediately
Codex disconnect giữa chừng Upload action log TRƯỚC khi chạy verification nặng

Pattern chung: đoán thay vì verify → fail → retry. Nguyên tắc: chưa verify thực tế = chưa được coi là đúng.

5. Dữ liệu có con số (production state)

Metric Count
tac_* tables 14
fn_tac_* functions 7 (6 new + 1 whitelist)
trg_tac_* triggers 6
Seed rows (8 vocab/config) 61
Core/member rows (6 tables) 0 (chưa có data thật)
Directus collections 14
TAC roles 2 (tac-agent, tac-admin)
TAC policies 2
TAC permissions 84 (28 agent + 56 admin)
TAC users 2 (@incomexsaigoncorp.vn)
GSM tokens 2
P9 Gate 12/12 PASS
GPT review reports (S186) ~20 documents
Action logs (S186) ~10 documents

6. Prompt targets S187

# Target Status
1 GPT final review P10A v0.3 Pending — việc đầu tiên
2 P10A-1 dispatch (read-only: schema discovery + segmentation candidate Điều 35) Sau GPT review
3 GPT review segmentation candidate Sau P10A-1
4 P10A-2 dispatch (insert Điều 35 + render cho User xem) Sau GPT approve + User GO
5 User review visible result (original vs reassembled + diff) Sau P10A-2
6 P10B (thêm 2 documents) nếu P10A PASS Sau User review

7. Tài liệu path + rev

Canonical prompts (KB):

Document Path Rev
Gate A prompt P9-gate-a-production-ddl-execution-prompt.md v0.5 FINAL
Gate A errata P9-gate-a-errata.md rev 1
G8A design P9-G8A-directus-roles-readiness-design.md v0.3
Gate design (A/B/C) P9-production-ddl-collection-gate-design.md v0.2
G8B-RP prompt P9-G8B-RP-directus-roles-permissions-execution-prompt-v0-2.md rev 2
G8B-Token prompt P9-G8B-Token-provisioning-prompt-v0-4.md rev 1
P9 closeout reports/p9-technical-closeout-gpt-approval-2026-04-29.md rev 1
Index index.md rev 4 (cần update rev 5 với P9 12/12 + roadmap)

Action logs (S186):

Gate Path
Gate A reports/p9-gate-a-production-ddl-execution-log-2026-04-28.md
Trigger guard investigation reports/p9-trigger-guard-drop-bug-investigation-2026-04-28.md
Trigger guard repair reports/p9-trigger-guard-drop-repair-log-2026-04-28-run2.md
Gate B reports/p9-gate-b-directus-collection-registration-log-2026-04-28-run2.md
Gate C reports/p9-gate-c-seed-log-2026-04-28.md
G8B-RP reports/p9-g8b-directus-roles-permissions-log-2026-04-29.md
G8B-RP re-verify reports/p9-g8b-rp-readonly-reverify-2026-04-29.md
G8B-Token reports/p9-g8b-token-provisioning-log-2026-04-29-run4.md

P10A plan (artifact — chưa upload KB):

P10A v0.3 nằm trong artifact conversation S186. Upload KB khi GPT final review PASS.

Handoff:

tham-khao/handoff-s186-p9-complete-p10a-plan.md (file này)


Handoff S186 → S187 | 2026-04-29 | Opus 4.6 P9 12/12 PASS. Next: P10A pilot cắt thử Điều 35.