KB-2504

P10B-2C-R2 artifact d28-insert-run.sql

48 min read Revision 1
artifactp10bd28execute-r2

-- P10B-2B-FIX-REGEN-PROMOTE v2c — DIEU-28 v2.0 candidate insert package -- Generated read-only; do not execute before P10B-2C-PF-R2. BEGIN;

INSERT INTO tac_publication (id, doc_code, version, publication_type, name, owner, description, lifecycle_status, risk_tier, publication_profile) VALUES ('cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'DIEU-28', 'v2.0', 'law', 'ĐIỀU 28: LUẬT KỸ THUẬT HIỂN THỊ — v2.0 BAN HÀNH', 'INCOMEX', 'DIEU-28 v2.0 regenerated candidate package with BG-UV-02 description fix', 'proposed', 'medium', '{"expected_units": 27, "source": "P10B-2B-FIX-REGEN-PROMOTE-v2c", "source_sha256": "fa5ed5c1f6a6ab70f69f48e0bd3a2e4d822eb6b672a1c2b2313edd23f3277d7b"}'::jsonb);

-- D38-DIEU28-ROOT INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 'D38-DIEU28-ROOT', 'DIEU-28', NULL, 0, 'heading', 'ROOT', 'INCOMEX', '{"body_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "canonical_address": "D38-DIEU28-ROOT", "source_span": {"end_line": 1, "start_line": 1}}'::jsonb, 'root', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('8047dc49-7960-5848-a351-538480a1b722'::uuid, '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 1, 'ĐIỀU 28: LUẬT KỸ THUẬT HIỂN THỊ — v2.0 BAN HÀNH', $BODYTAG1$$BODYTAG1$, NULL, 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'draft', 'unreviewed', 'empty', '{"description_required": false, "source_span": {"end_line": 1, "start_line": 1}, "word_count": 0}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('eeede20c-39b2-557e-8693-1053cbbbd332'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, '8047dc49-7960-5848-a351-538480a1b722'::uuid, 0);

-- D38-DIEU28-S0 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('2bab00a6-5f37-5bcc-8e9c-b347eae72f72'::uuid, 'D38-DIEU28-S0', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 1, 'paragraph', 'S0', 'INCOMEX', '{"body_sha256": "87c2850b9bd87854abd5bb9d57576f7fb01cb123fb9bc94888bfa76945e32704", "canonical_address": "D38-DIEU28-S0", "source_span": {"end_line": 8, "start_line": 2}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('4a094228-508f-5017-80e9-89d68a12595a'::uuid, '2bab00a6-5f37-5bcc-8e9c-b347eae72f72'::uuid, 1, 'Preamble', $BODYTAG2$> v2.0 BAN HÀNH | S150 (2026-04-01) | Huyên đề xuất + Claude soạn

Đổi tên: "Luật Khuôn Mẫu Chuẩn" → "LUẬT KỸ THUẬT HIỂN THỊ" Kế thừa: v1.0 (S157). Mở rộng: +Collection PG, +Nuxt whitelist, +Checklist, +Quy trình test, +Chuyển giao, +Coverage scanner. Hội đồng: GPT 8.4/10 + Gemini 9.5/10. 2 vòng review. Đồng thuận ban hành. Rà soát: 13/13 NT — 0 vi phạm (S165-KB rà soát).$BODYTAG2$, 'Preamble', '87c2850b9bd87854abd5bb9d57576f7fb01cb123fb9bc94888bfa76945e32704', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 8, "start_line": 2}, "word_count": 73}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('cd849a16-ed47-5146-a2df-2efe316cbd83'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '2bab00a6-5f37-5bcc-8e9c-b347eae72f72'::uuid, '4a094228-508f-5017-80e9-89d68a12595a'::uuid, 1);

-- D38-DIEU28-S1 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('84e1108b-8cd2-5c67-baaa-97b5ff087c1d'::uuid, 'D38-DIEU28-S1', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 2, 'heading', 'S1', 'INCOMEX', '{"body_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "canonical_address": "D38-DIEU28-S1", "source_span": {"end_line": 11, "start_line": 11}}'::jsonb, 'section', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('f7441752-c362-538e-8d3d-12fa9d50922f'::uuid, '84e1108b-8cd2-5c67-baaa-97b5ff087c1d'::uuid, 1, 'I. TUYÊN BỐ CỐT LÕI', $BODYTAG3$$BODYTAG3$, NULL, 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'draft', 'unreviewed', 'empty', '{"description_required": false, "source_span": {"end_line": 11, "start_line": 11}, "word_count": 0}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('cdb0efaa-f44c-58d4-8388-6d41e41883e5'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '84e1108b-8cd2-5c67-baaa-97b5ff087c1d'::uuid, 'f7441752-c362-538e-8d3d-12fa9d50922f'::uuid, 2);

-- D38-DIEU28-S1-P1 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('2f3e6ee2-0f35-5a7a-b904-c488bd0bc3d7'::uuid, 'D38-DIEU28-S1-P1', 'DIEU-28', '84e1108b-8cd2-5c67-baaa-97b5ff087c1d'::uuid, 1, 'paragraph', 'P1', 'INCOMEX', '{"body_sha256": "8f5cd61da52341eee7fe49311dc828ffa3ad9a0ce31e501385cfce7f98b92fa4", "canonical_address": "D38-DIEU28-S1-P1", "source_span": {"end_line": 16, "start_line": 12}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('efa2a20c-2889-5ecf-a989-86310928a667'::uuid, '2f3e6ee2-0f35-5a7a-b904-c488bd0bc3d7'::uuid, 1, 'I. TUYÊN BỐ CỐT LÕI (intro)', $BODYTAG4$> Nuxt CHỈ render từ khuôn đã đăng ký trong PG. Không có khuôn = không có giao diện. Không có ngoại lệ.

Mọi giao diện hiển thị business data trong Incomex = 1 instance của 1 khuôn mẫu chuẩn (template). Khuôn được code 1 LẦN, đăng ký trong PG, kiểm soát bởi DOT. Instance = config data trong PG → khuôn render. Thêm giao diện mới = INSERT config, KHÔNG code.$BODYTAG4$, 'I. TUYÊN BỐ CỐT LÕI (intro)', '8f5cd61da52341eee7fe49311dc828ffa3ad9a0ce31e501385cfce7f98b92fa4', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 16, "start_line": 12}, "word_count": 72}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('05f231a5-4511-5ac2-9b8d-90a5ce83beb3'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '2f3e6ee2-0f35-5a7a-b904-c488bd0bc3d7'::uuid, 'efa2a20c-2889-5ecf-a989-86310928a667'::uuid, 3);

-- D38-DIEU28-S1-P2 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('6b9c50f3-5952-500a-9fcc-e291e62f34a0'::uuid, 'D38-DIEU28-S1-P2', 'DIEU-28', '84e1108b-8cd2-5c67-baaa-97b5ff087c1d'::uuid, 2, 'paragraph', 'P2', 'INCOMEX', '{"body_sha256": "2b6958a58d8fb7786b5c428f4b11d431ea35ba82cc083decec908ed6eb81acf5", "canonical_address": "D38-DIEU28-S1-P2", "source_span": {"end_line": 26, "start_line": 18}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('9c2bacac-0b83-52ee-b19a-4fc7695939c5'::uuid, '6b9c50f3-5952-500a-9fcc-e291e62f34a0'::uuid, 1, 'Phạm vi luật — 3 lớp rõ ràng', $BODYTAG5$| Lớp | Ví dụ | Thuộc Điều 28? | |-----|-------|---------------| | Display template | DirectusTable, DirectusMatrix, TabPivot, DynamicEntityList | ✅ CÓ — phải đăng ký | | Hạ tầng UI | Layout shell, NavBar, ErrorPage, LoadingSpinner | ❌ KHÔNG — hạ tầng cố định | | PG trigger/function | BirthTrigger, pivot_matrix() | ❌ KHÔNG — backend |

---$BODYTAG5$, 'Phạm vi luật — 3 lớp rõ ràng', '2b6958a58d8fb7786b5c428f4b11d431ea35ba82cc083decec908ed6eb81acf5', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 26, "start_line": 18}, "word_count": 59}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('6e7c12bc-2172-5bf2-90b0-59d21dc609f1'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '6b9c50f3-5952-500a-9fcc-e291e62f34a0'::uuid, '9c2bacac-0b83-52ee-b19a-4fc7695939c5'::uuid, 4);

-- D38-DIEU28-S2 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 'D38-DIEU28-S2', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 3, 'heading', 'S2', 'INCOMEX', '{"body_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "canonical_address": "D38-DIEU28-S2", "source_span": {"end_line": 27, "start_line": 27}}'::jsonb, 'section', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('adddae63-d719-58fe-a8b1-87db833b98a4'::uuid, '001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 1, 'II. 5 NGUYÊN TẮC', $BODYTAG6$$BODYTAG6$, NULL, 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'draft', 'unreviewed', 'empty', '{"description_required": false, "source_span": {"end_line": 27, "start_line": 27}, "word_count": 0}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('923483b8-aef6-5fcf-8d37-c63572b1e170'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 'adddae63-d719-58fe-a8b1-87db833b98a4'::uuid, 5);

-- D38-DIEU28-S2-P1 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('2124554f-e422-5277-be30-e7df8491493c'::uuid, 'D38-DIEU28-S2-P1', 'DIEU-28', '001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 1, 'principle', 'P1', 'INCOMEX', '{"body_sha256": "6ceb6981a022b8bcac665f6c2262923a61edfde50771a96fbec9ccc413918818", "canonical_address": "D38-DIEU28-S2-P1", "source_span": {"end_line": 31, "start_line": 30}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('06990b4e-6f0d-597c-b8d7-07bf2e1dfacd'::uuid, '2124554f-e422-5277-be30-e7df8491493c'::uuid, 1, 'NT-D1: NUXT = MÀN HÌNH, CHỈ RENDER TỪ KHUÔN', $BODYTAG7$Nuxt ĐƯỢC: đọc Directus API, render từ khuôn, phát event/submit payload. Nuxt KHÔNG ĐƯỢC: business logic, query DB, tạo component ngoài khuôn, hardcode, điều phối logic submit.$BODYTAG7$, 'NT-D1: NUXT = MÀN HÌNH, CHỈ RENDER TỪ KHUÔN', '6ceb6981a022b8bcac665f6c2262923a61edfde50771a96fbec9ccc413918818', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 31, "start_line": 30}, "word_count": 27}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('b3dd981a-b97c-5984-b437-cea9ad75bdd6'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '2124554f-e422-5277-be30-e7df8491493c'::uuid, '06990b4e-6f0d-597c-b8d7-07bf2e1dfacd'::uuid, 6);

-- D38-DIEU28-S2-P2 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('b3cdef5f-8705-542a-98aa-ffa94860879e'::uuid, 'D38-DIEU28-S2-P2', 'DIEU-28', '001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 2, 'principle', 'P2', 'INCOMEX', '{"body_sha256": "87babdafe2412250d51bcd1baae364ed140e99504910eb49fdaa240ebf7b10b1", "canonical_address": "D38-DIEU28-S2-P2", "source_span": {"end_line": 34, "start_line": 33}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('28e02efb-f65f-540c-8dce-11df25a0a029'::uuid, 'b3cdef5f-8705-542a-98aa-ffa94860879e'::uuid, 1, 'NT-D2: KHUÔN = SSOT, CODE 1 LẦN', $BODYTAG8$1 loại giao diện = 1 khuôn. Instance = config. Sửa khuôn = tất cả instances cập nhật.$BODYTAG8$, 'NT-D2: KHUÔN = SSOT, CODE 1 LẦN', '87babdafe2412250d51bcd1baae364ed140e99504910eb49fdaa240ebf7b10b1', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 34, "start_line": 33}, "word_count": 18}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('f4a76d3b-b3d1-5594-8ac6-f8cbf2cacf54'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'b3cdef5f-8705-542a-98aa-ffa94860879e'::uuid, '28e02efb-f65f-540c-8dce-11df25a0a029'::uuid, 7);

-- D38-DIEU28-S2-P3 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('61379cfe-91bd-5d86-933a-8f3815c201ad'::uuid, 'D38-DIEU28-S2-P3', 'DIEU-28', '001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 3, 'principle', 'P3', 'INCOMEX', '{"body_sha256": "ad33b434f46831785d967710656b2c5fdfa1439119b4fd7eb3288e13d0de1a90", "canonical_address": "D38-DIEU28-S2-P3", "source_span": {"end_line": 37, "start_line": 36}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('ffb2319a-384d-5585-aa00-dcb9b49b89dd'::uuid, '61379cfe-91bd-5d86-933a-8f3815c201ad'::uuid, 1, 'NT-D3: CONFIG TRONG PG, KHÔNG TRONG TEXT', $BODYTAG9$Config trong PG (JSONB) để validate, query, DOT thao tác. Text = documentation.$BODYTAG9$, 'NT-D3: CONFIG TRONG PG, KHÔNG TRONG TEXT', 'ad33b434f46831785d967710656b2c5fdfa1439119b4fd7eb3288e13d0de1a90', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 37, "start_line": 36}, "word_count": 13}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('9a2d1787-a8e5-551a-ae34-87186a05c716'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '61379cfe-91bd-5d86-933a-8f3815c201ad'::uuid, 'ffb2319a-384d-5585-aa00-dcb9b49b89dd'::uuid, 8);

-- D38-DIEU28-S2-P4 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('5379b837-b6e5-5969-a49e-082ef3ef2189'::uuid, 'D38-DIEU28-S2-P4', 'DIEU-28', '001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 4, 'principle', 'P4', 'INCOMEX', '{"body_sha256": "e9fcbe21136706252270a4b8d85a367f996fd21b9665cfda28fbe024a872fc47", "canonical_address": "D38-DIEU28-S2-P4", "source_span": {"end_line": 40, "start_line": 39}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('27103a99-c0a6-55d4-87d9-8c57f3120266'::uuid, '5379b837-b6e5-5969-a49e-082ef3ef2189'::uuid, 1, 'NT-D4: KHUÔN LÀ THỰC THỂ QUẢN TRỊ', $BODYTAG10$Đăng ký design_templates, birth record, species SPE-TPL, DOT-health, PASS test.$BODYTAG10$, 'NT-D4: KHUÔN LÀ THỰC THỂ QUẢN TRỊ', 'e9fcbe21136706252270a4b8d85a367f996fd21b9665cfda28fbe024a872fc47', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 40, "start_line": 39}, "word_count": 10}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('15a347c3-63aa-5f64-b480-7d2f13187ce7'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '5379b837-b6e5-5969-a49e-082ef3ef2189'::uuid, '27103a99-c0a6-55d4-87d9-8c57f3120266'::uuid, 9);

-- D38-DIEU28-S2-P5 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('43a8cd8f-b9ff-566a-8cb0-8eda4cb1bf7f'::uuid, 'D38-DIEU28-S2-P5', 'DIEU-28', '001b8881-9cc9-5407-a34a-6d3e632412cd'::uuid, 5, 'checklist', 'P5', 'INCOMEX', '{"body_sha256": "4c28808845a993cd9dd97c160f9576d2a6f8836889abd8831d9fc94876e3883a", "canonical_address": "D38-DIEU28-S2-P5", "source_span": {"end_line": 57, "start_line": 42}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('9508181d-d779-587e-bd07-9980e5e1fb60'::uuid, '43a8cd8f-b9ff-566a-8cb0-8eda4cb1bf7f'::uuid, 1, 'NT-D5: MÁY ĐÚC KHUÔN — CHECKLIST 8 BỘ PHẬN', $BODYTAG11$| # | Bộ phận | Quên thì sao | |---|---------|-------------| | 1 | config_schema (JSONB) | Lỗi âm thầm | | 2 | PG validation (CHECK) | INSERT bậy | | 3 | Error boundary | Trang trắng | | 4 | Loading + Empty state | UI treo | | 5 | DOT-health | Lỗi không ai biết | | 6 | Test 5/5 PASS | Khuôn lỗi lan | | 7 | Documentation | Không dùng được | | 8 | Birth record (auto) | Không biết tồn tại |

Thiếu 1 = KHÔNG active. PG trigger enforce (§III).

---$BODYTAG11$, NULL, '4c28808845a993cd9dd97c160f9576d2a6f8836889abd8831d9fc94876e3883a', 'draft', 'unreviewed', 'normal', '{"description_required": false, "source_span": {"end_line": 57, "start_line": 42}, "word_count": 103}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('12dcc1ff-a8d7-5dcd-914a-89183537bffe'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '43a8cd8f-b9ff-566a-8cb0-8eda4cb1bf7f'::uuid, '9508181d-d779-587e-bd07-9980e5e1fb60'::uuid, 10);

-- D38-DIEU28-S3 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 'D38-DIEU28-S3', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 4, 'heading', 'S3', 'INCOMEX', '{"body_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "canonical_address": "D38-DIEU28-S3", "source_span": {"end_line": 58, "start_line": 58}}'::jsonb, 'section', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('a91fd145-eaa4-5a9c-8791-77dbc40df715'::uuid, 'ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 1, 'III. COLLECTION design_templates', $BODYTAG12$$BODYTAG12$, NULL, 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'draft', 'unreviewed', 'empty', '{"description_required": false, "source_span": {"end_line": 58, "start_line": 58}, "word_count": 0}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('753e099d-c76b-57b4-b6c5-0ad56f0fbbc6'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 'a91fd145-eaa4-5a9c-8791-77dbc40df715'::uuid, 11);

-- D38-DIEU28-S3-P1 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('04e0c674-2a71-53b7-8d30-9c1a78d6fd17'::uuid, 'D38-DIEU28-S3-P1', 'DIEU-28', 'ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 1, 'technical_spec', 'P1', 'INCOMEX', '{"body_sha256": "4537ea23216a940bbe32b420a2b15735252695729f235699a122f8df6c28f7b0", "canonical_address": "D38-DIEU28-S3-P1", "source_span": {"end_line": 79, "start_line": 61}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('e91e3984-9cf3-568f-97c1-751b14b3b1fa'::uuid, '04e0c674-2a71-53b7-8d30-9c1a78d6fd17'::uuid, 1, 'Schema', $BODYTAG13$| Field | Kiểu | Constraint | Mục đích | |-------|------|-----------|----------| | id | SERIAL | PK | | | code | TEXT | UNIQUE NOT NULL | TPL-xxx | | name | TEXT | NOT NULL | Tên hiển thị | | description | TEXT | nullable | Mô tả + cách dùng | | version | INT | DEFAULT 1 | Version hiện tại | | config_schema | JSONB | NOT NULL | Quy tắc validate config | | component_path | TEXT | nullable | Nuxt component | | instance_collection | TEXT | FK → collection_registry.collection_name | Collection chứa instances — FK enforce | | instance_count | INT | DEFAULT 0 | AUTO cập nhật bởi PG trigger | | checklist_status | JSONB | DEFAULT '{}' | 8 bộ phận — DOT validate đủ 8 key | | test_results | JSONB | DEFAULT '{}' | 5 loại test — DOT verify | | migration_source | TEXT | nullable | Component gốc (chuyển giao) | | status | TEXT | FK → template_statuses.code, DEFAULT 'draft' | Lifecycle — FK enforce | | species_code | TEXT | DEFAULT 'template' | SPE-TPL | | composition_level | TEXT | DEFAULT 'material' | Lớp 4 |$BODYTAG13$, 'Schema', '4537ea23216a940bbe32b420a2b15735252695729f235699a122f8df6c28f7b0', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 79, "start_line": 61}, "word_count": 203}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('14b77b28-17f5-5f38-99bf-fa94ce786a23'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '04e0c674-2a71-53b7-8d30-9c1a78d6fd17'::uuid, 'e91e3984-9cf3-568f-97c1-751b14b3b1fa'::uuid, 12);

-- D38-DIEU28-S3-P2 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('73a8af16-bb07-5267-80c0-29108ba0d9ef'::uuid, 'D38-DIEU28-S3-P2', 'DIEU-28', 'ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 2, 'technical_spec', 'P2', 'INCOMEX', '{"body_sha256": "7bf7ec1c11ffe6cd4223eeaf9c461fbbf34aa4e3ee0de03dabfe393a809b7858", "canonical_address": "D38-DIEU28-S3-P2", "source_span": {"end_line": 96, "start_line": 81}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('2e3a7751-ca6f-5818-9d32-bd07c7a419af'::uuid, '73a8af16-bb07-5267-80c0-29108ba0d9ef'::uuid, 1, '★ REFERENCE TABLE cho status (NT4+NT10)', $BODYTAG14$```sql CREATE TABLE template_statuses (code TEXT PRIMARY KEY, name TEXT NOT NULL, sort_order INT); INSERT INTO template_statuses VALUES ('draft', 'Nháp', 1), ('testing', 'Đang test', 2), ('active', 'Hoạt động', 3), ('deprecated', 'Lỗi thời', 4), ('retired', 'Ngừng', 5);

ALTER TABLE design_templates ADD CONSTRAINT fk_tpl_status FOREIGN KEY (status) REFERENCES template_statuses(code);


Thêm trạng thái mới = INSERT 1 row. KHÔNG ALTER TABLE.$BODYTAG14$, '★ REFERENCE TABLE cho status (NT4+NT10)', '7bf7ec1c11ffe6cd4223eeaf9c461fbbf34aa4e3ee0de03dabfe393a809b7858', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 96, "start_line": 81}, "word_count": 59}'::jsonb, 'GPT', 'PROV-AI');
INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order)
VALUES ('03fb66d9-74ad-5f79-9c9d-2f9369dcd1de'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '73a8af16-bb07-5267-80c0-29108ba0d9ef'::uuid, '2e3a7751-ca6f-5818-9d32-bd07c7a419af'::uuid, 13);

-- D38-DIEU28-S3-P3
INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status)
VALUES ('cd14ad7c-e0a7-5cd1-a88c-9ab874131dfa'::uuid, 'D38-DIEU28-S3-P3', 'DIEU-28', 'ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 3, 'technical_spec', 'P3', 'INCOMEX', '{"body_sha256": "bf6d2cbd10e38902f0143dad903dac15faefe0ed8930e96e8f0371a12212caff", "canonical_address": "D38-DIEU28-S3-P3", "source_span": {"end_line": 126, "start_line": 98}}'::jsonb, 'unit', 'draft_only');
INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance)
VALUES ('84da2f8f-6f84-5c05-9cb7-fc4b07c08aa0'::uuid, 'cd14ad7c-e0a7-5cd1-a88c-9ab874131dfa'::uuid, 1, '★ PG TRIGGER enforce lifecycle (Tuyên ngôn ②)', $BODYTAG15$```sql
CREATE FUNCTION fn_template_lifecycle_guard() RETURNS TRIGGER AS $$
BEGIN
  -- CẤM nhảy cóc: draft→active (bỏ qua testing)
  IF OLD.status = 'draft' AND NEW.status = 'active' THEN
    RAISE EXCEPTION 'CẤM draft→active. PHẢI qua testing (5/5 PASS).';
  END IF;
  
  -- CẤM active khi checklist chưa đủ 8 bộ phận
  IF NEW.status = 'active' AND (
    SELECT COUNT(*) FROM jsonb_object_keys(NEW.checklist_status)
  ) < 8 THEN
    RAISE EXCEPTION 'CẤM active khi checklist < 8. Hiện: %', 
      (SELECT COUNT(*) FROM jsonb_object_keys(NEW.checklist_status));
  END IF;
  
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER trg_template_lifecycle
  BEFORE UPDATE ON design_templates
  FOR EACH ROW WHEN (OLD.status IS DISTINCT FROM NEW.status)
  EXECUTE FUNCTION fn_template_lifecycle_guard();

→ Agent KHÔNG THỂ active khuôn chưa test hoặc checklist thiếu.$BODYTAG15$, '★ PG TRIGGER enforce lifecycle (Tuyên ngôn ②)', 'bf6d2cbd10e38902f0143dad903dac15faefe0ed8930e96e8f0371a12212caff', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 126, "start_line": 98}, "word_count": 114}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('e313b008-b72a-502c-b326-94bb9fbd4568'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'cd14ad7c-e0a7-5cd1-a88c-9ab874131dfa'::uuid, '84da2f8f-6f84-5c05-9cb7-fc4b07c08aa0'::uuid, 14);

-- D38-DIEU28-S3-P4 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('f872a303-28fe-582f-a5af-778bb0887b77'::uuid, 'D38-DIEU28-S3-P4', 'DIEU-28', 'ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 4, 'governance_process', 'P4', 'INCOMEX', '{"body_sha256": "185030c2c9642e1916e5c037859300eb1e2ae06c66662ab1653e00885cb18d65", "canonical_address": "D38-DIEU28-S3-P4", "source_span": {"end_line": 131, "start_line": 128}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('6142c716-17d3-58c0-8a61-8d9e5eb26cd1'::uuid, 'f872a303-28fe-582f-a5af-778bb0887b77'::uuid, 1, 'Quy tắc versioning', $BODYTAG16$- Không breaking: KHÔNG tăng version. Instance tự hưởng.

  • Breaking: TĂNG version. Backward compatibility nội bộ.
  • CẤM: Sửa breaking mà không tăng version.$BODYTAG16$, 'Quy tắc versioning', '185030c2c9642e1916e5c037859300eb1e2ae06c66662ab1653e00885cb18d65', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 131, "start_line": 128}, "word_count": 25}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('04f225b6-cfd4-5623-8041-a2c195bfab7f'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'f872a303-28fe-582f-a5af-778bb0887b77'::uuid, '6142c716-17d3-58c0-8a61-8d9e5eb26cd1'::uuid, 15);

-- D38-DIEU28-S3-P5 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('d452122b-86eb-5ec8-8676-ef0ff3de6fee'::uuid, 'D38-DIEU28-S3-P5', 'DIEU-28', 'ae1e3159-2fa7-55e8-a7ae-f4c4b10ae5b9'::uuid, 5, 'governance_process', 'P5', 'INCOMEX', '{"body_sha256": "494cdc9c62326087bebc4c9097724446cda2bdd1461f871f4454e97dfff25370", "canonical_address": "D38-DIEU28-S3-P5", "source_span": {"end_line": 137, "start_line": 133}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('e9e87e7a-f54d-5b64-bfba-5bc5267bcf3a'::uuid, 'd452122b-86eb-5ec8-8676-ef0ff3de6fee'::uuid, 1, 'Quy tắc instance', $BODYTAG17$- Instance PHẢI có template_code (FK) + template_version (INT).

  • Khuôn upgrade → instances cũ giữ version cũ → render theo version đó.

---$BODYTAG17$, 'Quy tắc instance', '494cdc9c62326087bebc4c9097724446cda2bdd1461f871f4454e97dfff25370', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 137, "start_line": 133}, "word_count": 24}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('462d0df0-d970-5245-99f7-2df6aac7e15e'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'd452122b-86eb-5ec8-8676-ef0ff3de6fee'::uuid, 'e9e87e7a-f54d-5b64-bfba-5bc5267bcf3a'::uuid, 16);

-- D38-DIEU28-S4 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('759b6697-255f-5446-bd94-b1499076a111'::uuid, 'D38-DIEU28-S4', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 5, 'process', 'S4', 'INCOMEX', '{"body_sha256": "609dfd525525789e37afc4cdba8886d023d37370891227a524753ee1410d12ea", "canonical_address": "D38-DIEU28-S4", "source_span": {"end_line": 151, "start_line": 139}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('b805ea6f-25e8-5958-8321-ddd31e2533a0'::uuid, '759b6697-255f-5446-bd94-b1499076a111'::uuid, 1, 'IV. QUY TRÌNH TEST KHUÔN — 5/5 PASS = ACTIVE', $BODYTAG18$| Test | Tên | Tiêu chí PASS | |------|-----|--------------| | 1 | Validation Gate | 5/5 config sai bị reject | | 2 | Multi-Instance | 3/3 configs render đúng, Nuxt = PG | | 3 | Resilience | 5/5 edge cases không crash | | 4 | Truth Check | 100% ô Nuxt = PG, 0 sai | | 5 | Live Config | Sửa config → giao diện đổi ngay, không deploy |

Lifecycle: draft → testing (5/5 PASS) → active. PG trigger enforce (§III).

---$BODYTAG18$, 'IV. QUY TRÌNH TEST KHUÔN — 5/5 PASS = ACTIVE', '609dfd525525789e37afc4cdba8886d023d37370891227a524753ee1410d12ea', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 151, "start_line": 139}, "word_count": 89}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('35c77f6f-5807-52ba-a2aa-659278f4a9c9'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '759b6697-255f-5446-bd94-b1499076a111'::uuid, 'b805ea6f-25e8-5958-8321-ddd31e2533a0'::uuid, 17);

-- D38-DIEU28-S5 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('2087ebe2-8337-5e5e-ace9-23707e73a923'::uuid, 'D38-DIEU28-S5', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 6, 'technical_spec', 'S5', 'INCOMEX', '{"body_sha256": "821c5b564843bfd860e087180d5db52bd5fe4affe8101bdc26e1ce2a4d8b7e5d", "canonical_address": "D38-DIEU28-S5", "source_span": {"end_line": 163, "start_line": 153}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('b189b53b-ae6e-5668-a302-8450de4e8f75'::uuid, '2087ebe2-8337-5e5e-ace9-23707e73a923'::uuid, 1, 'V. DOT QUẢN TRỊ — PAIRED (NT12)', $BODYTAG19$| DOT | Cấp | Chức năng | Paired với | Trigger | |-----|-----|----------|-----------|---------| | DOT-template-create | B | Tạo + đăng ký khuôn mới | DOT-template-health | on-demand | | DOT-template-health | A | Kiểm tra checklist, test re-run, coverage | — (self-monitoring) | cron (đọc từ dot_config) + manual | | DOT-template-coverage | A | Quét route/component ngoài registry | — | cron weekly + manual |

Dual-trigger (NT7): Cron (đọc schedule từ dot_config) + on-demand manual.

---$BODYTAG19$, 'V. DOT QUẢN TRỊ — PAIRED (NT12)', '821c5b564843bfd860e087180d5db52bd5fe4affe8101bdc26e1ce2a4d8b7e5d', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 163, "start_line": 153}, "word_count": 80}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('4a21836f-feef-5de1-b34e-adee52cae807'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '2087ebe2-8337-5e5e-ace9-23707e73a923'::uuid, 'b189b53b-ae6e-5668-a302-8450de4e8f75'::uuid, 18);

-- D38-DIEU28-S6 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('91a4413a-13c5-507c-bdb8-8da39687f699'::uuid, 'D38-DIEU28-S6', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 7, 'process', 'S6', 'INCOMEX', '{"body_sha256": "02758f53e63682fccd5bf09b0f09b8f906d0501b9dc6161fa2d6c5e53c1803fc", "canonical_address": "D38-DIEU28-S6", "source_span": {"end_line": 170, "start_line": 165}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('7c424f3a-8eb0-5288-aae1-7894f4ebce30'::uuid, '91a4413a-13c5-507c-bdb8-8da39687f699'::uuid, 1, 'VI. QUY TRÌNH TẠO KHUÔN MỚI', $BODYTAG20$1. Kiểm tra khuôn phù hợp đã có? → CÓ → INSERT config. XONG. 2. Thiết kế (4 bước HP) → 3. Đăng ký (DOT-template-create, status='draft') → 4. Implement (code 1 lần) → 5. Test (5/5) → 6. UPDATE status='testing' → 7. UPDATE status='active' → PG trigger verify checklist 8/8.

---$BODYTAG20$, 'VI. QUY TRÌNH TẠO KHUÔN MỚI', '02758f53e63682fccd5bf09b0f09b8f906d0501b9dc6161fa2d6c5e53c1803fc', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 170, "start_line": 165}, "word_count": 51}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('7ac8aa5a-4e30-5e7d-8223-b04dfe733190'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '91a4413a-13c5-507c-bdb8-8da39687f699'::uuid, '7c424f3a-8eb0-5288-aae1-7894f4ebce30'::uuid, 19);

-- D38-DIEU28-S7 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('8132ed1f-14fe-578f-a48d-1bc6da2306ee'::uuid, 'D38-DIEU28-S7', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 8, 'process', 'S7', 'INCOMEX', '{"body_sha256": "d230d07300648f4b2d8f6e4c7daa8ee9a4e3b9b58c11bb2c8a1bc162a229e254", "canonical_address": "D38-DIEU28-S7", "source_span": {"end_line": 189, "start_line": 172}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('733a4ce2-a7ea-581a-adcd-d42b37d8ebf7'::uuid, '8132ed1f-14fe-578f-a48d-1bc6da2306ee'::uuid, 1, 'VII. CHUYỂN GIAO COMPONENT HIỆN CÓ', $BODYTAG21$### 4 CÓ = đưa vào: Tái sử dụng + Config-driven + Độc lập + Ổn định.

KHÔNG đưa vào: Hạ tầng UI, backend, dùng 1 lần, chưa ổn định.

Quy trình: Kiểm kê → Đăng ký (draft) → Bổ sung thiếu → Test 5/5 → Activate.

Component Ứng viên
DynamicEntityList/Detail ✅ TPL-DYNAMIC-LIST/DETAIL
TabPivotView ✅ TPL-TAB-PIVOT
CommentModule ✅ TPL-003
WorkflowModule ✅ TPL-004
TaskModule ✅ TPL-005
InspectorDOT 🔄 TPL-006
Layout/NavBar/Error ❌ Hạ tầng
BirthTrigger ❌ Backend

---$BODYTAG21$, 'VII. CHUYỂN GIAO COMPONENT HIỆN CÓ', 'd230d07300648f4b2d8f6e4c7daa8ee9a4e3b9b58c11bb2c8a1bc162a229e254', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 189, "start_line": 172}, "word_count": 106}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('cb23d8e0-016f-51b7-9562-9741669758a8'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '8132ed1f-14fe-578f-a48d-1bc6da2306ee'::uuid, '733a4ce2-a7ea-581a-adcd-d42b37d8ebf7'::uuid, 20);

-- D38-DIEU28-S8 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('d20fb00b-b393-591e-823d-2f66d7febc44'::uuid, 'D38-DIEU28-S8', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 9, 'heading', 'S8', 'INCOMEX', '{"body_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "canonical_address": "D38-DIEU28-S8", "source_span": {"end_line": 190, "start_line": 190}}'::jsonb, 'section', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('5715c761-b0d0-512f-820e-8cdf1570f798'::uuid, 'd20fb00b-b393-591e-823d-2f66d7febc44'::uuid, 1, 'VIII. NUXT WHITELIST + COVERAGE SCANNER', $BODYTAG22$$BODYTAG22$, NULL, 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'draft', 'unreviewed', 'empty', '{"description_required": false, "source_span": {"end_line": 190, "start_line": 190}, "word_count": 0}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('6cd612bc-7e38-57e8-9b17-16532fbc629d'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'd20fb00b-b393-591e-823d-2f66d7febc44'::uuid, '5715c761-b0d0-512f-820e-8cdf1570f798'::uuid, 21);

-- D38-DIEU28-S8-P1 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('ba6e8dbb-cc76-5f35-82cf-7731820a5caa'::uuid, 'D38-DIEU28-S8-P1', 'DIEU-28', 'd20fb00b-b393-591e-823d-2f66d7febc44'::uuid, 1, 'technical_spec', 'P1', 'INCOMEX', '{"body_sha256": "89e05c127dbced47821f4312be65449ff8d4850dea896e78aee1407f2ecf3b16", "canonical_address": "D38-DIEU28-S8-P1", "source_span": {"end_line": 194, "start_line": 193}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('5f5689b9-e10d-5e65-a1da-59a16aae6f95'::uuid, 'ba6e8dbb-cc76-5f35-82cf-7731820a5caa'::uuid, 1, 'Whitelist', $BODYTAG23$Nuxt load → đọc template_code → SELECT design_templates WHERE status='active' → CÓ → render / KHÔNG → "Not found".$BODYTAG23$, 'Whitelist', '89e05c127dbced47821f4312be65449ff8d4850dea896e78aee1407f2ecf3b16', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 194, "start_line": 193}, "word_count": 19}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('1154fcc7-8583-5fe7-9cf7-3c909f6089a9'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'ba6e8dbb-cc76-5f35-82cf-7731820a5caa'::uuid, '5f5689b9-e10d-5e65-a1da-59a16aae6f95'::uuid, 22);

-- D38-DIEU28-S8-P2 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('fd42a2f4-892a-5364-ab4e-b12d76a370d8'::uuid, 'D38-DIEU28-S8-P2', 'DIEU-28', 'd20fb00b-b393-591e-823d-2f66d7febc44'::uuid, 2, 'technical_spec', 'P2', 'INCOMEX', '{"body_sha256": "bdae72e594acf63b8330558bf99d1d788c6343c96d3b687a11ba60467744ec66", "canonical_address": "D38-DIEU28-S8-P2", "source_span": {"end_line": 200, "start_line": 196}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('33dce4ee-6798-56ec-afa5-90a274d06367'::uuid, 'fd42a2f4-892a-5364-ab4e-b12d76a370d8'::uuid, 1, 'Coverage Scanner (DOT-template-coverage)', $BODYTAG24$3 câu: (1) Route nào do template nào render? (2) Route ngoài registry? (3) Component ngoài whitelist? Mục tiêu: 0 ngoài registry = coverage 100%.

---$BODYTAG24$, 'Coverage Scanner (DOT-template-coverage)', 'bdae72e594acf63b8330558bf99d1d788c6343c96d3b687a11ba60467744ec66', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 200, "start_line": 196}, "word_count": 26}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('8deb6a1b-05ad-501f-bab0-584dff2db315'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, 'fd42a2f4-892a-5364-ab4e-b12d76a370d8'::uuid, '33dce4ee-6798-56ec-afa5-90a274d06367'::uuid, 23);

-- D38-DIEU28-S9 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('8b5859ef-1ec8-5e2e-9dd5-e1e9e60896d4'::uuid, 'D38-DIEU28-S9', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 10, 'paragraph', 'S9', 'INCOMEX', '{"body_sha256": "b74e7071ca83fac4ca74dff9981ee85cfeac98c83734c9243e8070be8cbd5191", "canonical_address": "D38-DIEU28-S9", "source_span": {"end_line": 215, "start_line": 202}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('a92991cf-f70b-56b0-83d0-d21051a74b6e'::uuid, '8b5859ef-1ec8-5e2e-9dd5-e1e9e60896d4'::uuid, 1, 'IX. QUAN HỆ VỚI LUẬT KHÁC', $BODYTAG25$| Luật | Quan hệ | |------|---------| | Điều 0-G | Khuôn → birth_registry auto | | NT1 (SSOT) | design_templates = SSOT | | NT4 (Sẵn sàng) | Instance = config, ref table status | | NT10 (PG quản lý) | Config PG, status FK, lifecycle trigger | | NT12 (DOT cặp) | create(B)↔health(A) | | NT13 (Ưu tiên PG) | PG trigger lifecycle guard | | Điều 35 (DOT) | DOT lifecycle, dùng chung dot_config | | Điều 36 (Collection) | instance_collection FK, template_code FK enforce |

---$BODYTAG25$, 'IX. QUAN HỆ VỚI LUẬT KHÁC', 'b74e7071ca83fac4ca74dff9981ee85cfeac98c83734c9243e8070be8cbd5191', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 215, "start_line": 202}, "word_count": 90}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('61e6ba7f-1864-55e9-9315-8e5b1cc719c8'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '8b5859ef-1ec8-5e2e-9dd5-e1e9e60896d4'::uuid, 'a92991cf-f70b-56b0-83d0-d21051a74b6e'::uuid, 24);

-- D38-DIEU28-S10 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('7c48ea3d-1e5a-5bad-884e-228951c682e8'::uuid, 'D38-DIEU28-S10', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 11, 'checklist', 'S10', 'INCOMEX', '{"body_sha256": "80a41eacdf852780232087511b9cf936a06534d7aff35b2240f5dd72c800b445", "canonical_address": "D38-DIEU28-S10", "source_span": {"end_line": 226, "start_line": 217}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('b0b4dec5-79c6-536a-8237-175340d30a08'::uuid, '7c48ea3d-1e5a-5bad-884e-228951c682e8'::uuid, 1, 'X. NỢ KỸ THUẬT', $BODYTAG26$| TD | Nội dung | Khi nào | |----|---------|--------| | TD-A | CI scanner cấm import ngoài whitelist | Sau ban hành | | TD-B | Runtime manifest từ PG | Sau ban hành | | TD-C | Permissions/scope per template | Multi-role | | TD-D | Performance budget | TPL-002 active | | TD-E | Tách _tests, _health tables | >50 khuôn | | TD-F | Semver, compatibility matrix | Khuôn upgrade |$BODYTAG26$, NULL, '80a41eacdf852780232087511b9cf936a06534d7aff35b2240f5dd72c800b445', 'draft', 'unreviewed', 'normal', '{"description_required": false, "source_span": {"end_line": 226, "start_line": 217}, "word_count": 75}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('4b946837-cb9c-53e1-9e72-3032a7438075'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '7c48ea3d-1e5a-5bad-884e-228951c682e8'::uuid, 'b0b4dec5-79c6-536a-8237-175340d30a08'::uuid, 25);

-- D38-DIEU28-S11 INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status) VALUES ('9a1d49af-b0d7-5399-b843-dd5c9cf0be99'::uuid, 'D38-DIEU28-S11', 'DIEU-28', '09e5a5a5-bfc7-5882-9bf6-948a445b5341'::uuid, 12, 'paragraph', 'S11', 'INCOMEX', '{"body_sha256": "a8c128769877b7c52cf9c0f914807765f4f2f2b6748d1077bcb3ff696928a5ce", "canonical_address": "D38-DIEU28-S11", "source_span": {"end_line": 229, "start_line": 228}}'::jsonb, 'unit', 'draft_only'); INSERT INTO tac_unit_version (id, logical_unit_id, version_number, title, body, description, content_hash, lifecycle_status, review_state, length_flag, content_profile, editor, provenance) VALUES ('03189ba6-4dd0-5446-ae9b-a44c021eceec'::uuid, '9a1d49af-b0d7-5399-b843-dd5c9cf0be99'::uuid, 1, 'Footer', $BODYTAG27$Điều 28 v2.0 BAN HÀNH | 13/13 NT ✅ | 6/6 Q ✅ | Ref table status | PG trigger lifecycle+checklist guard | DOT paired rõ | instance_collection FK | Dùng chung dot_config$BODYTAG27$, 'Footer', 'a8c128769877b7c52cf9c0f914807765f4f2f2b6748d1077bcb3ff696928a5ce', 'draft', 'unreviewed', 'normal', '{"description_required": true, "source_span": {"end_line": 229, "start_line": 228}, "word_count": 33}'::jsonb, 'GPT', 'PROV-AI'); INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order) VALUES ('308507d7-3474-56cb-a9f5-00c41333f605'::uuid, 'cf8d4dc0-3d70-55f8-8c35-e01da101d710'::uuid, '9a1d49af-b0d7-5399-b843-dd5c9cf0be99'::uuid, '03189ba6-4dd0-5446-ae9b-a44c021eceec'::uuid, 26);

-- Review manually after PF-R2. Exactly one of the following may be uncommented during authorized execute step. COMMIT; -- ROLLBACK;

Back to Knowledge Hub knowledge/dev/laws/dieu38-trien-khai/reports/p10b-2c-r2-d28-execute-artifacts-2026-04-30/d28-insert-run.sql