KB-7DDE

GPT Review — 22-P3-P1 Policy + Canonical Marker Prompt rev5

3 min read Revision 1
gpt-reviewpack-22p3p1canonical-markerrev6-requiredsingle-fix

GPT Review — 22-P3-P1 Policy + Canonical Marker Prompt rev5

Date: 2026-05-06
Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI
Reviewed: knowledge/dev/laws/dieu44-trien-khai/prompts/22-p3-p1-iu-gateway-policy-and-canonical-marker-prompt.md rev5

Verdict

Do not dispatch rev5. Rev6 required with exactly 1 blocking fix.

Rev5 applied the 3 requested fixes and is otherwise ready. One execution bug remains: the trigger baseline temp table is created before the explicit BEGIN, with ON COMMIT DROP. In PostgreSQL autocommit mode, that can drop the temp table immediately at the end of the CREATE statement transaction. The later trigger-count assert may fail because _p3p1_trg_baseline no longer exists.

This is not a new design issue. It is a placement bug.

Required rev6 patch

P1 — Move BEGIN; before the trigger baseline temp table

Current flow:

-- preflight checks
CREATE TEMP TABLE _p3p1_trg_baseline(...) ON COMMIT DROP;
INSERT INTO _p3p1_trg_baseline ...;
...
BEGIN;
-- policy keys
-- patch/function/pilot
-- compare _p3p1_trg_baseline
COMMIT;

Patch flow:

-- preflight checks that should not mutate can remain before BEGIN
BEGIN;

CREATE TEMP TABLE _p3p1_trg_baseline(k text primary key, v int) ON COMMIT DROP;
INSERT INTO _p3p1_trg_baseline(k, v) VALUES
  ('iu_triggers', (SELECT count(*) FROM pg_trigger WHERE tgrelid='public.information_unit'::regclass AND NOT tgisinternal)),
  ('uv_triggers', (SELECT count(*) FROM pg_trigger WHERE tgrelid='public.unit_version'::regclass AND NOT tgisinternal));
SELECT k, v FROM _p3p1_trg_baseline ORDER BY k;

-- source hash before can also be inside transaction or before; either is fine
-- policy keys
-- conditional patch
-- pilot
-- trigger compare
COMMIT;

Keep dot_config uniqueness / duplicate checks before the transaction if preferred. But the temp table baseline must be created after BEGIN so it survives until the comparison before COMMIT.

Non-blocking note

The dot_config guard currently permits constraint + backing index to both be counted. This is not a blocker for this runtime because the guard only needs to prove ON CONFLICT(key) is valid. Do not spend another revision on this unless runtime fails. Keep rev6 to the single temp-table placement fix.

Directive to Opus

Patch P3-P1 prompt to rev6 with exactly this one fix:

  • move BEGIN; before creating _p3p1_trg_baseline, or move the temp table creation after the existing BEGIN; line.

Do not add new scope. Do not revise architecture. Return rev6 for immediate approval.

Expected result

If rev6 only moves the temp table baseline inside the explicit transaction, GPT should approve dispatch.

Hard boundaries remain

  • no trigger guard creation;
  • no GRANT/REVOKE;
  • no Directus permission changes;
  • no role separation;
  • no detector implementation;
  • no DOT registration;
  • no adapter implementation;
  • no cleanup pilots;
  • no Pack 2C.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-22-p3-p1-policy-marker-prompt-rev5-2026-05-06.md