GPT Review — P3D Pack1 Phase5C2B Design OK; Prompt DRAFT Not Approved
GPT Review — P3D Pack 1 Phase 5C2B Design OK; Prompt DRAFT Not Yet Approved
Date: 2026-05-12 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed:
knowledge/dev/laws/dieu44-trien-khai/design/p3d-pack1-phase5c2b-publication-authority-vocab-seed-design.mdknowledge/dev/laws/dieu44-trien-khai/prompts/p3d-pack1-phase5c2b-publication-authority-vocab-seed-prompt-DRAFT.mdknowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase5c2b-authority-vocab-seed-design-and-prompt-report.md
Verdict
Design note: accepted directionally.
Prompt DRAFT: not approved for Agent dispatch yet.
The scope is correct and minimal: seed exactly one dot_config vocab row for publication authority before Phase 5C2 migration. However, the write prompt needs a small rev2 safety patch before dispatch.
What is accepted
- Authority strategy Option C is correctly implemented in design:
dot_config.key = vocab.publication_authority.incomex_council
dot_config.value = incomex_council
publication_authority_ref_value = incomex_council
- Do not use
tac_publication.owner. - Do not patch
fn_iu_createbefore the pilot. - Keep Phase 5C2B separate from Phase 5C2 migration.
- Scope = one vocab seed row in
dot_configonly. - No TAC/IU migration in 5C2B.
- Exact-key rollback is the right rollback model.
Prompt blockers before dispatch
1. Existing row handling must distinguish OK vs conflict
Prompt says: if one or more rows exist, report ALREADY_EXISTS, skip INSERT, proceed to verify. That is correct only if the existing row exactly matches the locked values.
Required behavior:
if existing key exists and value/description policy matches → ALREADY_EXISTS_OK
if existing key exists but value differs → BLOCKED_EXISTING_CONFLICT
Do not overwrite existing row. Do not silently accept mismatched value.
2. Advisory lock should be transaction-scoped or paired with guaranteed unlock
Prompt uses session-level pg_try_advisory_lock, then releases in Phase 6. If the script aborts before Phase 6, lock may persist until the DB session ends.
Preferred patch:
BEGIN;
SELECT pg_try_advisory_xact_lock(hashtext('p3d_pack1_phase5c2b_publication_authority_vocab_seed')) AS lock_acquired;
-- recheck, insert, verify
COMMIT;
If pg_try_advisory_xact_lock is unavailable, keep session lock but require explicit failure-path unlock and report.
GPT preference: transaction-scoped lock.
3. Post-insert verify should run inside the transaction before COMMIT
Current prompt commits immediately after INSERT, then verifies in Phase 5. For a single-row seed, verification should happen before COMMIT so a mismatch can roll back cleanly.
Required transaction shape:
BEGIN
acquire transaction lock
recheck no conflict
insert row
verify row exactly inside transaction
COMMIT only if verify passes
Post-COMMIT read-only landscape can remain after commit.
4. Mandatory execution log is missing
Even a one-row production seed should have a VPS execution log, consistent with 5C1.
Add:
execution_log_path=/opt/incomex/logs/p3d-pack1-phase5c2b-<timestamp>.log
Log must capture:
- schema introspection;
- resolved columns;
- pre-existing row state;
- lock result;
- insert/verify outcome;
- committed/rolled back state;
- KB report upload status.
5. updated_at within last 60 seconds may be brittle
If execution/reporting is slow, a 60-second check could false-fail. Prefer verifying:
updated_at is non-null and >= transaction_start_time
or record v_run_started_at and compare to that.
6. Final response rollback command uses literal key
Final response template says:
rollback_command=DELETE FROM dot_config WHERE key = ...
Since the prompt resolves <config_key>, report should state:
rollback_key_column=<resolved config_key>
rollback_key_value=vocab.publication_authority.incomex_council
Raw SQL may be included as illustrative only after resolution.
Required next action
Open:
P3D_PACK1_PHASE5C2B_PROMPT_REV2_TRANSACTION_LOG_CONFLICT_PATCH
Patch prompt only. No Agent dispatch yet.
Status
phase5c2b_design=ACCEPTED_DIRECTIONALLY
phase5c2b_prompt_draft=NOT_APPROVED_FOR_DISPATCH
reason=existing_conflict_handling_transaction_lock_log
agent_dispatch_allowed=false
seed_allowed=false
migration_allowed=false
next_action=OPUS_PATCH_5C2B_PROMPT_REV2