KB-2049

P3D Phase 5C2-R0 Resume Plan — Report (Design-Only, Read-Only Verification)

14 min read Revision 1
p3dpack1phase5c2r0resume-plantac-to-iudesign-onlyreport2026-05-14

P3D Phase 5C2-R0 Resume Plan — Report

Date: 2026-05-14 Author: Claude Opus 4.7 (1M, xhigh) Mode: DESIGN ONLY / READ-ONLY VERIFICATION ONLY Status: PASS — design uploaded; awaiting GPT/Opus/User review Companion design: knowledge/dev/laws/dieu44-trien-khai/design/p3d-phase5c2-resume-tac-to-information-unit-migration-plan.md rev 1 Controlling prompt: knowledge/dev/laws/dieu44-trien-khai/prompts/agent-phase5c2-r0-resume-plan-design-only-2026-05-14.md rev 1


0. Hard boundaries — all honored

Boundary Honored Evidence
No execution / no DB write / no DDL / no DML Only SELECT, pg_get_*, information_schema.*; no INSERT/UPDATE/DELETE/TRUNCATE/MERGE
No mutating fn execution (fn_iu_create, fn_iu_save, fn_iu_apply_edit_draft, fn_birth_onboarding_full_scan_hc, …) none invoked; fn_iu_create was inspected via pg_get_function_identity_arguments, not called
No TAC writes / no IU migration rows / no bulk migration source query only; no INSERT performed
No UI cutover (Nuxt / Directus / config) nothing read or changed in Nuxt/Directus surfaces
No schema / trigger / fn patch / birth-system change no DDL of any kind
No Qdrant / vector mutation / reindex only GET /collections (read)
No old rev4 prompt execution / no rollback execution only matrix-style revalidation in design §4

no_mutation_performed = true.


1. Live PG verification summary (read-only)

Connection: ssh contabodocker exec -i postgres psql -U directus -d directus (read-only SELECTs only).

1.1 TAC source live state (rev4 §A)

Check Result Verdict
tac_publication exists / count 3 rows
tac_logical_unit exists / count 86 rows
tac_unit_version exists / count 86 rows
tac_publication_member exists / count 86 rows
DIEU-35 row doc_code=DIEU-35, version=v5.2, lifecycle_status=proposed
DIEU-35 member count 36
DIEU-35 render_order min=0 max=35 distinct=36 count=36 (contiguous)
DIEU-35 tac_logical_unit.owner NULL count 0
DIEU-35 tac_logical_unit.parent_id NULL 1 root + 35 with parent
DIEU-35 tac_unit_version count per LU (first 5) 1 / 1 / 1 / 1 / 1
DIEU-35 section_type distribution 12 distinct (governance_process=12, technical_spec=8, paragraph=5, checklist=2, process=2, appendix=1, article=1, changelog=1, definition=1, heading=1, instruction_block=1, principle=1)
Join path FK-derived publication → member → logical_unit / unit_version

tac_dieu35_verified=true, tac_member_count=36, tac_render_order_verified=true.

1.2 IU target live state (rev4 §B)

