KB-1263

Opus Review — 23-P2 Inspection Results + Decisions

4 min read Revision 1
pack-23p2reviewopusinspectiondecisionsproposal-model

Opus Review — 23-P2 Inspection Results + Decision Recommendations

Date: 2026-05-06 Reviewer: Opus Subject: 23-P2 COMPLETE — evidence đủ để chọn proposal model + gateway strategy Request: GPT/User quyết 4 điểm then chốt


1. Inspection PASS — Agent đúng

33/33 queries, 0 failures. Evidence đủ cho mọi câu hỏi design. Minor: edge type filter lowercase/UPPERCASE mismatch — cosmetic, không ảnh hưởng kết luận.

2. Opus Assessment on 4 Decisions

Decision 1: Proposal Model

Agent recommend C (separate table) hoặc D (hybrid). Tôi có ý kiến khác:

Opus recommend Model B (UV stores proposals, version_seq on merge only). Lý do:

  1. 1 ALTER duy nhất: ALTER TABLE unit_version ALTER version_seq DROP NOT NULL + partial unique: CREATE UNIQUE INDEX ON unit_version(unit_id, version_seq) WHERE version_seq IS NOT NULL (replace current constraint)
  2. Single audit trail: mọi proposals + merged versions cùng 1 bảng → query history đơn giản
  3. Greenfield: 5 UVs, all seq=1 → ALTER không risk
  4. Phase 1 đơn giản: fn_iu_propose_edit INSERT UV (seq=NULL, lifecycle='proposed') + fn_iu_merge_edit UPDATE UV (assign seq, lifecycle='merged')
  5. Model C thêm complexity: new table + merge copy logic + double audit trail

Nhưng nếu GPT/User prefer C cho separation rõ ràng → cũng OK, tôi không block.

Decision 2: Gateway Allow-list

Đồng ý Agent + GPT: allow-list trước edit/merge.

Approach: thêm dot_config key iu_create.gateway.allowed_marker_values = fn_iu_create,fn_iu_propose_edit,fn_iu_merge_edit,fn_iu_edit. Patch guard function sang ANY(string_to_array(...)) check. 1 prompt, gọn.

Decision 3: Ordering Primitive

3 options:

Option Pro Con Opus preference
IU core column sort_order INT Query sạch, index native ALTER TABLE ★ Long-term best
identity_profile JSONB sort_order Không DDL JSONB cast + expression index OK Phase 1
Edge metadata trên CONTAINS Normalize Query phức tạp Defer

Opus recommend: Core column sort_order INT (ALTER TABLE ADD COLUMN). Greenfield = miễn phí. Tránh JSONB workaround rồi migrate sau.

Decision 4: Edge Type Naming Convention

Data uses UPPERCASE (USES, BELONGS_TO, CONTAINS). Design docs + IU gateway reference lowercase. Cần chốt convention:

  • Uppercase cho consistency với existing 2199 edges?
  • Lowercase cho readability?

Opus recommend: Follow existing = UPPERCASE. Không đổi 2199 rows.

3. Đề xuất Pack 23-P3 Scope

Nếu GPT/User chốt 4 decisions:

23-P3: Gateway Allow-list + Schema Prep

  • Patch guard function → allow-list
  • ALTER unit_version: add base_version_ref, make version_seq nullable (if Model B) OR create unit_proposal table (if Model C)
  • ALTER information_unit: add sort_order INT (if chosen)
  • Seed gateway allowed_marker_values
  • Smoke test: fn_iu_create vẫn work qua new guard

23-P4: fn_iu_propose_edit + fn_iu_merge_edit + fn_iu_edit

  • Core edit functions
  • Pilot: edit 1 existing IU, create new version
  • Verify invariants still hold

23-P5: First Real IU Data

  • Convert 2 pilot docs → parent + children IUs
  • Render test: assemble children → document

Opus review | 2026-05-06 | 23-P2 COMPLETE | 4 decisions needed from GPT/User

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/opus-review-23-p2-inspection-results-and-decisions-2026-05-06.md