KB-6C51

P3D Phase 5C2 — 86 TAC Units Migration Completion Report (DIEU-35 + DIEU-28 + DIEU-32 ALL PASS)

13 min read Revision 1
p3dphase5c2completion86-unitstac-to-iudieu35dieu28dieu32dot-iu-cutter-next2026-05-14

P3D Phase 5C2 — 86 TAC Units Migration Completion Report

Date (UTC): 2026-05-14 Author: Claude Opus 4.7 (1M, xhigh) Status: COMPLETE — 86/86 source TAC rows migrated to native information_unit / unit_version. All three currently-live TAC publications committed. TAC source unchanged. Pre-existing 12 pilot/test IU rows untouched.


0. Headline

Publication Source rows Committed Synthesized Preserved Outcome utc_ts
DIEU-35 36 36 0 36 PASS 20260514T140804Z
DIEU-28 27 27 0 27 PASS 20260514T140835Z
DIEU-32 23 23 4 19 PASS (synthesize-title for 4 heading containers) 20260514T144644Z
TOTAL 86 86 4 82 3/3 PASS

Final live state (post-completion):

information_unit                            = 98   (= 12 pre + 36 DIEU-35 + 27 DIEU-28 + 23 DIEU-32)
unit_version                                = 105  (= 19 pre + 36 + 27 + 23)
birth_registry where collection='information_unit' = 98
tac_publication                             = 3    (unchanged)
tac_logical_unit                            = 86   (unchanged)
tac_unit_version                            = 86   (unchanged)
tac_publication_member                      = 86   (unchanged)

tac_source_untouched = true, pre_existing_iu_untouched = true, ui_cutover_performed = false, vector_work_performed = false, bulk_migration_performed = false, v3_patched_semantics_used = true, cross_system_hash_equality_used_as_gate = false, synthesize_title_policy_used_for_dieu32 = true.


1. Timeline

Date (UTC) Event
2026-04-29 Historical P10B-1C TAC execute/render for DIEU-32: 0 content drift confirmed (5,601 chars round-trip identical).
2026-05-05 Pack 2B P1: pilot IU created (pilot.iu0.test-001). DOT-119 v2 + trg_birth_information_unit installed.
2026-05-06 Pack 22 closure: fn_iu_create + gateway enforced.
2026-05-07 Pack 23 P3A..P3D2: edit/save/comment + iu_edit.policy.default_mode=require_review.
2026-05-12 TAC→UI baseline PASS; rev3/rev4 5C2 migration prompts drafted; Birth System B3-ELD landed.
2026-05-14 Birth System Rev3 ratified; 5C2-R0 design + read-only mapping artifact; first R1 attempt rolled back on V-3b cross-system hash mismatch; patched V-3 (V-3a/V-3b/V-3c split, V-3d demoted to report-only) applied.
2026-05-14T14:08:04Z R1 retry DIEU-35 PASS (36 rows).
2026-05-14T14:08:35Z R2 DIEU-28 PASS (27 rows).
2026-05-14T14:09:00Z R2 DIEU-32 first attempt blocked before BEGIN (4 NULL bodies in source).
2026-05-14 Root-cause investigation: INTENTIONAL_TAC_HEADING_CONTAINER + TAC_TO_IU_MODEL_GAP. Policy POLICY_SYNTHESIZE_TITLE_FOR_HEADING_NULL_BODY recommended.
2026-05-14 GPT approved policy + V-3b' conditional patch.
2026-05-14T14:46:44Z R2 DIEU-32 retry PASS (23 rows: 19 preserved + 4 synthesized via title). All 86 units complete.

2. Per-publication summary

2.1 DIEU-35 (36 rows, R1 retry)

  • Detailed report: knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r1-dieu35-retry-patched-v3-execution-report.md
  • Rollback-keys KB: knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu-35-rollback-keys-20260514T140804Z.md
  • VPS log: /opt/incomex/logs/p3d-phase5c2-dieu-35-20260514T140804Z.log
  • All 36 rows preserved (no synthesize). Soft-flag D38-DIEU35-S8-P3 (body_char=1) migrated verbatim.

2.2 DIEU-28 (27 rows, R2)

  • Detailed report: knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu28-pilot-migration-execution-report.md
  • Rollback-keys KB: knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu-28-rollback-keys-20260514T140835Z.md
  • VPS log: /opt/incomex/logs/p3d-phase5c2-dieu-28-20260514T140835Z.log
  • All 27 rows preserved. 5 heading-container rows used body='' (empty string), which fn_iu_create accepts → no synthesize branch needed.

