P10B-2C-PF-R2 — D28 SQL Inspection from KB Package v1.1
P10B-2C-PF-R2 — D28 SQL Inspection from KB Package v1.1
Date: 2026-04-30
Mode: READ-ONLY file inspection from KB package. No SQL execution, no SSH, no psql, no EXPLAIN, no DB connection.
Verdict: PASS — PF-R2 file inspection passed. Execute remains unauthorized until Execute R2 fresh runtime gates.
1. Manifest SHA Verified
KB path: knowledge/dev/laws/dieu38-trien-khai/data/p10b-d28-fix-package/manifest.json
bytes: 2673
sha256: 04c159ccaeadd252ec106b7845eec6c83b9141fc06f25d9103f118bb90595904
expected: 04c159ccaeadd252ec106b7845eec6c83b9141fc06f25d9103f118bb90595904
verdict: PASS
2. File SHA/Bytes
| File | Local bytes | Manifest bytes | Local SHA256 | Manifest SHA256 | Verdict |
|---|---|---|---|---|---|
| insert-candidate.sql | 48691 | 48691 | b71fd67544e1f97a72e1c6477218367f2f02be2c7009c6eb73490b601369e537 |
b71fd67544e1f97a72e1c6477218367f2f02be2c7009c6eb73490b601369e537 |
PASS |
| render.sql | 1165 | 1165 | 478d2115ded1e472b580c250a166945b4989d6e76019a5748a3012db168874e9 |
478d2115ded1e472b580c250a166945b4989d6e76019a5748a3012db168874e9 |
PASS |
| rollback.sql | 1007 | 1007 | bf07e44ddfd3557b621c455483a45784aa135f4ea4d4c8ec844a93a8512ed7c7 |
bf07e44ddfd3557b621c455483a45784aa135f4ea4d4c8ec844a93a8512ed7c7 |
PASS |
| verify-counts.sql | 978 | 978 | 3662534c043134b0feb78c124e309db846c042cd0d3b8b7c7281667f981e705d |
3662534c043134b0feb78c124e309db846c042cd0d3b8b7c7281667f981e705d |
PASS |
| birth-gate-requirements.json | 4668 | 4668 | 884691f905a60cd1b07dd703ba5712e62adf5b97590844293354ae289504fdbb |
884691f905a60cd1b07dd703ba5712e62adf5b97590844293354ae289504fdbb |
PASS |
| candidate-units-r2.json | 23486 | 23486 | e47775e33cc752656468edb287cca7b58539804678443b6c1b1dd03b165de8ad |
e47775e33cc752656468edb287cca7b58539804678443b6c1b1dd03b165de8ad |
PASS |
| gen.py | 13802 | 13802 | db34637cd4eb6f092ca3360ba6da390d9be8c98ac2c8f73f06e4253e51c3419a |
db34637cd4eb6f092ca3360ba6da390d9be8c98ac2c8f73f06e4253e51c3419a |
PASS |
| build_matrix.py | 376 | 376 | 82731c00c3e710909de803a17e4c8471eeb82e14905653f27248564da6dac1fd |
82731c00c3e710909de803a17e4c8471eeb82e14905653f27248564da6dac1fd |
PASS |
All 8 files listed in manifest matched SHA256 and byte count.
3. Transaction Structure
Outer BEGIN line: 3
Raw BEGIN grep lines: [3, 180] (line 180 is inside S3-P3 body)
COMMIT lines: [367]
ROLLBACK lines: [368]
DO $ count: 0
Head:
-- 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);
Tail:
| 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;
Both COMMIT; and ROLLBACK; are commented at EOF. No DO block. Uncommenting only COMMIT; after Execute R2 authorization is structurally safe.
4. INSERT Count (Sanitized, Body-Masked-First)
=== T4: INSERT count (sanitized) ===
tac_logical_unit: 27
tac_publication: 1
tac_publication_member: 27
tac_unit_version: 27
Total: 82
tac_publication: expected=1, actual=1 PASS
tac_logical_unit: expected=27, actual=27 PASS
tac_unit_version: expected=27, actual=27 PASS
tac_publication_member: expected=27, actual=27 PASS
T4 verdict: PASS
5. UV Column Completeness + 20/7 Split
=== T5: UV column completeness ===
UV columns: ['id', 'logical_unit_id', 'version_number', 'title', 'body', 'description', 'content_hash', 'lifecycle_status', 'review_state', 'length_flag', 'content_profile', 'editor', 'provenance']
title: PRESENT
description: PRESENT
body: PRESENT
provenance: PRESENT
lifecycle_status: PRESENT
review_state: PRESENT
=== T5b: 20/7 description split ===
description_required=true: 20 (expected 20)
exempt: 7 (expected 7)
heading: 5 (expected 5), checklist: 2 (expected 2)
T5 verdict: PASS
6. Sample Line-Range
S0 Paragraph
Lines 14-28. Description is title stub 'Preamble'; body is wrapped by $BODYTAG2$.
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)
26: 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);
27:
28: -- D38-DIEU28-S1
S3-P3 Technical Spec
Lines 177-207. Description is title stub '★ PG TRIGGER enforce lifecycle (Tuyên ngôn ②)'; body is wrapped by $BODYTAG15$; inner PL/pgSQL $$ delimiter is intact.
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).';
184: END IF;
185:
186: -- CẤM active khi checklist chưa đủ 8 bộ phận
187: IF NEW.status = 'active' AND (
188: SELECT COUNT(*) FROM jsonb_object_keys(NEW.checklist_status)
189: ) < 8 THEN
190: RAISE EXCEPTION 'CẤM active khi checklist < 8. Hiện: %',
191: (SELECT COUNT(*) FROM jsonb_object_keys(NEW.checklist_status));
192: END IF;
193:
194: RETURN NEW;
195: END;
196: $$ LANGUAGE plpgsql;
197:
198: CREATE TRIGGER trg_template_lifecycle
199: BEFORE UPDATE ON design_templates
200: FOR EACH ROW WHEN (OLD.status IS DISTINCT FROM NEW.status)
201: EXECUTE FUNCTION fn_template_lifecycle_guard();
202: ```
203:
204: → 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');
205: INSERT INTO tac_publication_member (id, publication_id, logical_unit_id, unit_version_id, render_order)
206: 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);
207:
ROOT Heading Exemption
Lines 6-20. Body is empty $BODYTAG1$$BODYTAG1$; description is NULL.
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)
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**
7. Dollar-Quoting Safety
=== T7: Dollar-quoting safety ===
Dollar-tag occurrences: 54 (even)
BODYTAG1: 2
BODYTAG2: 2
BODYTAG3: 2
BODYTAG4: 2
BODYTAG5: 2
BODYTAG6: 2
BODYTAG7: 2
BODYTAG8: 2
BODYTAG9: 2
BODYTAG10: 2
BODYTAG11: 2
BODYTAG12: 2
BODYTAG13: 2
BODYTAG14: 2
BODYTAG15: 2
BODYTAG16: 2
BODYTAG17: 2
BODYTAG18: 2
BODYTAG19: 2
BODYTAG20: 2
BODYTAG21: 2
BODYTAG22: 2
BODYTAG23: 2
BODYTAG24: 2
BODYTAG25: 2
BODYTAG26: 2
BODYTAG27: 2
T7 verdict: PASS
8. Destructive Scan
=== T8: Destructive scan (sanitized outer SQL) ===
No destructive commands on real tables in insert-candidate.sql.
T8 insert verdict: PASS
=== T8b: rollback.sql ===
-- Rollback DIEU-28 v2.0 candidate package; reverse-FK order and strictly scoped.
BEGIN;
WITH pub AS (
SELECT id FROM tac_publication WHERE doc_code = 'DIEU-28' AND version = 'v2.0'
), scoped_lu AS (
SELECT id FROM tac_logical_unit
WHERE doc_code = 'DIEU-28' AND canonical_address LIKE 'D38-DIEU28-%'
), scoped_uv AS (
SELECT uv.id FROM tac_unit_version uv JOIN scoped_lu lu ON lu.id = uv.logical_unit_id
)
DELETE FROM tac_publication_member pm
USING pub, scoped_lu lu, scoped_uv uv
WHERE pm.
DELETE targets: ['tac_publication_member', 'tac_unit_version', 'tac_logical_unit', 'tac_publication']
Reverse-FK order: PASS
Strict scope markers: PASS
No TRUNCATE/DROP/ALTER/UPDATE: PASS
T8 rollback verdict: PASS
9. render/verify Scope
render.sql:
-- Render DIEU-28 v2.0 preorder output; self-scoped, no external pub_id parameter.
WITH RECURSIVE pub AS (
SELECT id FROM tac_publication WHERE doc_code = 'DIEU-28' AND version = 'v2.0'
), tree AS (
SELECT lu.id, lu.parent_id, lu.canonical_address, lu.sort_order, lu.section_type,
uv.title, uv.body, 0 AS depth, ARRAY[lu.sort_order, 0, 0, 0]::int[] AS path
FROM tac_logical_unit lu
JOIN tac_publication_member pm ON pm.logical_unit_id = lu.id
JOIN pub ON pub.id = pm.publication_id
JOIN tac_unit_version uv ON uv.id = pm.unit_version_id
WHERE lu.parent_id IS NULL AND lu.doc_code = 'DIEU-28'
UNION ALL
SELECT child.id, child.parent_id, child.canonical_address, child.sort_order, child.section_type,
uv.title, uv.body, tree.depth + 1,
tree.path || child.sort_order
FROM tree
JOIN tac_logical_unit child ON child.parent_id = tree.id
JOIN tac_publication_member pm ON pm.logical_unit_id = child.id
JOIN pub ON pub.id = pm.publication_id
JOIN tac_unit_version uv ON uv.id = pm.unit_version_id
WHERE child.doc_code = 'DIEU-28'
)
SELECT canonical_address, depth, section_type, title, body
FROM tree
ORDER BY path;
verify-counts.sql:
-- Verify DIEU-28 v2.0 candidate package counts; self-scoped.
WITH pub AS (
SELECT id FROM tac_publication WHERE doc_code = 'DIEU-28' AND version = 'v2.0'
), lu AS (
SELECT id FROM tac_logical_unit WHERE doc_code = 'DIEU-28' AND canonical_address LIKE 'D38-DIEU28-%'
), uv AS (
SELECT uv.id FROM tac_unit_version uv JOIN lu ON lu.id = uv.logical_unit_id
), pm AS (
SELECT pm.id FROM tac_publication_member pm JOIN pub ON pub.id = pm.publication_id JOIN lu ON lu.id = pm.logical_unit_id JOIN uv ON uv.id = pm.unit_version_id
), counts AS (
SELECT 'publication' AS target, 1 AS expected, count(*)::int AS actual FROM pub
UNION ALL SELECT 'logical_unit', 27, count(*)::int FROM lu
UNION ALL SELECT 'unit_version', 27, count(*)::int FROM uv
UNION ALL SELECT 'publication_member', 27, count(*)::int FROM pm
)
SELECT target, expected, actual, (expected = actual) AS pass FROM counts
UNION ALL
SELECT 'total', 82, sum(actual)::int, (sum(actual)::int = 82) FROM counts;
Scope checks:
render: DIEU-28 present, v2.0 present, :pub_id count = 0
verify-counts: DIEU-28 present, v2.0 present, :pub_id count = 0
Both files are self-scoped to DIEU-28 / v2.0; no :pub_id parameter is used. Output columns are explicit: render returns canonical_address, depth, section_type, title, body; verify returns target, expected, actual, pass.
10. Verdict
PASS. Manifest root SHA verified, all manifest files fetched from KB and verified, SQL structure is safe for authorized COMMIT uncomment, sanitized INSERT count is 82, UV columns include description, BG-UV-02 20/7 split is correct, sample line ranges pass, dollar quoting is safe, destructive scan passes, and render/verify are self-scoped.
STOP. Do not execute SQL. Do not connect to DB. Await GPT authorization for Execute R2; Execute R2 must include fresh SSH/VPS/DB identity/collision/triggers preflight before any SQL execution.