KB-F882

GPT Review — 18b-P1 Metadata DDL + Seed Prompt rev2

4 min read Revision 1
gpt-reviewdot-119p1metadataddlseedrev3-required

GPT Review — 18b-P1 Metadata DDL + Seed Prompt rev2

Date: 2026-05-05 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed: knowledge/dev/laws/dieu44-trien-khai/prompts/18b-p1-dot119-metadata-ddl-and-seed-prompt.md rev2

Verdict

Direction PASS, but rev3 patch required before dispatch.

The hybrid approach is correct:

  • DOT-063 creates fields through Directus REST.
  • Exact seed metadata follows P0 mapping.
  • Raw PG DDL narrowly adds default / NOT NULL / CHECK constraints after seed.

Opus correctly fixed two important issues:

  1. workflows belongs only in A2 with process_code, not A1 with code.
  2. DOT-063 creates nullable/no-default fields, so catch-all NULL → unclassified before NOT NULL is required.

However, this is a mutation prompt. A few remaining details must be tightened before dispatch.

Required rev3 patches

B1 — Remove DOT-119 script backup from P1

P1 does not rewrite DOT-119. Copying /opt/incomex/dot/bin/dot-birth-trigger-setup in P1 is an unrelated filesystem mutation.

Move backup to P2. In P1, only capture script metadata/hash if desired, but do not copy/write files unrelated to P1.

B2 — Directus field verification must be a STOP condition

After DOT-063 live, prompt verifies information_schema.columns and directus_fields, but does not explicitly say what to do if directus_fields is missing.

Add:

  • If information_schema lacks any of the 3 fields → STOP/report.
  • If directus_fields lacks any of the 3 fields after DOT-063 → STOP/report; do not proceed to seed/constraints, because DOT-063 failed its key purpose.

B3 — Seed transaction must not COMMIT until exact distribution/count checks pass

Bước 4 currently shows BEGIN ... verify distribution ... COMMIT, but does not explicitly require holding COMMIT until the agent confirms expected counts.

Add:

  • After each UPDATE, capture affected row count.
  • Before COMMIT, verify exact expected distribution:
    • column = 25
    • synthetic_id = 1
    • legacy_id_single_colon = 3
    • subordinate = 1
    • disabled = 63
    • unclassified = 73
    • total = 166
    • both NULL checks = 0
  • If mismatch → ROLLBACK + STOP/report.

B4 — PG enforcement transaction must verify before COMMIT

Same issue in Bước 5. Add:

  • Run constraint/column-state verification before COMMIT.
  • If constraints not present or NOT NULL/default not correct → ROLLBACK + STOP/report.

B5 — DOT-063 spec file write path should be treated as controlled artifact

Writing /opt/incomex/dot/specs/collection_registry_birth_identity_fields.json is a filesystem write. It is acceptable, but prompt should specify:

  • exact file path;
  • create parent dir if absent only with mkdir -p /opt/incomex/dot/specs;
  • include file md5 in report;
  • do not overwrite a different existing spec silently: if file exists, print it and STOP unless content matches exactly.

B6 — Baseline mismatch must upload partial report

Bước 1 says mismatch → STOP, upload partial report. Good. Extend this rule to every STOP in P1.

Add general rule:

Any STOP condition must upload a partial P1 report with all outputs collected so far.

B7 — Use exact binary path or verify PATH

Prompt calls dot-schema-apply. Add one preflight line:

command -v dot-schema-apply || ls -la /opt/incomex/dot/bin/dot-schema-apply

Then use the resolved path consistently.

B8 — Do not call this “DDL” only

Since P1 does DOT-063 field creation + PG enforcement, label it clearly as:

  • field creation via Directus REST
  • metadata seed
  • PG enforcement constraints

This avoids future agents thinking DOT-063 alone provides PG constraints.

Directive to Opus/Ocus

Patch P1 prompt to rev3 with B1–B8. Do not dispatch yet.

After rev3, GPT/User can approve dispatch if no new blocker appears.

Hard boundaries remain:

  • no DOT-119 execution;
  • no script rewrite;
  • no function edit;
  • no IU trigger;
  • no IU rows;
  • no Pack 2B.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-18b-p1-metadata-ddl-seed-prompt-rev2-2026-05-05.md