2.3 DIEU-32 (23 rows, R2 retry with synthesize-title policy)

  • Detailed report: knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu32-retry-synthesize-title-execution-report.md
  • Rollback-keys KB: knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu32-rollback-keys-20260514T144644Z.md
  • VPS log: /opt/incomex/logs/p3d-phase5c2-dieu32-20260514T144644Z.log
  • 4 rows synthesized (body = source.title, body_source='synthesized_from_title_due_to_tac_heading_null_body'): D38-DIEU32-ROOT, D38-DIEU32-S2, D38-DIEU32-S3, D38-DIEU32-S4 — all section_type='heading' AND body IS NULL AND children > 0.
  • 19 rows preserved verbatim.

3. Patched V-3 semantics — final form (verified across 86 rows)

Sub-gate Spec Cumulative result
V-3a IU-side hash consistency uv.content_hash = fn_content_hash(uv.body) 86/86 PASS
V-3b' Body preservation (conditional) body_source='preserved_…' ⇒ byte-equality with source body; body_source='synthesized_…' ⇒ equality with source title + flags + section_type='heading' + src_body_was_null=true + children>0 82 preserved (byte-eq 82/82) + 4 synthesized (all conditions 4/4) = 86/86 PASS
V-3c TAC hash provenance content_profile.src_content_hash = tac_unit_version.content_hash 86/86 PASS
V-3d Cross-system hash equality REPORT ONLY, not a gate 0/86 (expected legacy divergence)

The patched V-3 semantics generalize cleanly across:

  • Publications with no NULL bodies (DIEU-35, DIEU-28) — synthesize branch never fires.
  • Publications with NULL bodies on heading containers (DIEU-32) — synthesize branch fires deterministically only for those rows.
  • The body-source flag is recorded on both identity_profile and content_profile and verified to match for every captured IU/UV pair.

4. Hard-boundary compliance (cumulative across the 3 publications)

