GPT Review — P3D Pack1 Phase4 DRAFT v3 Still Not Approved
GPT Review — P3D Pack 1 Phase 4 Implementation DRAFT v3 Still Not Approved
Date: 2026-05-11 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed:
knowledge/dev/laws/dieu44-trien-khai/prompts/p3d-pack1-phase4-governance-vocab-species-prep-implementation-prompt-DRAFT.mdrevision 3knowledge/dev/laws/dieu44-trien-khai/reports/p3d-pack1-phase4-implementation-draft-v3-patch-report.md
Verdict
DRAFT v3 is NOT approved for dispatch.
It improved over v2, but it still violates the principle:
If not certainly right, it is wrong.
The remaining issues are not cosmetic. They can cause production mistakes or reintroduce hidden hardcode.
Good improvements in v3
created_atwas removed from the assumed INSERT example.law_unitis correctly labelled as Pack 1 EVOLVE contract-required, not TAC-discovered.- Run marker concept was added.
- Vocab delta is computed from live data.
- Rollback intent is closer to exact-row rollback.
Blocking issues that remain
1. Species mapping still hardcodes target table names through an IN-list
v3 says it derives target collections, but the derivation query still contains:
relname IN ('information_unit','unit_version')
This is better than literal INSERT rows, but still not registry-driven enough for a prep prompt intended to eliminate hardcode. For this phase, target native IU collections must come from an explicit migration target contract or registry query, not from a literal pg_class filter disguised as discovery.
2. Composition still contains a hardcoded value
v3 contains:
CASE WHEN tc.birth_code_strategy = 'subordinate' THEN tc.birth_code_strategy ELSE ls.composition_level END
The literal 'subordinate' is a hardcoded semantic value. It also mixes birth-code strategy with composition level, which is not proven equivalent.
3. Species resolution is too fuzzy
Using:
species_name ILIKE '%law%' OR species_code ILIKE '%law%'
can match unintended species. Under the current philosophy, fuzzy matching may be used for discovery/reporting, but not for seed execution. Seed execution requires a contract-defined selector or a unique registry mapping rule reviewed by GPT/User.
4. psql variable :'run_marker' is not actually set
The shell sets RUN_MARKER, but the prompt does not pass it as a psql variable with -v run_marker=... or \set run_marker. The SQL examples using :'run_marker' may fail.
5. Temp-table rollback after COMMIT is fragile
Rollback section relies on _inserted_vocab_keys and _inserted_species temp tables after COMMIT. That is only available in the same session and only if the agent keeps the same connection. A production prompt should not depend on temp tables after commit for rollback. Either rollback must happen inside the same transaction before commit, or inserted rows must be marked with a persistent run marker and exact deterministic keys.
6. INSERT conflict behavior is not resolved
v3 introspects constraints but still does not define safe behavior if a key appears between delta computation and INSERT, or if dot_config.key lacks a unique constraint. It also removed ON CONFLICT without replacing it with a deterministic STOP/lock strategy.
7. Species mapping is too risky for this prompt
Because species mapping schema/semantics are not proven, and composition policy is still uncertain, species mapping should not be included as executable in the same first seed prompt. It should be read-only candidate generation only, or a separate later prompt after policy review.
Decision
For DRAFT v4, split scope:
Executable candidate
Only vocab prep may be an executable candidate, and only if made schema-safe.
Deferred
Species mapping must be deferred to a separate design/prompt unless a fully registry-backed, non-fuzzy, non-hardcoded selector and composition policy is proven.
Document-only
Hash provenance JSONB contract remains document-only; no backfill.
Required DRAFT v4 direction
DRAFT v4 must:
- Be renamed/scoped to
vocab prep onlyunless species is explicitly read-only candidate generation. - Use no literal target collections for INSERT.
- Remove executable species INSERT entirely.
- Keep species as read-only candidate report only.
- Use an actual psql variable mechanism for
run_markerif used. - Use transaction-local exact rollback before commit, or deterministic key-based rollback with exact keys.
- Introspect and require a unique constraint on
dot_config.key; STOP otherwise. - Use
ON CONFLICT (key) DO NOTHINGonly if the unique index/constraint exists and the prompt has verified it. - Include a dry-run mode that reports would-insert rows before committing.
- Still prohibit migration, DDL, Directus, Qdrant, collection promotion, universal_edges, and birth-gate patching.
Hard philosophy to encode
Not hardcoded does not mean “wrapped in a temp table”.
Not hardcoded means the value is derived from a declared authoritative source at execution time, and the prompt states why that source is authoritative.
Status
phase4_draft_v3=REJECTED_FOR_DISPATCH
reason=hidden_hardcode_and_execution_safety_gaps
species_mapping_executable=DEFERRED
vocab_prep_candidate=ALLOWED_FOR_DRAFT_V4_ONLY
migration_allowed=false
seed_allowed=false_until_DRAFT_v4_GPT_REVIEW
next_action=OPUS_PATCH_DRAFT_V4_VOCAB_ONLY_SPECIES_READONLY_CANDIDATE