DOT-119 Repair — P0 Read-only Mapping Report
DOT-119 Repair — P0 Read-only Mapping Report
Date: 2026-05-05 | Phase: P0 (read-only) Controlling: 18a rev4 FINAL + 18b rev3 PASS Mode: READ-ONLY. Zero mutation. No DDL. No UPDATE/INSERT/DELETE. No script edit.
§1. Baselines
| Item | Value |
|---|---|
| 1a — 3 new fields present? | NO (0 rows) — birth_code_strategy, birth_code_column, birth_identity_source all absent on collection_registry |
| 1b — fn_birth_registry_auto hash baseline | 1f729b3571a74963089bb3ef388217f3 |
| 1c — Birth trigger count | 30 (28 entity-birth + 2 self-triggers on birth_registry: auto_certify, change_flag_matrix) |
| 1d — Birth registry rows | 75,450 |
| 1e — DOT-119 script | path /opt/incomex/dot/bin/dot-birth-trigger-setup, size 8948 bytes, mtime Apr 4 04:50, md5 a0b926d3fd373b8995aea2f4e8136e01, lines 275 |
§2. Script Inspection
grep -c 'CREATE OR REPLACE FUNCTION fn_birth_registry_auto' /opt/incomex/dot/bin/dot-birth-trigger-setup
→ 1
Conclusion: v1 stale CONFIRMED. Script contains the function body and would clobber the installed v2 (synthetic-fallback) function on next run.
§3. Schema/Migration Tool Search
dot_tools query for code/name ILIKE '%SCHEMA%|%MIGR%|%ALTER%' returned multiple matches (deduplicated by code; both DOT-NNN and DOT_* rows refer to the same scripts):
Most relevant for collection_registry DDL:
| code | name | file_path |
|---|---|---|
| DOT-063 | dot-schema-apply | bin/dot/dot-schema-apply |
| DOT-067 | dot-schema-diff | bin/dot/dot-schema-diff |
| DOT-068 | dot-schema-ensure | bin/dot/dot-schema-ensure |
| DOT-074 | dot-schema-registry-collections-ensure | bin/dot/dot-schema-registry-collections-ensure |
Plus 30+ per-collection dot-schema-*-ensure ensurer scripts and 3 dot-migration-* migration scripts. DOT-074 dot-schema-registry-collections-ensure is the candidate that appears topical for collection_registry DDL.
Conclusion: schema_migration_tool_found = yes. NOT verified that any of these tools is the correct authorized path for adding the 3 new columns — that is a P1 prerequisite (read DOT-074 source + compare to required DDL). Per 18b §3 P0-Step 3 contract, this finding triggers "STOP chờ decision" before P1 chooses between (a) using DOT-074, (b) extending DOT-074, or (c) raw DDL with §36 authorization.
§4. Full Mapping Table
collection_registry.count = 166 total. Mapping rules applied per 18b-P0 prompt §4d.
§4.1 Strategy = column (25, all confidence=high, source=inferred_from_existing_trigger)
| collection | trigger | trigger_arg → birth_code_column | column verified |
|---|---|---|---|
| agents | trg_birth_agents | code | ok |
| approval_requests | trg_birth_approval_requests | code | ok |
| checkpoint_sets | trg_birth_checkpoint_sets | code | ok |
| checkpoint_types | trg_birth_checkpoint_types | code | ok |
| collection_registry | trg_birth_collection_registry | code | ok |
| dot_tools | trg_birth_dot_tools | code | ok |
| entity_dependencies | trg_birth_entity_dependencies | code | ok |
| entity_species | trg_birth_entity_species | code | ok |
| governance_registry | trg_birth_governance_registry | code | ok |
| law_catalog | trg_birth_law_catalog | law_code | ok |
| measurement_registry | trg_birth_measurement_registry | measurement_id | ok |
| meta_catalog | trg_birth_meta_catalog | code | ok |
| modules | trg_birth_modules | code | ok |
| normative_registry | trg_birth_normative_registry | code | ok |
| pivot_definitions | trg_birth_pivot_definitions | code | ok |
| pivot_results | trg_birth_pivot_results | pivot_code | ok |
| system_issues | trg_birth_system_issues | code | ok |
| table_registry | trg_birth_table_registry | table_id | ok |
| tasks | trg_birth_tasks | code | ok |
| taxonomy | trg_birth_taxonomy | code | ok |
| taxonomy_facets | trg_birth_taxonomy_facets | code | ok |
| ui_pages | trg_birth_ui_pages | code | ok |
| workflow_change_requests | trg_birth_workflow_change_requests | code | ok |
| workflows | trg_birth_workflows | process_code | ok |
| workflow_steps | trg_birth_workflow_steps | code | ok |
All 25 trigger args verified as existing columns on their tables → confidence=high for all.
§4.2 Strategy = legacy_id_single_colon (3, confidence=high)
| collection | trigger | function |
|---|---|---|
| governance_relations | trg_birth_governance_relations | fn_birth_registry_auto_id() |
| law_dot_enforcement | trg_birth_law_dot_enforcement | fn_birth_registry_auto_id() |
| law_jurisdiction | trg_birth_law_jurisdiction | fn_birth_registry_auto_id() |
birth_code_column = NULL. source = inferred_from_existing_trigger.
§4.3 Strategy = disabled (60, confidence=high)
All have governance_role='excluded' and no birth trigger. source = system_default.
_permissions_backup_s132c, block_button, block_button_group, block_button_groups, block_buttons, block_columns, block_cta, block_divider, block_faqs, block_form, block_gallery, block_hero, block_html, block_library, block_logocloud, block_quote, block_richtext, block_steps, block_team, block_testimonials, block_video, blocks, categories, entity_labels, forms, globals, languages, navigation, os_activities, os_deal_stages, os_deals, os_email_templates, os_expenses, os_invoices, os_payment_terms, os_payments, os_project_templates, os_project_updates, os_projects, os_proposal_approvals, os_proposal_blocks, os_proposals, os_settings, os_tasks, os_tax_rates, page_blocks, pages, pages_blocks, pages_blog, pages_projects, pages_translations, posts, redirects, seo, species_collection_map, taxonomy_matrix, team, testimonials, website, workflow_step_relations
§4.4 Strategy = unclassified (76, confidence=high)
No birth trigger; governance_role ∈ (governed, observed, locked, law_artifact). source = unclassified.
By role:
governed(8): apr_action_types, apr_approvals, apr_request_types, birth_registry, dot_domain_rules, field_type_equivalences, normative_relations- Plus
birth_registryitself (cannot self-trigger by design — likely to remaindisabledor special-cased; flagged as unclassified for human decision).
- Plus
locked(3): binding_registry, nrm_approval_rules, nrm_doc_type_configlaw_artifact(2): admin_fallback_log, law_version_verification_logobserved(63): agent_views, ai_discussion_comments, ai_discussions, ai_tasks, billing, block_columns_rows, block_gallery_files, block_logocloud_logos, block_step_items, block_testimonial_slider_items, checkpoint_instances, checkpoint_rules, checkpoint_set_items, checkpoint_type_overrides, comments, contacts, content_requests, conversations, derived_objects_registry, directus_fields, doc_reviews, entity_audit_queue, feedbacks, governance_audit_log, governance_docs, help, help_articles, help_collections, help_feedback, inbox, kb_audit_log, kb_documents_history, knowledge_documents, label_rules, lifecycle_log, measurement_log, messages, navigation_items, navigation_navigation_items, organization_addresses, organizations, organizations_contacts, os_activity_contacts, os_deal_contacts, os_invoice_items, os_items, os_project_contacts, os_proposal_contacts, os_task_files, post_gallery_items, registry_changelog, sales, table_proposals, task_checkpoints, task_comments, trigger_registry, universal_edges, universal_rule_registry, universal_rule_run_results, universal_rule_runs, universal_rule_violations, v_registry_counts, v_registry_summary, workflow_categories
Notes flagged in this group:
v_registry_counts,v_registry_summaryare VIEWS (cannot have triggers / cannot be born). Likely should bedisablednot unclassified — DDL attribute on registry rows for views needs human decision.birth_registryis the registry itself — self-birth would loop. Expected to bedisabled.directus_fieldsis a Directus system collection — DDL/strategy choice has cross-cutting implications.
§5. Manual Classifications + Provenance
| collection | strategy | birth_code_column | source | confidence | provenance |
|---|---|---|---|---|---|
information_unit |
synthetic_id |
NULL | manual |
high | 18a rev4 §3. No code column (15 cols, see existing-birth-code-column-patterns-report Q8). Synthetic shell information_unit::<uuid> matches v2 fallback pattern of every UUID-PK collection (~70k rows precedent). GPT/User decision. |
unit_version |
subordinate |
NULL | manual |
high | 18a rev4 §3. Child of information_unit; no independent birth identity. GPT/User decision. |
Currently both have governance_role='observed' and no birth trigger; manual classification overrides default unclassified.
§6. Distribution Preview
| strategy | count |
|---|---|
| column | 25 |
| synthetic_id | 1 |
| legacy_id_single_colon | 3 |
| subordinate | 1 |
| disabled | 60 |
| unclassified | 76 |
| TOTAL | 166 |
§7. Confidence Summary
All rows = confidence high. No rows downgraded to medium or low:
- All 25 column-arg triggers verified against
information_schema.columns→ allok(no missing column = no medium downgrade). - All trigger_def patterns parsed cleanly → no parse failures = no low downgrade.
- 2 manual rows are GPT/User decisions = high.
any_confidence_not_high = no.
§8. Decision Flags
schema_migration_tool_found: yes (DOT-074 dot-schema-registry-collections-ensure most topical; verification deferred to P1)
any_confidence_not_high: no
three_fields_already_present: no
dot119_stale_v1_confirmed: yes (grep count = 1)
fn_hash_baseline_captured: yes
fn_hash_value: 1f729b3571a74963089bb3ef388217f3
trigger_count: 30 (28 entity-birth + 2 birth_registry self)
birth_registry_count: 75450
script_md5: a0b926d3fd373b8995aea2f4e8136e01
script_lines: 275
script_size_bytes: 8948
script_mtime: Apr 4 04:50
collection_registry_total: 166
§9. STOP Conditions Checked
| Condition (per 18b-P0 prompt) | Triggered? | Note |
|---|---|---|
| 3 fields already exist (1a > 0 rows) | NO | 0 rows returned |
| Script grep returned 0 (v1 sanitized externally) | NO | grep returned 1 |
| Schema/migration tool found → 18b §3 says "STOP chờ decision" | YES (advisory) | Per umbrella 18b rev3, P1 must verify whether to use DOT-074 or extend it before any DDL. P0 prompt explicitly wants this flagged in report (not a P0 abort). |
| Mapping confidence not all high | NO | All high |
| Trigger arg column missing on table | NO | All 25 verified ok |
P0 mandatory HARD STOP after upload (§8) is triggered regardless. No subsequent action this phase.
§10. Hand-off Notes for P1 Drafting
Open items GPT/User must decide before P1 prompt is composed:
- DDL channel — use
DOT-074 dot-schema-registry-collections-ensure(read source first), extend it, or apply raw DDL under §36 authorization. P1 should begin with read of the DOT-074 script. - Views in
unclassified—v_registry_counts,v_registry_summarylikely belong indisabled; rule for views needs explicit policy. birth_registryitself — cannot self-trigger; should bedisabledor newself_registrystrategy?- Bulk reclassification of 76 unclassified rows — out of scope for 18b per umbrella (would inflate scope); likely surface via DOT-119 exit-10 remediation flow per 18a rev4 §5.1.
- Directus fields gap — 3 new cols added at PG layer must be registered in
directus_fields; see project memorys178_fix20_m3afor PG workaround precedent.
P0 read-only mapping report | 2026-05-05 | HARD STOP. Awaiting GPT/User review before P1 prompt drafted.