GPT Review — 23-P3C1 rev6-restored and UX Notes rev2
GPT Review — 23-P3C1 rev6-restored and UX Notes rev2
Date: 2026-05-07
Reviewer: GPT-5.5 Thinking / Incomex Hội đồng AI
Reviewed:
knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3c1-iu-edit-draft-safe-functions-prompt.mdrev6-restoredknowledge/dev/laws/dieu44-trien-khai/design/23-p3c1-ux-state-foundation-notes.mdrev2
Verdict
Do not dispatch yet. Rev7 required.
Opus successfully restored the P3C1 execution prompt and correctly patched UX notes to the per-actor last-view watermark model. The UX design direction is accepted.
However, the restored prompt has a serious shell-test blocker: many [ ... ] comparisons omit spaces around =, which makes tests pass incorrectly.
UX notes verdict
Accepted.
The per-actor watermark model is the right PG-native direction:
- no global
last_viewed_at; - state is per
(draft_id, reviewer_ref); - unread = comments newer than that actor’s watermark;
- latest 3–5 viewers are derived by
ORDER BY last_viewed_at DESC LIMIT 5; - actor card/GUC hook is deferred but recorded;
- no read/unread hacks in comment body or JSONB hot path.
This satisfies the User’s operational concerns: GPT, Opus, Gemini, etc. each keep their own viewed state and do not overwrite each other.
Prompt restore verdict
The full structure is restored:
- pre-read companion UX notes;
- preflight;
- four safe function bodies;
- T1–T21 tests;
- cleanup/report;
- hard boundaries.
But rev6-restored is not executable-safe yet due to shell assertion syntax.
Required rev7 fixes
P1 — BLOCKER: fix all shell [ "$X"="Y" ] comparisons
Rev6-restored contains many checks like:
[ "$T1"="no_change" ]
[ "$T2"="plan_ok" ]
[ "$T5_S"="draft_created" ]
[ "$SD"="t" ]
In POSIX shell, [ "$T1"="no_change" ] is a single non-empty argument, so it evaluates true regardless of the value. This causes false PASS.
Patch all such tests to include spaces around =:
[ "$T1" = "no_change" ]
[ "$T2" = "plan_ok" ]
[ "$T5_S" = "draft_created" ]
[ "$SD" = "t" ]
Also patch numeric/count comparisons:
[ "$DRAFT_NOW" = "$((DRAFT_BEFORE+2))" ]
[ "$DROP_FAIL" = "0" ]
Search and fix every pattern matching:
"="$"="[ "$VAR"="..." ][ "$(...)"="..." ]
P2 — Add a shell safety self-check
Add early in setup:
if [ "x"="y" ]; then
echo "BUG: shell test operator spacing check failed";
exit 2;
fi
But note this exact expression is intentionally bad and will return true in many shells. Better self-check:
if [ "x" = "y" ]; then
echo "BUG: shell equality broken";
exit 2;
fi
And add a comment:
# All test comparisons MUST use spaces around '=': [ "$A" = "$B" ]
Do not include the intentionally bad expression as executable code unless used only as a comment, because it would always fail the script.
P3 — Make T19 grantee privilege query quote role safely
Current:
SELECT has_function_privilege('$R','public.$SIG','EXECUTE');
If role contains special characters, this can break. Use psql variables:
CAN=$("${PSQL_NOSTOP[@]}" -v role="$R" -v sig="public.$SIG" -t -A -c \
"SELECT has_function_privilege(:'role', :'sig', 'EXECUTE');" 2>/dev/null)
P4 — T20 should avoid raw address interpolation
T20 still contains:
SELECT (fn_iu_comment('$TEST_ADDR_A','x','x'))->>'guidance'
Patch to use -v addr_a, -v addr_b and :'addr_a', :'addr_b'.
P5 — Add report line for UX notes version read
In final report, include:
ux_notes_read=23-p3c1-ux-state-foundation-notes.md rev2
ux_state_hooks=timestamp,actor_card_guc_deferred,per_actor_watermark_deferred
This makes it explicit that the last-view model is captured but not implemented in P3C1.
Directive to Opus
Patch P3C1 prompt to rev7 with P1–P5.
Path:
knowledge/dev/laws/dieu44-trien-khai/prompts/23-p3c1-iu-edit-draft-safe-functions-prompt.md
Do not dispatch after patch. Return for GPT/User final review.
Hard boundaries
- No dispatch.
- No table DDL.
- No schema changes.
- No trigger changes.
- No gateway changes.
- No IU/UV writes.
- No vector mutation.
- No cleanup.
- No Pack 2C.
Summary
The UX-state design is now correct: per-actor last-view watermark, not global. The execution prompt is restored, but the shell test comparison bug is a real blocker because it can make failures look like PASS. Rev7 should fix comparison syntax, tighten remaining quoting, and record the UX notes hook in the report.