KB-2AFD

P10B-2B-FIX-REGEN-PROMOTE v2c — D28 Package via SSH + KB Promote

14 min read Revision 1
reportp10bdieu-28fix-packageregen-promotepass

P10B-2B-FIX-REGEN-PROMOTE v2c — D28 Package via SSH + KB Promote

Date: 2026-04-29 / generated 2026-04-30 ICT
Scope: READ-ONLY package regeneration + KB upload. No D28 SQL package executed.
Verdict: PASS — package generated, uploaded, and read-back verified 9/9 exact match.

0. Skill + Laws

  • Read .claude/skills/incomex-rules.md directly: 36 items, 8-step workflow.
  • Agent Data search_knowledge("operating rules SSOT"): read in main process.
  • Agent Data search_knowledge("hiến pháp v4.0 constitution"): read in main process.
  • No background agent used.

0-W. 3 câu Tuyên ngôn

  1. Vĩnh viễn: /tmp is not SSOT; regenerated artifacts are promoted to KB canonical package path with manifest and exact read-back verification.
  2. Nhầm được không: Gate 0 proves VPS runtime via SSH and DB identity before any live schema/gate read; manifest pins SHA/bytes per file.
  3. 100% tự động: Candidate iteration, schema column existence checks, birth-gate matrix, SQL verification, upload, and read-back are scripted.

1. Gate 0 Result

Control host: Nguyens-MacBook-Air.local
Control user: nmhuyen
Runtime host via SSH: vmi3080463.contaboserver.net
Runtime uname: Linux vmi3080463 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Docker postgres: postgres
DB identity: directus/directus

Gate 0: PASS.

2. Input SHA Verification

candidate-units-r2.json bytes=23486 sha256=e47775e33cc752656468edb287cca7b58539804678443b6c1b1dd03b165de8ad
source DIEU-28 bytes=9289 sha256=fa5ed5c1f6a6ab70f69f48e0bd3a2e4d822eb6b672a1c2b2313edd23f3277d7b

Inputs were fetched from KB using Agent Data get_document_for_rewrite full-content reads.

3. Birth-Gate Compliance Matrix

  • Total gate entries: 13
  • Blocking gates: 10
  • Blocking PASS: 10/10
  • BG-UV-02: 20 description_required=true units use title stub; 7 exempt units use NULL.

Vocab evidence:

checklist	t	f
governance_process	t	t
heading	f	f
paragraph	t	t
principle	t	t
process	t	t
technical_spec	t	t

Matrix file: birth-gate-requirements.json, SHA 884691f905a60cd1b07dd703ba5712e62adf5b97590844293354ae289504fdbb.

4. Schema Discovery Summary

{
  "tac_logical_unit": 13,
  "tac_publication": 15,
  "tac_publication_member": 6,
  "tac_unit_version": 20
}

Required generated INSERT columns were checked against live information_schema from VPS.

5. Collision Check Result

tac_publication DIEU-28/v2.0 count: 0
tac_logical_unit D38-DIEU28-% count: 0

6. Generated SQL Files + SHA256

File Bytes SHA256
manifest.json 2673 04c159ccaeadd252ec106b7845eec6c83b9141fc06f25d9103f118bb90595904
insert-candidate.sql 48691 b71fd67544e1f97a72e1c6477218367f2f02be2c7009c6eb73490b601369e537
render.sql 1165 478d2115ded1e472b580c250a166945b4989d6e76019a5748a3012db168874e9
rollback.sql 1007 bf07e44ddfd3557b621c455483a45784aa135f4ea4d4c8ec844a93a8512ed7c7
verify-counts.sql 978 3662534c043134b0feb78c124e309db846c042cd0d3b8b7c7281667f981e705d
birth-gate-requirements.json 4668 884691f905a60cd1b07dd703ba5712e62adf5b97590844293354ae289504fdbb
candidate-units-r2.json 23486 e47775e33cc752656468edb287cca7b58539804678443b6c1b1dd03b165de8ad
gen.py 13802 db34637cd4eb6f092ca3360ba6da390d9be8c98ac2c8f73f06e4253e51c3419a
build_matrix.py 376 82731c00c3e710909de803a17e4c8471eeb82e14905653f27248564da6dac1fd

7. Column Completeness + INSERT Count + Destructive Scan

=== column completeness ===
['id', 'logical_unit_id', 'version_number', 'title', 'body', 'description', 'content_hash', 'lifecycle_status', 'review_state', 'length_flag', 'content_profile', 'editor', 'provenance']
description: PASS
title: PASS
body: PASS
provenance: PASS
lifecycle_status: PASS
review_state: PASS
=== insert count body-first sanitized ===
tac_publication: 1
tac_logical_unit: 27
tac_unit_version: 27
tac_publication_member: 27
total: 82
=== destructive scan body-first sanitized ===
insert-candidate.sql: PASS
render.sql: PASS
verify-counts.sql: PASS
rollback.sql: PASS
=== BG-UV-02 split ===
required=20 exempt=7 heading=5 checklist=2

8. Sample Verification

