KB-5F6A

IU-0 Pack 1 CP1 Preflight Report

4 min read Revision 1
iu0pack1checkpointpreflightdieu44

CP1 — Preflight Report

  • 0a SSH: PASS

  • 0b PG version: PostgreSQL 16.13 (Debian 16.13-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit

  • 0c gen_random_uuid(): PASS — built-in (PG13+, no extension required); returned 28459c04-9893-4751-998b-a16d1a7d9616

  • 0d dot_config schema: MISMATCH vs prompt assumption — HB-8 TRIGGERED

    Output \d dot_config (NGUYÊN VĂN):

                            Table "public.dot_config"
       Column    |           Type           | Collation | Nullable | Default
    -------------+--------------------------+-----------+----------+---------
     key         | text                     |           | not null |
     value       | text                     |           | not null |
     description | text                     |           |          |
     updated_at  | timestamp with time zone |           | not null | now()
    Indexes:
        "dot_config_pkey" PRIMARY KEY, btree (key)
    Triggers:
        trg_dot_config_touch BEFORE UPDATE ON dot_config FOR EACH ROW EXECUTE FUNCTION fn_dot_config_touch()
        trg_sync_cp_patterns AFTER INSERT OR UPDATE OF value ON dot_config FOR EACH ROW EXECUTE FUNCTION fn_sync_cp_patterns_to_meta()
    
    • config_key exists: N — actual column name is key
    • config_value exists: N — actual column name is value
    • description exists: Y
    • created_at exists: N — actual column is updated_at (NOT NULL DEFAULT now())
    • UNIQUE constraint on config_key: N/A — instead, key is PRIMARY KEY (implicitly UNIQUE NOT NULL)
    • Extra: two existing triggers (trg_dot_config_touch, trg_sync_cp_patterns) — INSERT into dot_config will fire trg_sync_cp_patterns AFTER INSERT on value column
  • 0e Conflict vocab keys: none (0 rows for vocab.unit_kind.*, vocab.section_type.*, vocab.publication_type.*)

  • 0f information_unit exists: N

  • 0f unit_version exists: N

  • 0g Backup files:

    • /opt/incomex/backups/pre-pack1-schema-20260504-113258.sql (837272 bytes)
    • /opt/incomex/backups/pre-pack1-dot-config-20260504-113258.sql (6495 bytes)

Overall: FAIL — STOP per HB-8

Lý do

Schema thực tế của dot_config lệch với INSERT trong Step 1 và với các SELECT trong fn_iu_birth_gate_layer1. Cụ thể:

Prompt giả định Thực tế
config_key key
config_value value
created_at updated_at (auto via DEFAULT now())
UNIQUE on config_key PRIMARY KEY on key

Nếu chạy nguyên văn:

  • Step 1 INSERT sẽ fail: column "config_key" does not exist.
  • Step 4 trigger function dùng WHERE config_key = ... → sẽ fail tại runtime trên mọi INSERT vào information_unit.
  • ON CONFLICT (config_key) cũng fail.

Phụ chú: trigger phụ

trg_sync_cp_patterns fires AFTER INSERT OR UPDATE OF value — nếu Opus quyết định seed vocab vào dot_config, cần xác định trigger này có side-effects gì với key prefix vocab.* (có thể an toàn nếu nó chỉ filter theo cp.* patterns, nhưng cần verify trước).

Yêu cầu Opus quyết định trước CP2

  1. Có phải đổi tên cột trong INSERT (key, value, description) và bỏ created_at (dùng default updated_at)? → Nếu đồng ý, cập nhật prompt cho Step 1 và cho fn_iu_birth_gate_layer1 (dùng WHERE key = ...).
  2. Hoặc dùng table khác để lưu vocab (vd. tạo iu_vocab riêng) → tránh đụng dot_config + trigger phụ?
  3. Verify hành vi trg_sync_cp_patterns đối với keys prefix vocab.* trước khi seed.

Đang DỪNG. Chờ Opus phê duyệt cách xử lý mới được tiếp tục Giai đoạn 2.