KB-598E

P3D Birth System — B3-A Readiness Rerun (after B3-A1a + B3-A1b)

10 min read Revision 1
p3d-birthb3-areadiness-rerunread-onlyreport

title: P3D Birth System — B3-A Readiness Rerun (after B3-A1a + B3-A1b) mainline: P3D_BIRTH_SYSTEM_COMPLETION_PACK phase: B3-A_RERUN status: PARTIAL mode: READ-ONLY date: 2026-05-12 host: 38.242.240.89 db: postgres (container=postgres, db=directus)

B3-A Readiness Rerun

Read-only recomputation of B3-A readiness from live PG state, following B3-A1a (7 species mappings) and B3-A1b (dot_domain_rules → governance_infra, species_collection_map.id=169). No mutations performed.

1. Function OID Resolution

Function Schema OID
fn_birth_registry_auto public 39232
fn_birth_registry_auto_id public 66750

fn_birth_registry_auto_resolved=true. Trigger validation throughout this report uses pg_trigger.tgfoid = 39232 (the contract function OID), not trigger name patterns. trigger_validation_by_function_oid=true.

2. Sibling/Variant Function

public.fn_birth_registry_auto_id (OID 66750) exists and has 3 trigger bindings (all on IN_SCOPE collections):

Collection Trigger tgfoid Status
governance_relations trg_birth_governance_relations 66750 enabled
law_dot_enforcement trg_birth_law_dot_enforcement 66750 enabled
law_jurisdiction trg_birth_law_jurisdiction 66750 enabled

variant_function_bindings_count=3. These are not counted as wired-to-contract (different OID).

3. collection_registry Universe (live)

Counter Value
birth_required_total 73
birth_required_in_scope 73
out_of_scope BIRTH_REQUIRED rows 0

Live distribution of description_policy across the 73 IN_SCOPE rows:

description_policy Count
required_detailed 12
structured_exempt 4
unclassified 57
(NULL) 0

policy_unknown_count = 57 (treating sentinel 'unclassified' as unknown). B3-P storage column is populated; semantic classification remains a separate workstream.

4. species_collection_map Coverage

Every IN_SCOPE BIRTH_REQUIRED collection now has at least one row in species_collection_map.

Counter Value
missing_species_mapping_count 0
missing_species_mapping_list (empty)

B3-A1a + B3-A1b together closed the prior gaps. dot_domain_rules now mapped to governance_infra via id=169.

5. Physical Base Table Coverage

Counter Value
missing_physical_table_count 0
missing_physical_table_list (empty)

All 73 IN_SCOPE collections resolve to information_schema.tables BASE TABLE rows in public.

6. Trigger Coverage (validated by function OID 39232)

Counter Value Notes
already_wired_count 60 Collections with ≥1 enabled trigger whose tgfoid = 39232
missing_trigger_count 10 No contract trigger AND no variant trigger
variant_only_count 3 No contract trigger; only variant tgfoid = 66750
trigger_candidate_count 13 73 − already_wired_count (= 10 missing + 3 variant-only)

trigger_candidate_set (IN_SCOPE ∩ has_table ∩ has_species ∩ NOT already wired to contract OID):

6.1 Missing trigger (no contract, no variant) — 10

# Collection Notes
1 apr_action_types freshly mapped via B3-A1a
2 apr_approvals freshly mapped via B3-A1a
3 apr_request_types freshly mapped via B3-A1a
4 binding_registry freshly mapped via B3-A1a
5 birth_registry RECURSIVE/SELF-BIRTH RISK — see §7
6 dot_domain_rules freshly mapped via B3-A1b (id=169)
7 field_type_equivalences freshly mapped via B3-A1a
8 normative_relations clean, no blocker found
9 nrm_approval_rules freshly mapped via B3-A1a
10 nrm_doc_type_config freshly mapped via B3-A1a

6.2 Variant-only bindings — 3

# Collection Variant Trigger Variant Function
1 governance_relations trg_birth_governance_relations fn_birth_registry_auto_id
2 law_dot_enforcement trg_birth_law_dot_enforcement fn_birth_registry_auto_id
3 law_jurisdiction trg_birth_law_jurisdiction fn_birth_registry_auto_id

