C3 — Component/BOM Operating Model
C3 — Component/BOM Operating Model
Loại: Design note tiền-schema — Điều 38 Text as Code Phase: P2c (Design Phase), tiếp nối C1 (Text Unit), C2 (Metadata), C1A (Segmentation) Trạng thái: OFFICIAL v0.1 — GPT PASS (R1 14 patches + 3 khuyến nghị, R2 FINAL PASS). User PASS. Ngày soạn: 2026-04-26 | Phiên: S181 Agent soạn: Opus 4.6 (Desktop) GPT review: Round 1 — PASS có điều kiện (14 patches + 3 khuyến nghị). Round 2 — FINAL PASS. Inputs: L2 (Component/BOM Governance), L4 (Birth Gate Extension), C1, C2, C1A, LSL-01 v0.3/v0.4, P5 v0.2, Đ24, Đ32, Đ33
1. Mục tiêu
C3 trả lời: "Kho linh kiện chuẩn vận hành thế nào trong thế giới unit-centric?"
Cụ thể:
- Component là gì, khác logical_unit thế nào, quan hệ ra sao.
- BOM lắp ráp component vào publication thế nào, khác publication_member thế nào.
- Variant/version/compatibility quản lý ra sao.
- Golden path và anti-pattern nằm ở đâu trong governance.
- C3 sẽ tạo ra yêu cầu gì cho P5b (schema bổ sung).
C3 là operating model — bản thiết kế kho linh kiện ở mức vận hành, đủ chi tiết để P5b chuyển thành schema, nhưng chưa phải schema. Tên bảng/cột/kiểu dữ liệu nếu xuất hiện chỉ là candidate concept cho P5b, không phải quyết định chốt.
2. Phạm vi / Không làm
2.1 Trong phạm vi
- Component registry operating model
- Component version model
- Component variant model
- BOM (Bill of Materials) operating model
- Reuse decision flow + machine enforcement
- Golden path / anti-pattern governance
- Component metadata requirements
- Label integration with Đ24
- Review / change-set / APR hooks cho component
- Birth gate readiness cho component
- Relationship với P5 schema hiện tại
- P5b schema impact map + minimum slice
2.2 Không làm
- Không SQL executable / migration / DOT implementation
- Không Qdrant / KG implementation
- Không workflow engine / UI
- Không sửa C1/C2/C1A/LSL/L1–L5/P5
- Không đọc 02* trong tham-khao/ làm nguồn điều hành
- Không chốt compatibility matrix cụ thể / danh sách golden path cụ thể
- Không chốt interface contract kỹ thuật chi tiết
3. Thuật ngữ cốt lõi
3.1 Component
Đơn vị giải pháp chuẩn hóa — đã đóng gói, có spec rõ, dùng lại được trong nhiều văn bản/hệ thống. Tương tự PLM part trong sản xuất.
Nôm na: Nếu logical_unit là "một đoạn trong cuốn sách" thì component là "một công cụ trong hộp dụng cụ" — cuốn sách nói "dùng cờ lê số 10 để vặn bu lông" (reference), còn cờ lê số 10 sống trong kho dụng cụ (component catalog), không phải trong cuốn sách.
3.2 Component version
Bản cụ thể của component tại 1 thời điểm. Version bump khi spec/implementation thay đổi. Version quản lý độc lập với document/publication version.
3.3 Component variant
Biến thể của base component — khác ở config/tham số, KHÔNG khác ở kiến trúc. Variant phải trỏ về base component (L2 §3.7). Variant có version + governance status riêng.
Khác kiến trúc = component mới hoặc major version/new base, không phải variant.
Lưu ý: Variant → base là quan hệ lineage/trace, KHÔNG phải parent-child structural tree. Component không có cây parent-child như logical_unit (xem INV-COMP-NO-TREE).
3.4 Component use / instance
Khi một publication/assembly dùng 1 component → đó là 1 component use (BOM entry). Mỗi use ghi: component nào, version nào, usage type, config override.
3.5 BOM (Bill of Materials)
Danh sách component mà 1 publication/assembly sử dụng, kèm version + config.
BOM mặc định ở cấp publication/assembly. Publication BOM là slice đầu tiên; component assembly/golden path có thể có BOM/assembly riêng ở P5b nếu cần.
Nôm na: BOM giống "danh sách nguyên liệu" trong công thức nấu ăn — liệt kê "món này dùng bột mì, trứng, đường". Còn "bước 3: cho trứng vào" là reference ở cấp bước (unit-level edge).
3.6 Golden path
Tổ hợp component đã phê duyệt, giải đúng 1 loại bài toán. Golden path là approved reference assembly trong catalog — data queryable trong PG, không phải markdown hướng dẫn (L2 §3.8).
3.7 Anti-pattern / Negative knowledge
Tổ hợp cấm, pattern thất bại — ghi nhận và quản lý theo Đ39 C13. Chỉ trở thành enforcement rule khi authority phê duyệt (L2 §3.9).
4. Component trong mô hình unit-centric
4.1 Component KHÔNG phải miếng thông tin
Đây là phân biệt quan trọng nhất của C3.
| Khía cạnh | Logical unit (miếng) | Component (linh kiện) |
|---|---|---|
| Bản chất | Đơn vị nội dung — một ý có title rõ, sửa riêng được | Đơn vị giải pháp — cơ chế/pattern đóng gói, dùng lại được |
| Sống ở đâu | Trong cây cấu trúc của publication (parent-child) | Trong component catalog (registry độc lập) |
| Thuộc document? | Có — mỗi logical_unit có doc_code binding | Không — component độc lập, nhiều documents dùng chung |
| Parent-child tree? | Có — cây cấu trúc dọc | Không — component không xếp cây. Variant → base là lineage/trace, không phải structural tree. |
| Publication? | Qua publication_member (N:M) — nội dung | Qua BOM entry (khác concept) — linh kiện sử dụng |
| Species (Đ29) | text_unit | component |
Quy tắc cứng (L2 §3.3): Component ≠ text unit. Hai entity khác nhau, hai species khác nhau, hai registry khác nhau, hai birth gate khác nhau.
4.2 Quan hệ component ↔ text unit
Hai cách component liên kết với text unit:
| Cơ chế | Cấp | Mô tả | Quản bằng |
|---|---|---|---|
| BOM entry | Publication/assembly | "Publication X dùng component Y" | BOM concept (P5b) |
| Reference edge | Unit | "Miếng Z tham chiếu component Y" | universal_edges (existing) |
Hai cơ chế bổ sung, không thay thế (L2 §3.3). BOM trả lời "publication này dùng linh kiện gì?" Reference edge trả lời "đoạn này nói đến linh kiện nào?"
4.3 Component không thay thế text authority
Authority pháp lý nằm ở văn bản/unit/change-set được duyệt (L2 §4.8). Component cung cấp giải pháp kỹ thuật/quản trị; authority vẫn thuộc publication enacted.
5. Component vs logical_unit vs unit_version — bảng so sánh
| Thuộc tính | logical_unit | unit_version | component | component_version |
|---|---|---|---|---|
| Identity | canonical_address (bất biến) | version_number per unit | code (unique) | version_number per component |
| Content | Không chứa trực tiếp | body, title, description | Không chứa trực tiếp | spec, interface, implementation_ref |
| Lifecycle | active/draft_only/retired | draft/enacted/superseded/retired | draft/active/deprecated/retired/superseded | draft/active/deprecated/superseded/retired |
| Governance status | N/A | review_state | approved_for_reuse / experimental / restricted / deprecated_but_allowed / forbidden_for_new | N/A (lifecycle đủ) |
| Thuộc document? | Có (doc_code) | Qua logical_unit | Không | Không |
| Parent-child tree? | Có | Không | Không (variant → base = lineage, không phải tree) | Không |
| Publication? | Qua publication_member | Trực tiếp trong membership | Qua BOM entry | Trực tiếp trong BOM entry |
| Species | text_unit | (part of text_unit) | component | (part of component) |
| Đ24 labels? | Có (entity_labels) | Kế thừa qua logical_unit | Có (entity_labels) | Kế thừa qua component |
6. Component registry operating model
6.1 Component registry ≠ PG catalog
Component catalog chỉ khai semantic/ownership/lifecycle/compatibility — cái PG không tự biết (NT11). Không khai lại pg_proc, pg_trigger, pg_class.
Component có thể trỏ đến PG objects (function, trigger) qua reference — nhưng chỉ trỏ, không khai lại metadata kỹ thuật. Storage model cho PG object references (JSONB vs junction/read-only reference) thuộc P5b quyết định; default nghiêng junction/read-only nếu cần integrity, nhưng C3 không chốt.
6.2 Ngưỡng vào catalog (L2 §3.4)
Chỉ đăng ký vào catalog khi đủ 3 điều kiện:
- Reuse value — đã dùng lại hoặc có căn cứ sẽ dùng lại.
- Ownership/lifecycle rõ — ai sở hữu, trạng thái gì, version nào.
- Compatibility/composition xác định — dùng với gì, không dùng với gì.
Helper nội bộ dùng 1 lần → KHÔNG vào catalog.
6.3 Component lifecycle (tuân thủ Đ4)
draft ──▶ active ──▶ deprecated ──▶ retired
│
└──▶ superseded (khi major version/new base thay thế)
draft: Đang soạn, chưa dùng được.active: Sẵn sàng sử dụng.deprecated: Vẫn hoạt động nhưng không nên dùng cho mới — chuyển sang replacement.retired: Ngưng hoạt động. BOM entry trỏ component retired → DOT cảnh báo.superseded: Bị thay bởi version mới hoặc component mới.
Lifecycle vs governance_status — phân biệt rõ:
- Lifecycle = trạng thái tồn tại (component đang sống, đang chết, hay đã nghỉ hưu).
- Governance_status = policy sử dụng (component được phép dùng ở mức nào).
Hai trục độc lập nhưng có ràng buộc: nếu lifecycle = 'retired' thì governance_status KHÔNG được là approved_for_reuse hay experimental (mâu thuẫn — đã nghỉ hưu mà vẫn cho dùng). Xem INV-LIFECYCLE-GOV-CONSISTENT.
6.4 Governance status (L2 §3.6)
Governance status là thuộc tính quản trị bổ sung lifecycle, phân loại mức độ cho phép sử dụng:
| Status | Ý nghĩa | Ai set |
|---|---|---|
approved_for_reuse |
Đã duyệt, khuyến khích dùng | Owner/Council |
experimental |
Đang thử nghiệm, dùng có rủi ro | Owner |
restricted |
Chỉ dùng trong scope cụ thể | Council |
deprecated_but_allowed |
Deprecated nhưng vẫn được dùng theo rule | Owner/Council |
forbidden_for_new |
Cấm dùng cho documents/publications mới | Council |
Governance status là controlled vocabulary — config/governance data, agent không tự sáng tác, không hardcode (NT4).
6.5 Component type (controlled vocabulary, L2 §3.5)
Bộ khởi đầu: pattern, template, guard, config_rule, workflow_step, function.
Mở rộng qua catalog governance/approval — agent không tự sáng tác. Component type vocabulary là config/governance data (NT4), không hardcode vĩnh viễn.
7. BOM operating model
7.1 BOM ≠ publication_member
Đây là phân biệt quan trọng thứ hai của C3.
| Khía cạnh | publication_member (P5) | BOM entry (P5b candidate) |
|---|---|---|
| Trả lời | "Publication gồm những miếng thông tin nào?" | "Publication dùng linh kiện chuẩn nào?" |
| Trỏ tới | unit_version (nội dung) | component_version (giải pháp) |
| Render? | Có — render_order xác định thứ tự đọc | Không trực tiếp — BOM là metadata quản trị, không phải nội dung đọc |
| Immutable khi enacted? | Có (P5 §9.1) | Có — BOM snapshot bất biến khi publication enacted |
7.2 BOM scope (L2 §3.10, §4.4)
BOM mặc định ở cấp publication/assembly. "Publication Đ38 v3.0 dùng guard-reuse-check v2, template-law-article v1.3" — đó là publication BOM.
Publication BOM là slice đầu tiên. Component assembly/golden path có thể có BOM/assembly riêng ở P5b nếu cần (ví dụ: golden path "Soạn luật mới" có danh sách component riêng không gắn với publication cụ thể).
Unit-level reference (miếng X nói "áp dụng guard Y") → quản bằng universal_edges, KHÔNG phải BOM.
7.3 BOM entry model (concept)
Mỗi BOM entry ghi:
| Field (concept) | Mô tả |
|---|---|
| publication/assembly ref | Publication hoặc assembly nào |
| component ref | Component nào |
| component_version ref | Version nào tại thời điểm add |
| usage_type | required / optional / reference / alternative |
| config_override | Config khác default nếu có |
7.4 BOM rules (L2 §3.10.2)
- Uniqueness per BOM: Mặc định 1 component tối đa 1 lần per publication. Nếu cùng component dùng 2 vai trò → dùng variant hoặc distinct component-use identity. P5b sẽ chốt uniqueness key:
(publication_id, component_id)hoặc(publication_id, component_id, usage_role). - BOM ghi version tại thời điểm add. Component bump version → BOM không tự đổi → DOT phát hiện mismatch → cảnh báo.
- BOM machine-readable, machine-checkable.
- Component mới add vào BOM phải
activehoặcapproved_for_reuse.deprecated_but_allowedchỉ được giữ hoặc dùng theo rule/approval. - Enacted publication → BOM bất biến (tương tự publication_member). Thêm/xóa component từ enacted BOM chỉ qua publication version mới.
8. Variant / Version / Compatibility model
8.1 Component version
draft ──▶ active ──▶ superseded (khi version mới active)
│
└──▶ deprecated ──▶ retired
- Version sequential per component.
- Version bump khi spec/implementation thay đổi.
- Tối đa 1 active version per component (tương tự tối đa 1 enacted unit_version per logical_unit). Xem INV-COMP-SINGLE-ACTIVE.
- Superseded: version cũ khi version mới active.
8.2 Variant model
base component ◄── variant A (config override X)
◄── variant B (config override Y)
- Variant phải trỏ base_component → base tồn tại (L2 §3.7).
- Variant khác base ở config/tham số, KHÔNG ở kiến trúc.
- Variant có version + governance status riêng.
- Nếu khác kiến trúc → component mới hoặc new base.
- Variant → base là lineage/trace, KHÔNG phải parent-child structural tree (INV-COMP-NO-TREE).
8.3 Compatibility rules (concept)
Compatibility rules xác định component nào dùng được với component nào:
| Rule type | Mô tả | Ví dụ |
|---|---|---|
requires |
Component A bắt buộc có Component B | guard-reuse-check requires function-search-catalog |
conflicts |
Component A không dùng chung với B | template-v1 conflicts template-v2 |
replaces |
Component A thay thế B | guard-reuse-check-v3 replaces guard-reuse-check-v2 |
compatible_with |
A và B dùng chung được (explicit) | pattern-law-article compatible_with template-law-header |
Compatibility rules lưu trong PG, machine-checkable. Là config/governance data (NT4), không hardcode. DOT/checker kiểm BOM entries có vi phạm compatibility không.
Danh sách rules cụ thể = config data, seed ở P5b/P6, KHÔNG chốt trong C3.
9. Reuse decision flow
9.1 Thứ tự bắt buộc (L2 §3.11)
① Reuse nguyên trạng → dùng đúng component đã có
↓ không thể
② Reuse + cấu hình → dùng component đã có + config khác
↓ không thể
③ Extend bằng variant → tạo biến thể, giữ trace với base
↓ không thể
④ Tạo mới (justified) → chỉ khi ①②③ bất khả thi
9.2 Machine enforcement (L2 §4.2, NT2)
Đây là cơ chế máy, không phải guideline:
- Birth path component kiểm reuse_decision_ref (L4 §5.3).
- Tạo mới (④) hoặc variant/base mới: bắt buộc reuse decision record + human approval.
- Reuse nguyên trạng/cấu hình (①②): theo policy, có thể không cần approval riêng.
- Enforcement mode: block/warn/escalate theo config (L4 §6).
9.3 Reuse decision record (concept)
Mỗi reuse decision ghi:
- Ai quyết định, khi nào.
- Đã tìm kiếm catalog chưa, kết quả gì.
- Justification: tại sao không reuse/extend.
- Approval: human approve nếu tạo mới.
Reuse decision record tham chiếu từ component. Storage model (P5b candidate table hay record trong existing table) thuộc P5b.
10. Golden path / Anti-pattern governance
10.1 Golden path
Golden path = approved reference assembly — tổ hợp component đã chứng minh giải đúng 1 loại bài toán.
Lưu trữ: PG data, machine-queryable. KHÔNG phải markdown hướng dẫn (L2 §3.8). Là config/governance data (NT4).
Governance: Golden path phải được authority phê duyệt (Council/Owner). Tạo/sửa golden path qua approval path.
Cấu trúc concept:
- Golden path metadata: identity, name, problem_type, lifecycle_status, approved_by.
- Golden path members: Danh sách component + version + assembly rules. Tách riêng khỏi metadata (không gộp component_list vào golden path record).
Golden path thuộc P5b phase 2 — không nằm trong minimum slice. Có thể triển khai sau component/BOM/reuse_decision/compatibility_rule ổn định.
10.2 Anti-pattern / Negative knowledge
Anti-pattern = tổ hợp cấm, pattern thất bại — quản lý theo Đ39 C13 (L2 §3.9).
Quy tắc: Anti-pattern chỉ trở thành enforcement rule khi authority phê duyệt. Trước khi phê duyệt = knowledge/advisory, không phải cấm cứng.
Lưu trữ: Có thể trong compatibility_rule (rule_type = 'conflicts'/'forbidden') hoặc concept riêng. P5b quyết.
KG projection: Anti-pattern có thể project vào KG (Đ39) với provenance. KG chỉ projection, không phải SoT enforcement. Không tạo authoritative component knowledge ngoài PG.
11. Metadata requirements
11.1 Component metadata — concept level (L2 §3.6, C2 §4.2.4)
| Level | Field (concept) | Fill type |
|---|---|---|
| Component (identity) | code (unique) | Agent manual / system-auto |
| name | Agent manual | |
| component_type | Agent manual, FK controlled vocab | |
| owner | Agent manual | |
| description / spec_summary | Agent manual | |
| interface (in/out governance-level) | Agent manual — required theo component_type config | |
| lifecycle_status | System auto / transition | |
| governance_status | Agent manual / Council, FK controlled vocab | |
| base_component_ref (nếu variant) | Agent manual | |
| reuse_decision_ref | Agent manual (bắt buộc khi tạo mới/variant) | |
| pg_object_refs | Agent manual (trỏ, không khai lại) | |
| identity_profile (JSONB) | Agent manual, per component_type | |
| Component version (content) | version_number | System auto |
| spec_detail | Agent manual | |
| implementation_ref | Agent manual (trỏ PG objects nếu có) | |
| changelog_summary | Agent manual | |
| lifecycle_status | System auto / transition | |
| content_hash | System auto / derived | |
| content_profile (JSONB) | Agent manual, per component_type | |
| created_at, updated_at | System auto |
11.2 BOM entry metadata (concept)
| Field (concept) | Fill type |
|---|---|
| publication/assembly ref | System/agent |
| component ref | Agent manual |
| component_version ref | Agent manual (version tại thời điểm add) |
| usage_type | Agent manual (required/optional/reference/alternative), controlled vocab |
| config_override | Agent manual (nếu khác default) |
| created_at | System auto |
11.3 Profile phân tầng (tương tự P5 DP-5)
| Object | Profile concept | Mô tả |
|---|---|---|
| component | identity_profile JSONB | Per component_type: {"domain": "governance", "pg_function": "fn_birth_gate_check"} |
| component_version | content_profile JSONB | Per version: {"test_coverage": 0.85, "performance_note": "..."} |
12. Label integration with Đ24
12.1 Component dùng Đ24 entity_labels
Component labels sử dụng Đ24 entity_labels. Component code hoặc entity mapping tương thích Đ24 sẽ map vào entity_labels.entity_code. Format chính xác xác định sau khi rà Đ24 entity_code format thực tế — C3 không chốt format quá sớm.
KHÔNG tạo label registry riêng (CI-9, P3 v0.4).
12.2 Facets cho component (concept)
| Facet | Mô tả | Ví dụ |
|---|---|---|
domain |
Lĩnh vực áp dụng | governance, content, infrastructure |
layer |
Tầng kiến trúc | KHO, NÃO, CỔNG |
component_family |
Nhóm linh kiện | birth-gate, review, lifecycle |
Facets mới cần đăng ký qua Đ24 + Council. KHÔNG tự tạo trong C3.
12.3 component_type ≠ Đ24 label
Tương tự section_type (P5 DP-4): component_type là FK controlled vocabulary (P5b candidate: component_type_vocab), KHÔNG phải Đ24 classification label. Nếu cần map sang Đ24 facet → rule riêng tại P6.
Component_type_vocab là controlled vocabulary cho structural/governance metadata, không thay thế Đ24 taxonomy_facets / entity_labels.
13. Review / Change-set / APR hooks
13.1 Component review
Component version có review concept tương tự unit_version:
unreviewed→in_review→review_passed/review_failed→needs_re_review- Review gắn component_version. Review base ≠ approve variants (analogous C1 I6).
13.2 Change-set cho component
Component changes có thể gom vào change-set cùng cơ chế change governance hiện hành. Cách tích hợp chính xác (dùng chung change_set table + extend, generic change_subject/polymorphic subject, hay table riêng) thuộc P5b quyết định. C3 chỉ chốt:
- Component tạo mới, version mới, retire, BOM update đều có thể gom vào change-set.
- Snapshot bất biến khi submitted (tương tự C1 I9).
- APR hook tương tự P5.
13.3 APR integration
- Component tạo mới (④): cần human approval qua Đ32 (L2 §4.1).
- Component version bump: cần owner review (L2 §3.2).
- Governance status change (ví dụ approved_for_reuse → forbidden_for_new): cần Council approval.
- APR hook: opaque reference tương tự P5.
14. Birth gate readiness
14.1 Component birth (L4 §5)
| Check | Field(s) (concept) | Enforcement |
|---|---|---|
| Code unique | component.code UNIQUE | BLOCK |
| Name + spec | name, spec_summary NOT NULL | BLOCK |
| Component_type valid | FK controlled vocab, status='active' | BLOCK |
| Owner present | owner NOT NULL | BLOCK |
| Description present | Description required theo component_type config. Một số component_types có thể cho phép mô tả ngắn/tối giản. | BLOCK hoặc WARN (per config) |
| Interface present | Nếu component_type yêu cầu (config) | BLOCK hoặc WARN |
| Variant trace | Nếu variant: base_component_ref trỏ component tồn tại | BLOCK |
| Reuse decision | Tạo mới (④) / variant / base mới: reuse_decision_ref + human approval | BLOCK (L4 §5.3) |
| Lifecycle default | 'draft' | SYSTEM AUTO |
| Governance status default | 'experimental' | SYSTEM AUTO |
| Species registration | component phải đăng ký như species/loài quản trị hoặc class tương đương theo Đ29/cơ chế hiện hành. Thao tác cụ thể thuộc deployment/design. | L4 §2.2 |
14.2 Component version birth
| Check | Field(s) (concept) | Enforcement |
|---|---|---|
| Component exists | component_ref FK valid | BLOCK |
| Version number | Auto-increment per component | SYSTEM AUTO |
| Spec detail | NOT NULL | BLOCK |
| Changelog summary | NOT NULL (mô tả thay đổi) | BLOCK |
| Lifecycle default | 'draft' | SYSTEM AUTO |
| Content hash | Computed | SYSTEM AUTO |
14.3 BOM entry birth
| Check | Field(s) (concept) | Enforcement |
|---|---|---|
| Publication/assembly exists | Ref FK valid | BLOCK |
| Component exists | Ref FK valid | BLOCK |
| Component version exists | Ref FK valid | BLOCK |
| Component status | lifecycle = 'active', governance = approved_for_reuse hoặc theo rule | BLOCK hoặc WARN |
| Uniqueness per publication | Per uniqueness key (P5b chốt) | BLOCK |
| Usage type valid | Controlled vocabulary | BLOCK |
| Publication not enacted | Enacted publication → BOM bất biến | BLOCK |
15. Relationship với P5 schema hiện tại
15.1 P5 slice Unit/Publication/Metadata KHÔNG cần sửa
C3 không phá P5 v0.2. P5b sẽ bổ sung Component/BOM và có thể extend change governance model. Lý do P5 giữ nguyên:
- P5 đã ghi rõ "Không full Component/BOM schema (thuộc C3/P5b)" trong §2.2.
- P5 change governance model extensible (có thể thêm change_type values hoặc polymorphic subject).
- P5 universal_edges đã support reference edge giữa unit và component.
- P5 Đ24 entity_labels đã support component labels.
15.2 P5 interaction points
| P5 element | C3 interaction |
|---|---|
publication |
BOM entry trỏ publication — cùng publication concept |
| change governance | Component changes có thể gom vào — cần extend ở P5b |
universal_edges |
Unit-level reference đến component — dùng edge existing |
entity_labels (Đ24) |
Component labels dùng entity_labels, entity mapping tương thích Đ24 |
publication_member |
Tách biệt BOM. publication_member = miếng. BOM = linh kiện. |
15.3 Invariants P5 giữ vững
Tất cả 15 invariants từ P5 §15 vẫn giữ nguyên. C3 không tạo xung đột.
16. P5b schema impact map
16.1 P5b minimum slice (triển khai trước)
| # | Concept (P5b candidate) | Mô tả | Relation |
|---|---|---|---|
| 1 | component | Registry component — identity, lifecycle, governance status | Độc lập. Labels qua entity_labels. |
| 2 | component_version | Version content — spec, implementation_ref, changelog | Ref → component |
| 3 | component_type_vocab | Controlled vocabulary cho component_type | FK from component. KHÔNG Đ24 replacement. |
| 4 | bom_entry | Bill of Materials — component trong publication | Ref → publication + component + component_version |
| 5 | reuse_decision | Record ghi nhận tìm kiếm + justification + approval | Ref từ component |
| 6 | compatibility_rule | Rules: requires/conflicts/replaces/compatible_with | Ref → component × 2 |
| 7 | governance_status_vocab | Controlled vocabulary cho governance_status | FK from component. KHÔNG Đ24 replacement. |
| 8 | Extend change governance | Thêm component change types + nullable component fields hoặc polymorphic subject | Extend P5 concept |
16.2 P5b phase 2 (sau minimum slice ổn định)
| # | Concept | Mô tả | Lý do defer |
|---|---|---|---|
| 9 | golden_path | Approved reference assembly metadata | Cần component/BOM ổn trước |
| 10 | golden_path_member | Component trong golden path + version + assembly rules | Cần golden_path concept |
Tổng: 8 concepts minimum slice + 2 concepts phase 2 + 1 extension.
17. Checker/DOT implications for P6
P6 cần thiết kế checker cho:
| Check | Mô tả | Trigger |
|---|---|---|
| BOM version mismatch | Component version trong BOM khác latest active version → WARN | DOT daily |
| BOM status check | BOM entry trỏ component retired/forbidden → ERROR | DOT daily |
| Compatibility violation | BOM entries vi phạm compatibility_rule → ERROR | DOT daily / on BOM change |
| Reuse decision completeness | Component mới không có reuse_decision_ref → ERROR | Birth gate + DOT daily |
| Golden path adherence | Publication dùng subset of golden path nhưng thiếu required components → WARN | DOT daily (phase 2) |
| Variant base valid | Variant trỏ base_component không tồn tại hoặc retired → ERROR | Birth gate + DOT daily |
| Component orphan | Component active nhưng không nằm trong BOM nào → INFO | DOT weekly |
| Governance status consistency | governance_status vs lifecycle_status mâu thuẫn (INV-LIFECYCLE-GOV-CONSISTENT) → ERROR | DOT daily |
| Component version consistency | Component active nhưng không có active version → ERROR | DOT daily |
| Component retired + active version | Component retired mà còn active version → ERROR (INV-COMP-RETIRED-NO-ACTIVE) | DOT daily |
18. Open decisions
| Code | Câu hỏi | Đề xuất C3 | Phase |
|---|---|---|---|
| OD-C3-01 | Component change governance: extend existing change_set hay polymorphic subject? | P5b quyết. Cả hai hướng hợp lệ. | P5b |
| OD-C3-02 | Golden path storage: dedicated concept hay JSONB? | Dedicated (machine-queryable, L2 §3.8). Phase 2 sau minimum slice. | P5b phase 2 |
| OD-C3-03 | Anti-pattern storage: compatibility_rule hay concept riêng? | compatibility_rule với rule_type='forbidden'. P5b quyết. | P5b |
| OD-C3-04 | Component version: sequential integer hay semantic? | Sequential (nhất quán unit_version). P5b chốt. | P5b |
| OD-C3-05 | Governance status: column hay table riêng với history? | Column + DOT audit. History nếu cần → audit log. P5b chốt. | P5b |
| OD-C3-06 | BOM entry config_override: JSONB hay dedicated columns? | JSONB (linh hoạt). P5b chốt. | P5b |
| OD-C3-07 | Usage type: controlled vocabulary table riêng hay enum? | Controlled vocabulary table (nhất quán P5 pattern). P5b chốt. | P5b |
| OD-C3-08 | Component vector projection? | Chỉ component_version spec text dài mới có vector projection. Qdrant/KG projection-only. Không tạo authoritative component knowledge ngoài PG. | P5b/P6 |
| OD-C3-09 | pg_object_refs: JSONB vs junction/read-only reference? | P5b quyết. Default nghiêng junction nếu cần integrity. | P5b |
| OD-C3-10 | BOM enacted immutability enforcement: trigger hay app? | P5b/P6 quyết. Nhất quán P5 publication_member. | P5b/P6 |
| OD-C3-11 | BOM uniqueness key: (pub_id, comp_id) hay (pub_id, comp_id, usage_role)? | P5b chốt. Nếu cùng component 2 vai trò → variant hoặc distinct use identity. | P5b |
19. Constitutional / Cross-law check
| Nguyên tắc / Luật | Verdict | Ghi chú |
|---|---|---|
| NT1 / NT13 — PG là SoT | PASS | Component + BOM sống trong PG. KG/Qdrant = projection, không tạo authoritative component knowledge ngoài PG. |
| NT2 — Cơ chế máy | PASS có điều kiện | Reuse decision = machine-enforced ở P5b/P6. C3 chỉ chốt operating model. |
| NT4 — Config/registration path | PASS có điều kiện | Vocab/compatibility/golden path/reuse decision là config/governance data, không hardcode. Component catalog không duplicate PG catalog. |
| NT8 — Assembly First | PASS | BOM + golden path = hiện thực hóa NT8. |
| NT11 — Khai tối thiểu | PASS có điều kiện | Component catalog ≠ PG catalog. Chỉ khai semantic. Không duplicate PG metadata. Không tạo label registry song song. |
| Đ4 — Lifecycle | PASS | Component lifecycle tuân thủ Đ4. |
| Đ24 — Label Law | PASS có điều kiện | Labels qua entity_labels hoặc mapping tương thích. Format chưa chốt quá sớm. Vocab tables ≠ Đ24 replacement. |
| Đ29 — Species | PASS | component species đăng ký theo Đ29/cơ chế hiện hành. |
| Đ32 — APR | PASS | APR hook, không redesign. Human approval cho tạo mới (④). |
| Đ33 — PG Law | PASS | Operating model only. Chưa vượt gateway. |
| Đ39 — KG | PASS | Anti-pattern → Đ39 C13. Golden path → KG projection. KG = projection only. |
| LSL-01 / C1A | PASS | Component ≠ text unit. BOM ≠ publication_member. Unit-centric giữ đúng. |
| L2 | PASS | C3 cụ thể hóa L2 ở mức operating model. |
| L4 | PASS | Birth gate hooks nhất quán L4 §5. |
| P5 v0.2 | PASS | P5 slice Unit/Publication/Metadata không cần sửa. P5b sẽ bổ sung Component/BOM và có thể extend change governance. |
20. PASS criteria
| # | Criterion | Status |
|---|---|---|
| 1 | Component ≠ text unit — 2 species, 2 registry, 2 birth gate | ✅ §4 |
| 2 | Component catalog ≠ PG catalog — chỉ khai semantic/ownership/lifecycle | ✅ §6.1 |
| 3 | BOM ≠ publication_member — 2 cơ chế tách biệt | ✅ §7.1 |
| 4 | BOM ≠ reference — BOM ở cấp publication/assembly, reference ở cấp unit | ✅ §4.2 |
| 5 | Reuse decision 4 bước + machine enforcement — nhất quán L2 §3.11 | ✅ §9 |
| 6 | Golden path = PG data, machine-queryable, phase 2 | ✅ §10.1 |
| 7 | Anti-pattern → Đ39 C13, enforcement chỉ khi authority approve | ✅ §10.2 |
| 8 | Đ24 labels, không registry song song, format deferred | ✅ §12 |
| 9 | Variant → base trace, không parent-child tree | ✅ §8.2 |
| 10 | P5 slice không cần sửa; P5b extend change governance | ✅ §15 |
| 11 | P5b impact map + minimum slice + phase 2 rõ | ✅ §16 |
| 12 | P6 checker implications liệt kê | ✅ §17 |
| 13 | Constitutional check PASS / PASS có điều kiện | ✅ §19 |
| 14 | Không SQL, migration, DOT, sửa luật | ✅ |
| 15 | C3 là operating model, tên table chỉ là candidate concept | ✅ §1, §16 |
| 16 | Lifecycle vs governance_status phân biệt + invariant | ✅ §6.3 |
| 17 | GPT review PASS + User duyệt | ✅ |
Invariants C3
| Code | Statement | Enforce by | Nguồn |
|---|---|---|---|
| INV-COMP-NEQ-UNIT | Component ≠ text unit — 2 species, 2 registries | Architecture | L2 §3.3 |
| INV-CATALOG-NEQ-PG | Component catalog ≠ PG catalog — chỉ khai semantic | Architecture, NT11 | L2 §3.3 |
| INV-BOM-NEQ-MEMBER | BOM ≠ publication_member — 2 cơ chế tách biệt | Concept design | L2 §3.3 |
| INV-BOM-NEQ-REF | BOM (publication-level) ≠ reference edge (unit-level) | Concept design | L2 §3.3 |
| INV-REUSE-FIRST | Reuse trước tạo mới — machine-enforced | Birth gate | L2 §3.11, §4.2 |
| INV-COMP-NO-AUTH | Component không thay thế text/law authority | Governance | L2 §4.8 |
| INV-VARIANT-BASE | Variant phải trỏ base component tồn tại | FK + birth gate | L2 §3.7 |
| INV-COMP-NO-TREE | Component không có parent-child structural tree. Variant → base là lineage/trace. | Architecture | GPT R1 khuyến nghị |
| INV-BOM-ENACTED-LOCK | Enacted publication → BOM bất biến, tương tự publication_member | Trigger/app | Tương tự P5 INV-ENACTED-IMMUT |
| INV-GOLDEN-PG | Golden path = PG data, machine-queryable, config/governance data | Concept design | L2 §3.8 |
| INV-COMP-LABEL-D24 | Component labels dùng Đ24 entity_labels hoặc mapping tương thích | Architecture | CI-9, P3 v0.4 |
| INV-COMP-SINGLE-ACTIVE | Tối đa 1 active component_version per component | Trigger/app | Tương tự P5 enacted-per-unit |
| INV-COMP-RETIRED-NO-ACTIVE | Component retired → không có active component_version | Trigger/app | GPT R1 #5 |
| INV-LIFECYCLE-GOV-CONSISTENT | lifecycle='retired' → governance_status KHÔNG được 'approved_for_reuse' hay 'experimental' | DOT checker | GPT R1 #6 |
| INV-KG-PROJECTION-ONLY | KG/Qdrant cho component là projection only, không tạo authoritative knowledge ngoài PG | Architecture | NT1/NT13, GPT R1 #10 |
GPT Review Patch log
Round 1 (14 patches + 3 khuyến nghị):
| # | Điểm | Hành động |
|---|---|---|
| 1 | C3 = operating model, candidate concept | ✅ §1, §16, §7.3, §11, §14 |
| 2 | Đ24 label format mềm | ✅ §12.1 |
| 3 | BOM uniqueness mềm | ✅ §7.4 rule #1 |
| 4 | BOM scope mở rộng | ✅ §3.5, §7.2 |
| 5 | Lifecycle version invariant | ✅ INV-COMP-SINGLE-ACTIVE, INV-COMP-RETIRED-NO-ACTIVE |
| 6 | Lifecycle vs governance_status | ✅ §6.3 + INV-LIFECYCLE-GOV-CONSISTENT |
| 7 | pg_object_refs deferred | ✅ §6.1, OD-C3-09 |
| 8 | Golden path structure tách | ✅ §10.1 |
| 9 | Change-set component deferred | ✅ §13.2 |
| 10 | Component vector projection ràng buộc | ✅ OD-C3-08 + INV-KG-PROJECTION-ONLY |
| 11 | Birth gate description per config | ✅ §14.1 |
| 12 | Species Đ29 wording | ✅ §14.1 |
| 13 | Constitutional check thêm điều kiện | ✅ §19 |
| 14 | PASS criteria P5 sửa wording | ✅ §20 #10 + §15.1 |
| K1 | Invariant no parent-child tree | ✅ INV-COMP-NO-TREE |
| K2 | Invariant BOM enacted lock | ✅ INV-BOM-ENACTED-LOCK |
| K3 | P5b minimum slice section | ✅ §16.1 + §16.2 |
C3 — Component/BOM Operating Model | OFFICIAL v0.1 | S181 | 2026-04-26 | Opus 4.6 GPT Review: R1 PASS có điều kiện (14+3) → R2 FINAL PASS User: PASS