KB-2623 rev 2

G6 PASS → Production Candidate Pack / G8 Readiness v0.2 — DRAFT (patched R37)

6 min read Revision 2

G6 PASS → Production Candidate Pack / G8 Readiness

Status: DRAFT v0.2 (patched per GPT R37) — doc-only, không mutation Phiên: S184 | Ngày: 2026-04-28 P9 Gate: 10/12 PASS | Còn lại: G8 (Directus roles) + G11 (User approval) Scope: Trích artifact tái sử dụng từ G6 + kế hoạch G8 + roadmap P9 production


⚠️ WARNING — DOC NÀY KHÔNG AUTHORIZE

Hành động Authorized?
Production DDL (CREATE TABLE trong public) ❌ — cần gate riêng
Directus collection creation ❌ — cần gate riêng
Role/permission creation (G8B) ❌ — cần gate riêng
Token provisioning GSM ❌ — cần gate riêng
Cron activation ❌ — cần gate riêng
P9 production migration execution ❌ — cần G11 User approval
Doc-only analysis / design ✅ — chỉ scope này

G6 PASS chỉ chứng minh dry-run hoạt động. Chưa authorize production mutation nào.


1. G6 PASS Evidence Summary

Metric Value
Run #4 / 2026-04-28
DDL 14 tables, 17 FK, 5 UNIQUE, 115 CHECK, 41 indexes
Functions 6 (SECURITY DEFINER + search_path locked)
Triggers 6
Seed 61 rows, SHA-256 COMPUTED
V1–V4 ALL PASS (V3 SQLSTATE 8/8, V4 isolation 0 violations)
Rollback DROP CASCADE → residue=0
Action log reports/p9-g6-execution-log-run4-2026-04-28.md (25,355 chars)

2. Artifacts tái sử dụng từ G6

Artifact Path/Location Reusable? Cần adapt
DDL bundle (14 tables + indexes) VPS /tmp/g6_run4.../ddl/g6_execution_bundle.sql (SHA c23987f2...) schema p9_g6_dryrunpublic
6 functions + 6 triggers Trong DDL bundle search_path → public, pg_catalog
8 seed SQL files KB seed-g6/seed-tac-*.sql (8 SHA-256 COMPUTED) schema qualify → public
Seed manifest KB seed-manifest-g6-expected.json rev 2 hash verify unchanged
V1–V4 verification harness VPS /tmp/g6_run4.../verify/ schema reference → public

3. Dry-run scaffolding phải loại bỏ

Scaffold Lý do
Schema p9_g6_dryrun references Production = public (Đ33 §0.1)
SET search_path TO p9_g6_dryrun, pg_catalog Production = public, pg_catalog
Rollback DROP SCHEMA CASCADE Production rollback khác (P8 §8.3)
Probe wrappers (v0.3–v0.6) Dry-run operational only
V3 adaptations (V3-02 retarget, V3-07 address) Verify lại trên production
Smoke test tmp schemas Không cần

4. G8 — TÁCH G8A (design) VÀ G8B (execution)

4.0 Phân biệt

G8A — Design/Readiness G8B — Execution
Loại Doc-only, read-only Mutation (role creation, permission assignment)
Khi nào Ngay — không cần collections tồn tại Sau production DDL + Directus collections
Output Role definitions, permission matrix, collection dependencies, gate requirements Roles created, tokens provisioned, DOT-TAC-ROLE-VERIFY PASS
Authorize Nằm trong scope doc này Cần gate riêng

4.1 G8A — Readiness Design (LÀM ĐƯỢC NGAY)

Mục tiêu: Thiết kế thẻ nhân viên trước khi nhà máy thật tồn tại.

Deliverable Status
Role definitions: tac-agent (CRUD), tac-admin (full + DDL) P8 §2.5 đã define
Permission matrix: role × collection × CRUD Cần soạn chi tiết
Collection dependency list: 14 collections nào cần trước G8B Cần xác nhận
Token provisioning plan (GSM paths, rotation) Cần soạn
DOT-TAC-ROLE-ENSURE script readiness DOT registered (E7), script chưa implement
Gate requirements + PASS/FAIL criteria P8 §3.4 đã define

4.2 G8B — Execution (CHỈ SAU PRODUCTION DDL + COLLECTIONS)

Dependency chain:

G6 PASS ✅ (dry-run proven)
  → [GATE] Production DDL: 14 tables + 6 functions/triggers trong public
  → [GATE] Directus collections: DOT-TAC-COLLECTION-REGISTER cho 14 tables
  → [GATE] G8B: Roles + permissions via DOT-TAC-ROLE-ENSURE
  → [GATE] Seed + crons + verify
  → [GATE] G11: User final approval

G8B KHÔNG chạy được trước collections (P8 §3.6).

4.3 G8 PASS criteria (P8 §3.4, cho G8B)

# Criterion
1 tac-agent role exists với CRUD on 14 tac_* collections
2 tac-admin role exists với full access on tac_*
3 Tokens provisioned via GSM
4 DOT-TAC-ROLE-VERIFY PASS

5. Dependency Questions — CẦN GIẢI QUYẾT

# Câu hỏi Impact Status
1 Roles có tạo trước collections được không? (role shell rỗng → add permissions sau) Có thể giảm bước G8B → 2 phases Chưa investigate
2 Permission templates có prepare trước được không? (JSON template → apply khi collections tồn tại) Accelerate G8B Chưa investigate
3 Exact collections nào cần trước G8B? (tất cả 14 hay subset?) Scope G8B 14 per P8 §1.4
4 G11 là approval cho toàn bộ production migration hay chỉ final sign-off? Gate placement Tier 3 §4.2 nói "after all 11/12 gates PASS"
5 Production entry gate cần design riêng hay dùng G6 bundle adapt? Effort Chưa chốt

6. KHÔNG thực hiện trong doc này

Cấm
Production DDL/DML
Directus role/collection creation
G8B execution
G11 request
P9 migration execution
Cron activation
Token provisioning

Production Candidate Pack / G8 Readiness v0.2 | S184 | 2026-04-28 | Doc-only DRAFT Patched per GPT R37: G8A/G8B split, warning, dependency questions Chờ GPT/User review trước khi bước tiếp