KB-38CF

GPT Final Approval — 23-P3D4C1U Prompt rev7

6 min read Revision 1
gpt-reviewfinal-approvalp3d4c1urev7immediateminimal-pocapproved-for-dispatch

GPT Final Approval — 23-P3D4C1U Prompt rev7

Date: 2026-05-08
Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI
Reviewed: knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3d4c1u-universal-core-implementation-prompt.md rev7

Verdict

APPROVED FOR DISPATCH.

P3D4C1U rev7 is now dispatch-safe for the immediate-only universal event core PoC on system_issues.

This approval supersedes the earlier rev4 approval and incorporates the User/Opus correction: use the simplest sufficient model first. The PoC must not install/query/schedule pg_cron, must not create a worker function, and must not introduce idle polling.

Accepted final architecture

Lane A — IMMEDIATE, active in this PoC
system_issues trigger -> event_outbox -> event_read implicit_self
O(1), no worker, no cron, no polling

Lane B — DELAYED, seam only for future
pending/worker/debounce reserved for future batch/noise-prone domains
not activated in P3D4C1U

Accepted rev7 fixes

  • Idempotency key is deterministic and no longer includes occurred_at:
    • event_domain + event_type + event_subject_table + event_subject_ref.
  • Immediate capture trigger handles conflict safely:
    • insert event;
    • if conflict/no returned id, select existing event id by deterministic key;
    • insert implicit self-read with valid event id.
  • Test T6 explicitly verifies duplicate/retry idempotency and self-read fallback.
  • Rollback section is guarded per table and requires precondition checks before destructive steps.
  • Report fields include idempotency and guarded rollback evidence.

Accepted minimal PoC footprint

P3D4C1U implementation is limited to:

  • 5 tables:
    • event_type_registry;
    • event_outbox;
    • event_read;
    • event_subscription;
    • event_pending as empty delayed-lane seam.
  • 2 triggers:
    • registry validation trigger on event_outbox;
    • immediate capture trigger on system_issues.
  • 2 access functions:
    • fn_event_unread;
    • fn_event_mark_read.

Explicitly not included:

  • no pg_cron;
  • no worker function;
  • no event_worker_log;
  • no fn_event_board;
  • no Directus mutation;
  • no Nuxt code;
  • no IU runtime change.

Dispatch instruction to Opus/Agent

Đọc prompt từ KB rồi thực hiện:

knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3d4c1u-universal-core-implementation-prompt.md

Mục tiêu:
P3D4C1U implements the minimal immediate-only universal event core PoC for system_issues.

Execute exactly within prompt boundaries:
1. Run preflight.
2. STOP and upload report if any mandatory preflight fails.
3. Create 5 core tables idempotently.
4. Create event_type_registry seed rows: 3 active immediate + 1 inactive delayed.
5. Seed minimal event_subscription rows and event.* dot_config keys.
6. Create registry enforcement trigger validating type + stream + delivery_lane.
7. Create immediate system_issues capture trigger using actual inventory columns.
8. Create fn_event_unread and fn_event_mark_read only.
9. Do NOT create worker function.
10. Do NOT install/query/schedule pg_cron.
11. Do NOT create fn_event_board.
12. Run deterministic tagged tests T1-T11.
13. Verify no pending rows for immediate events.
14. Verify IU runtime snapshot unchanged.
15. Verify rollback plan; do not execute destructive rollback on success.
16. Upload report:
    knowledge/dev/laws/dieu44-trien-khai/reports/23-p3d4c1u-universal-core-implementation-report.md

Upload report even on PASS, FAIL, CRITICAL, or BLOCKED.

Hard boundaries for execution

  • No Directus mutation.
  • No Nuxt code.
  • No Hermes.
  • No Codex dispatch unless User explicitly orders it.
  • No external scheduler/tool/service.
  • No pg_cron install/query/schedule.
  • No worker function.
  • No fn_event_board.
  • No event_config table.
  • No changes to iu_notification_* tables/functions/triggers.
  • No old IU-specific P3D4C1 resume.
  • No body/raw payload/vector/secret/personal data exposure.
  • No activity-log creep.
  • No destructive rollback on success.
  • No deletion/update of non-test system_issues rows.

Expected final report fields

Report must include the verification block from rev7, especially:

phase_status=PASS|FAIL|BLOCKED
preflight_system_issues=PASS|FAIL
system_issues_actor_column=<actual>
system_issues_tag_field=<actual>
preflight_dot_config=PASS|FAIL
preflight_iu_snapshot=<event_count>/<read_count>
preflight_no_existing_universal=PASS|ALREADY_PRESENT
ddl_tables_created=5/5
idempotency_key=domain+type+subject_table+subject_ref (no occurred_at)
delivery_lane_in_registry=true
registry_trigger_validates_lane=true
seed_types_immediate=3/3
seed_types_delayed_inactive=1/1
capture_trigger_created=PASS|FAIL
capture_uses_actual_columns=true
capture_idempotent=true
capture_conflict_select_for_self_read=true
capture_implicit_self_read=true
capture_hot_path=O(1)
capture_no_pending=true
worker_created=NO_DEFERRED
idle_polling_avoided=true
fn_event_unread_created=PASS|FAIL
fn_event_mark_read_created=PASS|FAIL
fn_event_board_created=NO_DEFERRED
test_T1_through_T11=PASS|FAIL
test_T6_duplicate_idempotent=PASS|FAIL
test_data_tagged=true
test_tag_field_from_inventory=true
rollback_guarded_per_table=true
rollback_executed=NO_ON_SUCCESS
iu_post_snapshot_match=PASS|FAIL
no_directus_mutation=true
no_nuxt_code=true
no_iu_change=true
next_required_pack=P3D4C2U_DIRECTUS_DOT_READONLY_EXPOSURE_PROMPT_REVIEW

Next after Agent report

GPT/User review the P3D4C1U execution report.

Only if P3D4C1U PASS should the next prompt be drafted:

P3D4C2U_DIRECTUS_DOT_READONLY_EXPOSURE_PROMPT_REVIEW

No Directus/Nuxt exposure is approved yet.

Operating lesson recorded

This pack records a governance lesson: begin from the simplest mechanism that satisfies the requirement. For common single events, immediate durable insert is simpler and more reliable than worker/polling. Delayed workers are justified only for batch/debounce/noise control.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-final-approval-23-p3d4c1u-prompt-rev7-2026-05-08.md