GPT Review — Pack 22 rev6 P0 Prompt Final Check
GPT Review — Pack 22 rev6 P0 Prompt Final Check
Date: 2026-05-06 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed:
knowledge/dev/laws/dieu44-trien-khai/design/22-dot-iu-create-wrapper-design.mdrev6knowledge/dev/laws/dieu44-trien-khai/prompts/22-p0-iu-native-create-contract-inspection-prompt.mdrev1
Verdict
Pack 22 rev6 direction PASS. P0 prompt needs a small rev2 patch before dispatch.
The scope is correct: read-only inspection only. No runtime mutation. It asks the right questions before building any PG function.
However, a few query/command details should be hardened so Agent does not fail or misreport.
Required prompt rev2 patches
P1 — Fix trigger timing/event bitmask query
Current query uses simplified bit masks that may misclassify trigger events. Use pg_get_triggerdef() as authoritative and keep bit fields as raw evidence.
Patch §2.4 query to include:
SELECT
t.tgname AS trigger_name,
p.proname AS function_name,
t.tgenabled,
t.tgisinternal,
t.tgconstraint != 0 AS is_constraint_trigger,
t.tgdeferrable,
t.tginitdeferred,
pg_get_triggerdef(t.oid) AS trigger_def
FROM pg_trigger t
JOIN pg_proc p ON p.oid = t.tgfoid
WHERE t.tgrelid = 'public.information_unit'::regclass
AND NOT t.tgisinternal
ORDER BY trigger_name;
Agent can infer BEFORE/AFTER and INSERT/UPDATE from trigger_def text.
P2 — Fix find ... -name precedence
Current bash:
find /opt/incomex/ -name '*.js' -o -name '*.ts' -o -name '*.py'
Without parentheses this can search incorrectly. Use:
find /opt/incomex/ -type f \( -name '*.js' -o -name '*.ts' -o -name '*.py' \) 2>/dev/null \
| xargs -r grep -lE 'information_unit.*create|iu_create|fn_iu' 2>/dev/null \
| head -20
Same for Directus search.
P3 — digest query should include argument signature
proname='digest' can be ambiguous. Use to_regprocedure where possible:
SELECT
to_regprocedure('digest(text,text)') IS NOT NULL AS digest_text_available,
to_regprocedure('gen_random_uuid()') IS NOT NULL AS uuid_available;
Then run test queries in separate block and record errors if any.
P4 — Contract column check should include updated_by for UV if design will write it
Prompt only checks unit_version.created_by; Pack 22 may also set updated_by depending on schema/profile. Since P2B-P1 likely used created_by and updated_by, include unit_version.updated_by as optional/verify:
- required if function will write it;
- otherwise report whether present.
Add a separate optional columns section:
SELECT table_name, column_name
FROM information_schema.columns
WHERE table_schema='public'
AND ((table_name='unit_version' AND column_name IN ('updated_by','date_created','date_updated'))
OR (table_name='information_unit' AND column_name IN ('date_created','date_updated')))
ORDER BY table_name, column_name;
P5 — Report must classify P0 blocker severity
Add report section:
## P1 readiness
- Blocking: [must fix before function design]
- Warnings: [can design around]
- TDs: [not blocking]
This avoids treating every finding as a blocker.
P6 — Add anti-hardcode self-check to report
Add:
## Anti-hardcode self-check
- Any exact runtime names proposed without catalog evidence? yes/no
- Any role grant target chosen without role inventory? yes/no
- Any count used as timeless truth? yes/no
- Any inaccessible path treated as absent? yes/no
Directive to Opus
Patch P0 prompt to rev2 with P1–P6. Pack 22 rev6 itself can remain as-is.
After prompt rev2, it is dispatchable.
Dispatch after patch
Đọc prompt từ KB rồi thực hiện:
knowledge/dev/laws/dieu44-trien-khai/prompts/22-p0-iu-native-create-contract-inspection-prompt.md
Mục tiêu: Kiểm kê runtime state cho IU creation contract. READ-ONLY, không tạo function, không DDL/DML. HARD STOP sau report.
Hard boundaries remain
- no CREATE FUNCTION;
- no DDL/DML;
- no DOT patch;
- no adapter implementation;
- no Pack 2C dispatch;
- no treating inaccessible paths as absent.