KB-4662

GPT Final Approval — 23-P3D4C1U Prompt rev4

6 min read Revision 1
gpt-reviewfinal-approvalp3d4c1urev4universal-eventimplementationapproved-for-dispatch

GPT Final Approval — 23-P3D4C1U Prompt rev4

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 rev4

Verdict

APPROVED FOR DISPATCH.

P3D4C1U rev4 is now dispatch-safe for PG production implementation within its stated scope.

This approval is limited to the implementation described in the prompt: universal event core + system_issues PoC. It does not approve Directus mutation, Nuxt code, Hermes, Codex, IU runtime changes, or the old IU-specific P3D4C1.

Accepted rev4 fixes

  • Column naming contract is locked:
    • event_outbox.event_subject_table, event_outbox.event_subject_ref;
    • event_pending.entity_table, event_pending.entity_ref;
    • event_read.event_id -> event_outbox.id.
  • Worker mapping is explicit:
    • pending.entity_table -> outbox.event_subject_table;
    • pending.entity_ref -> outbox.event_subject_ref.
  • Cleanup SQL uses correct columns per table:
    • pending cleanup by event_pending.entity_ref;
    • outbox cleanup by event_outbox.event_subject_ref;
    • read cleanup via event_id from matching outbox rows.
  • Next pack label is corrected to:
    • P3D4C2U_DIRECTUS_DOT_READONLY_EXPOSURE_PROMPT_REVIEW.
  • Verification fields include column-mapping checks.

Previously accepted production-safety fixes retained

  • Registry enforcement B: BEFORE INSERT trigger validates both event type and stream.
  • red_zone_violation is seeded inactive and producer is deferred.
  • fn_event_mark_read exists and handles implicit_self -> explicit_read.
  • event_read.read_status_source is constrained to explicit_read|implicit_self.
  • pg_cron scheduling uses safe $do$ / $cmd$ quoting.
  • pg_cron preflight is ordered safely.
  • SECURITY DEFINER functions use pinned pg_catalog, public search path.
  • Test data is tagged and cleanup is FK-aware.
  • NULL correlation_id emits piece-level events and never suppresses.
  • Reports are required even on FAIL/BLOCKED.
  • IU runtime remains protected.

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 universal event core + system_issues PoC in PG production.

Execute exactly within the prompt boundaries:
1. Run preflight.
2. STOP and upload report if any mandatory preflight fails.
3. Install/verify pg_cron only as specified.
4. Create the six universal core tables idempotently.
5. Seed event_type_registry, event_subscription, and event.* dot_config keys.
6. Create registry enforcement trigger.
7. Create system_issues capture trigger with actual-column inventory.
8. Create universal worker and cron schedule idempotently.
9. Create access functions including fn_event_mark_read.
10. Run deterministic tagged tests T1-T12.
11. Verify IU runtime snapshot unchanged.
12. Verify rollback plan; do not execute destructive rollback on success.
13. 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 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 rev4, including at least:

phase_status=PASS|FAIL|BLOCKED
preflight_system_issues=PASS|FAIL
system_issues_actor_column=<actual>
preflight_dot_config=PASS|FAIL
preflight_pg_cron=AVAILABLE|NOT_AVAILABLE
preflight_pg_cron_installed=INSTALLED|NOT_INSTALLED|ALREADY
preflight_iu_snapshot=<event_count>/<read_count>
preflight_no_existing_universal=PASS|ALREADY_PRESENT
ddl_tables_created=6/6
event_outbox_pk=id
event_outbox_subject_columns=event_subject_table+event_subject_ref
event_pending_entity_columns=entity_table+entity_ref
worker_column_mapping=entity→event_subject
event_read_fk=event_outbox(id)
event_read_status_check=explicit_read|implicit_self
registry_trigger_created=PASS|FAIL
registry_validates_stream=true
seed_types_active=3/3
seed_types_inactive=1/1
capture_hot_path=O(1)
red_zone_capture=DEFERRED_SEPARATE_MECHANISM
worker_exception_safe=true
worker_null_correlation_handling=PIECE_LEVEL
fn_event_mark_read_created=PASS|FAIL
fn_event_mark_read_handles_implicit=true
test_T1_through_T12=PASS|FAIL
test_cleanup_uses_correct_columns=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.

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