GPT Review — 23-P3D2 Notification Triggers Prompt rev5
GPT Review — 23-P3D2 Notification Triggers Prompt rev5
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.mdrev5
Verdict
Do not dispatch. Rev6 required.
Rev5 applied the intended edge-case fixes, but introduced a critical prompt-integrity regression: the executable CREATE section no longer contains the full Variant A/B SQL bodies and instead tells Agent to fetch/copy from rev4. This violates the established execution-prompt rule: the dispatched prompt must be self-contained and runnable without revision-history reconstruction.
Accepted rev5 fixes
- Preflight now checks
idcolumns forunit_edit_comment,unit_edit_draft, andunit_version. - T5/T13 now guard empty refs before UUID comparison queries.
- T11 now checks unread count before calling
fn_iu_mark_read. - T12 now tests implicit self-read through
fn_iu_notification_boardrather than ambiguous count comparison. - T16 verifies
latest_readerscontains GPT after mark-read. - Final report includes
board_scope=actionable_current_events. - T13 idempotency check is scoped to
(event_type, ref_id). - Event evidence is captured before cleanup.
- P3D3 context documentation requirements are reported.
Blocking issue
P1 — BLOCKER: Rev5 is not self-contained
Rev5 says:
Identical to rev4 §2 and §2B. Function bodies unchanged. Agent selects variant based on VERSION_HAS_ACTOR.
Agent: use the exact Variant A or Variant B SQL blocks from rev4...
This is not acceptable for dispatch. Claude/Agent sessions are short-context, and the prompt must not depend on KB revision history or manual copy/paste from an older revision.
Patch rev6:
- Restore full Variant A SQL block from rev4 into rev6.
- Restore full Variant B SQL block from rev4 into rev6.
- Keep all rev5 fixes in preflight/tests/cleanup/final.
- Remove all text that says “use rev4”, “copy from rev4”, or “function bodies unchanged from rev4” from the executable instruction path.
- The resulting prompt must be executable from one KB document alone.
Additional rev6 hardening fixes
P2 — T15 must increment TEST_FAIL on metadata mismatch immediately
Rev5 sets T15="FAIL_..." inside the loop but increments TEST_FAIL only at the end. This is acceptable if T15 remains non-PASS, but multiple mismatches may overwrite the failure reason. Patch to preserve details:
T15_DETAILS=""
...
[ "$SD" = "t" ] || T15_DETAILS="$T15_DETAILS SD_$SIG"
...
if [ -n "$T15_DETAILS" ] || [ "$PUB" != "0" ]; then T15="FAIL$T15_DETAILS PUB=$PUB"; TEST_FAIL=$((TEST_FAIL+1)); fi
P3 — T14 should explicitly check board function has no INSERT
Rev5 checks trigger functions insert into iu_notification_event. Add separate board safety:
fn_iu_notification_boardmust not containinsert into,update,delete, orcanonical_writer.
P4 — Report cleanup status explicitly
Rev5 prints cleanup=PASS during cleanup but final report does not include a stable field.
Add variables:
TEST_EVENT_CLEANUP=NOT_RUN|PASS|FAIL
FAIL_CLEANUP=NOT_RUN|CLEAN|CRITICAL
Final report should include both.
P5 — If cleanup fails after tests pass, final should not report notification_runtime=ACTIVE
Rev5 sets NOTIF_RUNTIME=ACTIVE whenever PHASE_STATUS=PASS. That is fine. But if test cleanup fails and triggers/functions are dropped by fail cleanup, PHASE_STATUS should not end as PASS. Ensure:
- cleanup failure sets
PHASE_STATUS=FAILbefore fail cleanup; - after fail cleanup, final remains FAIL or CRITICAL;
notification_runtime=ACTIVEonly if triggers/functions still exist and tests+cleanup passed.
Recommended final check on PASS:
ACTIVE_OBJS=$(... exact 4 funcs + 3 triggers count ...)
[ "$ACTIVE_OBJS" = "7" ] || PHASE_STATUS="CRITICAL"
P6 — Event evidence should include read evidence after mark_read before cleanup
Rev5 captures event counts but not read-state counts. Add:
- test_read_count_before_cleanup;
- board sample or count showing explicit_read for GPT;
- optional latest_readers sample.
This supports User’s “who has read” requirement in the report.
Directive to Opus
Patch P3D2 prompt to rev6 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
Rev5’s logic fixes are good, but the prompt is not dispatchable because it is no longer self-contained. Rev6 must inline the full Variant A/B CREATE SQL and preserve all rev5 test/cleanup improvements. After that, P3D2 may be ready for final approval.