KB-5F74

P11D — Logical Topic View Proof Design

38 min read Revision 1
p11dlogical-topic-view-prooftopic-viewtacdesign-proofruntime-deferreddieu38dieu44s190

P11D — Logical Topic View Proof Design

Trạng thái: P11D-A POLISH | Phiên: S190 (2026-05-02) Stage: Logical design only — runtime proof bằng data thật defer Pilot Tier 1 Path đề xuất (sau review/polish): knowledge/dev/laws/dieu38-trien-khai/closure/p11d-logical-topic-view-proof-design.md (defer User+GPT decide vào closure/ hay reports/) Phụ thuộc: P11A inventory rev 1 + P38-XC final rev 1 + P44-3 Profile Registry rev 1 + P44-4A Relation Edge Conformance rev 1 + P11C closure note rev 1 Outline: P11D outline PASS (S190 GPT review) Workflow: outline PASS → full draft → P11D-A polish 4 điểm GPT (đang đây) → User+GPT confirm → upload (KHÔNG upload trước xác nhận) P11D-A polish (S190 2026-05-02) áp dụng 4 chỉnh sửa GPT: (1) §5.1 Q-T1 sửa wording — không JOIN tac_publication_member như SSOT; resolve publication/container qua universal_edges hoặc reverse-index sinh từ universal_edges; helper chỉ là implementation detail post-P44-6; (2) §11.1 guardrail 10 typo fix Đ24 KGĐ39 KG; (3) §6.2 thêm disclaimer "shape phục vụ tư duy thiết kế, không phải JSON Schema/API/UI contract"; (4) §13 self-audit rút gọn còn 6 bullets chính. P11D-A final micro-fix (S190 2026-05-02): (5) §0 dòng 4 sửa wording contains include cả contradictsinclude cả contradicts với annotation đối lập; exclude contains vì contains thuộc composition, không thuộc Cap-4 relation enrichment.


§0. Tóm tắt 5 dòng cốt lõi

  1. P11D = Logical Topic View Proof Design — chứng minh về mặt thiết kế rằng nếu information_unit có topic metadata (trong content_profile JSONB) + relation edges (trong universal_edges) thì có thể gom Topic View xuyên D28/D32/D35. Không phải runtime proof bằng data thật (defer Pilot Tier 1).
  2. Topic field model logical: topic_code (snake_case) + topic_name + topic_namespace + topic_status + Optional confidence/method/provenance. Storage trong tac_unit_version.content_profile.topic_labels (Optional theo Đ44 §9.1 + P44-3 INV-P4). Topic vocab table defer P44-6; P11D dùng free-text/topic_code + provenance bắt buộc.
  3. Topic source method scope P11D: chỉ manual + section_derived. Agent extraction defer Đ39 mature.
  4. 5 query types proof Q-T1..Q-T5: Topic→units / Topic→grouped by publication / Topic→related qua edges (include cả contradicts với annotation đối lập; exclude containscontains thuộc composition, không thuộc Cap-4 relation enrichment) / Topic→missing metadata low confidence / Topic→source trace provenance.
  5. Boundary nghiêm: KHÔNG SQL thật / KHÔNG DDL / KHÔNG code / KHÔNG mở P44-6 / KHÔNG populate data thật / KHÔNG tạo P11B closure. Roadmap sau: P11D outline PASS → P11D full draft (đang đây) → polish → upload → P11E Checker Proof (Gap D). P44-6 vẫn defer.

§1. P11D là gì + boundary

1.1 Mục tiêu

P11D = Logical Topic View Proof Design cho TAC pipeline.

Trả lời câu hỏi thiết kế: "Nếu các information_unit có topic metadata (trong content_profile JSONB) + relation edges (trong universal_edges là SSOT), liệu có thể gom Topic View xuyên 3 publications hiện hữu (D28/D32/D35) không?"

P11D chứng minh về mặt thiết kế — bằng query catalog logical + assembly pipeline + edge cases — rằng câu trả lời là . Runtime proof bằng data thật defer Pilot Tier 1 (sau khi populate topic_labels + relation edges thật).

P11D xuất phát từ:

  • P11A §5 Top 3 Next Proofs — Proof 3 Topic View (Gap C trong GPT analysis 2026-05-01).
  • GPT analysis Gap C: "query labels/relations, return units from many publications, show source publication/address, retain provenance and lifecycle".

1.2 P11D LÀM (10 việc)

# Việc Section
1 Inputs inherited từ P11A + P38-XC + P44-3 + P44-4A + P11C §2
2 Topic field model logical (identity + source + confidence + provenance + status) §3
3 Profile field mapping cho topic (content_profile JSONB) align P44-3 §4
4 Topic query catalog Q-T1..Q-T5 logical §5
5 Topic view assembly pipeline (5 steps) §6
6 Provenance + lifecycle tracking per topic_label §7
7 Anti-pattern (cấm) + edge cases (xử lý) §8
8 OPEN P11D-α..ζ + TD P11D-1..4 §9
9 Risk/conflict check + mitigate §10
10 Scope recap (KHÔNG làm) + roadmap sau P11D §11 + §12

