GPT Review — 18b-P2 DOT-119 Script Rewrite Prompt rev3
GPT Review — 18b-P2 DOT-119 Script Rewrite Prompt rev3
Date: 2026-05-05 Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI Reviewed:
knowledge/dev/laws/dieu44-trien-khai/design/dot119-v2-script-content.shrev2 / Rev 3 contentknowledge/dev/laws/dieu44-trien-khai/prompts/18b-p2-dot119-script-rewrite-prompt.mdrev4 / Rev 3 content
Verdict
Rev3 fixes the hardcoded function-hash blocker, but is not approved for dispatch. Rev4 required.
Good fixes:
KNOWN_V2_FN_HASHremoved.- Synthetic strategy now uses capability check instead of fixed implementation hash.
- Function hash remains audit/no-clobber evidence only.
- Smoke test includes no-hardcode-hash check.
However, rev3 introduced/left several execution risks.
Required rev4 patches
B1 — Prompt must be self-contained
The rev3 prompt says:
“Xem rev 2 prompt cho full SQL”
This is not acceptable for a runtime mutation prompt. Claude Code should not have to mentally merge rev2 + rev3. Rev4 must include the full P2 prompt: all preflight SQL, sample-selection SQL, install commands, smoke commands, report requirements, and hard boundaries.
B2 — Remove placeholder grep in smoke test #13
Rev3 still has:
grep -cF '...' "$DOT119"
This is a placeholder. Replace with exact no-clobber check, for example:
grep -cF 'CREATE OR REPLACE FUNCTION fn_birth_registry_auto' "$DOT119"
Expected: 0.
B3 — Capability check should recognize JSONB/id fallback patterns
Current script checks id reference with:
grep -qE '\.id\b|NEW\.id'
This may fail if the installed function reads id through JSONB, e.g.:
to_jsonb(NEW)->>'id'
Rev4 should accept common safe patterns:
NEW.id.idto_jsonb(NEW)->>'id'to_jsonb(NEW) ->> 'id'
The goal is capability detection, not formatting brittleness.
B4 — Add explicit function existence check for helper function
For legacy_id_single_colon, script should verify fn_birth_registry_auto_id exists before building trigger SQL.
Example:
SELECT to_regprocedure('fn_birth_registry_auto_id()') IS NOT NULL;
If absent, exit 11 or 13 with clear message.
B5 — Make psql error handling strict
run_pg should use -v ON_ERROR_STOP=1 so SQL errors do not get swallowed in unexpected ways:
docker exec -i "$PG_CONTAINER" psql -v ON_ERROR_STOP=1 -U "$PG_USER" -d "$PG_DB" -t -A -q "$@"
B6 — Add temp-file integrity check
Prompt should require:
- md5 of KB script source if available;
- md5 of temp file after writing;
- md5 of installed file after
mv; - all included in report.
If KB md5 is not preknown, report temp/installed md5 at minimum.
B7 — Clarify --help behavior
Current script exits 1 for explicit --help. This is acceptable if documented, but better to make:
- no args → exit 1;
--help→ exit 0.
Not mandatory, but if unchanged, prompt smoke test should state explicit --help exit 1 is intended.
B8 — Partial report on any STOP
Rev3 says report, but mutation prompts should repeat:
Any STOP before or after install must upload partial report with all outputs collected so far.
Hardcode assessment
Rev3 removes the hardcoded hash. Good.
But rev3 prompt still contains a placeholder ('...') and a non-self-contained reference to rev2. Those are operational hardcoding/ambiguity risks. Rev4 must be fully explicit.
Directive to Opus/Ocus
Patch both files:
knowledge/dev/laws/dieu44-trien-khai/design/dot119-v2-script-content.shknowledge/dev/laws/dieu44-trien-khai/prompts/18b-p2-dot119-script-rewrite-prompt.md
Rev4 requirements:
- Make prompt self-contained; do not say “see rev2 prompt”.
- Replace smoke test placeholder grep with exact grep command.
- Expand synthetic fallback capability check to accept JSONB id extraction patterns.
- Verify
fn_birth_registry_auto_id()exists before usinglegacy_id_single_colon. - Add
-v ON_ERROR_STOP=1torun_pg. - Add temp/installed script md5 integrity reporting.
- Clarify/help behavior or adjust explicit
--helpto exit 0. - Restate partial-report-on-any-STOP.
Do not dispatch yet.
Hard boundaries remain:
- no
fn_birth_registry_autoedit; - no IU trigger install;
- no IU rows;
- no Pack 2B;
- no seed/DDL changes.