KB-6643

dot-iu-cutter v0.2 Phase α DDL Authoring — GPT Review

4 min read Revision 1
dot-iu-cutterreviewv0.2phase-alphaddl-authoringrevision-required

dot-iu-cutter v0.2 — Phase α DDL Authoring GPT Review

Date: 2026-05-15
Reviewer: GPT
Files reviewed: Phase α DDL Authoring Report and DDL Draft
Scope: Review only. No DDL executed, no mutation, no migration.


1. Verdict

phase_alpha_ddl_authoring_status: REVISION_REQUIRED
agent_revision_needed: true
DDL_execution_allowed: false
dry_run_allowed: false
production_migration_allowed: false
reason: authority_DEFAULT_before_backfill_bug

The DDL package is well structured, but the authority-column DDL has a material semantic bug that must be fixed before dry-run.


2. Blocking Finding

The draft currently adds authority columns with DEFAULT 'draft' before the intended backfill:

ALTER TABLE public.tac_logical_unit
    ADD COLUMN IF NOT EXISTS authority text DEFAULT 'draft';

UPDATE public.tac_logical_unit
   SET authority = CASE lifecycle_status ... END
 WHERE authority IS NULL;

In PostgreSQL, adding a column with a non-null default makes existing rows read as that default. Therefore WHERE authority IS NULL may match zero rows. This breaks the documented intent that authority is backfilled from lifecycle_status, and it makes the trigger/updated_at side-effect assessment incorrect.

The same issue appears on sandbox_tac.logical_unit: the draft says existing sandbox authority values should remain NULL, but ADD COLUMN authority text DEFAULT 'draft' makes existing rows read as draft, contradicting the design and verification expectation.


3. Required Fix

Use a two-step pattern:

Production

ALTER TABLE public.tac_logical_unit
    ADD COLUMN IF NOT EXISTS authority text;

UPDATE public.tac_logical_unit
   SET authority = CASE lifecycle_status
                     WHEN 'draft_only' THEN 'draft'
                     WHEN 'active'     THEN 'enacted'
                     WHEN 'retired'    THEN 'enacted'
                   END
 WHERE authority IS NULL;

ALTER TABLE public.tac_logical_unit
    ALTER COLUMN authority SET DEFAULT 'draft';

Sandbox

ALTER TABLE sandbox_tac.logical_unit
    ADD COLUMN IF NOT EXISTS authority text;

ALTER TABLE sandbox_tac.logical_unit
    ALTER COLUMN authority SET DEFAULT 'draft';

Do not backfill sandbox rows in Phase α. Existing sandbox rows should remain NULL; new sandbox rows receive default draft.


4. Required Document Updates

Revise:

  1. DDL draft.
  2. DDL authoring report.
  3. Verification plan.
  4. Rollback draft, if needed.

The verification plan must expect:

public.tac_logical_unit.authority:
  draft: 86
  enacted: 0
  runtime: 0
  null: 0
sandbox_tac.logical_unit.authority:
  null: 76

The report must state that the production backfill UPDATE is expected to affect 86 rows and fire trg_tac_birth_gate_lu, bumping updated_at, while sandbox existing rows remain NULL.


5. Accepted Parts

The following remain accepted:

fn_tac_birth_gate_lu_inspection: accepted
single_transaction_posture: accepted
alias_placement: cutter_governance.canonical_address_alias
FK_posture: soft_uuid_reference_no_cross_schema_FK
CHECK_constraint: none_in_phase_alpha
sandbox_alias_mirror: omit
dry_run_env_policy: fresh_sibling_env
identity_profile_cleanup: defer
canonical_address_format_version_column: accepted
canonical_address_alias_table_general_shape: accepted

6. Next Step

Agent must produce revision 2 of the DDL authoring package correcting the authority/default/backfill semantics. Do not proceed to dry-run until GPT reviews the revision.

ready_for_dry_run_prompt: false
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/reviews/dot-iu-cutter-v0.2-phase-alpha-ddl-authoring-gpt-review-2026-05-15.md