P2B-P1 — IU Pilot INSERT + Birth Fire Verification Report
P2B-P1 — IU Pilot INSERT + Birth Fire Verification Report
Date: 2026-05-05 | Status: COMPLETE — PASS Executed by: Claude Opus 4.7 agent Controlling prompt:
knowledge/dev/laws/dieu44-trien-khai/prompts/19-p2b-p1-iu-pilot-insert-and-birth-fire-prompt.mdrev2 Connection:docker exec -i postgres psql -U directus -d directus(VPS 38.242.240.89)
1. Preflight results
2.1 Baselines (before)
| tbl | count |
|---|---|
| iu | 0 |
| uv | 0 |
| iu_birth | 0 |
| uv_birth | 0 |
✓ IU=0, IU_birth=0 as expected. UV/UV_birth baseline = 0.
2.2 Trigger exists
trg_birth_information_unit present (1 row). ✓
2.3 Audit baselines
fn_hash(fn_birth_registry_auto):1f729b3571a74963089bb3ef388217f3birth_trigger_count: 31total_birth_count: 75990
2.4 Vocab values chosen
Query against dot_config:
| key | value | vocab_token |
|---|---|---|
| vocab.publication_type.design_doc | design_doc | design_doc |
| vocab.section_type.section | section | section |
| vocab.unit_kind.design_doc_section | design_doc_section | design_doc_section |
Selected (using key suffix as vocab_token):
<UNIT_KIND>→design_doc_section<SECTION_TYPE>→section
2.5 Canonical address absent
SELECT count(*) FROM information_unit WHERE canonical_address='pilot.iu0.test-001'; → 0. ✓
2.6 Hash function availability
| digest_text | digest_bytea | sha256_bytea |
|---|---|---|
| digest(text,text) | digest(bytea,text) | sha256(bytea) |
All present. Selected priority #1: encode(digest(v_body, 'sha256'), 'hex').
2. Transaction result
SUCCESS. Single transaction (BEGIN; SET CONSTRAINTS ALL DEFERRED; DO $$...$$; COMMIT) returned COMMIT with no errors.
NOTICE output:
WARNING: Birth gate L1 PILOT-ONLY: P-pub1 missing — production sẽ BLOCK
WARNING: Birth gate L1 PILOT-ONLY: P-pub2 missing — production sẽ BLOCK
NOTICE: IU_ID=3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe
NOTICE: UV_ID=6c2f01c6-2bb0-4357-a0d6-735945d35b5b
NOTICE: CONTENT_HASH=7bab3f7add2c0bc03105415724abd381abcad035d06e2428d8543c211a7f57e8
The two PILOT-ONLY warnings are gate L1 advisory messages (P-pub1/P-pub2 missing) — informational only, not blockers, and consistent with pilot mode design.
3. IU row snapshot
id | 3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe
canonical_address | pilot.iu0.test-001
unit_kind | design_doc_section
owner_ref | pilot.owner.iu0
lifecycle_status | draft
conformance_status | open
version_anchor_ref | 6c2f01c6-2bb0-4357-a0d6-735945d35b5b
content_anchor_ref | 6c2f01c6-2bb0-4357-a0d6-735945d35b5b
identity_profile | {"title": "Pilot IU Test 001", "owner_lookup_ref": "pilot.owner.iu0", "primary_section_type_ref": "section"}
created_by | agent:p2b-p1
4. UV row snapshot
id | 6c2f01c6-2bb0-4357-a0d6-735945d35b5b
unit_id | 3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe
body | Pilot content for information unit test 001. This is a controlled test row created by Pack 2B-P1.
content_hash | 7bab3f7add2c0bc03105415724abd381abcad035d06e2428d8543c211a7f57e8
version_seq | 1
lifecycle_status | draft
5. Birth registry snapshot
entity_code | collection_name | born_at
-------------------------------------------------------+------------------+-------------------------------
information_unit::3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe | information_unit | 2026-05-05 07:07:26.107923+00
(Note: report query in §4.3 of prompt referenced column created_at, which does not exist on birth_registry. Substituted date_created for column-existence check; date_created is NULL on this row. Authoritative timestamp is born_at. This is a read-only verify SQL adjustment — no state mutation.)
4.3b entity_code join verify
id | 3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe
entity_code | information_unit::3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe
expected_entity_code | information_unit::3ffbbaa5-f22a-4df4-8bc6-c27eab2787fe
entity_code_ok | t
✓ entity_code matches information_unit::<iu_uuid> exactly.
4.4 UV birth count
SELECT count(*) FROM birth_registry WHERE collection_name='unit_version'; → 0. ✓ (UV is subordinate, no birth trigger.)
6. Invariant comparison
| Invariant | Before (§2.3) | After (§4.5) | Match |
|---|---|---|---|
fn_hash (fn_birth_registry_auto) |
1f729b3571a74963089bb3ef388217f3 |
1f729b3571a74963089bb3ef388217f3 |
✓ |
birth_trigger_count (trg_birth_*) |
31 | 31 | ✓ |
7. Counts delta
| tbl | before | after | delta | gate |
|---|---|---|---|---|
| information_unit | 0 | 1 | +1 | hard ✓ |
| unit_version | 0 | 1 | +1 | hard ✓ |
| iu_birth (br where collection=information_unit) | 0 | 1 | +1 | hard ✓ |
| uv_birth (br where collection=unit_version) | 0 | 0 | 0 | hard ✓ |
| total_birth (audit) | 75990 | 75991 | +1 | audit only — informational, +1 consistent |
8. Pass/Fail summary
- IU row exists with correct canonical_address (
pilot.iu0.test-001) - UV row exists with
unit_id = IU.id(3ffbbaa5-…) -
IU.version_anchor_ref = UV.id(6c2f01c6-…) -
IU.content_anchor_ref = UV.id::text(6c2f01c6-…) - Birth registry has 1 new row for
information_unit -
entity_code = information_unit::<iu_uuid>(verified by join,entity_code_ok=true) - UV birth count unchanged (0)
-
fn_hashunchanged -
birth_trigger_countunchanged (31)
Result: ALL CHECKS PASS.
9. Cleanup SQL draft (DO NOT RUN — chờ approval)
-- CLEANUP (DO NOT RUN unless approved)
BEGIN;
UPDATE information_unit
SET version_anchor_ref=NULL, content_anchor_ref=NULL
WHERE canonical_address='pilot.iu0.test-001';
DELETE FROM unit_version
WHERE unit_id IN (
SELECT id FROM information_unit WHERE canonical_address='pilot.iu0.test-001'
);
DELETE FROM birth_registry
WHERE collection_name='information_unit'
AND entity_code IN (
SELECT 'information_unit::' || id::text
FROM information_unit
WHERE canonical_address='pilot.iu0.test-001'
);
DELETE FROM information_unit
WHERE canonical_address='pilot.iu0.test-001';
COMMIT;
10. Hard-stop confirmation
P2B-P1 COMPLETE. HARD STOP. Chờ GPT/User review.
P2B-P1 report | 2026-05-05 | 1 IU + 1 UV pilot. Birth fire verified. All invariants held.