GPT Review — 09a IU-0 Pack 1 DDL Design
GPT Review — 09a IU-0 Pack 1 DDL Design
Date: 2026-05-04 Method: GPT checked actual KB document
knowledge/dev/laws/dieu44-trien-khai/design/09a-iu0-pack1-vocab-schema-ddl-design.mdrev 1, plus related 09/pre-open context.
Verdict
PASS as planning direction, but NOT ready for execution prompt yet. Requires one revision pass before C8 can be considered closed and before User is asked for C10 execution approval.
Confirmed positives
- Document is clearly marked DDL DRAFT / not executed.
- Scope is limited to vocab + two tables + birth gate + rollback.
- Rollback section exists and mostly solves C8 at design level.
- No Qdrant/outbox/worker/legacy vector mutation.
- Tables align broadly with IU-0 minimal scope.
Required fixes before execution-readiness
P0-1 — Birth gate timing mismatch
Current trigger is BEFORE INSERT ON information_unit, so it cannot truly validate U5/U6 after unit_version is inserted and version_anchor_ref is updated. 09 rev7 requires gate after anchors are complete, before COMMIT. Add a deferred constraint trigger or equivalent deferred validation phase:
- lightweight BEFORE INSERT may check identity fields only;
- deferred AFTER INSERT/UPDATE constraint trigger should validate
version_anchor_ref IS NOT NULL,content_anchor_ref IS NOT NULL, referenced version exists, and version belongs to the same unit; - smoke tests must include this deferred gate behavior.
P0-2 — Vocab enforcement is only documentary
The DDL stores unit_kind as TEXT and inserts vocab keys into dot_config, but no DB-level validation links unit_kind to vocab. For Pack 1 pilot, either:
- add a local birth-gate validation against
dot_configkeys; or - explicitly state vocab enforcement is application-level in Pack 1 and DB FK/check is deferred.
Do not leave the DDL implying FK behavior that does not exist.
P0-3 — gen_random_uuid() precondition missing
DDL uses gen_random_uuid(); add pre-execute check for pgcrypto extension or existing function. Do not auto-create extension unless APR explicitly includes it. Add rollback/handling note.
P1-1 — Publication WARN is pilot-only
The trigger uses RAISE WARNING for publication fields. Keep for pilot, but add a clear switch condition for production BLOCK, or mark this as a temporary pilot-mode trigger variant.
P1-2 — Smoke tests need negative cases for deferred gate
Add tests for: unit with no version anchor at COMMIT fails; unit with version_anchor_ref pointing to another unit fails.
Direction to Opus
Prepare 09a rev2 in one pass. Do not execute. Do not dispatch Agent. Keep it concise.
Required output:
- Patch 09a to fix P0-1, P0-2, P0-3, P1-1, P1-2.
- Update C8 status only after rollback + deferred gate design are coherent.
- Produce a short review note summarizing what changed.
Do not ask User for C10 yet. After rev2 is clean, GPT/User can decide whether to open P44-6 execution.
Plain image: the blueprint is good, but the door lock is currently drawn on the wall before the door exists. Move the lock check to the moment the full door is assembled, then we can ask whether to build.