These three would be flagged as missing-contract by an OID-based validator. A unification step (consolidate onto the contract function or whitelist the variant) is required before B3-A is fully PASS.

7. Explicit Classification of Candidates / Blockers

Item Status Notes
birth_registry recursive/self-birth risk TRUE — must be exempted before any naive B3-A install Inserting into birth_registry would re-fire fn_birth_registry_auto on birth_registry, looping. birth_registry already carries unrelated triggers (trg_birth_auto_certify, trg_birth_change_flag_matrix); no contract trigger present — safe today, dangerous if wired.
governance_relations variant binding active, blocks PASS currently uses fn_birth_registry_auto_id
law_dot_enforcement variant binding active, blocks PASS currently uses fn_birth_registry_auto_id
law_jurisdiction variant binding active, blocks PASS currently uses fn_birth_registry_auto_id
normative_relations clean / blocked status CLEAN (no blocker) — straightforward candidate for contract trigger install

birth_registry_recursive_risk=true.

8. Duplicate Trigger Tech Debt

Collections with >1 enabled trigger bound to fn_birth_registry_auto (OID 39232). These are functionally redundant — both triggers fire on every INSERT, emitting 2 birth_registry rows per row inserted.

# Collection Triggers (both tgfoid=39232)
1 agents birth_trigger_agents, trg_birth_agents
2 checkpoint_sets birth_trigger_checkpoint_sets, trg_birth_checkpoint_sets
3 checkpoint_types birth_trigger_checkpoint_types, trg_birth_checkpoint_types
4 collection_registry birth_trigger_collection_registry, trg_birth_collection_registry
5 dot_tools birth_trigger_dot_tools, trg_birth_dot_tools
6 entity_dependencies birth_trigger_entity_dependencies, trg_birth_entity_dependencies
7 entity_species birth_trigger_entity_species, trg_birth_entity_species
8 meta_catalog birth_trigger_meta_catalog, trg_birth_meta_catalog
9 modules birth_trigger_modules, trg_birth_modules
10 system_issues birth_trigger_system_issues, trg_birth_system_issues
11 table_registry birth_trigger_table_registry, trg_birth_table_registry
12 tasks birth_trigger_tasks, trg_birth_tasks
13 taxonomy birth_trigger_taxonomy, trg_birth_taxonomy
14 taxonomy_facets birth_trigger_taxonomy_facets, trg_birth_taxonomy_facets
15 ui_pages birth_trigger_ui_pages, trg_birth_ui_pages
16 workflow_change_requests birth_trigger_workflow_change_requests, trg_birth_workflow_change_requests
17 workflows birth_trigger_workflows, trg_birth_workflows
18 workflow_steps birth_trigger_workflow_steps, trg_birth_workflow_steps

Count: 18. Pattern: each has a birth_trigger_* (legacy/Directus-named) plus a trg_birth_* (DOT-convention) trigger. Recommend de-duplication in a follow-up phase; out of scope for this rerun.

9. Side-Effect / Mutation Confirmation

no_mutation_performed=true. This session executed only SELECT statements (pg_proc, pg_trigger, pg_class, information_schema, public.collection_registry, public.species_collection_map). No INSERT/UPDATE/DELETE/DDL ran; no trigger, function, policy, or migration was created or modified.

10. Final Status & Recommendation

b3a_readiness_rerun_status = PARTIAL. Species + physical-table + policy-storage gates are GREEN. Remaining work before B3-A install can proceed safely:

  1. Decide variant unification policy for governance_relations, law_dot_enforcement, law_jurisdiction — consolidate onto fn_birth_registry_auto OR formally whitelist fn_birth_registry_auto_id as a contract sibling. (Blocks 3 collections.)
  2. Mark birth_registry as EXEMPT or set up self-birth guard before any B3-A install. Naïve wiring would recurse. (Blocks 1 collection.)
  3. Install contract trigger on the remaining 9 clean candidates (the 10 missing minus birth_registry).
  4. Optional/Followup: De-duplicate the 18 redundant trigger pairs (§8) and reclassify the 57 unclassified description_policy rows (§3).

next_recommended_action = GPT_REVIEW_READINESS_RERUN_BEFORE_ANY_TRIGGER_INSTALL

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reports/p3d-birth-system-b3a-readiness-rerun-after-b3a1b-report.md