GPT Review — Existing Birth Code Column Patterns + Doc Cleanup Directive
GPT Review — Existing Birth Code Column Patterns + Doc Cleanup Directive
Date: 2026-05-05 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed:
knowledge/dev/laws/dieu44-trien-khai/reports/existing-birth-code-column-patterns-report.mdrev 1knowledge/dev/laws/dieu44-trien-khai/design/16b-iu0-existing-birth-pipeline-adaptation.mdrev 1- User/Opus summary in conversation
Verdict
Agent report PASS. It materially changes the correct IU birth direction.
The report answers the User’s real question: previous birth/backfill processes already solved “no code column” cases. IU should not invent a new process, and file 16/17 are superseded. In addition, file 16b rev1 is also partially superseded because it assumed DOT-119 supports --code-column and preferred canonical_address; runtime evidence shows both assumptions are unsafe.
Key findings from Agent report
-
Existing system has precedent for no-code entities
- 5 collections use non-
codetext columns:table_id,process_code,law_code,measurement_id,pivot_code. - 3 collections use
fn_birth_registry_auto_id()no-arg variant.
- 5 collections use non-
-
The dominant real pattern is synthetic shell
- 69,644 / 75,005
birth_registryrows useTABLE::iddouble-colon synthetic format. - 323 rows use
TABLE:idsingle-colon_idvariant. - 0 rows use bare UUID.
- 0 rows use path/canonical format.
- 69,644 / 75,005
-
Current installed
fn_birth_registry_auto(text)is v2 and has synthetic fallback- It reads
to_jsonb(NEW)->>code_column. - If that value is NULL/empty, it generates
TG_TABLE_NAME || '::' || NEW.id::text. - This is how many UUID-PK collections are born without a usable code.
- It reads
-
DOT-119 script on disk is stale/dangerous
- It is v1, has no
--code-columnCLI, and hardcodes function body without synthetic fallback. - Running it could clobber installed v2
fn_birth_registry_autoand remove the fallback used by ~70k rows. - Therefore do not run DOT-119 until it is reconciled/fixed.
- It is v1, has no
-
canonical_addressis not the best immediate birth code- It is meaningful and human-readable, but it would introduce a new path/canonical entity_code precedent.
- Existing precedent for UUID-PK/no-code collections is synthetic shell
table::uuid. - IU should initially follow precedent:
information_unit::<uuid>via v2 fallback.
Corrected IU birth direction
Do not use file 17 Option B pilot exception.
Do not run DOT-119 as currently installed.
Do not prefer canonical_address until governance deliberately approves a new canonical/path entity_code convention.
Correct near-term direction:
- Reuse current installed
fn_birth_registry_auto(text)v2. - Create an IU birth trigger in a way that does not reinstall/clobber the function.
- Trigger can call
fn_birth_registry_auto('__force_synthetic__')or another deliberately absent column name, causing v2 fallback to generateinformation_unit::<uuid>. - Alternatively use a proven no-arg
_idvariant only if its semantics are preferred and compatible, but the dominant current format is double-colonTABLE::id.
This is a small trigger-setup problem, not a new governance process.
Documentation cleanup / supersede requirement
The User is correct: misleading design docs must be explicitly marked to avoid future confusion.
Required doc cleanup:
-
Patch file 16 rev2 header:
- Status:
SUPERSEDED — do not execute. - Reason: existing birth pipeline already supports no-code entities via synthetic fallback; formal pilot exception not needed.
- Pointer: this GPT review + Agent report.
- Status:
-
Patch file 17 rev1 header:
- Status:
SUPERSEDED — do not execute. - Reason: Pack 2B pilot exception path replaced by existing birth pipeline adaptation.
- Pointer: this GPT review + Agent report.
- Status:
-
Patch file 16b rev1 to rev2:
- Status:
REVISED AFTER AGENT INVESTIGATION. - Remove/strike unsafe assumptions:
- DOT-119 supports
--code-columnCLI; - canonical_address is preferred immediate code;
- dry-run DOT-119 is safe/useful.
- DOT-119 supports
- Replace with corrected direction:
- DOT-119 on disk is stale v1 and must not be run;
- installed
fn_birth_registry_autov2 synthetic fallback is the path; - IU should use synthetic
information_unit::<uuid>unless a deliberate governance decision chooses canonical_address.
- Status:
-
Create new execution design pack:
knowledge/dev/laws/dieu44-trien-khai/design/18-iu0-birth-trigger-existing-pipeline-execution-pack.md
Required contents for file 18
-
Inputs/evidence:
- Agent report
existing-birth-code-column-patterns-report.md; - S145/S160 reports;
- Pack 1 IU schema;
- Pack 2A registration;
- Description Policy ratification.
- Agent report
-
Scope:
- install birth trigger for
information_unitusing current installed v2 function; - no function replacement;
- no DOT-119 execution until script fixed;
- no IU rows except controlled test if approved;
- no unit_version birth trigger.
- install birth trigger for
-
Execution approach options:
- Option A: direct
CREATE TRIGGER trg_birth_information_unit ... EXECUTE FUNCTION fn_birth_registry_auto('__force_synthetic__')or equivalent absent column string, relying on v2 fallback. - Option B: use
fn_birth_registry_auto_id()only if matching semantics are accepted; note this creates single-colon format unlike dominant v2 fallback. - Option C: first repair DOT-119 to match v2, then use tool; likely larger scope and not needed for IU unblock.
- Option A: direct
-
Recommended approach:
- Prefer Option A as minimal, precedent-compatible, no function clobber.
- However, require exact trigger definition and a read-only/source verification before execution.
-
Preflight:
- confirm current
fn_birth_registry_autostill contains synthetic fallback; - confirm no existing
trg_birth_information_unit; - confirm
information_unit.idexists NOT NULL default UUID; - confirm
information_unitis incollection_registryand observed; - confirm
description_policy=structured_exempt; - confirm row count 0 or controlled state;
- confirm
birth_registryunique on entity_code.
- confirm current
-
Test plan:
- If test row is approved, insert one IU+UV through Pack 1 L1/L2 transaction and verify
birth_registry.entity_code = 'information_unit::' || iu.id. - If no test row approved, only install trigger and defer row test.
- Unit_version remains subordinate and no birth trigger.
- If test row is approved, insert one IU+UV through Pack 1 L1/L2 transaction and verify
-
Rollback:
- drop trigger only;
- do not modify function;
- cleanup any test row and corresponding birth_registry if created, or mark follow-up.
-
Report path:
knowledge/dev/laws/dieu44-trien-khai/reports/iu0-existing-birth-trigger-execution-report.md
-
Hard stops:
- if installed function lacks fallback;
- if DOT-119 is about to be run;
- if proposed SQL replaces function;
- if canonical/path entity_code is chosen without explicit approval;
- if any Pack 2B/vector/outbox/Directus exposure is attempted.
Current decision
Do not execute yet. First, Opus must clean/supersede the misleading docs and draft file 18. After file 18 review, GPT/User can approve a minimal trigger setup execution.