D38-DIEU28-S0: lines 14-25
14: 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);
15: 
16: -- D38-DIEU28-S0
17: INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status)
18: 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');
19: 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)
20: 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**
21: > **Đổi tên:** "Luật Khuôn Mẫu Chuẩn" → "LUẬT KỸ THUẬT HIỂN THỊ"
22: > **Kế thừa:** v1.0 (S157). Mở rộng: +Collection PG, +Nuxt whitelist, +Checklist, +Quy trình test, +Chuyển giao, +Coverage scanner.
23: > **Hội đồng:** GPT 8.4/10 + Gemini 9.5/10. 2 vòng review. Đồng thuận ban hành.
24: > **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');
25: INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order)
D38-DIEU28-S3-P3: lines 172-183
172: 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);
173: 
174: -- D38-DIEU28-S3-P3
175: INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status)
176: 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');
177: 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)
178: VALUES ('84da2f8f-6f84-5c05-9cb7-fc4b07c08aa0'::uuid, 'cd14ad7c-e0a7-5cd1-a88c-9ab874131dfa'::uuid, 1, '★ PG TRIGGER enforce lifecycle (Tuyên ngôn ②)', $BODYTAG15$```sql
179: CREATE FUNCTION fn_template_lifecycle_guard() RETURNS TRIGGER AS $$
180: BEGIN
181:   -- CẤM nhảy cóc: draft→active (bỏ qua testing)
182:   IF OLD.status = 'draft' AND NEW.status = 'active' THEN
183:     RAISE EXCEPTION 'CẤM draft→active. PHẢI qua testing (5/5 PASS).';
D38-DIEU28-ROOT: lines 6-17
6: 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);
7: 
8: -- D38-DIEU28-ROOT
9: INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status)
10: 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');
11: 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)
12: 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');
13: INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order)
14: 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);
15: 
16: -- D38-DIEU28-S0
17: INSERT INTO tac_logical_unit (id, canonical_address, doc_code, parent_id, sort_order, section_type, section_code, owner, identity_profile, tier, lifecycle_status)

9. Hardcode Audit Result

=== hardcode audit ===
PASS: 0 hardcoded unit arrays in generation logic

10. Generator Scripts + SHA256

gen.py: db34637cd4eb6f092ca3360ba6da390d9be8c98ac2c8f73f06e4253e51c3419a
build_matrix.py: 82731c00c3e710909de803a17e4c8471eeb82e14905653f27248564da6dac1fd

11. Manifest SHA256

manifest.json: 04c159ccaeadd252ec106b7845eec6c83b9141fc06f25d9103f118bb90595904

12. Upload Status

File Status KB Path
manifest.json created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/manifest.json
insert-candidate.sql created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/insert-candidate.sql
render.sql created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/render.sql
rollback.sql created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/rollback.sql
verify-counts.sql created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/verify-counts.sql
birth-gate-requirements.json created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/birth-gate-requirements.json
candidate-units-r2.json created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/candidate-units-r2.json
gen.py created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/gen.py
build_matrix.py created knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/build_matrix.py

13. Read-Back Verification

File Local bytes Remote bytes SHA256 Exact match Truncated
manifest.json 2673 2673 04c159ccaeadd252ec106b7845eec6c83b9141fc06f25d9103f118bb90595904 True False
insert-candidate.sql 48691 48691 b71fd67544e1f97a72e1c6477218367f2f02be2c7009c6eb73490b601369e537 True False
render.sql 1165 1165 478d2115ded1e472b580c250a166945b4989d6e76019a5748a3012db168874e9 True False
rollback.sql 1007 1007 bf07e44ddfd3557b621c455483a45784aa135f4ea4d4c8ec844a93a8512ed7c7 True False
verify-counts.sql 978 978 3662534c043134b0feb78c124e309db846c042cd0d3b8b7c7281667f981e705d True False
birth-gate-requirements.json 4668 4668 884691f905a60cd1b07dd703ba5712e62adf5b97590844293354ae289504fdbb True False
candidate-units-r2.json 23486 23486 e47775e33cc752656468edb287cca7b58539804678443b6c1b1dd03b165de8ad True False
gen.py 13802 13802 db34637cd4eb6f092ca3360ba6da390d9be8c98ac2c8f73f06e4253e51c3419a True False
build_matrix.py 376 376 82731c00c3e710909de803a17e4c8471eeb82e14905653f27248564da6dac1fd True False

All 9 files were fetched back from KB with exact content equality and matching SHA256.

14. Đ41 Code Hygiene

On branch main
Changes not staged for commit:
	modified:   scripts/pg-backup.sh

Untracked files:
	data/
	scripts/pg-backup.sh.pre-fix-2026-04-27

no changes added to commit

Existing VPS worktree changes were not touched.

15. Required Next Step

P10B-2C-PF-R2 required before execute.

16. Verdict

PASS. Regenerated D28 FIX package via SSH using KB inputs + VPS live schema/gates, uploaded 9/9 files to KB via Agent Data API, and verified read-back exact match 9/9.

STOP. Do not execute SQL package. Await PF-R2 then execute R2.