KB-1382
Handoff S185 → S186 — G8A PASS + Gate Design PASS
6 min read Revision 1
handoffs185s186g8agate-designp9
Handoff S185 → S186
Phiên: S185 (Miếng 9) Ngày: 2026-04-28 Opus: thực thi + điều hành agent GPT: định hướng, phản biện, giám sát (nhiều vòng review) User: ý tưởng, nguyên tắc, mục tiêu, authorize, dispatch agent
1. Tóm tắt 1 câu
S185 hoàn thành G8A v0.3 GPT PASS (Directus 11 policy model) + Production DDL/Collection Gate Design v0.2 GPT PASS (6 lỗi phát hiện qua probe, 7 sửa đổi) — P9 Gate vẫn 10/12, thêm 2 tài liệu thiết kế quan trọng cho production migration.
2. Quyết định kỹ thuật cụ thể
| Quyết định | Chi tiết | GPT round |
|---|---|---|
| Directus 11 dùng 3-layer: Role→Access→Policy→Permissions | Thay legacy Role→Permissions, phát hiện qua G8A-0 probe | G8A-0 probe |
tac-agent-policy API-only (app_access=false) |
Theo pattern AI Agent role hiện có |
G8A v0.3 |
tac-admin-policy app_access=DECISION PENDING |
Không giả định UI access, chờ explicit decision | G8A v0.3 GPT |
| Gate A/B/C tách riêng | A=DDL, B=Collections, C=Seed — không gộp 1 prompt | Gate Design GPT |
| Gate B: auto-introspect + POST meta-only | Directus tự phát hiện PG tables, POST chỉ thêm UI metadata | Probe check #5 |
| Gate B pre-check: read-only verify, không POST | POST là mutation, không thuộc pre-check | GPT final patch |
| Gate B execution: sequential (1 đầu → verify → 13 còn lại) | Rollback dễ hơn nếu fail sớm | GPT final patch |
| fn_tac_log_checker_issue whitelist | Đã tồn tại từ E-R3, pre-check expect 1 before / 7 after Gate A | Probe check #2 |
| /tmp DDL bundle: EXISTS + SHA MATCH nhưng phải persist | /tmp ephemeral, canonicalize trước execution | Probe check #3 + GPT |
| Seed retarget p9_g6_dryrun → public + recompute SHA | Dry-run manifest tách riêng production manifest | Probe check #4 |
3. Sai lầm + bài học
| Sai lầm | Anti-pattern | Bài học |
|---|---|---|
| Gate Design v0.1 liệt kê 6/6 function names sai | AP-EVIDENCE-BLIND | Luôn đối chiếu action log, không liệt kê từ memory |
| Pre-check P2 expect fn_tac_* = 0 | AP-EVIDENCE-BLIND | Phải kiểm tra existing objects trước khi viết expected counts |
| Gate B pre-check có POST (mutation) | Nhầm scope | Pre-check = read-only, mutation thuộc execution phase |
| Agent check /tmp chạy local Mac thay VPS | Prompt chưa rõ | Nói rõ "SSH vào VPS contabo" trong prompt |
| Tạo artifact riêng cho prompt tiny | Gây nhầm lẫn UI | Prompt nhỏ gửi inline, không tạo artifact |
4. Dữ liệu có con số
| Metric | Value |
|---|---|
| G8A revisions | v0.1 → v0.2 → v0.3 (3 versions, GPT PASS final) |
| G8A-0 probe checks | 5/5 CLEAR |
| Directus version | 11.5.1, Policies model |
| Existing Directus roles | 7 (tac-agent/tac-admin NOT present) |
| Existing Directus collections | 190 user (no tac_*) |
| Gate Design v0.1 lỗi phát hiện | 6 (2 nghiêm trọng: function names + pre-check) |
| Gate Design patches | 7 sửa đổi qua 3 vòng GPT |
| /tmp DDL bundle | EXISTS, SHA MATCH (c23987f2...) |
| Seed files cần retarget | 8/8 (all use p9_g6_dryrun.) |
| P9 Gate | 10/12 PASS (unchanged — G8 + G11 remaining) |
| GPT review rounds (session) | ~8 rounds |
| KB docs created/updated | G8A rev 4, Gate Design rev 1, handoff |
5. Prompt targets phiên S186
| Target | Effort | Executor |
|---|---|---|
| GPT review handoff + direction | — | GPT |
| Draft Gate A Production DDL Execution Prompt | doc-only (medium) | Opus |
| GPT review Gate A prompt | — | GPT |
| Canonical DDL persist sub-step design | doc-only | Opus |
6. Việc tiếp đủ làm ngay
Bước kế tiếp (GPT đã khuyến nghị):
Draft Gate A Production DDL Execution Prompt Design — doc-only, chưa execution:
- Canonical DDL persist/canonicalize sub-step
- Production DDL candidate SHA
- Live pre-checks (P1–P5)
- Backup PF-07 v0.5
- Trigger guard health check
- Explicit whitelist fn_tac_log_checker_issue
- Rollback excluding whitelist
- Action log path
- Không Gate B/C/G8B/G11/P9
Sau Gate A prompt PASS:
- Gate B execution prompt (Directus collection registration)
- Gate C execution prompt (Seed)
- DOT-TAC-ROLE-ENSURE D11 update design
- G8B execution gate
- G11 User final approval
Open decisions (không block Gate A):
- Collection
meta.hiddencho vocab tables tac-adminapp_access(G8A §3.2)- V3–V4 re-verify: adapt from G6 or fresh
- Collection
meta.groupnaming
7. Tài liệu path + rev
| Doc | Path | Rev |
|---|---|---|
| G8A Readiness Design v0.3 | knowledge/dev/laws/dieu38-trien-khai/P9-G8A-directus-roles-readiness-design.md |
rev 4 |
| Gate Design v0.2 | knowledge/dev/laws/dieu38-trien-khai/P9-production-ddl-collection-gate-design.md |
rev 1 |
| Index | knowledge/dev/laws/dieu38-trien-khai/index.md |
rev 2 |
| G6 Run #4 action log | reports/p9-g6-execution-log-run4-2026-04-28.md |
rev 1 |
| Seed manifest | seed-manifest-g6-expected.json |
rev 2 |
| Handoff S184 | tham-khao/handoff-s184-g6-pass-g8a.md |
rev 1 |
GPT reviews (KB, session S185):
gpt-review-g8a-0-probe-prompt-2026-04-28.mdgpt-review-g8a-0-probe-v0-2-final-2026-04-28.mdgpt-review-g8a-0-probe-results-2026-04-28.mdgpt-review-g8a-v0-3-2026-04-28.mdgpt-direction-after-g8a-v0-3-pass-2026-04-28.mdgpt-review-production-ddl-collection-probe-report-2026-04-28.mdgpt-direction-production-ddl-collection-readiness-probe-2026-04-28.mdgpt-review-production-ddl-collection-probe-summary-2026-04-28.mdgpt-review-production-ddl-collection-gate-v0-2-2026-04-28.mdgpt-final-review-production-ddl-collection-gate-v0-2-2026-04-28.md
Phân vai hiện tại
| Vai | Ai | Scope |
|---|---|---|
| Thực thi + điều hành agent | Opus 4.6 (Desktop) | Soạn design/prompt, verify report, update KB |
| Định hướng, phản biện, giám sát | GPT (Council) | Review mọi design trước execution |
| Ý tưởng, nguyên tắc, authorize | User (Anh Huyên) | GO/NO-GO, dispatch agent, chỉ đạo ưu tiên |
Handoff S185 → S186 | 2026-04-28 | Opus 4.6 | G8A PASS + Gate Design PASS, tiếp Gate A prompt