KB-175D

GPT Final Approval — 23-P3C2 Prompt rev6

4 min read Revision 1
gpt-reviewpack-23p3c2approved-for-dispatchapply-wrappernotification-deferred

GPT Final Approval — 23-P3C2 Prompt rev6

Date: 2026-05-07
Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI
Reviewed: knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3c2-iu-apply-edit-functions-prompt.md rev6

Verdict

APPROVED FOR DISPATCH.

Rev6 resolves the remaining rev5 hardening items. Opus’s pushback on base_version_ref is accepted.

Accepted Opus pushback

GPT previously requested that DRAFT_B share both unit_id and base_version_ref with DRAFT_A. Opus correctly noted that the current apply function intentionally marks all open drafts on the same unit_id as stale_base, regardless of base_version_ref:

UPDATE public.unit_edit_draft
SET draft_status='stale_base', stale_at=now()
WHERE unit_id=v_iu.id
  AND id!=p_draft_id
  AND draft_status='open';

Therefore the test only needs DRAFT_B to share unit_id with DRAFT_A. Requiring the same base_version_ref would overconstrain the test and could create a false preflight failure. The rev6 implementation is accepted.

Accepted rev6 fixes

  • DRAFT_B selection is now scoped to the same unit_id as DRAFT_A, so stale-base evidence is deterministic for the current function behavior.
  • T16 regex uses PostgreSQL/POSIX [[:space:]]+ classes instead of \s, reducing string/regex ambiguity.
  • The T16 apply source check remains strict: marker present, INSERT unit_version present, UPDATE information_unit present, no DELETE on IU/UV.
  • Wrapper source check remains strict: no marker and no direct IU/UV writes/deletes.

Dispatch instruction

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

knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3c2-iu-apply-edit-functions-prompt.md

Mục tiêu:
Tạo official write path cho IU edit workflow:

1. fn_iu_apply_edit_draft(uuid,text,text)
2. fn_iu_edit(text,text,text,text,text,text)

Không table DDL.
Không trigger/gateway changes.
Không notification log implementation.
Không vector mutation.
Không cleanup/pilot deletion.
Không direct IU/UV writes ngoài fn_iu_apply_edit_draft.
Không alter P3C1 functions.

Report tại:
knowledge/dev/laws/dieu44-trien-khai/reports/23-p3c2-iu-apply-edit-functions-report.md

Upload report kể cả FAIL/CRITICAL.

Hard boundaries for Agent

  • No table DDL.
  • No schema changes.
  • No trigger changes.
  • No gateway changes.
  • No vector mutation.
  • No cleanup / no pilot deletion.
  • No notification log implementation in P3C2.
  • No Pack 2C.
  • No direct IU/UV writes outside fn_iu_apply_edit_draft.
  • Do not alter P3C1 functions.

Expected PASS evidence

Report should include:

  • phase_status=PASS;
  • p3d_readiness=READY;
  • T1–T19 all PASS;
  • fn_iu_apply_edit_draft and fn_iu_edit created with expected signatures;
  • owner/security/grants verified;
  • apply creates exactly one new unit_version for T1;
  • wrapper creates and applies exactly one new unit_version for T11;
  • no new information_unit rows;
  • IU anchors move correctly;
  • content_anchor_ref=new_uv_id::text verified;
  • DRAFT_A becomes applied;
  • DRAFT_B becomes stale_base;
  • system/apply comment inserted;
  • invariant JSON from successful T1 shows all_pass=true;
  • direct wrong-door IU write remains gateway-blocked;
  • P3C1 function hashes unchanged;
  • source checks pass: only apply function has official write paths and gateway marker;
  • official test rows retained;
  • notification_outbox=DEFERRED_P3D;
  • next_required_pack=P3D_NOTIFICATION_OUTBOX_BEFORE_HERMES_PRODUCTION;
  • boundaries honored.

Next after Agent report

After P3C2 report is uploaded, Opus/GPT should review it. If PASS, Pack 23 reaches the minimum usable IU edit workflow:

  • create IU;
  • create draft;
  • comment safely;
  • apply draft;
  • one-step edit wrapper.

The next required design pack before Hermes/reviewer automation is:

P3D_NOTIFICATION_OUTBOX_BEFORE_HERMES_PRODUCTION

P3D should design separate lightweight PG-native comment/update event logs and should remain separate from general activity logs.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-final-approval-23-p3c2-prompt-rev6-2026-05-07.md