KB-DE5D

GPT Review — 23-P3C3 Natural Save Router Prompt rev1

8 min read Revision 1
gpt-reviewpack-23p3c3rev2-requiredfn_iu_savenatural-router

GPT Review — 23-P3C3 Natural Save Router Prompt rev1

Date: 2026-05-07
Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI
Reviewed: knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3c3-iu-natural-save-router-prompt.md rev1

Verdict

Direction accepted, but do not dispatch. Rev2 required.

Opus correctly captured the P3C3 goal: fn_iu_save becomes the natural AI-facing front door for content create/edit, while fn_iu_comment remains the free-flow comment front door.

Opus’s pushback removing mode='apply' is accepted. Reviewer apply should stay as the explicit fn_iu_apply_edit_draft(draft_id, actor) button. fn_iu_save is for creators/editors, not for bypassing review policy.

However, rev1 has one major blocker: the fn_iu_create call is speculative and likely wrong. A prompt cannot leave the Agent to “adapt function call” inside a CREATE FUNCTION body. P3C3 must use the known/runtime-verified exact signature.

Accepted design decisions

  • fn_iu_save has two modes only: auto, draft.
  • No mode='comment' in primary interface.
  • No mode='apply' in fn_iu_save.
  • Comment remains free-flow via fn_iu_comment.
  • fn_iu_save must not direct-write IU/UV and must not set app.canonical_writer.
  • fn_iu_save should be SECURITY DEFINER with pinned search_path and PUBLIC revoked.
  • P3C3 should not alter P3C1/P3C2 functions.

Required rev2 fixes

P1 — BLOCKER: replace speculative fn_iu_create call with exact verified call

Rev1 says Agent should discover/adapt the fn_iu_create signature, but the function body itself hardcodes a 6-argument call:

public.fn_iu_create(
  btrim(p_address),
  'content',
  'current',
  btrim(p_actor),
  v_profile,
  p_body
)

This is not acceptable. The Pack 22 report already shows the runtime function was callable as:

fn_iu_create(pilot_addr, 'X', 'X', 'a')

So P3C3 must preflight the exact runtime signature and then use that exact known call pattern.

Patch:

  1. Preflight require:
SELECT to_regprocedure('public.fn_iu_create(text,text,text,text)');
  1. If not found, STOP. Do not ask Agent to adapt dynamically.

  2. In fn_iu_save, new-address path should call:

RETURN public.fn_iu_create(
  btrim(p_address),
  COALESCE(NULLIF(btrim(p_title), ''), btrim(p_address)),
  p_body,
  btrim(p_actor)
);

If Opus believes the order is not address/title/body/actor, inspect source/report and hard-code the correct order in rev2. Do not leave it as an Agent decision at execution time.

P2 — T1 should verify official creation semantics, not only row counts

T1 currently accepts any status and only checks one IU + one UV. Add:

  • version_seq = 1;
  • fn_iu_verify_invariants(TEST_NEW_ADDR)->>'all_pass' = true;
  • report created status JSON.

P3 — Use the newly created address as the deterministic existing-address test target

Rev1 selects TEST_EXIST_ADDR from the oldest existing IU. That may carry historical drafts/comments and make tests less deterministic.

Patch flow:

  • T1 creates TEST_NEW_ADDR official.
  • T2/T3/T4 should use TEST_NEW_ADDR as the existing-address target.

This keeps P3C3 tests isolated to the new pilot IU created by P3C3.

P4 — T4 no_change must branch on policy outcome

If current policy is auto_apply, T3 applies the body and T4 should return no_change.

If current policy is require_review, T3 creates a draft only; official body is not changed, so T4 may create another draft or return an open-draft status depending on lower-layer behavior. Do not require no_change in that case.

Patch:

  • if T3 status = applied, then T4 must be no_change and no new UV;
  • if T3 status = draft_created_review_required, report T4 no-change path as SKIPPED_POLICY_REQUIRE_REVIEW or use mode='draft' no-change expectations based on draft behavior, but do not falsely fail.

P5 — T7 comment free-flow test must avoid multi-draft ambiguity

After T2/T3, the existing address may have multiple open/stale/applied drafts. A natural fn_iu_comment(address, actor, body) call can legitimately return multiple_open_drafts if more than one open draft exists.

To prove free-flow comment without ambiguity, use explicit context with a known draft id from T2:

fn_iu_comment(
  TEST_NEW_ADDR,
  'agent:p3c3',
  'P3C3 test comment',
  'note',
  NULL,
  jsonb_build_object('draft_id', T2_DID)
)

Expected: comment_added or the exact success status used by P3C1. Also verify comment count +1. Do not add approval.

P6 — T13 counts should check all expected deltas or branch by policy

Rev1 only checks IU +1. P3C3 should report and verify:

  • IU +1 from new creation;
  • UV + at least 1 from new creation, plus +1 if T3 auto-applies;
  • draft +1 from T2, plus +1 from T3 existing edit;
  • comment +1 from T7, plus system comments if auto-apply path creates them.

If exact counts are too dependent on policy, branch expectations by T3 status and report the deltas explicitly.

P7 — T12 hash boundary should include P3C2/P3B-FU functions but exclude fn_iu_save

Rev1 is fine in spirit. Ensure the before/after hash list does not include fn_iu_save because it is newly created. It currently excludes it; preserve this.

P8 — Report cleanup semantics clearly

If tests fail after T1/T2/T3, official/draft/comment pilot rows may remain even if fn_iu_save is dropped. Add final report fields:

cleanup_on_test_fail=drop_fn_iu_save_only
test_rows_retained_on_fail=true
test_rows_retained_on_pass=true

Do not attempt destructive cleanup.

P9 — Default policy note: do not switch policy inside P3C3

P3C3 prompt currently reports next step as SWITCH_DEFAULT_POLICY_TO_REQUIRE_REVIEW. Good. Add a clear hard boundary:

  • P3C3 does not change dot_config.iu_edit.policy.default_mode.
  • Policy switch is a separate reviewed step after P3C3 PASS.

P10 — Preflight should verify fn_iu_comment callable form used by T7

Because T7 will use the 6-argument form with context, preflight should verify:

to_regprocedure('public.fn_iu_comment(text,text,text,text,text,jsonb)')

If not found, STOP or adjust test with explicit reviewed signature.

Directive to Opus

Patch P3C3 prompt to rev2 with P1–P10.

Path:

knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3c3-iu-natural-save-router-prompt.md

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

Hard boundaries remain

  • No dispatch.
  • No table DDL.
  • No trigger/gateway changes.
  • No vector mutation.
  • No notification implementation.
  • No cleanup/pilot deletion.
  • Do not alter P3C1/P3C2 functions.
  • Do not implement P3D.
  • Do not add comment approval.
  • Do not switch broad-use policy in P3C3.

Summary

P3C3’s design is right. The prompt must stop treating fn_iu_create as an adaptable mystery call and instead use a known exact signature. Tests should become deterministic by using the newly created P3C3 IU as the existing-address target, branching correctly on policy, and using explicit comment context to avoid ambiguity.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/gpt-review-23-p3c3-natural-save-router-prompt-rev1-2026-05-07.md