P44-5 — Update Mechanism + DOT Contract Matrix Realization
P44-5 — Update Mechanism + DOT Contract Matrix Realization
Trạng thái: P44-5A POLISH | Phiên: S190 (2026-05-02) Authority: Đ44 v0.1.2 controlled DRAFT (chưa enacted) — §6 (Cơ chế tự cập nhật) + §9 (Enforcement + DOT cặp + Conformance) Path đề xuất (sau User+GPT confirm):
knowledge/dev/laws/dieu44-trien-khai/design/06-update-mechanism-dot-contract-matrix.mdPhụ thuộc: P44-0 README rev 1, P44-1 Family Registry rev 1, P44-2 SCMR rev 1, P44-3 Profile Registry rev 1, P44-4A Relation/Composition Edge Conformance rev 1, P38-XC final rev 1 Nguồn nền: Đ44 v0.1.2 §6 + §9, Đ35 v5.2 DOT Governance pattern (dot_registry, paired writer/checker, fix_repair_dot flow), Đ22 v1.2 self-healing pattern (detect_query + auto_fix_action + autofix_enabled + re-check + system_issues lifecycle), Đ0-B v3.1 §I-C + §IV Outline: P44-5 outline PASS (S190) → outline polish PASS (S190) sau 4 chỉnh sửa GPT bắt buộc + Q1-Q9 Workflow: outline → outline polish PASS → full draft → P44-5A polish 3 điểm GPT (đang đây) → User+GPT confirm → upload (KHÔNG upload trước xác nhận, theo guardrail GPT) P44-5A polish (S190 2026-05-02) áp dụng 3 chỉnh sửa GPT: (1) INV-DUAL-2 siết 6 guard tương đương INV-DUAL-1 (universal_edges là SSOT direction đúng nhưng vẫn cần guard chặt cho helper schema); (2) §6.2 familypublicationLV-4 wording sửa — ghi rõgoverned_by/governs+published_in/publisheslà candidate, defer APR/P44-6 + Authority Map/Đ37 alignment; (3) Đổi prefixRole:→Procedure:cho 2 one-shot controlled procedure ở §12 (TD-44-2 + TD-44-3) — phân biệt rõ với DOT recurring.
§0. Tóm tắt 5 dòng cốt lõi
- P44-5 hiện thực hóa logical contract của P44-4A thành Update Mechanism + DOT Contract Matrix cho Cap-4 Relation và Cap-5 Composition. Logical only: Role label cho DOT recurring + Procedure label cho one-shot, không code, không DDL, không migration script, không schedule cụ thể.
- 3 tầng kiểm + 5 mechanisms (Đ44 §9.1 + §6.B) áp dụng cho edge entries: Completeness (birth gate), Correctness (4 audit chiều A1-A4 per-edge), Consistency (cross-object + INV-DUAL + cycle detection), Optional Enrichment (INFO không block).
- Auto-fix conservative theo Đ22 pattern:
autofix_enabledstart-OFF, opt-in sau APR/pilot. A1/A2/A4/cycle/provenance missing/INV-DUAL-1 = KHÔNG auto-fix mặc định; chỉ A3 missing reverse + INV-DUAL-3 status sync = auto-fix với precondition rõ. INV-DUAL-1 default = quarantine + escalate, KHÔNG auto-fill universal_edges từ helper (universal_edges là SSOT). INV-DUAL-2 auto-fill helper từ universal_edges chỉ khi đủ 6 guard chặt (SSOT direction đúng nhưng helper schema phải bảo vệ). - Anti-mutation guardrail 2 layer: edge conformance checker (Cap-4/5 checker) chỉ audit + flag + escalate; cascade retire thuộc Object lifecycle mechanism / Đ4, KHÔNG thuộc edge checker. Reverse-index P1 pilot-only; threshold P1→P2→P3 defer P44-6.
- Unlock Tier 4 P38-XC + Đ44 Conformance Clause C5 cho 2 family pilot TAC (
information_unit+publication). DOT names thực + schedule cụ thể + threshold số = defer P44-6/APR. TD-44-2/TD-44-3 = Procedure: one-shot controlled procedure / runbook, KHÔNG đăng ký DOT thật trong P44-5.
§1. Mục đích + ranh giới P44-5
1.1 P44-5 LÀM (14 việc)
| # | Việc | Tham chiếu | Section |
|---|---|---|---|
| 1 | Inputs inherited từ P44-4A + Đ44 + Đ35 + Đ22 + P38-XC | — | §2 |
| 2 | Update Mechanism logical design: 3 tầng kiểm + 5 mechanisms + decision tree event-driven | Đ44 §9.1 + §6.B | §3 |
| 3 | DOT Contract Matrix Cap-4 Relation (Role label only) | P44-4A §10.2 | §4 |
| 4 | DOT Contract Matrix Cap-5 Composition (Role label only) + Dual transitional instances | P44-4A §5 + §7.7.3 | §5 |
| 5 | Writer/Checker responsibility matrix tổng hợp + mapping LV-1..LV-5 + Tier 1 PASS Item 4 | Đ44 §6.A | §6 |
| 6 | Event model / Schedule model / Hybrid + trade-off | Đ44 §6.B + Đ35 trigger/cron | §7 |
| 7 | Auto-fix vs Escalate policy logical (autofix_enabled start-OFF; INV-DUAL-1 quarantine default; INV-DUAL-2 auto-fill candidate với 6 guard) | Đ22 + P44-4A §7.7.2 | §8 |
| 8 | Anti-drift enforcement for Dual transitional (INV-DUAL-1..4 + sunset path) | P44-4A §7.7.3 + §7.7.4 | §9 |
| 9 | Reverse-index P1/P2/P3 decision framework (threshold defer P44-6) | P44-4A §6.3 | §10 |
| 10 | Recursive audit / Cycle detection contract (depth ≤ 4 + auto-fix NONE) | P44-4A §5.6 + §11 | §11 |
| 11 | TD-44-2 / TD-44-3 handoff boundaries (Procedure: one-shot controlled procedure, KHÔNG DOT thật) | P44-4A §8 + §9 | §12 |
| 12 | OPEN / Technical Debt phát sinh từ P44-5 (10 OPEN + 6 TD) | — | §13 |
| 13 | Recap kỷ luật scope cuối + phép thử | — | §14 |
| 14 | Handoff after P44-5 (Đ44 enacted → P44-6 → pilot) | Đ44 §10.3 | §15 |
1.2 P44-5 KHÔNG LÀM (8 guardrails — kỷ luật scope nghiêm)
7 guardrails self-imposed từ outline polish + 1 guardrail Role/Procedure label.
- KHÔNG đặt tên DOT cụ thể, KHÔNG dùng placeholder snake_case giống DOT registry pattern (vd
{cap5_dual_sync_*},dot_universal_edges_*). Chỉ dùng Role label với prefixRole:cho DOT recurring (writer/checker/maintainer) + Procedure label với prefixProcedure:cho one-shot controlled procedure (TD-44-2 + TD-44-3). DOT name cụ thể chốt P44-6/APR. - KHÔNG code, KHÔNG DDL, KHÔNG ALTER TABLE, KHÔNG migration script, KHÔNG mutate production.
- KHÔNG execute audit query trên production (kể cả read-only). Cần execute → soạn prompt agent riêng sau khi User cho phép.
- KHÔNG patch Đ44, Đ35, Đ22, Đ4, Đ0-B, P44-1/2/3/4A, P38-XC. P44-5 chỉ realize logical contract đã có; không amend luật/design.
- KHÔNG mở rộng sang Đ39 KG, Qdrant projection schema, BPMN Đ34 workflow design, NĐ-36-01 entity_relations chi tiết. Defer post-Tier 4.
- KHÔNG chốt phút/giờ schedule cụ thể (vd "5 phút", "daily 02:00 UTC"). Chỉ chốt logical category (event-driven / hot path / cold path / weekly).
- KHÔNG chốt threshold số cụ thể cho reverse-index P1→P2→P3 (vd edge count number, query/sec, latency ms). Defer P44-6 + benchmark.
- KHÔNG upload first draft. Chờ User + GPT review polish round (P44-5A) trước upload.
1.3 Phép thử nhanh sa đà
Nếu thấy đang viết một trong các thứ sau → dừng + báo lại:
- Tên DOT thật (vd
dot_universal_edges_writer,DOT-XXX). - Snake_case placeholder dài giống DOT registry (vd
{cap5_dual_sync_tac_publication_member}). - DDL (
CREATE TABLE,ALTER TABLE,CREATE FUNCTION). - Schema chi tiết tên cột PG cho universal_edges hoặc helper table.
- Schedule cụ thể (vd "cron 0 */6 * * *", "daily 02:00").
- Threshold số (vd "P99 > 100ms", "edge count > 10000").
- Audit query thực (kể cả
SELECTread-only). - Migration script cho 2199 legacy edges.
- Workflow design BPMN cho edge promotion.
§2. Inputs inherited from P44-4A + Đ44 + Đ35 + Đ22 + P38-XC
2.1 Từ P44-4A (logical contract đã chốt — KHÔNG repeat content)
| ID | Item | Reference P44-4A |
|---|---|---|
| I-44A-1 | 8 logical fields E1-E8 cho edge entries (composite ref + provenance + status + valid_time) | §4 |
| I-44A-2 | 8 invariants INV-E1..E8 (id unique, ref resolvable, edge_type valid, provenance post-Đ44, status ≥ 2 state, symmetric reverse, composition family valid, cycle ≤ 4) | §4.5 |
| I-44A-3 | 8 Core + 3 Candidate edge types vocab logical | §3 |
| I-44A-4 | 4 audit chiều A1-A4 (orphan source / orphan target / missing reverse / vocab violation) | §10.1 |
| I-44A-5 | INV-DUAL-1..4 anti-drift 2 chiều cho Dual transitional | §7.7.3 |
| I-44A-6 | Sunset path 4 conditions C1-C4 + 2 exit paths E1/E2 + audit định kỳ 6 tháng | §7.7.4 |
| I-44A-7 | Reverse-index 3 patterns P1/P2/P3 + P1 pilot-only siết | §6.2 + §6.3 |
| I-44A-8 | Composition Cap-5 align Đ0-B 7 lớp + composition_role + granularity_level + CYCLE detection depth ≤ 4 | §5 |
| I-44A-9 | Tier 1 PASS criteria 6 items checklist | §12.2 |
| I-44A-10 | Anti-pattern Living DB query (cấm UNION 2 nguồn, cấm fallback to helper) | §12.1 |
| I-44A-11 | OPEN P44-4-α..θ + TD P44-4-1..6 inherited | §13 |
| I-44A-12 | Defer table 12 items (storage format, physical column, DOT name, schedule, threshold...) | §15.4 |
2.2 Từ Đ44 v0.1.2 controlled DRAFT
| ID | Item | Reference Đ44 |
|---|---|---|
| I-44-1 | 5 mục tiêu sống LV-1..LV-5 (Là ai / Thuộc / Nói gì / Liên quan / Ai dùng) | §6.A |
| I-44-2 | Decision Tree 5 mechanisms (Trigger / DOT cặp / Job/cron / Workflow BPMN / Agent extraction) | §6.B |
| I-44-3 | Maturity Levels M0-M4 (Manual / Trigger-only / DOT-paired / Self-healing / Cross-cutting) | §6.C |
| I-44-4 | 3 tầng kiểm Completeness / Correctness / Consistency + Optional Enrichment | §9.1 |
| I-44-5 | DOT cặp NT12 (writer + checker, family thiếu 1 chiều = vi phạm) | §9.2 |
| I-44-6 | Schema Conformance Audit (DOT định kỳ audit SCMR) | §9.3 |
| I-44-7 | Birth gate cho Object mới (5 yêu cầu) | §9.4 |
| I-44-8 | Đ44 Conformance Clause C1-C5 (OQC, G1-G12 mapping, Family Registry entry, Relation Layer integration, Cơ chế cập nhật) | §9.5 |
| I-44-9 | NS-1..NS-5 nguyên tắc SSOT Schema | §1 |
2.3 Từ Đ35 v5.2 DOT Governance (pattern reference, không đọc full)
| ID | Item | Pattern reference |
|---|---|---|
| I-35-1 | dot_registry pattern: dot_id, tier (A/B/C), domain, op, class, trigger, cron, paired, coverage, last_executed, file path | dot_registry schema |
| I-35-2 | DOT cặp paired pattern: writer (động cơ chính) + checker (động cơ phụ) | NT12 + Đ35 §3 |
| I-35-3 | Flow fix_repair_dot end-to-end + verify 3 tầng + ADMIN fallback có audit |
Đ35 v5.2 |
| I-35-4 | DOT registration qua APR (Đ32) | Đ35 §5 |
2.4 Từ Đ22 v1.2 Self-healing (pattern reference, không đọc full)
| ID | Item | Pattern reference |
|---|---|---|
| I-22-1 | Pattern detect → auto_fix_action → re-check → confirm → close issue | Đ22 §A+5 |
| I-22-2 | autofix_enabled config guard per rule (kill switch human có thể tắt) |
Đ22 §A+4 |
| I-22-3 | Cron + register pattern (Đăng ký dot_tools) | Đ22 §A+6 |
| I-22-4 | system_issues lifecycle (open/resolved/archived + reopen_count + auto_close config) |
Đ22 §1.1 |
| I-22-5 | HC-TRIGGER: PL/pgSQL Appendix A2; guard autofix_enabled | Đ22 Appendix A2 |
2.5 Từ P38-XC §8 (capability matrix reference)
| ID | Item | Reference P38-XC |
|---|---|---|
| I-XC-1 | Capability matrix Cap-1..5 (Identity / Lifecycle / Profile / Relation / Composition) | §8 |
| I-XC-2 | Cap-1/2/3 (Identity/Lifecycle/Profile) đã được P44-1 + P44-3 cover qua Family Registry + Profile Registry — P44-5 KHÔNG repeat, chỉ tham chiếu | §8 + P44-1 + P44-3 |
| I-XC-3 | Reverse-index responsibility logical (Q3 + Q5 reverse) | §8.1 |
| I-XC-4 | Recursive audit terminal cap defer (OPEN P38-X-15) | §8 |
2.6 Tổng hợp boundary
P44-5 realize cho Cap-4 + Cap-5 (theo Q1 GPT đã PASS). Cap-1/2/3 chỉ tham chiếu — KHÔNG mở rộng. KHÔNG xâm phạm P44-1 (Family Registry) hoặc P44-3 (Profile Registry) scope.
§3. Update Mechanism logical design — 3 tầng kiểm + 5 mechanisms + decision tree
3.1 3 tầng kiểm cho edge entries (realize Đ44 §9.1 + Conformance Clause C5)
Nguyên tắc: Đ44 §9.1 đã chốt 3 tầng cho mọi family. P44-5 áp dụng cho edge entries (Cap-4 Relation + Cap-5 Composition).
3.1.A Completeness (INSERT/birth path) — block mặc định nếu fail
| Check | Tiêu chí | Hành động khi fail |
|---|---|---|
| C-1 Identity | E1 edge_id unique, immutable |
Block INSERT |
| C-2 Endpoint resolve | E2 source_ref + E3 target_ref resolve về Object thoả OQC ≥ 3/4 (Đ44 §2.2) |
Block INSERT |
| C-3 Edge type valid | E4 edge_type ∈ vocab framework (8 Core + 3 Candidate + APR-extended) + match namespace (Đ44 §5 vs NĐ-36-01) |
Block INSERT |
| C-4 Provenance post-Đ44 | E6 provenance đầy đủ (creator + method + source_context + timestamp) — bắt buộc post-Đ44 enacted |
Block INSERT (legacy edges grace period theo Đ44 §5.4 + TD-44-3) |
| C-5 Status init | E7 status ∈ {proposed, active}; default theo provenance method |
Block INSERT |
| C-6 Family resolved | Source/target family_code đăng ký trong Family Registry (P44-1) | Block INSERT |
Reference: Đ44 §9.4 (Birth gate cho Object mới) + Đ44 §5.4 (Edge governance post-Đ44 provenance bắt buộc). P44-5 KHÔNG tạo birth gate riêng cho edge — tham chiếu hiện hành.
3.1.B Correctness (sau INSERT, schedule periodic)
| Check | Tiêu chí | Audit chiều P44-4A | Hành động khi fail |
|---|---|---|---|
| Co-1 | Source resolve về Object hợp lệ (chưa retired) | A1 | Mark edge quarantine, log issue, escalate (KHÔNG auto-fix — xem §8.2) |
| Co-2 | Target resolve về Object hợp lệ | A2 | Mark edge quarantine, log issue, escalate |
| Co-3 | Edge type vocab violation | A4 | Block edge update, log issue, escalate APR |
| Co-4 | Provenance valid | (post-Đ44 only) | Mark quarantine, escalate |
| Co-5 | Endpoint OQC ≥ 3/4 | A1+A2 | Mark quarantine, log + escalate |
3.1.C Consistency (cross-object, daily/weekly)
| Check | Tiêu chí | Audit chiều / INV | Hành động khi fail |
|---|---|---|---|
| Cs-1 | Symmetric edges có cả 2 entries (contradicts, compatible_with) |
A3 | Auto-fix (DOT auto-create reverse) — nếu autofix_enabled=true (default OFF, opt-in sau APR/pilot); else log + escalate |
| Cs-2 | Reverse-index sync với forward edges | (P38-XC §8.1) | Schedule re-build (P2) hoặc trigger fix (P3); pilot P1 chỉ verify health |
| Cs-3 | INV-DUAL-1 (helper row có nhưng universal_edges thiếu) | INV-DUAL-1 | Default quarantine + escalate, KHÔNG auto-fill universal_edges (xem §8.2 + §9.3 — siết theo P44-4A §7.7.2 SSOT) |
| Cs-4 | INV-DUAL-2 (universal_edges có nhưng helper thiếu) | INV-DUAL-2 | Auto-fill candidate với 6 guard chặt (SSOT direction đúng nhưng vẫn cần guard helper schema) — xem §8.2 + §9.4 |
| Cs-5 | INV-DUAL-3 (status mismatch giữa 2 nguồn) | INV-DUAL-3 | Auto-sync theo SSOT (universal_edges) — autofix_enabled=true |
| Cs-6 | INV-DUAL-4 (transaction atomicity) | INV-DUAL-4 | Trigger guard rollback partial; out-of-band write → drift bị Cs-3/Cs-4 catch |
| Cs-7 | Composition cycle detection (depth ≤ 4 Đ0-B §IV) | INV-E8 | KHÔNG auto-fix — log + escalate (xem §11) |
| Cs-8 | Relation cycle (references, depends_on, uses) |
(extension INV-E8) | KHÔNG auto-fix — log + escalate |
| Cs-9 | Orphan downstream khi parent retired | (Đ4 cascade) | Edge checker chỉ flag affected Objects + escalate Object lifecycle mechanism (xem §8.6) |
3.1.D Optional Enrichment (INFO không block)
| Check | Tiêu chí | Hành động |
|---|---|---|
| OE-1 | E5 confidence field populate cho derived edges |
INFO log "low priority" — không block |
| OE-2 | provenance.confidence_method chi tiết |
INFO log |
| OE-3 | provenance.source_context ngữ cảnh đầy đủ |
INFO log |
3.2 Mapping 5 mechanisms (Đ44 §6.B) cho edge events
Mọi mechanism áp dụng cho cả Cap-4 và Cap-5, nhưng cardinality khác nhau theo nature edge type.
| Mechanism | Khi áp dụng cho edge | Status mature P44-5 |
|---|---|---|
| Trigger (PG, sync cùng giao tác) | (a) Edge create/update khi FK structural sync (Dual transitional, INV-DUAL-4 transaction atomicity); (b) Edge sync khi Object lifecycle transition (cascade theo §8.6 — KHÔNG retire Object, chỉ flag); (c) Birth gate enforcement on INSERT theo §3.1.A | Active: trigger code chốt P44-6 |
| DOT cặp (writer + checker NT12) | (a) Cap-4/5 writer create/update edges trên Object events; (b) Cap-4/5 checker periodic audit 4 chiều A1-A4; (c) Reverse-index maintainer (P1/P2/P3); (d) Cycle detector (composition); (e) Dual sync + dual drift checker (per Dual transitional family) | Active: contract chốt §4-§5; DOT name chốt P44-6 |
| Job/cron (async, batch) | (a) Periodic audit 4 chiều (cold path); (b) Periodic INV-DUAL drift detection; (c) Reverse-index refresh nếu chọn P2; (d) Cycle detection weekly; (e) Sunset condition evaluation periodic (Role: Sunset Condition Evaluator) | Active: schedule cụ thể chốt P44-6 |
| Workflow BPMN (multi-step có người duyệt) | (a) Edge promotion proposed → active khi cần human review; (b) Edge type vocab amendment qua APR (Đ32) |
M0 — defer: BPMN engine Đ34 chưa active. Integration placeholder logic: edge promotion request → APR queue (qua hiện hành) → human review → APR PASS → DOT writer apply. Khi BPMN engine active → migrate vào BPMN. OPEN P44-5-ζ |
| Agent extraction (AI infer) | (a) Semantic-derived edges với confidence < 1.0; (b) Auto-suggest derived_from cho vector projection |
M0 — defer: thuộc Đ39/NĐ-36-01 scope, KHÔNG thuộc P44-5. OPEN P44-5-η |
3.3 Decision tree event-driven cho edge update
Edge event xảy ra?
├── Object INSERT/UPDATE/transition cùng giao tác?
│ → Trigger (PG) + Cap-4/5 writer atomically
│ → Validation Completeness (§3.1.A) — block nếu fail
│
├── FK/structural change cùng giao tác (Dual transitional)?
│ → Trigger dual-write atomically (Role: Cap-5 Dual Sync)
│ → INV-DUAL-4 transaction atomicity guard
│
├── Periodic conformance check (cron)?
│ → Cap-4/5 checker schedule (hot/cold path theo §7.2)
│ → 4 audit chiều A1-A4 + INV-DUAL drift detection
│ → Cycle detection weekly
│
├── Drift detected (4 chiều A1-A4 hoặc INV-DUAL)?
│ → Severity classification (xem §8.2)
│ │ ├── High severity (A1/A2/A4/cycle/INV-DUAL-1/provenance missing)
│ │ │ → KHÔNG auto-fix → log issue → escalate
│ │ ├── Medium severity (A3 missing reverse, INV-DUAL-3 status sync)
│ │ │ → Auto-fix DEFAULT nếu `autofix_enabled=true` (start-OFF, opt-in)
│ │ │ → Wire re-check post-fix → confirm → close issue
│ │ └── Special (INV-DUAL-2 universal_edges → helper)
│ │ → Auto-fill helper candidate với 6 guard chặt + autofix_enabled
│ │ → SSOT direction đúng nhưng helper schema phải bảo vệ
│
├── Object retire/deprecate?
│ → Edge checker flag affected_objects[] + log issue
│ → Escalate Object lifecycle mechanism (Đ4)
│ → KHÔNG tự cascade retire (xem §8.6 — 2 layer separation)
│
├── Edge promotion proposed → active cần human review?
│ → APR queue (BPMN defer M0)
│ → Human review → APR PASS → writer apply
│
└── Semantic-derived edge cần AI infer?
→ Defer Đ39/NĐ-36-01 (M0 — OPEN P44-5-η)
§4. DOT Contract Matrix — Cap-4 Relation
4.1 Capability scope
Cap-4 Relation handle edge types:
- Core (Đ44 §5.3.A):
references,depends_on,uses,implements,supersedes,contradicts,compatible_with. (Note:containsthuộc Cap-5 Composition, không Cap-4.) - Candidate (Đ44 §5.3.B, chờ User ban hành):
derived_from,governed_by,published_in. - Living DB Q tương ứng: Q4 (Tôi dùng ai?), Q5 (Ai dùng tôi?), Q6 (Tôi sinh từ đâu?).
4.2 Role contract matrix Cap-4
Lưu ý: tất cả là Role label logical. DOT name cụ thể chốt P44-6/APR.
| Role | Trigger model | Schedule model | Tier (Đ35) | Paired with | Domain (Đ35) | Coverage |
|---|---|---|---|---|---|---|
| Role: Cap-4 Relation Writer | event-driven (Object INSERT/UPDATE/transition; provenance event) | n/a (event-only) | A | Role: Cap-4 Relation Checker | infrastructure.relation | Tạo/cập nhật edges với validation Completeness §3.1.A |
| Role: Cap-4 Relation Checker | n/a | cron periodic (logical: hot path tần suất cao + cold path tần suất thấp; số cụ thể chốt P44-6) | B | Role: Cap-4 Relation Writer | infrastructure.relation | Periodic audit 4 chiều A1-A4 cho relation edges |
| Role: Cap-4 Reverse-Index Maintainer | event-driven (P3) hoặc schedule (P2) hoặc on-demand (P1 pilot) — pattern theo §10 | tuỳ pattern | A (P3) / B (P2) / B (P1) | Role: Cap-4 Relation Checker | infrastructure.relation.reverse | Maintain reverse-index cho Q5/Q6 |
| Role: Cap-4 Enrichment (Tier 2+ defer) | scheduled hoặc agent-triggered | cron tần suất thấp | C | n/a | enrichment.relation | Auto-suggest related edges qua similarity (defer Đ39 mature) |
4.3 Audit chiều A1-A4 mapping per Role Cap-4
| Audit chiều | Role: Cap-4 Relation Writer | Role: Cap-4 Relation Checker | Role: Cap-4 Reverse-Index Maintainer |
|---|---|---|---|
| A1 Orphan source | Validate trên INSERT (block) | Periodic verify | (gián tiếp qua source_ref index) |
| A2 Orphan target | Validate trên INSERT (block) | Periodic verify | (gián tiếp qua target_ref index) |
| A3 Missing reverse (symmetric edges) | Validate symmetric pair on INSERT (warn nếu thiếu) | Periodic detect + auto-fix với guard (xem §8.2) | Maintain reverse-index cho symmetric |
| A4 Vocab violation | Validate edge_type vocab + namespace on INSERT (block) | Periodic re-verify nếu vocab framework amend | n/a |
4.4 Per-Role contract — input/output/preconditions/postconditions
Role: Cap-4 Relation Writer
- Inputs: Object event (INSERT/UPDATE/transition), edge intent (source/target/edge_type/provenance).
- Preconditions: source/target Object thoả OQC ≥ 3/4 + Family Registry resolved + edge_type vocab valid + provenance đầy đủ post-Đ44.
- Outputs: Edge entry trong universal_edges với E1-E8 đầy đủ.
- Postconditions: Edge
status=active(structural FK-derived) hoặcproposed(semantic-derived); reverse-index trigger update (P3) hoặc schedule update (P2); paired checker schedule next run. - Failure mode: validation fail → block INSERT + log birth gate violation; transaction rollback.
Role: Cap-4 Relation Checker
- Inputs: cron schedule trigger (hot/cold path), edge subset (per family hoặc global).
- Preconditions: edge subset selectable + read access universal_edges.
- Outputs: Issues logged tới
system_issuesper drift detected;last_check_at+last_check_resultupdated. - Postconditions:
autofix_enabled=true→ trigger auto_fix_action (chỉ A3 + INV-DUAL-3 status);autofix_enabled=false→ log only + escalate. - Failure mode: checker error → re-schedule + log incident; not block production traffic.
Role: Cap-4 Reverse-Index Maintainer
- Inputs: edge events (P3 trigger) hoặc schedule trigger (P2) hoặc on-demand query (P1).
- Preconditions: pattern P1/P2/P3 chốt cho scale tier; reverse-index storage available (P2 = materialized view, P3 = cache table, P1 = index trên forward).
- Outputs: Reverse-index entries hoặc materialized view refreshed.
- Postconditions: Q5/Q6 query latency trong budget; consistency với forward edges.
- Failure mode: pattern P1 latency vượt budget → APR đánh giá chuyển P2/P3.
§5. DOT Contract Matrix — Cap-5 Composition
5.1 Capability scope
Cap-5 Composition handle:
- Edge types:
contains,belongs_to,part_of_composite(defer use case). - Composition role:
atomic/molecular/composite(P38-XC §7.2 align Đ0-B Lớp 1/2/3). - Granularity_level: 1-3 (atomic/molecular/composite), 4-6 (Material/Product/Building) defer khi family xuất hiện.
- Living DB Q tương ứng: Q2 (Tôi thuộc ai?), Q3 (Ai thuộc tôi?).
5.2 Role contract matrix Cap-5
| Role | Trigger model | Schedule model | Tier (Đ35) | Paired with | Domain (Đ35) | Coverage |
|---|---|---|---|---|---|---|
| Role: Cap-5 Composition Writer | event-driven (Object INSERT/UPDATE; set parent_or_container_ref + composition_role) | n/a | A | Role: Cap-5 Composition Checker | infrastructure.composition | Tạo contains/belongs_to edges với validation Completeness |
| Role: Cap-5 Composition Checker | n/a | cron periodic | B | Role: Cap-5 Composition Writer | infrastructure.composition | Periodic audit 4 chiều A1-A4 + composition_role consistency |
| Role: Cap-5 Reverse-Index Maintainer | event/schedule/on-demand (pattern §10) | tuỳ pattern | A (P3) / B (P2/P1) | Role: Cap-5 Composition Checker | infrastructure.composition.reverse | Maintain reverse contains cho Q3 |
| Role: Cap-5 Cycle Detector | n/a (read-only audit) | cron weekly | B | Role: Cap-5 Composition Checker | infrastructure.composition.cycle | Recursive CTE depth ≤ 4 + cycle path detection |
| Role: Cap-5 Dual Sync (chỉ instance per Dual transitional family) | event-driven dual-write trigger | n/a | A | Role: Cap-5 Dual Drift Checker (cùng family instance) | infrastructure.composition.dual | INV-DUAL-1+4: helper INSERT → universal_edges atomically |
| Role: Cap-5 Dual Drift Checker (chỉ instance per Dual transitional family) | n/a | cron periodic | B | Role: Cap-5 Dual Sync (cùng family instance) | infrastructure.composition.dual | INV-DUAL-1/2/3 drift detection |
5.3 Audit chiều mapping + recursive cycle detection per Role Cap-5
| Audit chiều / INV | Composition Writer | Composition Checker | Reverse-Index Maintainer | Cycle Detector | Dual Sync | Dual Drift Checker |
|---|---|---|---|---|---|---|
| A1 Orphan source | Validate INSERT | Periodic | (gián tiếp) | n/a | (gián tiếp validate) | n/a |
| A2 Orphan target | Validate INSERT | Periodic | (gián tiếp) | n/a | (gián tiếp validate) | n/a |
| A3 Missing reverse | Validate INSERT (warn) | Periodic | Maintain reverse | n/a | n/a | n/a |
| A4 Vocab violation | Validate INSERT (block) | Periodic | n/a | n/a | n/a | n/a |
| INV-E8 Cycle (depth ≤ 4) | n/a | (delegate) | n/a | Primary owner — recursive CTE weekly | n/a | n/a |
| INV-DUAL-1 (helper có, universal_edges thiếu) | n/a | n/a | n/a | n/a | (write atomically prevent) | Primary owner — drift detect, default quarantine + escalate (xem §8.2 + §9.3) |
| INV-DUAL-2 (universal_edges có, helper thiếu) | n/a | n/a | n/a | n/a | (write atomically prevent) | Primary owner — auto-fill candidate với 6 guard chặt (xem §8.2 + §9.4) |
| INV-DUAL-3 (status mismatch) | n/a | n/a | n/a | n/a | n/a | Primary owner — auto-sync theo SSOT |
| INV-DUAL-4 (transaction atomicity) | n/a | n/a | n/a | n/a | Primary owner — trigger guard rollback partial | (catch out-of-band write qua INV-DUAL-1/2) |
5.4 TAC family-specific instance (Dual transitional cho tac_publication_member)
Default ruling P44-4A §7.7.2:
tac_publication_member= (c) Dual transitional. universal_edges là SSOT duy nhất; helper là enforcement helper hoặc materialized representation.
TAC family-specific instances:
- 1 instance của Role: Cap-5 Dual Sync cho
tac_publication_member(transaction-based dual-write trigger). - 1 instance của Role: Cap-5 Dual Drift Checker cho
tac_publication_member(periodic INV-DUAL-1..3 audit + escalate).
Sunset behavior (P44-4A §7.7.4):
- Khi 4 conditions C1-C4 đều hết → exit path E1 (drop helper) hoặc E2 (helper materialized representation).
- E1: retire 2 instance + drop
tac_publication_member+ populate universal_edges đầy đủ. - E2: retire Role: Cap-5 Dual Sync instance (vì không còn cần dual-write); giữ Role: Cap-5 Dual Drift Checker instance (vẫn cần catch drift cho materialized representation); flag helper là materialized.
DOT name cụ thể cho 2 instance chốt P44-6/APR. Cụm này là family-specific instance, không thêm role mới.
5.5 Per-Role contract Cap-5 — input/output/preconditions/postconditions
Role: Cap-5 Composition Writer
- Inputs: Object event (INSERT/UPDATE), parent_or_container_ref intent, composition_role (auto-derive từ aggregation hoặc set explicit).
- Preconditions: parent Object thoả OQC; family hợp lệ chứa con; bootstrap order (atomic → molecular → composite) tuân thủ (P44-4A §5.5).
- Outputs:
contains/belongs_toedge entries; composition_role set; granularity_level set. - Postconditions: Cycle detection schedule next; reverse-index trigger update (P3) hoặc schedule (P2).
Role: Cap-5 Composition Checker
- Inputs: cron trigger; edge subset.
- Preconditions: read access universal_edges + Object families.
- Outputs: Issues logged per drift; composition_role consistency report.
- Postconditions:
autofix_enabledrule routing (xem §8.2).
Role: Cap-5 Cycle Detector
- Inputs: cron weekly trigger; composition edges global.
- Preconditions: PG 14+ recursive CTE support (
WITH RECURSIVE ... CYCLE id SET is_cycle USING path); depth limit ≤ 4. - Outputs: Cycle paths report (path, length, severity); affected Objects list.
- Postconditions: KHÔNG auto-fix (cycle = data corruption suspect); log + escalate APR.
Role: Cap-5 Dual Sync (instance per family)
- Inputs: helper row INSERT/UPDATE/DELETE event (cùng giao tác).
- Preconditions: family đã enable Dual transitional via APR; 4 conditions C1-C4 còn ít nhất một active.
- Outputs: Atomic write helper + universal_edges (transaction-based dual-write); INV-DUAL-4 enforcement.
- Postconditions: Cùng commit hoặc cùng rollback; partial failure → trigger guard rollback toàn bộ.
Role: Cap-5 Dual Drift Checker (instance per family)
- Inputs: cron trigger; helper rows + universal_edges composition entries (filter family).
- Preconditions: read access cả 2 nguồn.
- Outputs: Drift report INV-DUAL-1/2/3 per row; severity classification.
- Postconditions: Severity routing — INV-DUAL-1 default quarantine + escalate (KHÔNG auto-fill); INV-DUAL-2 auto-fill candidate với 6 guard chặt; INV-DUAL-3 auto-sync status theo SSOT.
§6. Writer/Checker responsibility matrix tổng hợp
6.1 Bảng matrix tổng hợp (Cap-4 + Cap-5)
| Role | LV-1 Identity | LV-2 Thuộc | LV-3 Nói gì | LV-4 Liên quan | LV-5 Ai dùng | Audit chiều | Schedule type | Tier |
|---|---|---|---|---|---|---|---|---|
| Role: Cap-4 Relation Writer | (gián tiếp via E2) | n/a | n/a | Primary (LV-4) | Setup (qua reverse) | A1+A2+A4 validation | event | A |
| Role: Cap-4 Relation Checker | (verify) | n/a | n/a | Primary (LV-4) | (gián tiếp) | A1+A2+A3+A4 | cron periodic | B |
| Role: Cap-4 Reverse-Index Maintainer | n/a | n/a | n/a | (support) | Primary (LV-5) | A3 (gián tiếp) | tuỳ pattern | A/B |
| Role: Cap-5 Composition Writer | (gián tiếp via parent_ref) | Primary (LV-2) | n/a | n/a | n/a | A1+A2+A4 validation | event | A |
| Role: Cap-5 Composition Checker | (verify) | Primary (LV-2) | n/a | n/a | n/a | A1+A2+A3+A4 | cron periodic | B |
| Role: Cap-5 Reverse-Index Maintainer | n/a | (support) | n/a | n/a | Primary (LV-5 cho Q3) | A3 (gián tiếp) | tuỳ pattern | A/B |
| Role: Cap-5 Cycle Detector | n/a | (audit lifecycle integrity) | n/a | n/a | n/a | INV-E8 cycle | cron weekly | B |
| Role: Cap-5 Dual Sync | n/a | (enforce LV-2 helper sync) | n/a | n/a | n/a | INV-DUAL-1+4 | event | A |
| Role: Cap-5 Dual Drift Checker | n/a | (audit LV-2 helper drift) | n/a | n/a | n/a | INV-DUAL-1+2+3 | cron periodic | B |
| Role: Sunset Condition Evaluator | n/a | (audit sunset trigger) | n/a | n/a | n/a | (sunset 4 conditions) | cron periodic (default đề xuất 6 tháng, final cadence defer P44-6/APR) | B |
Note: LV-1 Identity và LV-3 Nói gì được P44-1 (Family Registry) + P44-3 (Profile Registry) cover. P44-5 KHÔNG repeat.
6.2 Mapping LV-1..LV-5 cho 2 family pilot TAC
Family information_unit (TAC logical unit)
| LV | Mechanism | Role | Status mature |
|---|---|---|---|
| LV-1 Identity | Birth gate (P44-1 + P44-3) | (P44-1/P44-3 cover) | M2 |
| LV-2 Thuộc | Composition belongs_to publication |
Role: Cap-5 Composition Writer + Checker; (Dual transitional → +Dual Sync + Dual Drift Checker per tac_publication_member) |
Cap-5 contract chốt P44-5; DOT name P44-6 |
| LV-3 Nói gì | Profile (topic, entity, claim) (P44-3) | (P44-3 cover) | M0-M1 (profile populate B) |
| LV-4 Liên quan | Relation candidate edges có thể gồm references, derived_from, governed_by/governs, published_in/publishes theo vocab Đ44 §5.3.A + B; cách dùng cụ thể cho information_unit cần đối chiếu Authority Map/Đ37 ở P44-6/APR |
Role: Cap-4 Relation Writer + Checker | Cap-4 contract chốt P44-5; vocab usage chốt P44-6 |
| LV-5 Ai dùng | Reverse referenced_by, reverse contains cho Q3 |
Role: Cap-4 Reverse-Index Maintainer + Role: Cap-5 Reverse-Index Maintainer | Pattern P1 pilot-only chốt; threshold defer P44-6 |
Family publication (TAC publication)
| LV | Mechanism | Role | Status mature |
|---|---|---|---|
| LV-1 Identity | Birth gate (P44-1) | (P44-1 cover) | M2 |
| LV-2 Thuộc | (n/a — publication là container, không belongs_to) | n/a | n/a |
| LV-3 Nói gì | Publication profile (P44-3) | (P44-3 cover) | M0-M1 |
| LV-4 Liên quan | Quan hệ LV-4 có thể gồm governed_by/governs và published_in/publishes theo vocab candidate Đ44 §5.3.B; cách dùng cụ thể cho publication cần đối chiếu Authority Map/Đ37 ở P44-6/APR. KHÔNG khẳng định trộn governs (reverse của governed_by) với published_in (Candidate edge khác) như đã chốt |
Role: Cap-4 Relation Writer + Checker | Cap-4 contract chốt P44-5; vocab usage + Authority Map alignment chốt P44-6/APR |
| LV-5 Ai dùng | Reverse contains (Q3 — ai thuộc publication này) + reverse published_in (publishes) |
Role: Cap-5 Reverse-Index Maintainer + Role: Cap-4 Reverse-Index Maintainer | Pattern P1 pilot |
6.3 Tier 1 PASS Item 4 checklist (P44-4A §12.2)
Tier 1 PASS Item 4 = "DOT Cap-4/Cap-5 writer + checker đăng ký". P44-5 chốt logical contract (Role + responsibility + paired); DOT name + đăng ký dot_registry chốt P44-6/APR.
| # | Item | Owner P44-5 | Owner P44-6 |
|---|---|---|---|
| 1 | Role contract Cap-4 writer + checker logical | ✅ §4.2 + §4.4 | DOT name + register |
| 2 | Role contract Cap-5 writer + checker logical | ✅ §5.2 + §5.5 | DOT name + register |
| 3 | Reverse-index Maintainer contract (P1 pilot) | ✅ §4 + §5 + §10 | DOT name + register; threshold benchmark |
| 4 | Cycle Detector contract logical | ✅ §5 + §11 | DOT name + register |
| 5 | Dual Sync + Dual Drift Checker per family Dual | ✅ §5.4 + §9 | DOT name + register per family instance |
| 6 | Sunset Condition Evaluator contract logical | ✅ §6.1 + §9.7 | DOT name + cadence |
6.4 Đ44 Conformance Clause C5 mapping cho 2 family pilot
Đ44 §9.5 C5 yêu cầu: "Cơ chế cập nhật — khai báo ≥ 1 cơ chế triển khai cho mỗi LV-1..LV-5 áp dụng (Trigger/DOT cặp/Job/Workflow/Extraction)".
| Family | LV-1 | LV-2 | LV-3 | LV-4 | LV-5 |
|---|---|---|---|---|---|
information_unit |
Trigger (birth gate, P44-1) | Trigger (Composition Writer) + DOT cặp (Dual Sync + Dual Drift Checker per tac_publication_member) |
Trigger (P44-3 profile fill) + DOT cặp (P44-3 fill checker) | DOT cặp (Cap-4 Relation Writer + Checker) | DOT cặp (Reverse-Index Maintainer Cap-4 + Cap-5) |
publication |
Trigger (P44-1) | n/a | Trigger (P44-3) | DOT cặp (Cap-4 — vocab usage candidate, Authority Map alignment defer P44-6) | DOT cặp (Reverse-Index Cap-5 cho Q3 + reverse of published_in) |
→ Conformance Clause C5 PASS cho 2 family pilot khi P44-5 + P44-1 + P44-3 hợp nhất + Authority Map alignment chốt P44-6.
§7. Event model / Schedule model logical
7.1 Event model (sync, cùng giao tác)
| Event | Trigger Role | Logic |
|---|---|---|
| Object INSERT | Cap-4/5 Writer atomically | Validate Completeness §3.1.A → INSERT edge với E1-E8 đầy đủ → reverse-index trigger update (P3) hoặc schedule (P2) |
Object UPDATE (transition lifecycle vd proposed → active) |
Cap-4/5 Checker re-validate | Re-verify edges related; especially supersedes chain on version succession; flag affected edges |
| Object retire/deprecate | Edge checker flag affected_objects[] | KHÔNG cascade retire (xem §8.6 — 2 layer separation); flag + escalate Object lifecycle mechanism (Đ4) |
| FK/structural sync (Dual transitional) | Cap-5 Dual Sync atomically | Helper INSERT/UPDATE/DELETE → universal_edges INSERT/UPDATE/DELETE cùng giao tác (INV-DUAL-4) |
| APR vocab amendment (edge_type extension) | Vocab framework update + Cap-4/5 Checker re-verify | Edge entries hiện hữu vocab không hợp → mark quarantine + log issue |
7.2 Schedule model (async, batch)
| Path | Scope | Cadence logical | Cadence cụ thể |
|---|---|---|---|
Hot path (high-frequency edges, vd references trong TAC pilot) |
Cap-4/5 Checker quét edge subset hot | Tần suất cao | Defer P44-6 + benchmark |
Cold path (low-frequency edges, vd governed_by family-level) |
Cap-4/5 Checker quét edge subset cold | Tần suất thấp | Defer P44-6 |
| Cycle detection | Cap-5 Cycle Detector recursive CTE depth ≤ 4 | Tần suất rất thấp (read-only, expensive) | Defer P44-6 (đề xuất "weekly" logical) |
| Dual drift detection | Cap-5 Dual Drift Checker per family | Tần suất trung bình | Defer P44-6 |
| Reverse-index refresh (chỉ áp dụng nếu chọn P2) | Reverse-Index Maintainer | Tần suất theo P99 latency budget | Defer P44-6 |
| Sunset condition evaluation | Sunset Condition Evaluator | Periodic, default đề xuất 6 tháng, final cadence defer P44-6/APR | Defer P44-6 |
7.3 Hybrid model
Hybrid = event-driven + schedule-driven + on-demand.
Khi áp dụng:
- Event-driven cho bắt drift ngay khi xảy ra (Trigger + Writer atomically).
- Schedule cho catch missed events + cycle detection + dual drift detection.
- On-demand cho human-triggered audit (vd APR review, manual investigation).
Example combined flow:
- Object INSERT → event Trigger → Cap-4/5 Writer atomically populate edges.
- Schedule daily cron → Cap-4/5 Checker re-verify recent edges + audit 4 chiều A1-A4.
- Schedule weekly → Cap-5 Cycle Detector recursive scan.
- On-demand → APR triggers Cap-4/5 Checker on specific edge subset for review.
7.4 Trade-off bảng
| Tiêu chí | Event-driven | Schedule-driven | On-demand |
|---|---|---|---|
| Latency phát hiện drift | ~0 (atomically) | ≤ cadence | ≤ trigger latency |
| Overhead | Cao trên hot path | Thấp (batch) | Thấp |
| Completeness | 100% với trigger code đúng | Có thể miss out-of-band write | Tuỳ trigger query |
| Resource consumption | Liên tục | Burst theo cron | Tuỳ |
| Khi dùng | Hot path, dual sync, atomic write | Cold path, periodic audit | Human review, APR |
§8. Auto-fix vs Escalate policy logical
8.1 Pattern Đ22 áp dụng cho edge entries
Đ22 v1.2 pattern:
detect_query+auto_fix_action+autofix_enabledconfig guard + Wire re-check + system_issues lifecycle.
Áp dụng cho Cap-4/5:
- Checker chạy
detect_query(4 chiều A1-A4 + INV-DUAL + cycle). - Drift detected → tra severity table (§8.2) → routing:
- Block → KHÔNG auto-fix, log issue, escalate.
- Auto-fix candidate → check
autofix_enabled(start-OFF default). - Special → check 6 guard precondition (INV-DUAL-1, INV-DUAL-2).
- Nếu auto-fix → execute
auto_fix_action→ Wire re-check (re-run detect) → confirm fixed → close issue. - Nếu không thoả guard → log issue với severity + recommendation → escalate APR.
8.2 Severity + auto-fix scope (default conservative)
Default policy:
autofix_enabledstart-OFF tất cả rules. Opt-in per rule chỉ sau APR/pilot evidence + risk assessment (Q3 GPT trả lời).
| Drift type | Severity | Auto-fix scope | Lý do | autofix_enabled default |
|---|---|---|---|---|
| A1: Orphan source (source object retired/deleted) | High | KHÔNG auto-fix — log issue, mark edge quarantine, escalate |
Có thể là dữ liệu thật bị mất → cần human verify; auto-fix risk delete edge thật | n/a (no auto rule) |
| A2: Orphan target | High | KHÔNG auto-fix — log issue, mark edge quarantine, escalate |
Tương tự | n/a |
| A3: Missing reverse (symmetric edge thiếu reverse) | Medium | Auto-fix candidate — DOT auto-create reverse entry với provenance auto_reverse_fill |
Reverse là deterministic cho symmetric edge types | start-OFF, opt-in sau APR/pilot |
| A4: Vocab violation (edge_type ngoài framework) | High | KHÔNG auto-fix — block birth, escalate APR (vocab amendment qua Đ32) | Vocab amendment phải qua APR, không tự ý add | n/a |
| INV-DUAL-1 mismatch (helper/FK row có nhưng universal_edges thiếu entry tương ứng) | High | DEFAULT: quarantine helper row + escalate, KHÔNG auto-fill universal_edges. Auto-fill CHỈ exception khi thoả ĐỦ 6 guard chặt: (g1) helper row được tạo bởi transaction hợp lệ (audit log có evidence); (g2) source resolve về Object hợp lệ (OQC ≥ 3/4); (g3) target resolve về Object hợp lệ; (g4) edge_type deterministic theo namespace + family rule; (g5) provenance tạo được với creator='auto_dual_repair' + method='structural_fk_inferred'; (g6) không conflict với universal_edges hiện hữu (không có entry mâu thuẫn cho cùng source/target/edge_type, kể cả status deprecated/retired). Cần autofix_enabled=true sau APR/pilot |
Nguyên tắc: universal_edges là SSOT (P44-4A §7.7.2). Pattern bị cấm "fallback to helper" áp dụng cả write direction — không tin helper ghi ngược SSOT khi không đủ 6 guard | start-OFF; opt-in CHỈ sau APR cấp medium + pilot evidence + 6 guard implement đủ |
| INV-DUAL-2 mismatch (universal_edges có entry nhưng helper thiếu row) | High | DEFAULT: auto-fill candidate (KHÔNG mặc định fill mù) — chỉ auto-fill helper khi thoả ĐỦ 6 guard chặt: (g1) universal_edges entry status ∈ {active, proposed} hợp lệ (không retired/deprecated); (g2) source/target resolve về Object hợp lệ (OQC ≥ 3/4 cả 2 endpoint); (g3) helper schema/FK constraint chắc chắn pass (FK targets resolve, NOT NULL constraints, CHECK constraints, UNIQUE keys không conflict); (g4) không tạo duplicate helper row (kiểm UNIQUE + composite key trước insert); (g5) provenance helper tạo được với creator='auto_dual_helper_fill' + method='ssot_to_helper_sync' + source_context=universal_edges:<edge_id>; (g6) autofix_enabled=true sau APR/pilot. Thiếu bất kỳ guard nào → log + escalate, KHÔNG auto-fill |
Nguyên tắc: universal_edges là SSOT, fill xuống helper là đúng chiều SSOT direction, NHƯNG vẫn có thể phá FK/helper schema nếu fill mù. Helper schema phải bảo vệ — guard chặt tương đương INV-DUAL-1 nhưng đối tượng khác (helper schema thay vì universal_edges conflict) | start-OFF; opt-in CHỈ sau APR cấp medium + pilot evidence + 6 guard implement đủ |
| INV-DUAL-3 status mismatch | Medium | Auto-sync DEFAULT theo SSOT (universal_edges status thắng) | Status sync là deterministic; SSOT direction rõ | start-OFF, opt-in sau APR/pilot |
| INV-DUAL-4 violation (transaction atomicity broken) | High | Trigger guard rollback partial (atomic enforcement); out-of-band write → drift bị INV-DUAL-1/2 catch | Atomic = trigger code; out-of-band = audit catch | (handled by trigger code, not separate rule) |
| Cycle detected (composition depth > 4 hoặc self-loop) | High | KHÔNG auto-fix — log + escalate APR | Cycle = data corruption nghi ngờ; auto-fix risk break legitimate composition | n/a |
| Provenance missing (edge mới post-Đ44 thiếu provenance) | Block | KHÔNG auto-fix — block birth gate (§3.1.A C-4 + Đ44 §5.4); legacy retrofit ngoài hot path | Đ44 §5.4 yêu cầu tuyệt đối post-Đ44 | n/a |
8.3 autofix_enabled config guard
Default: start-OFF tất cả rules — opt-in per rule.
Pattern Đ22:
- Mỗi rule có config flag
autofix_enabled_<rule_id>trong dot_config (vdautofix_enabled_a3_missing_reverse,autofix_enabled_inv_dual_1_universal_fill,autofix_enabled_inv_dual_2_helper_fill,autofix_enabled_inv_dual_3_status_sync). - Default value =
false(start-OFF). - Opt-in path: APR cấp medium đề xuất bật rule cho 1 family pilot → pilot evidence ≥ 30 day không incident → APR PASS → flip flag =
true. - Kill switch: human có thể flip
falsebất kỳ lúc nào nếu phát hiện sự cố.
8.4 Wire re-check post-fix (Đ22 pattern)
Sau khi auto-fix:
- Re-run
detect_querytrên edge subset đã fix. - Confirm drift fixed (no more issue).
- Close
system_issuesentry vớiauto_fixed=true+ audit trail. - Nếu re-check vẫn fail → reopen issue + escalate (drift không fix được auto).
8.5 Escalation path
| Severity | Escalation |
|---|---|
| Block (provenance missing post-Đ44) | Block INSERT immediately; user/agent báo lỗi |
| High recurring (≥ 3 lần trong cadence) | Log + escalate APR cấp medium |
| High vocab amendment | APR cấp high (Đ32) |
| Medium recurring | Log + scheduled review |
| Drift cụm large (≥ X% edges) | Auto-disable autofix_enabled flag relevant + escalate APR |
Threshold X% cụ thể defer P44-6 + benchmark.
8.6 Anti-mutation guardrail — 2 layer responsibility tách rõ
Quan trọng nhất §8 — sửa wording GPT bắt từ outline polish.
8.6.1 2 layer responsibility
Layer A: Edge conformance checker layer (Cap-4/5 checker — thuộc P44-5 scope):
Edge checker được phép:
- Mutate edge entries (mark
quarantine/deprecated/active; update edge fields E1-E8). - Mutate helper rows (Dual transitional sync — INV-DUAL-1/2/3 enforcement theo §9, với guard chặt theo §8.2).
- Flag affected Objects (log issue tới
system_issuesvới fieldaffected_objects[]). - Escalate sang Object lifecycle mechanism khi cần.
Edge checker KHÔNG được phép:
- Mutate Object data (vd retire Object, deprecate Object, change Object lifecycle state).
- Tạo/xoá Object instance.
- Modify Object profile fields (P44-3 scope).
Layer B: Object lifecycle mechanism layer (Đ4 lifecycle law / birth-retire mechanism — KHÔNG thuộc P44-5 scope):
Object lifecycle mechanism chịu trách nhiệm:
- Cascade retire khi container retire (composition lifecycle phụ thuộc, P44-4A §5.8).
- Promotion lifecycle Object (proposed → active → deprecated → retired).
- Lifecycle rule enforcement Đ4.
- Birth-retire mechanism per Đ44 §9.4 + Đ4.
8.6.2 Cascade retire — phân định rõ
Cascade retire dù có rule deterministic vẫn KHÔNG thuộc edge conformance checker — phải do Object lifecycle mechanism trigger.
Flow đúng:
- Container Object retire trigger Đ4 lifecycle event.
- Đ4 lifecycle mechanism đọc composition rule → identify affected member Objects.
- Đ4 lifecycle mechanism cascade retire member Objects.
- Sau member Objects retire → edge checker (Cap-5 checker) catch orphan edges (A1/A2 — source/target retired) → mark
quarantine+ escalate.
Flow sai (cấm):
- Edge checker phát hiện container retire.
- Edge checker tự retire member Objects dựa trên composition rule.
- → VI PHẠM 2 layer separation.
Lý do tách:
- Edge state ≠ Object lifecycle state — 2 domain khác.
- Trộn 2 layer = precedent xấu cho future leak (vd "edge confidence thấp → edge checker tự retire Object?", "edge bị contradicts → edge checker tự deprecate Object?").
- 2 layer độc lập về responsibility, kết nối qua interface escalation (edge checker flag
affected_objects[]→ lifecycle mechanism đọc + xử lý).
8.6.3 Interface escalation specification (high-level)
OPEN P44-5-κ: chi tiết interface escalation chốt khi Đ4 lifecycle law có specific cascade rule cho composition. P44-5 chỉ chốt high-level contract.
Edge checker → Object lifecycle mechanism interface:
- Method: log issue tới
system_issuesvới fieldsseverity,affected_objects[],recommended_action('cascade_retire' / 'deprecate' / 'review'). - Object lifecycle mechanism subscribe
system_issuesevents filterrecommended_action. - Lifecycle mechanism kiểm Đ4 rule + composition cascade rule → tự quyết định cascade hay không.
- Edge checker KHÔNG đọc lifecycle response — chỉ producer events.
§9. Anti-drift enforcement for Dual transitional
Realize INV-DUAL-1..4 (P44-4A §7.7.3) thành DOT Role contract cụ thể + sunset path enforcement.
9.1 Recap INV-DUAL-1..4
| Invariant | Mô tả |
|---|---|
| INV-DUAL-1 | Mỗi row hợp lệ trong helper PHẢI có đúng 1 edge tương ứng trong universal_edges |
| INV-DUAL-2 | Mỗi universal_edges composition edge giữa 2 endpoint composition (kèm edge_type=contains namespace Đ44) PHẢI có row helper tương ứng NẾU helper còn tồn tại |
| INV-DUAL-3 | Status sync (helper status vs universal_edges status không lệch ngữ nghĩa) |
| INV-DUAL-4 | Transaction atomicity: mọi INSERT/UPDATE/DELETE liên quan composition edge phải cùng commit hoặc cùng rollback |
9.2 Role instance per Dual transitional family
Mỗi family chọn (c) Dual transitional (P44-4A §7.7.2) → 2 instance:
| Role | Instance per family | Trigger model | Schedule model |
|---|---|---|---|
| Role: Cap-5 Dual Sync | 1 instance per Dual family | event-driven dual-write trigger | n/a |
| Role: Cap-5 Dual Drift Checker | 1 instance per Dual family | n/a | cron periodic |
Hiện tại: Chỉ TAC family tac_publication_member chọn Dual transitional → 2 instance cho TAC.
9.3 INV-DUAL-1 enforcement (siết theo outline polish)
Quan trọng nhất §9 — siết theo P44-4A §7.7.2 (universal_edges là SSOT).
Detection: Role: Cap-5 Dual Drift Checker periodic quét helper rows → verify mỗi row có universal_edges entry tương ứng.
Default action: quarantine helper row + escalate, KHÔNG auto-fill universal_edges.
Auto-fill exception chỉ được phép khi thoả ĐỦ 6 guard (theo §8.2):
- (g1) helper row được tạo bởi transaction hợp lệ (audit log có evidence trace).
- (g2) source resolve về Object hợp lệ (OQC ≥ 3/4 verify).
- (g3) target resolve về Object hợp lệ.
- (g4) edge_type deterministic theo namespace + family rule (không ambiguous).
- (g5) provenance tạo được với
creator='auto_dual_repair'+method='structural_fk_inferred'+source_context=<helper_table>:<row_id>. - (g6) không conflict với universal_edges hiện hữu (không có entry mâu thuẫn cho cùng source/target/edge_type, kể cả status
deprecated/retired).
Cần autofix_enabled_inv_dual_1_universal_fill=true sau APR cấp medium + pilot evidence ≥ 30 day không incident.
OPEN P44-5-ι: chi tiết validation cho 6 guard, đặc biệt định nghĩa "conflict" (g6) — defer APR + pilot benchmark.
9.4 INV-DUAL-2 enforcement (auto-fill candidate với 6 guard chặt — siết theo P44-5A polish)
Polish P44-5A: SSOT direction (universal_edges → helper) đúng nguyên tắc, NHƯNG auto-fill mù vẫn có thể phá FK/helper schema. Phải siết guard tương đương INV-DUAL-1 nhưng đối tượng khác.
Detection: Role: Cap-5 Dual Drift Checker periodic quét universal_edges composition entries (filter family) → verify helper row tồn tại.
Default action: Auto-fill candidate (KHÔNG mặc định fill mù) — chỉ auto-fill helper khi thoả ĐỦ 6 guard chặt:
- (g1) universal_edges entry
status∈ {active, proposed} hợp lệ — KHÔNG auto-fill cho entrydeprecated/retired. - (g2) source/target resolve về Object hợp lệ (OQC ≥ 3/4 verify cả 2 endpoint).
- (g3) helper schema/FK constraint chắc chắn pass:
- FK targets resolve về row hợp lệ trong target table.
- NOT NULL constraints satisfied.
- CHECK constraints không vi phạm.
- UNIQUE keys / composite keys không conflict.
- (g4) Không tạo duplicate helper row — kiểm UNIQUE + composite key trước INSERT (vd
(publication_id, unit_id)chotac_publication_member). - (g5) Provenance helper tạo được với
creator='auto_dual_helper_fill'+method='ssot_to_helper_sync'+source_context=universal_edges:<edge_id>+timestamp+ reference universal_edges entry. - (g6)
autofix_enabled_inv_dual_2_helper_fill=truesau APR cấp medium + pilot evidence ≥ 30 day không incident.
Thiếu bất kỳ guard nào → log issue + escalate, KHÔNG auto-fill.
Lý do siết: universal_edges là SSOT → fill xuống helper là đúng chiều SSOT direction (P44-4A §7.7.2 align). NHƯNG helper schema có constraint riêng (FK, UNIQUE, CHECK, NOT NULL) → fill mù có thể gây constraint violation, duplicate row, data corruption ở helper layer. Helper schema phải được bảo vệ tương đương universal_edges.
OPEN P44-5-ι (mở rộng): chi tiết validation cho 6 guard cả INV-DUAL-1 và INV-DUAL-2 — defer APR + pilot benchmark.
9.5 INV-DUAL-3 status mismatch enforcement (auto-sync theo SSOT)
Detection: Role: Cap-5 Dual Drift Checker periodic quét cả 2 nguồn → compare status fields.
Default action: Auto-sync status theo SSOT (universal_edges status thắng).
- Helper status update theo universal_edges status.
- Provenance:
auto_status_sync+ reference timestamp.
Cần autofix_enabled_inv_dual_3_status_sync=true sau APR/pilot.
9.6 INV-DUAL-4 transaction atomicity enforcement
Detection: Trigger code on INSERT/UPDATE/DELETE helper hoặc universal_edges → validate dual-write atomic.
Default action: Trigger guard rollback partial failure (transaction-based dual-write).
Out-of-band write (vd manual SQL bypass trigger) → drift sẽ bị INV-DUAL-1/INV-DUAL-2 catch ở chu kỳ Drift Checker tiếp theo.
DOT-level: trigger code thuộc Role: Cap-5 Dual Sync. Code cụ thể chốt P44-6.
9.7 Sunset path enforcement (P44-4A §7.7.4)
Sunset 4 conditions C1-C4 + 2 exit paths E1/E2.
Sunset trigger: 4 conditions C1-C4 đều hết → BẮT BUỘC chuyển E1 hoặc E2.
Role: Sunset Condition Evaluator (xem §6.1):
- Periodic execution (default đề xuất 6 tháng, final cadence defer P44-6/APR).
- Evaluate 4 conditions C1-C4 status per Dual family.
- Produce evaluation report → APR cấp medium decide exit path.
Exit paths:
| Exit | Action | Role retired/added |
|---|---|---|
| E1: Drop helper hoàn toàn | Migrate (b): drop helper table, populate universal_edges đầy đủ | Retire 2 instance (Cap-5 Dual Sync + Cap-5 Dual Drift Checker) per family; no role added |
| E2: Helper as materialized representation | Helper retained, ghi rõ là materialized (không SSOT), DOT checker bắt drift | Retire 1 instance (Cap-5 Dual Sync — không còn dual-write); giữ 1 instance (Cap-5 Dual Drift Checker — vẫn cần catch drift); flag helper là materialized |
9.8 Audit định kỳ sunset
Theo P44-4A §7.7.4: "Mỗi 6 tháng re-evaluate 4 conditions".
Role: Sunset Condition Evaluator — periodic execution evaluating 4 conditions sunset Dual transitional → produce evaluation report → APR cấp medium decide.
Cadence:
- Default đề xuất: 6 tháng.
- Final cadence (3 / 6 / 12 tháng): defer P44-6/APR theo benchmark + risk profile per family.
- Cadence cụ thể chốt P44-6/APR.
Output report:
- Per family: 4 conditions C1-C4 status (active/inactive).
- Recommendation: maintain Dual / sunset E1 / sunset E2.
- Evidence: benchmark data, drift incidents count, performance metrics.
§10. Reverse-index implementation decision framework P1/P2/P3
10.1 Recap 3 patterns (P44-4A §6.2)
| Pattern | Mô tả | Owner Role |
|---|---|---|
| P1: On-demand | Reverse query trực tiếp trên universal_edges với index | Role: Cap-4/5 Reverse-Index Maintainer (chỉ verify index health) |
| P2: Materialized view | PG materialized view refresh định kỳ | Role: Cap-4/5 Reverse-Index Maintainer (refresh schedule + drift staleness) |
| P3: Trigger-driven cache | Bảng cache, trigger update mỗi INSERT/UPDATE/DELETE edge | Role: Cap-4/5 Reverse-Index Maintainer (trigger-driven + invariant cache vs source) |
10.2 Decision matrix logical (KHÔNG chốt số cụ thể)
| Scale tier | Edge count (logical) | Query frequency (logical) | P99 latency budget (logical) | Pattern recommended |
|---|---|---|---|---|
| Pilot | nhỏ | thấp | rộng | P1 on-demand chấp nhận pilot-only (P44-4A §6.3 siết wording) |
| Production small | trung bình | trung bình | trung bình | P2 materialized view với refresh schedule |
| Production medium | lớn | trung bình-cao | hẹp | P2 hoặc P3 tuỳ refresh tolerance |
| Production large | rất lớn | cao | rất hẹp | P3 trigger-driven cache |
10.3 Threshold P1 → P2 → P3
Threshold số cụ thể defer P44-6 + benchmark. P44-5 chỉ chốt decision framework logical.
Logical triggers chuyển pattern:
- P1 → P2: P99 latency vượt budget HOẶC edge count growth > X% per month HOẶC query frequency tăng vượt threshold (số cụ thể defer).
- P2 → P3: Refresh staleness gây query inconsistency HOẶC refresh duration vượt budget HOẶC concurrency contention (số cụ thể defer).
Decision flow:
- Pilot start với P1 (TAC: 86 units, 3 publications — đáp ứng pilot conditions §6.3 P44-4A).
- Pilot evidence ≥ 30 day → benchmark báo cáo.
- Nếu benchmark vượt threshold → APR cấp medium đánh giá chuyển pattern.
- Migration P1 → P2 hoặc P2 → P3 qua APR PASS → P44-6+ implementation.
OPEN P44-5-γ: threshold số cụ thể (edge count number, query/sec, latency ms) defer P44-6 + pilot benchmark.
10.4 DOT responsibility per pattern
| Pattern | Role: Reverse-Index Maintainer responsibility | Trigger | Schedule | Tier |
|---|---|---|---|---|
| P1 | Verify index health periodic (B-tree index trên target_ref + edge_type) | n/a | cron rất thấp tần suất | B |
| P2 | Refresh materialized view + drift staleness check | schedule | cron periodic | B |
| P3 | Trigger-driven cache update + invariant cache vs source | event-driven trigger | cron drift verify | A |
10.5 Migration plan giữa patterns (logical)
| Migration | Action high-level | Owner P44-6 |
|---|---|---|
| P1 → P2 | (1) Build materialized view DDL; (2) Initial populate; (3) Schedule refresh; (4) Switch query path từ direct universal_edges → materialized view; (5) Verify consistency | DDL + cutover plan |
| P2 → P3 | (1) Install triggers on universal_edges INSERT/UPDATE/DELETE; (2) Build cache table DDL; (3) Initial sync; (4) Switch query path; (5) Drop materialized view sau verify | Trigger code + cutover plan |
Migration script defer P44-6.
10.6 TAC pilot hiện tại
TAC pilot (3 publications, 86 units) → đáp ứng pilot conditions §6.3 P44-4A (i)(ii)(iii):
- (i) Edge count nhỏ (< 1000 estimated cho composition + relation).
- (ii) Có index/plan kiểm tra cơ bản trên target_ref + edge_type (chốt P44-6).
- (iii) Query frequency thấp (Living DB pilot, không hot path).
→ P1 chấp nhận cho TAC pilot only. Khi enacted + scale tăng → re-evaluate qua APR.
§11. Recursive audit / Cycle detection contract
11.1 Cycle types
| Type | Edge type involved | Risk | Detection scope |
|---|---|---|---|
| Composition cycles | contains, belongs_to |
Lifecycle cascade infinite loop, broken hierarchy | Cap-5 primary owner |
| Relation cycles | references, depends_on, uses |
Cross-reference vô hạn, broken dependency analysis | Cap-4 (extension) |
| Version succession cycles | supersedes chain |
Version succession ambiguous | Cap-4 (special) |
11.2 Recursive CTE pattern logical
Đ0-B §IV requirement: cycle detection bắt buộc + depth ≤ 4 guardrail.
Pattern PG 14+ (logical, KHÔNG code cụ thể):
- Recursive CTE traversing edge chain (
containscho composition,references/depends_on/usescho relation). CYCLE id SET is_cycle USING pathclause để PG tự detect cycle.WHERE depth <= 4guardrail.- Output: cycle path, length, severity, affected Objects.
11.3 Role contracts
| Role | Trigger model | Schedule model | Tier | Coverage |
|---|---|---|---|---|
| Role: Cap-5 Cycle Detector (primary) | n/a (read-only audit) | cron weekly (default đề xuất; final cadence defer P44-6) | B | Composition cycle detection global |
| Role: Cap-4 Cycle Detector (optional, extension) | n/a | cron periodic | B | Relation cycle detection cho hot edge types |
11.4 Auto-fix scope cho cycles
NONE — KHÔNG auto-fix cycle detected.
Lý do: cycle = data corruption nghi ngờ; auto-fix risk break legitimate composition (vd self-reference hợp lệ trong rare case). Default = log + escalate APR.
Action:
- Cycle detected → log issue tới
system_issuesvới severityhigh, fieldscycle_path,cycle_length,affected_objects[]. - Escalate APR cấp medium.
- Human review + decide: break cycle manually qua APR PASS → DOT writer apply.
11.5 Terminal cap chính thức
OPEN P44-5-ε (kế thừa OPEN P38-X-15): terminal cap chính thức cho recursive depth — defer Đ0-B amendment hoặc P44-6.
P44-5 lock depth ≤ 4 theo Đ0-B §IV hiện hành. Khi family Lớp 4-6 (Material/Product/Building) xuất hiện → re-evaluate cap.
11.6 Output report format
Format chi tiết defer P44-6. P44-5 chốt high-level fields:
| Field | Mô tả |
|---|---|
cycle_path |
List Object IDs trên cycle |
cycle_length |
Số Object trong cycle |
severity |
high (depth violation > 4 hoặc self-loop) / medium (depth ≤ 4 nhưng nghi ngờ) |
affected_objects[] |
Objects bị ảnh hưởng |
cycle_type |
composition / relation / version_succession |
detected_at |
Timestamp |
recommended_action |
apr_review_required / human_break_needed |
§12. TD-44-2 / TD-44-3 handoff boundaries
Quan trọng: TD-44-2 và TD-44-3 là Procedure: one-shot controlled procedure / runbook, KHÔNG đăng ký DOT thật trong P44-5 (sửa từ outline polish theo GPT điểm 4 + P44-5A polish điểm 3 — đổi prefix
Role:→Procedure:để phân biệt rõ với DOT recurring).
12.1 TD-44-2 boundary — relation_edge lifecycle audit
P44-4A §8 đã có 6-step audit logical plan. TD-44-2 là one-shot audit để verify relation_edge thoả OQC-2 (≥ 2 state thực).
P44-5 LÀM:
- Procedure: Relation Edge Lifecycle Audit — one-shot controlled procedure.
- Định nghĩa logical procedure execute 6 step (P44-4A §8.2) khi User cho phép.
- KHÔNG đăng ký vào dot_registry.
- KHÔNG execute audit trong P44-5.
P44-5 KHÔNG LÀM:
- KHÔNG execute audit query trên production.
- KHÔNG amend Đ44 §4.2 seed (chờ User cho phép theo OPEN P44-4-δ).
Promotion path:
- Khi enacted + audit pass → có thể promote thành DOT recurring qua P44-6/APR (lúc đó mới chuyển từ
Procedure:sangRole:+ đăng ký dot_registry). - Pre-promotion: chỉ controlled procedure, run khi User trigger riêng.
12.2 TD-44-3 boundary — Legacy edges retrofit
P44-4A §9 đã có 4 phase logical retrofit policy. TD-44-3 là retrofit ~2199 legacy edges thiếu provenance.
P44-5 LÀM:
- Procedure: Legacy Edge Provenance Retrofit — one-shot controlled procedure / retrofit runbook.
- Định nghĩa logical procedure execute Phase 0/1/2/3 (P44-4A §9.2) per batch khi enabled.
- KHÔNG đăng ký vào dot_registry.
P44-5 KHÔNG LÀM:
- KHÔNG execute retrofit.
- KHÔNG migration script.
- KHÔNG chốt grace period default cho legacy edges (defer OPEN P44-4-ε + Đ44 Appendix A G6).
Promotion path:
- Khi pilot pass + Đ44 Appendix A G6 → promote DOT qua P44-6/APR (lúc đó mới chuyển từ
Procedure:sangRole:+ đăng ký dot_registry).
12.3 Birth gate enforcement post-Đ44
Theo Q9 GPT (đã PASS outline polish): KHÔNG tạo birth gate riêng cho edge; chỉ tham chiếu Đ44 §9.4 + §5.4.
P44-5 nguyên tắc:
- Edge entries birth gate enforcement tham chiếu Đ44 §9.4 (Birth gate cho Object mới) + Đ44 §5.4 (Edge governance + provenance bắt buộc post-Đ44) — KHÔNG tạo birth gate riêng cho edge.
- Lý do: tránh duplicate luật + leverage existing Đ44 framework.
Cap-4/5 Writer (§4.2 + §5.2) thực hiện validation Completeness §3.1.A theo birth gate hiện hành Đ44 §9.4 + §5.4.
12.4 Phân biệt prefix Role: vs Procedure: (sau P44-5A polish)
Polish P44-5A: phân biệt rõ 2 loại label để tránh hiểu nhầm.
| Prefix | Loại | Đặc điểm | Ví dụ |
|---|---|---|---|
Role: |
DOT recurring (writer/checker/maintainer) | Đăng ký vào dot_registry khi P44-6/APR; có cron schedule hoặc trigger event recurring; paired theo NT12 |
Role: Cap-4 Relation Writer; Role: Cap-5 Composition Checker; Role: Cap-5 Cycle Detector; Role: Sunset Condition Evaluator |
Procedure: |
One-shot controlled procedure / runbook | KHÔNG đăng ký dot_registry; chạy 1 lần (hoặc per batch) khi User trigger hoặc APR cho phép; KHÔNG có recurring schedule | Procedure: Relation Edge Lifecycle Audit (TD-44-2); Procedure: Legacy Edge Provenance Retrofit (TD-44-3) |
Khi 1 procedure được promote thành recurring sau P44-6/APR → đổi prefix từ Procedure: → Role: + đăng ký dot_registry. Trước đó, KHÔNG dùng Role: cho one-shot.
§13. OPEN / Technical Debt phát sinh từ P44-5
13.1 OPEN items (10 items)
| ID | Item | Resolve khi |
|---|---|---|
| OPEN P44-5-α | DOT names cụ thể cho 8-12 Role placeholder + 2 Procedure placeholder | P44-6 + Đ35 paired design + APR |
| OPEN P44-5-β | Schedule cụ thể (phút/giờ) cho cron Cap-4/5 Checker hot/cold path; Cycle Detector; Dual Drift Checker | Pilot benchmark + Đ41 cron framework |
| OPEN P44-5-γ | Reverse-index threshold (edge count, query/sec, latency ms) chuyển P1→P2→P3 | P44-6 + pilot benchmark |
| OPEN P44-5-δ | autofix_enabled config default per rule (start-OFF confirmed P44-5; opt-in trigger conditions + APR cadence chốt sau) |
APR + risk assessment per rule |
| OPEN P44-5-ε | Recursive cycle detection terminal cap chính thức (kế thừa OPEN P38-X-15) | OPEN P38-X-15 + Đ0-B amendment hoặc family Lớp 4-6 xuất hiện |
| OPEN P44-5-ζ | Workflow BPMN integration cho edge promotion (proposed → active) | Đ34 engine active |
| OPEN P44-5-η | Agent extraction cho semantic-derived edges | Đ39 mature + NĐ-36-01 Phần 5 enacted |
| OPEN P44-5-θ | Sunset evaluation report format + APR template | APR Đ32 framework + decision log standard |
| OPEN P44-5-ι ⚡(mới outline polish, mở rộng P44-5A) | INV-DUAL-1 + INV-DUAL-2 auto-fill exception — chính sách validation chi tiết cho 2 bộ 6 guard (g1-g6 mỗi bộ), đặc biệt định nghĩa "conflict với universal_edges hiện hữu" (INV-DUAL-1 g6) và "duplicate helper row" (INV-DUAL-2 g4) | APR + pilot benchmark |
| OPEN P44-5-κ ⚡(mới outline polish) | Ranh giới chính xác giữa edge conformance checker layer vs Object lifecycle mechanism layer (Đ4) cho composition cascade — interface escalation specification | Khi Đ4 lifecycle law có specific cascade rule cho composition |
13.2 Technical Debt (6 items)
| ID | Item | Resolve khi |
|---|---|---|
| TD P44-5-1 | DOT registration entries cho 2 family pilot (Role placeholder → real DOT name in dot_registry); Procedure placeholders KHÔNG đăng ký dot_registry trong P44-5 | P44-6 + Đ44 enacted v1.0 |
| TD P44-5-2 | Trigger code cho INV-DUAL-4 transaction atomicity (Cap-5 Dual Sync trigger function) | P44-6 implementation |
| TD P44-5-3 | Materialized view DDL cho P2 reverse-index (nếu chọn pattern P2 sau benchmark) | P44-6 + scale evidence |
| TD P44-5-4 | Đ22 pattern extension cho edge entries — auto_fix_action library cho 4 chiều A1-A4 + INV-DUAL (đặc biệt 2 bộ 6 guard cho INV-DUAL-1 + INV-DUAL-2) | Đ22 amendment hoặc P44-6 |
| TD P44-5-5 | Sunset Condition Evaluator implementation — periodic scheduler + report generator + APR template | P44-6 |
| TD P44-5-6 | Birth gate Đ44 §9.4 enforcement code cho edge entries (validation Completeness §3.1.A C-1..C-6 trong Cap-4/5 Writer) | Đ44 enacted + P44-6 |
§14. What P44-5 must NOT do (recap kỷ luật)
14.1 Recap 8 guardrails (§1.2)
- KHÔNG đặt tên DOT cụ thể; chỉ Role label cho recurring + Procedure label cho one-shot.
- KHÔNG code, KHÔNG DDL, KHÔNG migration script, KHÔNG mutate production.
- KHÔNG execute audit query (kể cả read-only).
- KHÔNG patch Đ44, Đ35, Đ22, Đ4, Đ0-B, P44-1/2/3/4A, P38-XC.
- KHÔNG mở rộng sang Đ39 KG, Qdrant, BPMN Đ34, NĐ-36-01 entity_relations chi tiết.
- KHÔNG chốt phút/giờ schedule cụ thể.
- KHÔNG chốt threshold số cụ thể cho reverse-index P1→P2→P3.
- KHÔNG upload first draft.
14.2 Phép thử cuối
| Câu hỏi | Action |
|---|---|
| Tôi đang viết tên DOT thật? | STOP — đổi sang Role label hoặc Procedure label |
Tôi đang dùng Role: cho one-shot procedure? |
STOP — dùng Procedure: (xem §12.4) |
| Tôi đang viết DDL/SQL/code? | STOP — defer P44-6 |
| Tôi đang chốt phút/giờ schedule? | STOP — defer OPEN P44-5-β |
| Tôi đang chốt threshold số reverse-index? | STOP — defer OPEN P44-5-γ |
| Tôi đang execute audit query? | STOP — defer User cho phép + prompt agent riêng |
| Tôi đang amend luật/design hiện hữu? | STOP — P44-5 chỉ realize, không amend |
| Tôi đang mở rộng Đ39/Qdrant/BPMN? | STOP — defer post-Tier 4 |
| Tôi đang viết workflow BPMN design? | STOP — Đ34 M0, integration placeholder nhẹ §3.2 |
| Tôi đang viết auto-fill universal_edges từ helper mặc định? | STOP — INV-DUAL-1 default quarantine + escalate (§8.2 + §9.3) |
| Tôi đang viết auto-fill helper từ universal_edges mặc định không guard? | STOP — INV-DUAL-2 cần 6 guard chặt (§8.2 + §9.4) |
| Tôi đang thiết kế cascade retire trong edge checker? | STOP — 2 layer separation (§8.6) |
Tôi đang khẳng định family publication dùng governs/published_in chốt? |
STOP — wording candidate, defer P44-6/APR + Authority Map (§6.2) |
§15. Handoff after P44-5
15.1 Workflow sau P44-5 polish + upload
- Đ44 enacted v1.0 (User ban hành) — P44-5 còn defer các OPEN/TD đến enacted.
- APR cấp high đăng ký 2 family pilot + Đ44 Conformance Clause C1-C5 (theo §9.5 Đ44).
- P44-6 (đề xuất tên: Implementation Realization) — chốt:
- DOT names thật + đăng ký dot_registry per Role.
- Schedule cụ thể (phút/giờ) per cron rule.
autofix_enabledconfig default per rule + opt-in conditions.- Threshold số reverse-index P1→P2→P3.
- Trigger code DDL cho INV-DUAL-4 transaction atomicity.
- Materialized view DDL nếu chọn P2.
- Sunset Condition Evaluator implementation.
- Birth gate enforcement code cho edge entries.
- Procedure → Role promotion (TD-44-2 + TD-44-3 nếu approve recurring).
- Authority Map alignment cho
governed_by/governs+published_in/publishesper family (Đ37 reference).
- Pilot Tier 1 trên TAC family — execute writer + checker + reverse-index cho 2 family pilot.
- Tier 4 unlock sau pilot pass + Đ44 Conformance Clause C5 verify.
15.2 P44-5 KHÔNG hứa
- Timeline enacted (defer User decision).
- Schedule cụ thể (defer P44-6).
- Threshold số reverse-index (defer P44-6).
- DOT names thật (defer P44-6).
- Code triển khai (defer P44-6).
- Authority Map alignment cụ thể cho
governs/published_in(defer P44-6/APR).
15.3 Self-audit checklist
| Aspect | Status |
|---|---|
| NT4 cấm hardcode | ✅ Role + Procedure label config-driven; autofix_enabled config flag; threshold defer config |
| NT9 vĩnh viễn vs tạm | ✅ Sunset path Dual transitional có 4 conditions + 2 exit paths explicit (P44-4A §7.7.4 inherited) |
| NT11 khai tối thiểu | ✅ Provenance auto từ context; PG tự suy ra timestamps |
| NT12 DOT pairing | ✅ Mọi Cap-4/5 role có writer + checker pair; Dual instance có Sync + Drift Checker |
| NT13 PG-anchored | ✅ universal_edges + helper rows + system_issues tất cả PG-anchored |
| NT14 thực thi được ngay | ✅ Tier 1 PASS Item 4 + Đ44 Conformance C5 verify được sau P44-6 |
| Đ44 NS-1 SSOT | ✅ universal_edges là SSOT; helper là enforcement; INV-DUAL-1 không auto-fill ngược (§9.3 siết); INV-DUAL-2 auto-fill helper với 6 guard chặt (§9.4 siết — SSOT direction đúng nhưng helper schema phải bảo vệ) |
| Đ44 NS-4 PG-anchored governance | ✅ Role + Procedure contracts + DOT registry trong PG |
| Đ44 §6.A LV-1..LV-5 | ✅ §6.4 mapping cho 2 family pilot |
| Đ44 §6.B Decision Tree | ✅ §3.2 mapping 5 mechanisms |
| Đ44 §9.1 3 tầng kiểm | ✅ §3.1 áp dụng |
| Đ44 §9.2 DOT cặp NT12 | ✅ §4 + §5 paired |
| Đ44 §9.4 Birth gate | ✅ §3.1.A tham chiếu (KHÔNG tạo birth gate riêng — Q9) |
| Đ44 §9.5 Conformance Clause C5 | ✅ §6.4 mapping |
| Đ35 dot_registry pattern | ✅ Role contract align tier/domain/paired; Procedure KHÔNG đăng ký |
| Đ22 detect → fix → re-check pattern | ✅ §8.1 + §8.4 áp dụng |
| Đ22 autofix_enabled config guard | ✅ §8.3 start-OFF default |
| Đ0-B §I-C structural vs functional | ✅ Helper enforcement vs universal_edges SSOT (P44-4A §7.7.2 inherited) |
| Đ0-B §IV cycle detection depth ≤ 4 | ✅ §11.2 + §11.5 |
| 2 layer separation (edge checker vs Object lifecycle) | ✅ §8.6 + OPEN P44-5-κ |
| Anti self-contradiction P44-5 ↔ P44-4A | ✅ INV-DUAL-1 §8.2 + §9.3 align với P44-4A §7.7.2 (universal_edges là SSOT, không fallback to helper kể cả write direction); INV-DUAL-2 §8.2 + §9.4 đối xứng siết guard cho helper schema |
| Authority Map alignment defer | ✅ §6.2 family publication ghi rõ candidate, defer P44-6/APR |
| Procedure vs Role separation | ✅ §12 + §12.4 + §14.2 |
| 8 guardrails P44-5 | ✅ §1.2 + §14 |
| Q1-Q9 GPT trả lời | ✅ Áp dụng 100% |
| 4 điểm GPT bắt buộc outline polish | ✅ Áp dụng 100% |
| 3 điểm GPT bắt buộc P44-5A polish | ✅ Áp dụng 100% (INV-DUAL-2 6 guard, governs/published_in candidate wording, Procedure prefix) |
→ Không phát hiện xung đột với Hiến pháp + luật + 8 guardrails P44-5.
15.4 Defer table tổng hợp (kế thừa P44-4A §15.4 + thêm P44-5 defer items)
| # | Không chốt | Defer đến |
|---|---|---|
| (i) | DOT names cụ thể (placeholder Role + Procedure labels) | P44-6/APR |
| (ii) | Schedule cụ thể (phút/giờ) cho cron | P44-6 + benchmark |
| (iii) | Threshold số reverse-index P1→P2→P3 | P44-6 + benchmark |
| (iv) | autofix_enabled opt-in conditions per rule |
APR + pilot evidence |
| (v) | INV-DUAL-1 + INV-DUAL-2 auto-fill 2 bộ 6 guard validation chi tiết (đặc biệt INV-DUAL-1 g6 "conflict" + INV-DUAL-2 g4 "duplicate helper row") | APR + pilot |
| (vi) | Cascade retire interface escalation chi tiết | Khi Đ4 lifecycle law có specific cascade rule |
| (vii) | Recursive cycle detection terminal cap chính thức | OPEN P38-X-15 + Đ0-B amendment |
| (viii) | Workflow BPMN integration | Đ34 engine active |
| (ix) | Agent extraction semantic-derived edges | Đ39 mature |
| (x) | Sunset Condition Evaluator cadence final (3/6/12 tháng) | P44-6/APR |
| (xi) | Sunset evaluation report format + APR template | APR framework Đ32 |
| (xii) | Trigger code DDL cho INV-DUAL-4 atomicity | P44-6 |
| (xiii) | Materialized view DDL nếu chọn P2 | P44-6 + scale evidence |
| (xiv) | Đ22 auto_fix_action library cho 4 chiều A1-A4 + INV-DUAL (đặc biệt 2 bộ 6 guard) | Đ22 amendment hoặc P44-6 |
| (xv) | Birth gate enforcement code cho edge entries (validation §3.1.A C-1..C-6) | P44-6 + Đ44 enacted |
| (xvi) | Procedure → Role promotion (TD-44-2 + TD-44-3) khi approve recurring | P44-6/APR |
| (xvii) | Authority Map alignment cụ thể cho governs/governed_by/published_in/publishes per family |
P44-6/APR + Đ37 reference |
| (xviii-xxiv) | (kế thừa P44-4A §15.4 (i)-(xii) chưa resolve) | (theo bảng P44-4A) |
15.5 Sau khi User + GPT confirm P44-5A polish
Workflow (theo pattern P44-4A + Q5 GPT outline):
- User + GPT confirm P44-5A đủ điều kiện upload.
- Upload KB vào path
knowledge/dev/laws/dieu44-trien-khai/design/06-update-mechanism-dot-contract-matrix.md. - KHÔNG tạo decision log ngay (logical contract đã rõ; APR sẽ chốt khi Đ44 enacted).
- Dừng P44-5.
- Đề xuất bắt đầu P44-6 — Implementation Realization (DOT names thật + DDL + code + schedule + threshold + Procedure→Role promotion + Authority Map alignment).
Không upload trước khi User + GPT xác nhận P44-5A đủ điều kiện (theo guardrail GPT pattern P44-4).
P44-5A POLISH | S190 (2026-05-02) | Soạn: Opus 4.7 | Outline PASS S190 → Outline polish PASS S190 (4 chỉnh sửa GPT bắt buộc + Q1-Q9) → Full draft S190 → P44-5A polish 3 chỉnh sửa GPT (INV-DUAL-2 6 guard chặt SSOT direction nhưng helper schema phải bảo vệ; §6.2 governs/published_in candidate wording defer Authority Map P44-6/APR; Procedure: prefix cho one-shot phân biệt với Role: recurring) | Authority: Đ44 v0.1.2 controlled DRAFT | Phụ thuộc: P44-0/1/2/3/4A + P38-XC final + Đ0-B v3.1 + Đ35 v5.2 + Đ22 v1.2 | Self-audit Hiến pháp + 8 guardrails + 4 điểm GPT outline polish + 3 điểm GPT P44-5A polish + Q1-Q9 + anti self-contradiction P44-5 ↔ P44-4A: PASS, không phát hiện xung đột | Trạng thái: uploaded knowledge/dev/laws/dieu44-trien-khai/design/06-update-mechanism-dot-contract-matrix.md