P7C — Sandbox Evidence & P8 Readiness Brief
P7C — Sandbox Evidence & P8 Readiness Brief
Loại: Evidence summary + readiness assessment Phase: P7C (post-sandbox, pre-P8) Trạng thái: OFFICIAL — GPT reviewed. User pending. Ngày: 2026-04-27 | Phiên: S182 Agent soạn: Opus 4.6 (Desktop) GPT review: PASS có điều kiện nhẹ → patched 5 điểm
1. Executive Summary
P7B sandbox prototype đã PASS toàn bộ. Schema P5 v0.2 hoạt động với dữ liệu thật (76 units từ 3 tài liệu thiết kế Đ38). Constraints hold, checkers pass, round-trip lossless, code blocks byte-exact, production untouched.
Sandbox chứng minh: thiết kế kho đúng, hàng vừa kệ, nhãn đúng, lắp lại nguyên vẹn. Sẵn sàng chuyển sang P8 — thiết kế triển khai production. P8 chỉ thiết kế, chưa migrate.
sandbox_tac vẫn là prototype, KHÔNG phải SoT production.
2. Evidence Table
| # | Milestone | Date | Result | Report |
|---|---|---|---|---|
| 1 | P7A dry-run segmentation | 2026-04-26 | PASS — 76 units, 0 ERROR simulated | S182 artifact (P7A Step 1–3 + Step 4–9) |
| 2 | P7B design v0.3 | 2026-04-26 | OFFICIAL — GPT 3 rounds PASS | P7B-sandbox-pg-prototype-design-v0-3.md |
| 3 | C2A preflight + schema | 2026-04-26 | PASS — PF-0→PF-6 all PASS, 8 tables + 3 functions + 2 triggers | reports/p7b-c2a-log-2026-04-26.md |
| 4 | PF-4 automated visibility | 2026-04-26 | PASS — 0/394 Directus collections, search_path NOT SET. Automated via Directus REST API — manual UI không còn là gate chính. | reports/p7b-c2a-pf4-dot-log-2026-04-26.md |
| 5 | C2B seed + verify | 2026-04-27 | PASS — 76+76+3+76 seeded, 0 violations, byte-exact 11/11 | reports/p7b-c2b-seed-verify-log-2026-04-26.md |
Seed summary
| Table | Rows | Status |
|---|---|---|
| section_type_vocab | 11 | ✅ |
| publication_type_vocab | 1 | ✅ |
| logical_unit | 76 (HOWTO: 8, C1A: 34, P5: 34) | ✅ |
| unit_version | 76 (all v1 draft) | ✅ |
| publication | 3 (pilot-v0, proposed) | ✅ |
| publication_member | 76 (DFS render_order) | ✅ |
| change_set | 0 (hook, empty) | ✅ |
| change_set_member | 0 (hook, empty) | ✅ |
Verification summary
| Check | Result |
|---|---|
| Constraint violations (5 checks) | 0 |
| Content hash NULL | 0/76 |
| Content hash recompute mismatch | 0/76 |
| Length flags | 76 normal, 0 soft, 0 hard |
| Round-trip DFS order | 3/3 docs correct |
| DDL byte-exact (8 units) | 8/8 PASS |
| ASCII byte-exact (3 units) | 3/3 PASS (no WARN) |
| Production unchanged | 0 logical_unit-like in public |
Production isolation
| Guard | Verified |
|---|---|
| DML only sandbox_tac.* | ✅ |
| No public.* read/write (except pg_catalog) | ✅ |
| No Directus collection created | ✅ (PF-4 automated) |
| No dot_tools write | ✅ |
| No entity_labels write | ✅ |
| No incomex_metadata write | ✅ |
| No KB source docs modified | ✅ |
3. Constitutional / Cross-law Verdict
| Law | Verdict | Evidence |
|---|---|---|
| NT1 — PG nền tảng | PASS | Sandbox dùng PG. Production SoT unchanged. |
| NT2 — Machine-enforceable | PASS | 8 constraints (UNIQUE, FK, CHECK) + 2 triggers + automated checkers. Không manual gate. |
| NT4 — Config, not hardcode | PASS có điều kiện | Sandbox dùng CHECK enum (acceptable prototype). Production PHẢI chuyển FK vocab nơi governance mở rộng enum. |
| NT11 — Khai tối thiểu | PASS | Không duplicate registry. Labels chỉ proposal, chưa ghi entity_labels. |
| NT13 — PG First | PASS | Sandbox = PG schema. Không workaround. |
| Đ24 — Label Law | PASS | 228 label proposals trong P7A. Không cross-read/write entity_labels. Cần verify facet existence trước P9. |
| Đ32 — APR | PASS | change_set tables = empty hooks. Không APR trong sandbox. |
| Đ33 — PG Law | PASS | directus DB (§0.1). Schema sandbox_tac isolated. DDL via E1 exception. Password GSM (PF-6). Naming snake_case. DOT registration: sandbox C2B dùng Option B (action-log-only) theo prompt đã duyệt. P8 phải formalize DOT registration policy — default hiến pháp = 100% DOT; thiếu DOT thì thiết kế/viết DOT. |
| Đ35 — DOT Governance | PASS | Checkers automated: PF-4 via Directus REST API, C2B verify via SQL queries. Manual UI không còn là gate chính — UI/View chỉ để báo cáo hoặc quan sát. Action logs đầy đủ. |
| P5 — Schema Draft | PASS | 8/8 tables faithful to P5 pseudo-DDL. All constraints match design intent. |
| P6 — Checker Design | PASS | Birth gate + daily invariant subset verified. 0 ERROR. |
Không có vi phạm hiến pháp/luật. NT4 và DOT registration cần hành động trước P9.
4. Observations & Lessons
4.1 Length flag surprise
P7A dự đoán ~7 soft_limit units. Thực tế 0 — tất cả 76 normal. Merged sections vẫn dưới threshold (largest = 550 words, technical_spec soft = 800). Threshold đang hợp lý.
4.2 Trigger Guard DDL detection
VPS event trigger TRIGGER-GUARD phát hiện C2A DDL — informational warning, không lỗi. Production DDL sẽ cần coordinate với guard.
4.3 Vocabulary coverage
11/17 section_type candidates seeded. 6 chưa dùng (article, rationale, checklist, instruction_block, matrix, appendix). Expected — pilot docs là design notes. Round 2 sẽ exercise thêm.
4.4 Component/BOM deferred
P5b (10 tables) chưa sandbox. Round 2 sau P8 design.
4.5 PF-4: Manual UI → Automated API
S182 established precedent: checker gates dùng Directus REST API (GET /collections) thay manual UI. Đây là default cho P8/P9.
5. Risks Remaining Before P8
| # | Risk | Severity | Mitigation |
|---|---|---|---|
| 1 | CHECK enum → FK vocab cho production | Medium | P8 must design FK migration path. |
| 2 | Đ24 facet existence unverified | Medium | Verify facets before P9. |
| 3 | DOT/checker registration policy | Medium | P8 must formalize. Default = 100% DOT. |
| 4 | Component/BOM tables untested | Medium | P5b sandbox deferred to round 2. |
| 5 | Qdrant/vector projection untested | Low | P8 must design async projection. |
| 6 | Write-path for AI/Agent undefined | Medium | P8 must design gateway + approval flow. |
| 7 | Sandbox lifespan undecided | Low | Keep for P8 reference. DROP after P8 approved or 30 days. |
| 8 | TRIGGER-GUARD coordination | Low | Production DDL must coordinate. |
6. P8 Scope Proposal
P8 = Implementation Design Planning. KHÔNG phải production execution.
6.1 Proposed P8 deliverables
| # | Deliverable | Description |
|---|---|---|
| 1 | Production schema hardening | CHECK→FK where governance needs. Enum management policy. |
| 2 | Write-path design | AI/Agent gateway: who can INSERT/UPDATE, via Directus API or direct psql, approval flow. |
| 3 | DOT/checker registration | Formalize P6 checkers trong dot_tools. Cron schedule. Tier assignment. Default = 100% DOT. |
| 4 | Đ24 label integration | Verify/create facets. Design label assignment flow. |
| 5 | Qdrant/KG async projection | Design vector sync trigger, chunk strategy, projection manifest. |
| 6 | Component/BOM sandbox (round 2) | P5b tables sandbox, seed, verify. |
| 7 | Migration/rollback design | Production migration script. Rollback plan. Data backfill strategy. |
| 8 | Đ33 gateway formalization | Register production DDL/DML paths. User/role design. |
| 9 | PASS/FAIL criteria P8→P9 | Define what "ready for production migration" means. |
6.2 P8 does NOT include
Running production DDL, migrating production data, creating Directus collections, modifying existing production schemas, any P9 execution.
6.3 P8 operating model
P8 là multi-step design phase:
- User duyệt mục tiêu + roadmap P8. Trong P8, chỉ escalate về User khi: đổi mục tiêu, đụng production, phát sinh rủi ro/luật/governance lớn.
- Opus (Desktop) điều hành agent trong phạm vi mục tiêu đã duyệt.
- GPT giám sát/phản biện mỗi deliverable.
- Agent thực thi theo prompt Opus soạn.
7. Sandbox Lifecycle Recommendation
| Option | Description | Recommendation |
|---|---|---|
| A — Keep | Keep sandbox_tac for P8 reference + round 2 testing | Recommended |
| B — Archive + DROP | Export data, DROP schema | After P8 design approved |
| C — DROP now | DROP immediately | Not recommended |
Đề xuất: Option A — giữ sandbox_tac cho P8 reference.
8. Not Authorized
| Action | Status |
|---|---|
| Production migration | ❌ NOT AUTHORIZED |
| P8 execution (DDL/DML production) | ❌ NOT AUTHORIZED |
| P9 execution | ❌ NOT AUTHORIZED |
| Sandbox cleanup/DROP | ❌ NOT AUTHORIZED (chờ chỉ đạo) |
| Component/BOM sandbox (round 2) | ❌ NOT AUTHORIZED (chờ P8) |
| Modify existing production schemas | ❌ NOT AUTHORIZED |
| Create Directus collections | ❌ NOT AUTHORIZED |
9. Conclusion
P7 Pilot phase COMPLETE:
P7 plan ✅ → P7A dry-run ✅ → P7B design ✅ → C2A schema ✅ → PF-4 auto ✅ → C2B seed ✅ → P7C evidence ✅
Sandbox prototype chứng minh P5 schema hoạt động. 76 units seeded, 0 violations, byte-exact preservation, production isolated. Sẵn sàng P8 implementation design — khi User approve mục tiêu P8.
Patch log
v1.0 → v1.1 (GPT review, 5 patches)
| # | Điểm | Sửa |
|---|---|---|
| 1 | Trạng thái mâu thuẫn | "OFFICIAL — GPT reviewed. User pending." |
| 2 | DOT registration scope | Option B chỉ cho sandbox C2B. P8 phải formalize. Default = 100% DOT. |
| 3 | Đ35 automated emphasis | PF-4 automated via API. Manual UI không còn gate chính. |
| 4 | "2–3 sessions" estimate | Đổi "multi-step design phase" |
| 5 | Approval wording | User duyệt mục tiêu; Opus điều hành; GPT giám sát; escalate khi cần |
P7C v1.1 | OFFICIAL — GPT reviewed | S182 | 2026-04-27 | Opus 4.6