Check Result Verdict
information_unit schema 19 cols (incl. unit_kind, sort_order, section_type, section_code, doc_code, conformance_status)
unit_version schema 16 cols
IU row count 12 (all pilot.* or test/*, all unit_kind='design_doc_section')
UV row count 19
fn_iu_create signature (9-arg) → jsonb matches Pack 22 README + dot_config.iu_create.gateway.canonical_function
fn_iu_create_plan signature → jsonb matches
fn_iu_verify_invariants(p_addr text)jsonb present
fn_content_hash(p_body text)text present
trg_aa_iu_gateway_write_guard on information_unitfn_iu_gateway_write_guard enforced
trg_aa_uv_gateway_write_guard on unit_versionfn_iu_gateway_write_guard enforced
dot_config.iu_create.gateway.mode enforced
dot_config.iu_create.gateway.canonical_function public.fn_iu_create(text,text,text,text,text,text,text,text,uuid)
dot_config.iu_create.gateway.allowed_marker_values fn_iu_create,fn_iu_apply_edit_draft
dot_config.iu_edit.policy.default_mode require_review (Pack 23 P3C4 live)
trg_birth_information_unit def AFTER INSERT ON public.information_unit FOR EACH ROW EXECUTE FUNCTION fn_birth_registry_auto('__birth_synthetic_id__') (exact 18c)
Independent unit_version birth trigger NONE (subordinate)
species_collection_map for information_unit (information_unit_atom, information_unit, is_primary=true)
birth_registry IU coverage 12 / 12 with species_code='information_unit_atom', composition_level='atom', 0 NULL species
identity_profile placement ON information_unit=YES, ON birth_registry=NO (Rev3 §3)

iu_target_verified=true, iu_existing_rows_count=12.

1.3 Vocab seeds (rev4 §6 G0-12..14)

Key Live value Required by 5C2
vocab.publication_authority.incomex_council incomex_council
vocab.publication_type.law law ✓ (was a known gap on 2026-05-05; now seeded)
vocab.unit_kind.law_unit law_unit ✓ (was a known gap on 2026-05-05; now seeded)
vocab.section_type.* coverage 13 keys present (appendix, article, changelog, checklist, definition, governance_process, heading, instruction_block, paragraph, principle, process, section, technical_spec) ✓ — covers all 12 distinct D35 section_types
iu_create.gateway.* policy keys 10 keys present (mode, canonical_function, plan_function, allowed_marker_values, marker_key, marker_value, direct_insert_policy, exempt_policy, policy_doc_path, readme_path)

1.4 Collision check

SELECT count(*) FROM information_unit iu JOIN tac_publication_member pm ON true JOIN tac_publication p ON p.id=pm.publication_id JOIN tac_logical_unit lu ON lu.id=pm.logical_unit_id WHERE p.doc_code='DIEU-35' AND iu.canonical_address=lu.canonical_address;

0 collisions between the 36 source canonical_address values and the 12 existing IU rows.

1.5 Birth contract live (Rev3 invariants)

Invariant Result Verdict
birth_registry.canonical_address / owner / jsonb_profile columns present (text NULL / text NULL / jsonb NOT NULL DEFAULT '{}')
birth_registry row count 285,965 (informational; grew naturally)
jsonb_profile IS NULL count 0 ✓ I-1
Triggers on birth_registry exactly trg_birth_auto_certify, trg_birth_change_flag_matrix, trg_count_birth_registry (3) ✓ I-6
fn_birth_registry_auto md5 1f729b3571a74963089bb3ef388217f3 (unchanged)
fn_birth_onboarding_full_scan_hc + HC row present + active
DOT-119 v2 script md5 5883bce405b86ab436e885cf16fd22de (no-clobber)

1.6 Vector

Check Result
Qdrant collections 1 — production_documents only
production_documents.points_count 6,084 (was 5,015 at hardening 2026-05-11; natural growth)
Qdrant status green
Agent-data /health.status healthy; qdrant/postgres/openai all ok
data_integrity.sync_status warning (known-informational, ratio=2.05 > 2.0 — per hardening §12.1, not an ALERT)
ALERT-level vector reports since hardening none

vector_efficiency_alert=NONE, vector_work_allowed=false.

live_pg_verified=true.


2. Rev4 revalidation outcome

20-row matrix in design §4 covers every assumption in rev4 against current live truth. Summary:

Category Count
CONFIRMED (assumption holds live) 7 (R-4, R-5, R-6, R-7, R-17, R-20, R-12 statically resolves)
UNCHANGED (still valid as written) 6 (R-2, R-3, R-14, R-15, R-16, R-18, R-19)
DIFFERS (rev4 predates current state — non-blocking; R0/R1 must integrate) 5 (R-1 mode inversion; R-8 Birth Rev3; R-9 Pack 22 gateway; R-10 Pack 23 require_review; R-11 12-row pilot namespace)
UNVERIFIED (deferred to R1) 1 (R-13 LOGGING_DIR convention)
SIMPLIFIES (live state lets R0 drop a probe) 1 (R-12 fn shape statically resolved)
BLOCKING 0

rev4_revalidation_required = true (acknowledged), rev4_revalidation_matrix_complete = true.

Integration confirmations:

  • birth_rev3_integrated = true (R-8 + §5.7 of design)
  • pack22_fn_iu_create_integrated = true (R-9 + §5.2 / §5.6 of design)
  • pack23_require_review_integrated = true (R-10 + §5.8 of design)
  • tac_ui_preservation_integrated = true (R-19 + design §0 boundaries + §6.4)

5C2-R0 — Read-only mapping / dry-run (design §6.1). Reasons:

  1. The mapping itself is the non-trivial design surface: 10-key identity_profile patch, gateway-marker discipline on the post-fn_iu_create UPDATE, exact-key rollback strategy. Reviewing it before any write is the cheapest possible safety gate.
  2. Live schema diverges from rev4 + canonical-contract assumptions in non-blocking ways (information_unit already carries unit_kind, sort_order, section_type, section_code, doc_code, conformance_status). A read-only mapping is the cleanest way to demonstrate this to GPT/Opus/User without committing to execution semantics.
  3. R0 + GPT/Opus/User review costs little; R1 without R0 review would require speculative execution under hard-boundary risk.

recommended_option = 5C2-R0_READONLY_MAPPING_DRYRUN.

R1 (DIEU-35 pilot execution) and R2 (controlled batch DIEU-28/DIEU-32) are documented in design §6.2 and §6.3 as future, separately-authorized packs. UI cutover (design §6.4) is explicitly out-of-scope future pack only.


4. Validation criteria for future R1 (designed in §7 of design)

10 gates V-1..V-10:

# Gate
V-1 Row accounting: captured count = source count = 36
V-2 Render fidelity: identity_profile→rendering→render_order multiset = {0..35}
V-3 Content hash fidelity: per-row UV content_hash = fn_content_hash(body) = src content_hash
V-4 Authority on all: identity_profile→publication_authority_ref = 'incomex_council' for 36/36
V-5 Birth coverage: 36 birth rows; 0 NULL species; all information_unit_atom / atom
V-6 TAC source untouched: pre/post-tx counts identical for the 4 TAC tables
V-7 fn_iu_verify_invariants PASS per row (all_pass=true)
V-8 Gateway integrity (triggers attached post-COMMIT; no marker leakage)
V-9 Pre-existing 12 pilot/test IU rows untouched (id-list comparison)
V-10 Rollback-key artifact written to KB AND VPS log (dual-write before COMMIT)

V-1..V-7 inside-tx (failure → ROLLBACK). V-8..V-10 post-COMMIT post-conditions (failure → exact-key rollback per §8 of design).


5. Exact-key rollback (designed in §8 of design)

Captured-UUID-only DELETE order: birth_registry (by entity_code IN ANY(...)) → unit_version (by id IN ANY(...)) → information_unit (by id IN ANY(...)). PATTERN-MATCHING DELETION PROHIBITED. Dual-write (KB + VPS log) BEFORE COMMIT.


6. Required final response fields

phase5c2_r0_design_status=PASS
no_mutation_performed=true
live_pg_verified=true
tac_dieu35_verified=true
tac_member_count=36
tac_render_order_verified=true
iu_target_verified=true
iu_existing_rows_count=12
rev4_revalidation_required=true
rev4_revalidation_matrix_complete=true
birth_rev3_integrated=true
pack22_fn_iu_create_integrated=true
pack23_require_review_integrated=true
tac_ui_preservation_integrated=true
recommended_option=5C2-R0_READONLY_MAPPING_DRYRUN
phase5c2_execution_allowed=false
bulk_migration_allowed=false
ui_cutover_allowed=false
vector_work_allowed=false
next_required_review=GPT_OPUS_USER_REVIEW_PHASE5C2_R0_PLAN
report_path=knowledge/dev/laws/dieu44-trien-khai/reports/p3d-phase5c2-resume-plan-report.md

7. Open items / risks / non-blockers flagged for review

# Item Class Note
O-1 Canonical-contract design §E "must-ADD columns to IU native (unit_kind, sort_order, section_type)" NON-BLOCKING — STALE Live information_unit already has all three plus section_code, doc_code, conformance_status. Phase 2 DDL of the EVOLVE plan is silently complete; update §E in a later doc-only patch
O-2 rev4 §3 <logging_convention_path> = /opt/incomex/logs NON-BLOCKING — R1-deferred R0 does not need the FS path; R1 must live-verify or report LOGGING_DIR_UNKNOWN
O-3 Birth ELD deferred enrichment (canonical_address, owner, jsonb_profile backfill on birth_registry) OUT-OF-SCOPE for 5C2 Per Rev3 §7 + handoff §4; separate enrichment workstream
O-4 147 unclassified rows in collection_registry.description_policy NON-BLOCKING information_unit + unit_version are structured_exempt; 5C2 not gated
O-5 Pack 23 IU event emission to event_outbox with event_domain='information_unit' DEFERRED_P3D Not on 5C2 critical path; known gap for IU notification filter
O-6 IU vector collection not yet provisioned DEFERRED Out-of-scope for 5C2; legacy vector hardening already PASS
O-7 UI cutover (Nuxt /knowledge/laws) EXPLICITLY OUT-OF-SCOPE Separate future pack only; design §6.4
O-8 12 pre-existing pilot/test IU rows MUST-NOT-TOUCH All unit_kind='design_doc_section' in pilot.*/test/* namespaces; zero collision with D35
O-9 DIEU-28 (27 members) and DIEU-32 (23 members) DEFERRED to R2 Same EVOLVE pattern; separate prompts after R1 PASS

None of O-1..O-9 block R0.


8. Required next gate

GPT review of this plan → Opus review → User GO before any R0 execution prompt is drafted. R0 execution prompt is a separate doc that references this plan and emits the artifacts listed in design §9.


P3D Phase 5C2-R0 Resume Plan Report | 2026-05-14 | Claude Opus 4.7 xhigh | No mutation. Live-evidence-led.