KB-4107

GPT Review — File 16b Existing Birth Pipeline Adaptation

4 min read Revision 1
gpt-reviewfile16bbirth-pipelinedot-119iu-0approve-investigation-with-patches

GPT Review — File 16b Existing Birth Pipeline Adaptation

Date: 2026-05-04 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed: knowledge/dev/laws/dieu44-trien-khai/design/16b-iu0-existing-birth-pipeline-adaptation.md rev 1

Verdict

PASS DIRECTION. Approve read-only/dry-run investigation after small prompt hardening.

File 16b correctly corrects the overengineering in files 16/17. The right next question is not “new pilot birth exception or QT-002 later?” but:

Can the existing DOT-119 / fn_birth_registry_auto(code_column) pipeline be used for information_unit with canonical_address as the code column?

This aligns with User’s instruction: existing birth law/process/tooling must be reused before inventing new process.

What file 16b gets right

  • Finds S145-M2 evidence for DOT-119.
  • Notes DOT-119 supports --code-column=<col>.
  • Notes non-code columns (law_code, measurement_id) already worked.
  • Correctly prefers canonical_address over id as likely birth code because it is text, unique, human-readable, and semantically meaningful.
  • Correctly keeps unit_version subordinate/no separate birth trigger for now.
  • Correctly supersedes file 16/17 execution direction.
  • Keeps investigation read-only + dry-run.

Small required prompt hardening before dispatch

P1 — Avoid dumping full script blindly if very long

Instead of unconditional cat, use:

sed -n '1,240p' /opt/incomex/dot/bin/dot-birth-trigger-setup

If script longer, agent can report line count and only inspect relevant argument parsing / SQL generation sections.

P2 — Add runtime uniqueness/immutability checks for canonical_address

Add:

SELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_name='information_unit'
  AND column_name IN ('id','canonical_address');

SELECT indexname, indexdef
FROM pg_indexes
WHERE tablename='information_unit'
  AND indexdef ILIKE '%canonical_address%';

If there is no unique index/constraint on canonical_address, do not assume it is safe as birth code.

P3 — Inspect DOT-119 trigger function call shape

Q3 should include pg_get_triggerdef for at least one non-code trigger and ideally all three known non-code examples if present:

  • trg_birth_law_catalog
  • trg_birth_measurement_registry
  • any trigger using code_column arg

P4 — Dry-run must be explicitly non-mutating and report exact proposed SQL

Agent must confirm dry-run does not create trigger. After dry-run, run Q5 trigger check again to confirm no trg_birth_information_unit exists.

P5 — Add STOP if unit_version already has/needs birth trigger unexpectedly

Investigation should inspect unit_version triggers too. If a birth trigger exists on unit_version, report and STOP for design review.

P6 — Add report decision fields

Report should conclude:

  • recommended code column: canonical_address / id / neither;
  • whether DOT-119 dry-run passes;
  • exact execute command if approved later;
  • whether function/tool adaptation is needed;
  • whether file 16/17 remain superseded.

Directive to Opus/Ocus

Patch the investigation prompt inside file 16b or prepare a final dispatch prompt with P1–P6. Do not execute trigger setup yet.

The dispatch is allowed only for:

  • read-only commands;
  • DOT-119 --dry-run;
  • no IU rows;
  • no CREATE TRIGGER;
  • no function/tool edits.

Report path remains: knowledge/dev/laws/dieu44-trien-khai/reports/iu0-birth-pipeline-adaptation-investigation-report.md

After investigation report, GPT/User decides whether to approve the actual DOT-119 execute command.

Current state

  • File 16/17 option-exception direction: superseded for now.
  • File 16b: correct direction, needs small prompt hardening.
  • Next: dispatch read-only/dry-run investigation after prompt patch.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-file16b-existing-birth-pipeline-adaptation-2026-05-04.md