1.3 P11D KHÔNG LÀM (10 guardrails)

  1. KHÔNG SQL thật — chỉ logical query pattern (vd "JSONB @> operator" — không câu SQL chạy được).
  2. KHÔNG DDL — không tạo schema mới (vd topic vocab table defer P44-6).
  3. KHÔNG code — không Nuxt component, không API endpoint, không backend logic.
  4. KHÔNG execute query/audit trên production (kể cả read-only).
  5. KHÔNG mở P44-6 Implementation Realization (defer Đ44 enacted v1.0 + APR cấp high).
  6. KHÔNG populate topic_labels thật trên 86 units (defer Pilot Tier 1).
  7. KHÔNG tạo P11B closure — P44-3 đã cover Profile Registry (Gap A); không sinh doc thừa.
  8. KHÔNG sửa P44-3 / P44-4A / P44-5A / P11C closure. P11D chỉ realize logical proof, không amend design hiện hữu.
  9. KHÔNG claim đã runtime proof bằng data thật — wording "Logical Proof Design" xuyên suốt; runtime proof defer Pilot.
  10. KHÔNG mở rộng sang Đ39 KG / Qdrant projection / Đ34 BPMN workflow / Directus UI / Nuxt UI (defer post-Tier 4).

1.4 Phép thử nhanh sa đà

Nếu thấy đang viết:

  • SQL thật chạy được → STOP, đổi sang "logical pattern".
  • DDL CREATE TABLE topic vocab → STOP, defer P44-6.
  • Mocked data thật cho 86 units → STOP, dùng scenario synthetic minh hoạ.
  • "P11D đã chứng minh runtime…" → STOP, sửa "P11D chứng minh về mặt thiết kế…".
  • Mở rộng P44-6 implementation hoặc Đ39/BPMN → STOP, defer.

§2. Inputs inherited

2.1 Từ P11A inventory