Boundary Compliance
No DDL / no schema / no trigger or fn change / no birth-system change ✅ across all 3
No direct INSERT to IU/UV — only fn_iu_create
No TAC writes (V-6 PASS thrice)
No UI cutover / Nuxt / Directus / config / vector / event_outbox
No bulk migration beyond DIEU-35/28/32
Pre-existing 12 pilot/test IU rows untouched throughout
No pattern-matching DELETE; rollback-key dual-write before each COMMIT ✅ (no rollbacks needed; one in-tx abort on R1-first occurred via psql crash; one in-tx abort on the corrected V-3b' attempt; both transactional, no residue)
No automatic content repair beyond approved heading-title synthesis ✅ — non-heading NULL bodies would have raised EXCEPTION in the DO block (BLOCK branch)

5. Toward dot-iu-cutter v0.1 — distilled mandatory capabilities

This run validates the architecture for the future automated cutter ("Cắt luật A"). The capabilities the cutter must implement, distilled from the three published reports:

5.1 Live, parametric, deterministic pipeline

  1. Source discovery — FK-driven join tac_publication → tac_publication_member → tac_logical_unit → tac_unit_version filtered by doc_code; recursive CTE for hierarchy depth. No hand-crafted SQL per publication.
  2. Preflight gate runner (--doc_code) — 19 hard gates: TAC tables exist, publication exists, member_count>0, render_order contiguous, owner-NULL=0, body-NULL classification (must match synthesize policy below), collision count, vocab coverage, fn signature, gateway mode, edit policy, birth trigger, species map, pre-existing IU snapshot, TAC pre-counts, soft-flag scan.
  3. Per-row classifier with explicit policy:
    • SYNTHESIZE_TITLE iff section_type='heading' AND body IS NULL AND children>0 → body = source.title; provenance flagged.
    • PRESERVE iff body IS NOT NULL → body = source.body; provenance flagged.
    • BLOCK iff body IS NULL AND not heading-container → abort.
  4. Bounded transaction per publication: 1 BEGIN, N × (fn_iu_create + SET LOCAL marker + 2 UPDATEs), capture arrays into transaction-local GUCs, then validation, then COMMIT or ROLLBACK. Wall-clock ≤1s per 36 rows observed.
  5. Rollback-key dual-write before COMMIT — KB upload (agent-data MCP API) + VPS log file (with sync). Both must succeed before COMMIT; abort otherwise. This run verified the pattern with revisions 1 (DIEU-35), 1 (DIEU-28), 1 (DIEU-32 first attempt aborted via psql crash; KB doc retained as historical evidence), and 1 (DIEU-32 retry, the binding one).
  6. Patched V-3 (V-3a/V-3b'/V-3c gates; V-3d report-only) + V-1/V-2/V-4..V-7 inside the transaction + V-8..V-10 post-COMMIT.
  7. Exact-key rollback if post-COMMIT validation fails — captured UUID arrays only, no pattern matching.
  8. Per-publication and consolidated reports auto-generated from a structured summary JSON.

5.2 Validation contract (the cutter's promise)

For every committed publication the cutter guarantees:

  • IU/UV/birth count equality with source count.
  • render_order multiset equality with source.
  • IU-side hash consistency (V-3a) 100%.
  • Conditional body fidelity (V-3b') 100% per body_source branch.
  • TAC hash provenance (V-3c) 100%.
  • Authority on all rows.
  • Birth coverage with information_unit_atom / atom species 100%.
  • TAC source counts unchanged.
  • fn_iu_verify_invariants PASS per row.
  • Gateway triggers attached + marker clean after COMMIT.
  • Pre-existing IU rows untouched.
  • Rollback-keys artifact persisted in both KB and VPS log.

5.3 Operator UX

Target invocation (future):

# Read-only check
dot-iu-cutter check --doc_code DIEU-35

# Read-only mapping artifact (R0-equivalent)
dot-iu-cutter map --doc_code DIEU-35 --output kb://artifacts/...

# Bounded migration (single publication, all gates, dual-write rollback)
dot-iu-cutter migrate --doc_code DIEU-35

# Status across publications
dot-iu-cutter status

Behind the scenes, the orchestrator logic from this 86-unit run becomes the cutter's internal state machine.

5.4 Out-of-scope for v0.1 (future passes)

  • IU parent FK enrichment (information_unit.parent_or_container_ref populated from identity_profile.tac_hierarchy.src_parent_canonical_address once all rows exist).
  • UI cutover from TAC reader to IU reader.
  • IU vector collection provisioning.
  • IU event emission to event_outbox.
  • TAC compatibility view (tac_logical_unitinformation_unit WHERE unit_kind='law_unit').

These are tracked as separate design packs.


6. Required final response fields (consolidated)

phase5c2_status=COMPLETE
publications_committed=3
total_source_rows=86
total_iu_created=86
total_uv_created=86
total_birth_created=86
synthesized_rows_total=4
preserved_rows_total=82
dieu35_status=PASS    (36 rows preserved)
dieu28_status=PASS    (27 rows preserved)
dieu32_status=PASS    (19 preserved + 4 synthesized via title)
tac_source_untouched=true
pre_existing_iu_untouched=true
ui_cutover_performed=false
vector_work_performed=false
bulk_migration_performed=false
v3_patched_semantics_used=true
v3b_conditional_policy_verified=true
cross_system_hash_equality_used_as_gate=false
synthesize_title_policy_applied=true
publications_reports=[
  "knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r1-dieu35-retry-patched-v3-execution-report.md",
  "knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu28-pilot-migration-execution-report.md",
  "knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-r2-dieu32-retry-synthesize-title-execution-report.md"
]
rollback_keys_reports=[
  "knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu-35-rollback-keys-20260514T140804Z.md",
  "knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu-28-rollback-keys-20260514T140835Z.md",
  "knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-dieu32-rollback-keys-20260514T144644Z.md"
]
completion_report_path=knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-86-units-completion-report.md
next_recommended_action=GPT_REVIEW_DIEU32_RETRY_THEN_START_DOT_IU_CUTTER_DESIGN

7. Required next gate

GPT_REVIEW_DIEU32_RETRY_THEN_START_DOT_IU_CUTTER_DESIGN — review the 86-unit completion result and dispatch the dot-iu-cutter v0.1 design pack as the canonical productionization of this manual orchestrator.


P3D Phase 5C2 86-Unit Completion | 2026-05-14 | All 3 publications PASS | 86/86 source rows migrated to native IU. Next: dot-iu-cutter v0.1 design.