KB-20A3

GPT Review — 23-P3D2 Notification Triggers Prompt rev6

5 min read Revision 1
gpt-reviewpack-23p3d2notificationtriggersrev7-required

GPT Review — 23-P3D2 Notification Triggers Prompt rev6

Date: 2026-05-08
Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI
Reviewed: knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3d2-notification-triggers-prompt.md rev6

Verdict

Do not dispatch yet. Rev7 required.

Rev6 fixed the self-contained prompt problem: full Variant A/B SQL is now inline and executable from one document. However, there is one runtime blocker in the test flow: the comment notification test calls fn_iu_comment before any open draft exists for the test IU. P3C1 behavior for fn_iu_comment is to return no_open_draft and not insert a comment when there is no open draft. Therefore T5 will likely fail before it can test the comment trigger.

Accepted rev6 fixes

  • Full Variant A and Variant B SQL are inline. The prompt is now self-contained.
  • T15 accumulates security failure details instead of overwriting.
  • T14 checks fn_iu_notification_board is read-only.
  • Cleanup status variables are explicit: TEST_EVENT_CLEANUP, FAIL_CLEANUP.
  • Cleanup failure prevents notification_runtime=ACTIVE.
  • Read evidence is captured before cleanup.

Required rev7 fixes

P1 — BLOCKER: T5 comment test must run against an open draft

Current order:

  1. create new IU with fn_iu_save(TEST_ADDR, ...);
  2. run T5 comment via fn_iu_comment(TEST_ADDR, ...);
  3. later T7 creates draft.

But after step 1 there is no open draft. fn_iu_comment will likely return no_open_draft, so no unit_edit_comment row and no comment_added event.

Patch test order or T5 setup:

Recommended order:

  1. Birth/new IU test remains first.
  2. T7 draft event creates TEST_DRAFT_ID via: fn_iu_save(TEST_ADDR, ..., mode='draft').
  3. T5 comment event then calls fn_iu_comment with explicit draft context:
SELECT public.fn_iu_comment(
  TEST_ADDR,
  'agent:opus',
  'P3D2 comment',
  'general',
  'agent',
  jsonb_build_object('draft_id', TEST_DRAFT_ID)
);
  1. T8 applies TEST_DRAFT_ID.

This makes comment routing deterministic and aligns with P3C1 semantics.

If Opus does not want to renumber tests, keep test labels but move the draft setup before the comment call. The report can still list T5/T7; execution order matters more than numbering.

P2 — T5 should verify returned comment status

T5 should not only verify event count and ref existence. It should capture fn_iu_comment result and require:

  • status='comment_added';
  • comment_id if returned; if not returned, query latest comment id as fallback;
  • notification ref_id matches actual comment id.

If fn_iu_comment result is no_open_draft, T5 must fail cleanly and print the returned JSON.

P3 — T7/T5 dependency should be explicit in final report

Report:

test_draft_id=<...>
comment_context=draft_id
comment_route=fn_iu_comment_with_explicit_context

This is important because notification correctness depends on comment routing into an open draft.

P4 — Add final active object verification before PASS

Rev6 tests T1/T2 early, but before final PASS add exact active object check:

  • 4 functions exist:
    • fn_iu_notif_comment()
    • fn_iu_notif_draft()
    • fn_iu_notif_version()
    • fn_iu_notification_board(text,text,integer)
  • 3 triggers exist:
    • trg_aa_iu_notif_comment
    • trg_aa_iu_notif_draft
    • trg_aa_iu_notif_version

If expected active object count is not 7, set PHASE_STATUS=CRITICAL, not PASS.

P5 — Final report should include active object count

Add:

active_object_count=<0|7|...>
active_object_check=PASS|FAIL

Rev6 computes latest reader evidence in T16, but final report only has READ_EVIDENCE. Add a short final line:

latest_readers_gpt_verified=true|false

Directive to Opus

Patch P3D2 prompt to rev7 with P1–P6.

Path:

knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3d2-notification-triggers-prompt.md

Do not dispatch after patch. Return for GPT/User final review.

Hard boundaries remain

  • No dispatch.
  • No Pack 23 function changes.
  • No P3D1 table changes.
  • No gateway/birth trigger changes.
  • No vector mutation.
  • No LISTEN/NOTIFY.
  • No retention/archival.
  • No external queue.
  • No global read flag.
  • No Hermes production start.

Summary

Rev6 is self-contained and close. Rev7 must fix test ordering so comment notification is tested against an actual open draft, then add final active-object verification. After that, P3D2 should be ready for final approval.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-23-p3d2-notification-triggers-prompt-rev6-2026-05-08.md