ID Item Reference P11A
I-A-1 86 units / 3 publications (D28/D32/D35) / 86 unit_versions / 86 members — production state §1 Executive Summary
I-A-2 3 JSONB profiles GIN-indexed: identity_profile (LU), content_profile (UV), publication_profile (Pub) — chưa populate, all {} §2 Gap matrix #14-16, §4.1
I-A-3 universal_edges 2199 rows (cấu hình đầy đủ) — chưa có TAC edges populate §2 Gap matrix #17-19, §4.2
I-A-4 Topic labels chưa có (Gap D #21) — cần design §2 Gap matrix #21
I-A-5 Top 3 Next Proofs đề xuất: Proof 1 JSONB profile populate, Proof 2 TAC relation edges (đã closed P11C), Proof 3 Topic View (P11D này) §5

2.2 Từ P38-XC final

ID Item Reference P38-XC
I-XC-1 3 JSONB profile sketches: identity_profile / content_profile / publication_profile §7 (sketch)
I-XC-2 Profile fields liên quan topic (Optional Enrichment): topic_labels, entity_mentions, numeric_claims, version_refs, summary_text §7 Optional fields
I-XC-3 Capability matrix Cap-1..5 — P11D realize Q-Topic (mở rộng Q-set), dựa Cap-3 Profile + Cap-4 Relation §8
I-XC-4 Q1-Q6 Living DB — P11D thêm Q-Topic family (Q-T1..Q-T5) §8
I-XC-5 OPEN P38-X-13 reverse-index — defer P44-4A đã closed §13

2.3 Từ P44-3 Profile Registry

ID Item Reference P44-3
I-3-1 Profile entity: profile_code + schema_definition + required_fields_set + optional_fields_set §3
I-3-2 INV-P4 constraint: mọi field phải nằm đúng 1 trong required/optional sets §4
I-3-3 Profile lifecycle: proposed → active → deprecated → retired §5
I-3-4 topic_labels thuộc Optional Enrichment (Đ44 §9.1) — không block birth gate §6 + Đ44 §9.1

2.4 Từ P44-4A Relation Edge

ID Item Reference P44-4A
I-4A-1 universal_edges là SSOT (P44-4A §7.7.2 — chốt) §7.7.2
I-4A-2 8 Core edge types: references, depends_on, uses, implements, supersedes, contradicts, compatible_with, contains §3
I-4A-3 3 Candidate edge types: derived_from, governed_by, published_in (chờ User ban hành) §3
I-4A-4 INV-DUAL-1..4 anti-drift — P11D query không touch (chỉ read universal_edges SSOT) §7.7.3
I-4A-5 Cấm fallback to helper (P44-4A §12.1) — P11D query KHÔNG được đọc tac_publication_member để gom topic §12.1

2.5 Từ P11C closure note

ID Item Reference P11C
I-C-1 universal_edges là SSOT (chốt) §3
I-C-2 Cap-4 Relation + Cap-5 Composition contracts (chốt) §3
I-C-3 Implementation defer P44-6 + Pilot Tier 1 §5
I-C-4 P11D = next recommended proof (Topic View) §6

§3. Topic field model logical

3.1 Topic identity (4 fields bắt buộc cho mỗi topic_label)

Field Type Constraint Lý do
topic_code string snake_case, immutable per topic, unique within namespace Identity stable; query key chính
topic_name string human-readable, mutable Display label, không phải identity
topic_namespace string snake_case (vd tac.governance, tac.lifecycle, tac.vocab, tac.dot, tac.cycle) Nhóm topic; tránh collision cross-domain
topic_status enum proposed / active / deprecated / retired align Đ4 lifecycle Lifecycle handling

Ví dụ logical (KHÔNG SQL):

topic_code = "birth_gate"
topic_name = "Birth Gate Enforcement"
topic_namespace = "tac.governance"
topic_status = "active"

3.2 Topic source — 3 method (P11D scope chỉ 2 đầu)

Quyết định GPT Q-D1: P11D chỉ proof manual + section_derived. Agent extraction defer Đ39 mature.

Method Mô tả P11D scope Lý do
manual User/Agent ghi explicit topic_code vào content_profile.topic_labels ✅ In scope Confidence = 1.0; nguồn provenance trực tiếp
section_derived Topic auto-derive từ section_type + body keywords (vd section "Birth Gate" → birth_gate topic) ✅ In scope Section_type vocab đã có; deterministic mapping
agent_extraction AI extract topic từ summary_text + entity_mentions ⏸ Defer Đ39 mature Cần Đ39 KG + provenance method agent_extraction chuẩn
relation_derived Nếu A references B + A có topic X → suggest B cũng X (low confidence) ⏸ Defer Pilot Nguy cơ cycle topic propagation; cần benchmark

3.3 Topic confidence (Optional)

Field Range Ghi chú
topic_confidence [0.0, 1.0] Optional; manual = 1.0; section_derived = mặc định 0.9; agent/relation defer
Threshold "low confidence" (defer Pilot — không chốt số) Quyết định GPT Q-D4: chỉ ghi "có threshold", value defer pilot

Threshold số (vd < 0.7) defer Pilot Tier 1 + benchmark. P11D chỉ chốt logical "có threshold" để Q-T4 query phát hiện units low confidence.

3.4 Topic provenance (bắt buộc post-Đ44)

Quyết định GPT Q-D3: Start free-text topic_code + provenance bắt buộc. Topic vocab table defer P44-6.

Per topic_label, provenance fields:

  • creator: user_id (manual) / agent_name (defer) / section_derived_v1 (section)
  • method: manual / section_derived / agent_extraction (defer) / relation_derived (defer)
  • timestamp: ISO 8601, khi gán topic_label
  • source_context: cho section_derived = section_type:birth_gate; cho manual = user_input

Provenance align Đ44 §5.4 post-Đ44 (P11C closure §3) — KHÔNG block birth gate vì topic_labels là Optional Enrichment, NHƯNG nếu populate thì provenance bắt buộc.

3.5 Topic vocab governance (defer P44-6)

Quyết định GPT Q-D3 + Q-D5: Vocab table + alias resolution defer P44-6 + APR.

P11D chỉ chốt logical:

  • Topic vocab table chưa tồn tại trong P11D — start với free-text topic_code + provenance.
  • Alias resolution (vd birth_gatebirthgate_check) defer P44-6 + APR Đ32.
  • P11D chỉ flag need (xem §9 OPEN P11D-α + P11D-δ).

3.6 Topic lifecycle (align Đ4)

Topic status follows Đ4 lifecycle:

  • proposedactive qua APR PASS.
  • activedeprecated khi superseded bởi topic mới (vd birth_gate_v1birth_gate_v2); link qua supersedes edge type (P44-4A vocab).
  • deprecatedretired sau grace period (defer P44-6 cụ thể).

P11D chỉ chốt logical lifecycle pattern; full transition rule + grace period defer OPEN P11D-ε.


§4. Profile field mapping

4.1 Field placement align P44-3 + P38-XC

Field Profile location Required/Optional Rationale
topic_labels (list of objects) tac_unit_version.content_profile JSONB Optional (theo P44-3 INV-P4 + Đ44 §9.1 Optional Enrichment) Không block birth gate; populate dần
summary_text tac_unit_version.content_profile JSONB Optional Hỗ trợ Q-T4 quality flags
entity_mentions tac_unit_version.content_profile JSONB Optional Defer agent extraction
numeric_claims tac_unit_version.content_profile JSONB Optional Defer agent extraction

4.2 Schema sketch logical (KHÔNG JSON Schema thật)

Dạng object shape mô tả, KHÔNG phải JSON Schema validation thật.

content_profile.topic_labels = list of:
  {
    topic_code: snake_case_string (required),
    topic_name: human_string (optional, populate later),
    topic_namespace: snake_case_string (required),
    topic_status: enum(proposed|active|deprecated|retired) (required),
    topic_confidence: float [0.0, 1.0] (optional),
    topic_method: enum(manual|section_derived) (required if confidence != 1.0),
    topic_provenance: {
      creator: string,
      method: string,
      timestamp: iso8601,
      source_context: string
    } (required post-Đ44)
  }

4.3 GIN index leverage

content_profile JSONB hiện đã có GIN index (P11A §1 Executive Summary). Q-T1..Q-T5 dùng @> containment operator để tận dụng GIN — không cần index mới.

Logical pattern (KHÔNG SQL thật):

content_profile @> {topic_labels: [{topic_code: "birth_gate"}]}

4.4 INV-P4 constraint check

P44-3 INV-P4: mọi field phải nằm đúng 1 trong required_fields_set HOẶC optional_fields_set.

P11D xác nhận:

  • topic_labels ∈ optional_fields_set của profile information_unit_content_v1.
  • Sub-fields trong topic_labels[i]: topic_code + topic_namespace + topic_status + topic_provenance ∈ required (per object); rest optional.

§5. Topic query catalog Q-T1..Q-T5

Wording cảnh báo: Tất cả query là logical query pattern. Không phải SQL chạy được. P11D = Logical Proof Design — chứng minh về mặt thiết kế rằng các pattern này khả thi với infrastructure hiện hữu (universal_edges SSOT + content_profile JSONB GIN-indexed). Runtime kiểm chứng bằng data thật defer Pilot Tier 1.

5.1 Q-T1: Topic → list units

Use case: "Cho topic birth_gate, liệt kê tất cả units có topic này, kèm publication context."

Logical pattern (KHÔNG SQL thật):

  • Source chính (units + topic):
    • tac_unit_version (nguồn content_profile) JOIN tac_logical_unit (nguồn canonical_address).
    • Filter: content_profile @> {topic_labels: [{topic_code: <X>}]}.
    • Filter lifecycle: lifecycle_status ∈ {active, proposed} (default — option include retired qua flag).
  • Resolve publication/container (KHÔNG dùng tac_publication_member làm SSOT):
    • Resolve qua universal_edges với edge_type=contains / belongs_to (Cap-5 Composition theo P44-4A §3 + P44-5A §5) — xác định publication container của mỗi unit.
    • HOẶC qua reverse-index sinh từ universal_edges (P44-4A §6 reverse-index P1/P2/P3) — pre-compute mapping unit → publication.
    • Helper tac_publication_member chỉ là enforcement helper / materialized representation (P11C closure §3) — KHÔNG phải SSOT; có thể dùng làm implementation detail post-P44-6 nhưng không phải nguồn group publication trong logical design.
  • Project: (canonical_address, doc_code, doc_version, section_type, summary_text, topic_confidence, lifecycle_status).

Logical proof (design level): Với 86 units / 3 publications, scenario synthetic minh hoạ — manual populate 5 units D35 + 3 units D32 + 1 unit D28 với topic_code = "birth_gate" → Q-T1 trả về 9 units, sorted by doc_code. Không phải runtime proof — đây là design-level walk-through để chứng minh logical pattern khả thi với infrastructure hiện hữu (universal_edges SSOT + content_profile JSONB GIN-indexed).

5.2 Q-T2: Topic → grouped by publication

Use case: "Cho topic birth_gate, group theo publication."

Logical pattern:

  • Q-T1 result GROUP BY doc_code.
  • Aggregate per group: count + min/max version + lifecycle_status mix.

Logical proof (design level): Output object:

{
  "topic": "birth_gate",
  "publications": [
    {doc_code: "D35", count: 5, lifecycle: {active: 5}},
    {doc_code: "D32", count: 3, lifecycle: {active: 2, proposed: 1}},
    {doc_code: "D28", count: 1, lifecycle: {active: 1}}
  ]
}

→ Chứng minh về mặt thiết kế rằng topic phân bố không đều xuyên publications — insight giá trị thiết kế. Runtime kiểm chứng defer Pilot Tier 1.

Quyết định GPT Q-D2: include contradicts với annotation rõ "đối lập", không loại. Vì cùng topic nhưng đối lập là thông tin quan trọng.

Use case: "Cho topic birth_gate, tìm units liên quan qua relation edges (units không tag topic_label nhưng có edge đến units của topic)."

Logical pattern:

  • Step 1: Source set = Q-T1 result (units có topic).
  • Step 2: Query universal_edges với target_ref ∈ Source set + edge_type ∈ whitelist.
  • Step 3: Edge type whitelist (xem §5.3.1 dưới).
  • Step 4: Trả về source_ref units (related set).
  • Step 5: Annotate mỗi related unit với relation_kind + via_target (target nào của Q-T1 set link tới).

§5.3.1 Edge type whitelist cho topic enrichment:

Edge type Include? Annotation relation_kind Lý do
references ✅ Include references (cùng topic, citation) Standard citation; chắc chắn liên quan
depends_on ✅ Include depends_on (cùng topic, dependency) Phụ thuộc luật/chốt — cùng topic
compatible_with ✅ Include compatible_with (cùng topic, đồng thuận) Đồng thuận — cùng topic
contradicts Include với annotation đối lập contradicts (cùng topic, đối lập) Quyết định GPT Q-D2: cùng topic nhưng đối lập = thông tin quan trọng để topic view show controversy/conflict
implements ✅ Include implements (cùng topic, thực hiện) Thực hiện luật/quy định — cùng topic
supersedes ✅ Include supersedes (version succession, cùng topic) Version chain — cùng topic, lifecycle khác
uses ⚠️ Optional uses (cùng topic, sử dụng) Có thể noise; defer Pilot benchmark
contains ❌ Exclude (composition, không phải relation topic) Composition khác relation; xử lý qua Q2/Q3 P38-XC

§5.3.2 Logical pattern annotation:

related_units = [
  {
    unit: <unit_data>,
    relation_kind: "contradicts",  // GPT Q-D2: contradicts vẫn show
    via_target: <target_canonical_address>,
    edge_provenance: <from universal_edges>
  }
]

Logical proof (design level): Scenario synthetic — D32 unit về "lifecycle status enum" references D35 unit về "birth gate" (D32 unit không có topic_label birth_gate). Q-T3 trả về D32 unit với relation_kind=references + via_target=D35 unit. Topic view enrich từ 9 units (Q-T1) → ~15 units (Q-T1 ∪ Q-T3). Runtime kiểm chứng defer Pilot Tier 1 (cần populate relation edges thật).

5.4 Q-T4: Topic → missing metadata / low-confidence units

Use case: "Cho topic birth_gate, tìm units cần human review (low confidence hoặc thiếu summary/entity)."

Logical pattern:

  • Source: Q-T1 result.
  • Filter: topic_confidence < <THRESHOLD> OR summary_text IS NULL OR entity_mentions = [] OR topic_provenance IS NULL.
  • Annotate reason per unit (vd reason: "low_confidence").

THRESHOLD wording: P11D không chốt số (Quyết định GPT Q-D4). Chỉ ghi: <THRESHOLD> là parameter, value defer Pilot Tier 1 + benchmark.

Logical proof (design level): Output object:

{
  "topic": "birth_gate",
  "needs_review": [
    {unit: <D32 unit>, reason: "low_confidence", confidence: 0.6},
    {unit: <D28 unit>, reason: "missing_summary"}
  ]
}

Threshold số final + benchmark defer Pilot Tier 1.

5.5 Q-T5: Topic → source trace / provenance

Use case: "Cho 1 unit cụ thể trong topic view, trace nguồn topic_label + version evolution."

Logical pattern:

  • Source: 1 unit từ Q-T1 (specified by canonical_address).
  • Trace 1: topic_labels[i].topic_provenance per topic_label.
  • Trace 2: query tac_unit_version cùng logical_unit_id để show topic_labels evolution xuyên versions.

Logical proof (design level): Output object:

{
  "unit": <D35 unit canonical_address>,
  "topic_provenance_trail": {
    topic_code: "birth_gate",
    creator: "user_id_42",
    method: "manual",
    timestamp: "2026-04-15T10:00:00Z",
    source_context: "user_input"
  },
  "version_history": [
    {version: 1, topic_labels: ["birth_gate"]},
    {version: 2, topic_labels: ["birth_gate", "lifecycle"]}
  ]
}

→ Chứng minh về mặt thiết kế rằng P11D giữ provenance + lifecycle (yêu cầu GPT Gap C). Runtime trace bằng data thật defer Pilot Tier 1.


§6. Topic view assembly logic

6.1 Pipeline 5 steps

Input: topic_code (vd "birth_gate")
  ↓
Step 1: GATHER
  → Q-T1 trả về core unit set (units có topic_label)
  ↓
Step 2: ENRICH
  → Q-T3 tìm related units qua relation edges (include contradicts với annotation)
  → Output: extended set = Q-T1 ∪ related, mỗi unit annotate với relation_kind
  ↓
Step 3: GROUP
  → Q-T2 group theo publication (D28 / D32 / D35)
  → Aggregate count + lifecycle mix per group
  ↓
Step 4: QUALITY
  → Q-T4 flag missing metadata / low confidence
  → Tách needs_review subset
  ↓
Step 5: PROVENANCE
  → Q-T5 attach trace cho mỗi unit (provenance + version evolution)
  ↓
Output: TopicView object structured

6.2 Output object shape (logical design sketch, KHÔNG JSON Schema thật)

Disclaimer: Shape dưới đây phục vụ tư duy thiết kế cho Topic View — KHÔNG phải JSON Schema validation, API response contract, hay UI contract. Schema thật + API + UI đều defer P44-6 / Pilot Tier 1 / UI design phase.

TopicView {
  topic: {topic_code, topic_name, topic_namespace, topic_status},
  
  publications: [
    {
      doc_code, doc_version,
      core_count: <int>,        // từ Q-T1
      related_count: <int>,     // từ Q-T3
      total_count: <int>,
      lifecycle_mix: {active: <n>, proposed: <n>, ...},
      units: [
        {
          canonical_address,
          section_type, summary_text,
          lifecycle_status,
          relation_kind: <core|references|contradicts|...>,  // core = từ Q-T1; rest = từ Q-T3
          via_target: <if relation_kind != core>,
          topic_confidence,
          topic_provenance
        }
      ]
    }
  ],
  
  quality_flags: {
    needs_review_count: <int>,
    needs_review_units: [{canonical_address, reason}]
  },
  
  metadata: {
    retrieved_at: <iso8601>,
    retrieved_by: <user_or_agent_id>,
    p11d_version: "logical_proof_design_v1"
  }
}

6.3 Performance considerations (logical)

  • TAC pilot 86 units / 3 publications: P1 reverse-index on-demand đủ (theo P44-4A §6.3 + P11C closure §3).
  • Q-T1 sử dụng GIN index trên content_profile (đã có).
  • Q-T3 sử dụng B-tree index trên universal_edges.target_ref (defer P44-6 verify index).
  • Khi scale → P2/P3 (defer P44-6 + benchmark theo P11C closure §5).

6.4 Anti-coupling guarantee

  • Q-T1..Q-T5 chỉ đọc tac_* JOINs hợp lệ + universal_edges (SSOT theo P11C closure).
  • KHÔNG đọc tac_publication_member để gom cross-publication (vi phạm anti-pattern P44-4A §12.1 — xem §8.1).

§7. Provenance + lifecycle tracking

7.1 Provenance per topic_label (post-Đ44 bắt buộc)

Mỗi entry trong content_profile.topic_labels[i] MUST có topic_provenance (P11D §3.4):

  • creator: ai gán (user_id / agent_name / section_derived_v1).
  • method: manual / section_derived (P11D scope).
  • timestamp: ISO 8601.
  • source_context: vd section_type:birth_gate cho section-derived; user_input cho manual.

Align Đ44 §5.4 post-Đ44 + P11C closure §3 (provenance bắt buộc cho mọi metadata mới post-enacted).

7.2 Topic_label immutability per version

  • content_profile của tac_unit_version enacted: immutable (theo Đ28 v2.0 enacted immutability trigger — P11A §2 #9).
  • Sửa topic_labels của 1 version enacted → KHÔNG được phép; phải tạo unit_version mới + new content_profile.
  • Đây align Đ44 §5.4 + LSL-01 NT15.

7.3 Topic evolution xuyên versions

  • Same logical_unit_id qua nhiều unit_version → topic_labels có thể thay đổi (vd v1 chỉ có birth_gate, v2 thêm lifecycle).
  • Q-T5 trace timeline xuyên versions để show topic evolution.

7.4 Retire handling

  • Unit retired (lifecycle_status=retired): mặc định filter ra khỏi Q-T1, NHƯNG có flag option include retired (vd cho audit historical).
  • Topic retired (topic_status=retired): filter ra khỏi Q-T1 default; vẫn xuất hiện trong version_history (Q-T5) qua supersedes chain.

7.5 Topic lifecycle transitions (logical, defer chi tiết)

Pattern align Đ4 lifecycle:

  • proposedactive: APR PASS (vocab governance).
  • activedeprecated: superseded; link supersedes edge.
  • deprecatedretired: grace period (defer P44-6 + APR cụ thể).

P11D chỉ chốt pattern logical; full transition rule + grace period defer OPEN P11D-ε.


§8. Anti-pattern + edge cases

8.1 Anti-patterns (CẤM)

ID Anti-pattern Lý do cấm Mitigate
AP-1 Q-T1/Q-T2/Q-T3 đọc trực tiếp tac_publication_member để gom cross-publication thay vì qua universal_edges + relation edges Vi phạm P11C closure §3 (universal_edges là SSOT) + P44-4A §12.1 (cấm fallback to helper) Pipeline §6.1 force qua relation edges layer; tac_publication_member chỉ dùng cho membership query trong cùng publication
AP-2 Auto-derive topic_label từ section_type + body keywords mà không có provenance Vi phạm Đ44 §5.4 post-Đ44 (provenance bắt buộc) + P11C closure §3 §7.1 bắt buộc topic_provenance đầy đủ; section_derived method có creator='section_derived_v1' + source_context='section_type:<X>'
AP-3 Topic_code free-text không governance → tạo duplicate (birthgate vs birth_gate vs BG) Confusion + Q-T1 miss matches OPEN P11D-α: vocab table + governance defer P44-6 + APR; P11D scope chỉ free-text + cảnh báo duplicate risk
AP-4 Q-T3 chain enrichment vô hạn (related of related of related…) Topic explosion + cycle topic propagation §5.3 Q-T3 chỉ 1 hop (Q-T1 + 1 layer related); chain ≥ 2 hops defer P44-6
AP-5 Trộn Cap-5 Composition (contains/belongs_to) vào topic enrichment Q-T3 Composition khác Relation; tách layer responsibility (P11C closure §3) §5.3.1 edge type whitelist exclude contains; Q-T3 chỉ Cap-4 Relation

8.2 Edge cases

ID Case Xử lý
EC-1 Unit không có topic_labels (default {}) KHÔNG xuất hiện trong Q-T1; có thể xuất hiện trong Q-T3 qua edges (annotate relation_kind); vẫn được tính trong Q-T4 quality flags
EC-2 Unit có nhiều topic_labels (1-to-many) Xuất hiện trong nhiều topic views; không vi phạm; aggregate count độc lập per topic
EC-3 Topic không có units (vocab tồn tại, chưa unit nào tag) Q-T1 rỗng; topic view return empty + flag coverage: zero
EC-4 Cross-publication topic mismatch (D28 dùng birth_gate, D35 dùng birthgate_check) OPEN P11D-δ: alias resolution defer P44-6/APR; P11D chỉ flag mismatch trong quality_flags + cảnh báo cần vocab governance
EC-5 Cycle trong relation edges Q-T3 (vd A→B→A references chain) P44-5A §11 Cap-5 Cycle Detector handle (depth ≤ 4); Q-T3 1 hop tránh cycle ngắn
EC-6 Edge contradicts giữa 2 units cùng topic Include với annotation relation_kind=contradicts (Quyết định GPT Q-D2); show controversy trong topic view — đây là feature, không phải bug
EC-7 Topic deprecated/retired nhưng vẫn có units active tag Q-T1 filter topic_status default; flag warning "topic deprecated, units still tag — needs migration"
EC-8 unit_version mới không có topic_labels (regression) Q-T1 dùng latest active version → unit không xuất hiện; trace Q-T5 show topic loss; flag warning trong quality

§9. OPEN / Technical Debt

9.1 OPEN items (6 items)

ID Item Resolve khi
OPEN P11D-α Topic vocab table + governance (vocab schema, APR amendment rule, alias mapping) P44-6 + Đ32 APR framework
OPEN P11D-β Topic source method definition chi tiết — quy tắc populate per method (manual / section_derived); agent_extraction + relation_derived defer Đ39 mature P44-6 + Đ39 mature
OPEN P11D-γ Topic confidence threshold số (vd "low confidence < 0.7") Pilot Tier 1 + benchmark
OPEN P11D-δ Cross-publication topic alias resolution (vd birth_gatebirthgate_check) — full mechanism APR + vocab governance
OPEN P11D-ε Topic lifecycle full transition rule + grace period (proposed→active→deprecated→retired align Đ4) Đ4 lifecycle law amendment hoặc P44-6
OPEN P11D-ζ Q-T3 edge type whitelist final — đặc biệt uses include/exclude; chain enrichment max hops Pilot Tier 1 + benchmark

9.2 Technical Debt (4 items)

ID Item Resolve khi
TD P11D-1 Populate topic_labels thật cho 86 units (manual hoặc section_derived) Pilot Tier 1
TD P11D-2 Topic vocab table DDL + seed (sau OPEN P11D-α resolve) P44-6
TD P11D-3 Q-T1..Q-T5 SQL thật + index optimization + benchmark P44-6 + benchmark
TD P11D-4 Topic view UI (Directus collection / Nuxt component) Pilot Tier 1 + UI design phase

§10. Risk / Conflict check

# Risk Severity Mitigate
R1 Topic vocab tự do tạo duplicate (birthgate vs birth_gate vs BG) Medium §3.5 + §8.1 AP-3 + OPEN P11D-α; P11D start free-text + cảnh báo duplicate
R2 Auto-derive topic vi phạm Đ44 §5.4 post-Đ44 (provenance bắt buộc) High §3.4 + §7.1 + §8.1 AP-2: provenance bắt buộc cho mọi method; section_derived có creator='section_derived_v1' + source_context
R3 Topic view bypass universal_edges (vi phạm P11C closure SSOT) High §6.4 anti-coupling + §8.1 AP-1: pipeline force qua relation edges; cấm đọc tac_publication_member cross-publication
R4 Topic source method scope không đủ (chỉ manual + section trong P11D) Medium Quyết định GPT Q-D1: agent_extraction defer Đ39 mature; P11D scope đủ proof logical
R5 Confidence threshold không có evidence pilot → khó set threshold đúng Medium Quyết định GPT Q-D4: defer Pilot; P11D không chốt số, chỉ logical "có threshold"
R6 Cross-publication topic mismatch không có alias resolution Medium OPEN P11D-δ + §8.2 EC-4: P11D flag warning, defer P44-6/APR
R7 Topic lifecycle không align Đ4 chi tiết Low §7.5 pattern logical; OPEN P11D-ε defer transition rule
R8 Q-T3 edge enrichment quá rộng → topic view noise Medium §5.3.1 whitelist; uses defer; chain max 1 hop (§8.1 AP-4)
R9 P11D không thể runtime proof vì topic_labels chưa populate (all {}) High Wording disclaimer: P11D là Logical Proof Design, runtime proof defer Pilot Tier 1; outline + draft ghi rõ "design proof, không runtime proof"
R10 P11D mở rộng sang Đ39 KG / Đ34 BPMN / Directus UI / Nuxt UI Medium §1.3 guardrail 10 + §11 scope recap; defer post-Tier 4
R11 Q-T3 include contradicts gây hiểu nhầm "đồng thuận" Medium §5.3.1 whitelist annotation relation_kind=contradicts rõ "đối lập"; §8.2 EC-6 frame là feature show controversy
R12 Cycle topic propagation (relation_derived defer nhưng nguy cơ tương lai) Low §3.2 relation_derived defer Pilot; §8.1 AP-4 chain max 1 hop

Tổng: 2 High + 7 Medium + 2 Low + 1 wording disclaimer (R9). Tất cả mitigate trong P11D. Không Critical.

Anti self-contradiction check: P11D không vi phạm P11C closure (universal_edges SSOT) — Q-T3 force qua universal_edges; không bypass to helper.


§11. Scope recap — what P11D must NOT do

11.1 Recap 10 guardrails (§1.3)

  1. KHÔNG SQL thật.
  2. KHÔNG DDL.
  3. KHÔNG code.
  4. KHÔNG execute query/audit.
  5. KHÔNG mở P44-6.
  6. KHÔNG populate topic_labels thật.
  7. KHÔNG tạo P11B closure (theo Quyết định GPT Q-D6).
  8. KHÔNG sửa P44-3/P44-4A/P44-5A/P11C closure.
  9. KHÔNG claim runtime proof bằng data thật (P11D = Logical Proof Design).
  10. KHÔNG mở rộng Đ39 KG / Đ34 BPMN / Qdrant / Directus UI / Nuxt UI.

11.2 Phép thử cuối

Câu hỏi Action
Tôi đang viết SQL chạy được? STOP — đổi sang "logical pattern"
Tôi đang viết DDL CREATE TABLE? STOP — defer P44-6
Tôi đang viết Nuxt component / API code? STOP — defer Pilot Tier 1
Tôi đang chốt threshold số confidence? STOP — defer Pilot (Quyết định GPT Q-D4)
Tôi đang chốt topic vocab table schema? STOP — defer P44-6 (Quyết định GPT Q-D3)
Tôi đang viết "P11D đã proof" mà chưa data thật? STOP — đổi "P11D chứng minh về mặt thiết kế"
Tôi đang tạo P11B closure note? STOP — Quyết định GPT Q-D6 skip
Tôi đang dùng contains trong Q-T3 enrichment? STOP — composition không thuộc Cap-4 Relation (§5.3.1 exclude)
Tôi đang đọc tac_publication_member để gom cross-publication? STOP — vi phạm AP-1; phải qua universal_edges
Tôi đang loại contradicts khỏi Q-T3? STOP — Quyết định GPT Q-D2: include với annotation đối lập

§12. Roadmap sau P11D

12.1 Sau P11D full draft PASS

  1. User + GPT review full draft P11D.
  2. Polish round (P11D-A) theo feedback nếu có.
  3. User + GPT confirm P11D đủ điều kiện upload.
  4. Upload KB tại path đề xuất knowledge/dev/laws/dieu38-trien-khai/closure/p11d-logical-topic-view-proof-design.md (defer User+GPT decide closure/ hay reports/).
  5. KHÔNG tạo decision log ngay (logical design, APR sẽ chốt khi Đ44 enacted + Pilot).
  6. Dừng P11D.

12.2 Sau P11D upload

Đề xuất bước kế tiếp (chờ User+GPT chọn):

Lựa chọn Tên Mô tả ngắn Khuyến nghị
A P11E Checker proof (Gap D) Logical design cho 4 checker prototype: numeric claim drift / version reference drift / broken cross-reference / code-text mismatch Khuyến nghị — completes P11 series proof phase
B P44-6 Implementation Realization DDL + code + DOT names + schedule + threshold + Authority Map alignment Defer — cần Đ44 enacted + APR
C Pilot Tier 1 (populate data thật) Populate topic_labels + relation edges thật cho 86 units Defer — cần P44-6 trước

Khuyến nghị Opus: Lựa chọn A — P11E Checker proof. Lý do:

  • P11 series là proof first; P11E completes Gap D từ GPT analysis 2026-05-01.
  • P11E logical proof không cần Đ44 enacted; parallel với P44-6.
  • Sau P11E → P11 proof phase đầy đủ → có evidence mạnh cho APR Đ44 enacted.

12.3 P11 series tổng hợp (cập nhật)

# Stage Status Note
P11A Inventory + Gap analysis ✅ Uploaded (2026-05-01) Source of truth cho P11 series
P11B Metadata profile proof (Gap A) Skipped Quyết định GPT Q-D6: P44-3 đã cover; không tạo doc thừa
P11C Relation edges proof (Gap B) ✅ Closed (2026-05-02) P44-4A + P44-5A cover design; closure note uploaded
P11D Topic View proof (Gap C) 🔄 Full draft đang đây Logical Proof Design
P11E Checker proof (Gap D) ⏳ Next sau P11D 4 checker prototype
P11F Vector/KG projection (Gap E) ⏸ Defer Đ39 mature + NĐ-36-01 Phần 5 enacted

12.4 P44-6 vẫn defer

  • Đến khi cần implementation thật (Đ44 enacted v1.0 + APR cấp high + pilot tiền đề).
  • P44-6 không cản P11D/P11E (parallel khả thi).

§13. Self-audit P11D (rút gọn theo P11D-A polish)

  • Không SQL thật / DDL / code — chỉ logical pattern + output shape sketch.
  • Không runtime claim bằng data thật — wording "Logical Proof Design" + R9 disclaimer + scenario synthetic minh hoạ xuyên suốt.
  • universal_edges là SSOT — Q-T1 resolve publication qua universal_edges/reverse-index; Q-T3 force qua relation edges layer; cấm bypass to helper (§5.1 + §6.4 + §8.1 AP-1).
  • 6 quyết định GPT applied — Q-D1 §3.2 / Q-D2 §5.3.1 / Q-D3 §3.4-3.5 / Q-D4 §3.3 / Q-D5 §3.5 / Q-D6 §11 + §12.3.
  • OPEN P11D-α..ζ + TD P11D-1..4 rõ ràng với resolve path defer (§9).
  • P44-6 deferred — không khởi động trong P11D; §12.4 chỉ tham chiếu defer.

P11D-A POLISH FINAL | S190 (2026-05-02) | Soạn: Opus 4.7 | Outline PASS S190 → Full draft S190 → P11D-A polish 4 chỉnh sửa GPT (§5.1 không JOIN tac_publication_member như SSOT — resolve qua universal_edges/reverse-index; §11.1 typo Đ24 KG → Đ39 KG; §6.2 disclaimer output shape không phải JSON Schema/API/UI; §13 self-audit rút gọn) → P11D-A final micro-fix (§0 dòng 4 sửa wording contains include cả contradictsinclude contradicts với annotation đối lập; exclude contains vì composition) | Stage: Logical Proof Design only — runtime proof defer Pilot Tier 1 | Phụ thuộc: P11A inventory + P38-XC final + P44-3 + P44-4A + P11C closure | 6 quyết định GPT áp dụng 100% | Self-audit anti self-contradiction P11D ↔ P11C ↔ P44-4A: PASS | Trạng thái: uploaded knowledge/dev/laws/dieu38-trien-khai/closure/p11d-logical-topic-view-proof-design.md