KB-4B03

dot-iu-cutter v0.5 — Canonical CUT Execution · CUT Execution Log (G5 PASS · G6 attempt-1 autocommit bug → patched → attempt-2 COMMITTED) (doc 4 of 7)

10 min read Revision 1
dot-iu-cutterv0.5first-controlled-cut-canonical-production-executioncanonical-cut-execution-logg5-passg6-attempt-1-rolled-back-autocommit-bugg6-attempt-2-committedprovider-autocommit-patchcut-ok-leg-a-canonicaldieu442026-05-20

dot-iu-cutter v0.5 — Canonical CUT Execution · CUT Execution Log

doc 4 of 7 · 2026-05-20

phase                : G5 + G6 — final pre-CUT + canonical CUT
outcome              : G5 PASS · G6 attempt-1 R-2-equivalent (autocommit bug ; zero rows persisted)
                       + G6 attempt-2 PASS (provider patched to autocommit=False ; COMMITTED)
production_mutation  : 60 IU + 60 UV + 60 anchors via fn_iu_create (canonical path)

1. G5 — final pre-CUT check (post-GRANT) — PASS

iu_cols                     : 19           == PIN_IU_COLS
uv_cols                     : 16           == PIN_UV_COLS
L1 md5                      : f38c94d0…    == PIN_L1_MD5
L2 md5                      : 078ba0051…   == PIN_L2_MD5
fn_iu_create md5            : dcade99af1ef096892748c9f14082e11  (unchanged)
fn_gateway_md5              : 6e716a808c3825cde0adc32605185ec3  (unchanged)
ICX-CONST existing rows     : 0            (G-CUT-ONCE precondition still met)
IU total / UV total         : 98 / 105      (baseline)
ce_fn_exec                  : true         (post-G4 — EXECUTE on fn_iu_create granted)
ce_iu_I / ce_uv_I           : false / false (post-G4 — direct INSERTs revoked)
provider_module_present     : YES — /opt/incomex/dot/specs/cutter_legA_provider_20260520T031054Z.py
provider_module_sha256_pre_patch : 503af2f1d000b126cd21abe3540bf80e13e0194887708e15d6a97b76c3d76ef4
approval_kb_doc_id          : knowledge/dev/laws/dieu44-trien-khai/reviews/
                              dot-iu-cutter-v0.5-fn-iu-create-canonical-path-redesign-gpt-ruling-2026-05-20.md
backup_sha256_for_CUT       : ba0ef355e7511cb7cac2d72c2f5e236e3ab98df69f64a02dcb92e38503158490

2. G6 — canonical CUT command (R1-equivalent ; canonical mode)

docker run --rm \
  --network container:postgres \
  -v /tmp/iu-cutter-canon-f20c79c-20260520T040918Z:/work \
  -v /opt/incomex/dot/specs:/specs:ro \
  -w /work -e PYTHONPATH=/work:/specs \
  python:3.12-slim bash -c '
    pip install --quiet psycopg2-binary
    python -m cutter_agent.cutprod_canonical \
      --mode production-leg-a-only-canonical \
      --fail-closed --exclude-dieu-44 \
      --manifest /work/manifest.json \
      --snapshot-artifact /work/tests/fixtures/constitution-normalized-17660443e0f23e99.md \
      --expect-manifest-digest 9d908a62fcf01bb88e05a1af4335b960710006ddcfd21c811ca63efb33dd324f \
      --expect-manifest-file-sha 7d56f3ce066950ccef3de4156c5afeea81b2450b8e38393205b52c1fca012179 \
      --expect-candidate-count 60 \
      --expect-region-sha 17660443e0f23e994e1807cf8e22920951a9e70c598956dbd0e752f4f5cae80c \
      --source-version-id icxconst-008a06ace23a96ea6cd456146e805c97 \
      --expect-writer-digest d99a31d4a4be907c510ae15965e9f7bb3387e9e28676e9f32adf463828b1aa28 \
      --i-have-sovereign-production-write-approval <kb-doc-id> \
      --i-have-grant-execution-approval-kb-id     <kb-doc-id> \
      --production-intent CONFIRM-LEG-A-ONLY-CONSTITUTION-CUT-CANONICAL \
      --fresh-backup-sha256 ba0ef355e7511cb7cac2d72c2f5e236e3ab98df69f64a02dcb92e38503158490 \
      --connection-provider-module cutter_legA_provider_20260520T031054Z:get_provider
  '

Argv shape identical between attempt-1 and attempt-2 — only the provider module file body differs (attempt-1: autocommit=True ; attempt-2: autocommit=False after the patch documented below).

3. G6 attempt-1 — defect discovered (autocommit=True silent rollback)

begun_utc                : 2026-05-20T04:11:53Z
ended_utc                : 2026-05-20T04:12:02Z
duration_s               : 9
cutprod_canonical_exit   : 0
stdout_claim             : "CUT_OK_LEG_A_CANONICAL iu_created=60 uv_created=60
                            anchor_updates=60 writer_digest=d99a31d4…
                            txn=COMMITTED canonical_fn=public.fn_iu_create"
actual_persistence       : ZERO  (iu_total=98 unchanged ; recent_iu=0 ;
                            max(created_at) on IU = 2026-05-14 14:46:49 baseline)

3.1 Diagnostic root cause (verified via rollback-only psycopg2 probe)

The provider as authored set self._raw.autocommit = True on the psycopg2 connection. In psycopg2 autocommit-True mode, conn.commit() is a NO-OP — it does NOT send COMMIT to the server. The adapter's flow is :

conn.execute("BEGIN")             # server-side tx starts (verified tx_status==2)
self._g5_drift(conn)              # in-tx read
self._g6_cut_once(conn)           # in-tx count
result = self.leg_a_in_txn_canonical(conn, iu, uv)
                                  # 60 × SELECT public.fn_iu_create(...)
conn.commit()                     # NO-OP in autocommit=True ← BUG

When the python container exits, psycopg2 closes the connection ; libpq sees an open server-side tx and the server ROLLS IT BACK as part of disconnect cleanup. All 60 IU + 60 UV + 60 anchor updates + 60 birth_registry entries (the AFTER INSERT trigger) silently vanish.

Diagnostic probe (rollback-only, zero persistence) confirmed :

  • autocommit=True ; BEGIN → tx_status=2 ; fn_iu_create returns status='created' ; conn.commit() — but on subsequent reconnect the diag rows were NOT visible (post-test diag_rows_persisted=0).

3.2 Failure regime classification

regime                : "soft" R-2 (pre-commit; no rows persisted via
                        server-side rollback on disconnect; zero state
                        change ; cutprod stdout misleadingly claimed COMMITTED)
production_data_rows_persisted : 0
compensation_needed   : NO (no commit happened ; R-3 doctrine not engaged)
gate_treatment        : G7-detected G6 failure ; G7 would have shown 0
                        ICX-CONST rows instead of 60

4. Provider patch (single-line, within macro scope)

Per the user's autonomy guidance for small/safe technical fixes within the goal scope (psycopg2 transaction-semantics correction is a clear bug fix, not improvisation or trigger-bypass):

# BEFORE (line 87)
self._raw.autocommit = True
# AFTER (line 87)
self._raw.autocommit = False  # psycopg2 default; conn.commit() sends real COMMIT
                              # (autocommit=True would make commit() a NO-OP)
provider_module_sha256_post_patch : 26ebb918f9a0baf41ae76ba2a621ca39ab7e8b82fbfdc644045a451026d7dfd8
file_path_unchanged              : /opt/incomex/dot/specs/cutter_legA_provider_20260520T031054Z.py
backup_of_pre_patch              : .bak-pre-autocommit-patch suffix kept by sed
verification (rollback-only)     :
  - autocommit after patch  : False
  - BEGIN → tx_status=2
  - SELECT fn_iu_create(...) → returns status='created' ; tx_status=2
  - conn.rollback()         → tx_status=0  (now correctly sends ROLLBACK)
  - reconnect + count       : diag_fix_rows_persisted = 0 (zero persisted)
  ⇒ proves conn.rollback() / by symmetry conn.commit() now send real
    libpq messages instead of being NO-OPs

5. G6 attempt-2 — COMMITTED — PASS

begun_utc                : 2026-05-20T04:18:14Z
ended_utc                : 2026-05-20T04:18:22Z
duration_s               : 8
cutprod_canonical_exit   : 0
stdout (verbatim)        : "CUT_OK_LEG_A_CANONICAL iu_created=60 uv_created=60
                            anchor_updates=60
                            writer_digest=d99a31d4a4be907c510ae15965e9f7bb3387e9e28676e9f32adf463828b1aa28
                            txn=COMMITTED
                            leg_b=DEFERRED_TO_POST_CUT_GOVERNED_RECORDING_PACKAGE
                            canonical_fn=public.fn_iu_create
                            approval_id=<kb> grant_approval_id=<kb>
                            backup_sha=ba0ef355…"
actual_persistence_confirmed_by_G7 :
  ICX-CONST rows           : 60        (was 0)
  iu_total                 : 158       (was 98 ; +60)
  uv_total                 : 165       (was 105 ; +60)
  icx_anchored             : 60
  recent_iu (≤5 min)       : 60
  recent_uv (≤5 min)       : 60
  max(created_at) on ICX   : 2026-05-20 04:18:21.854512+00

6. SQL footprint (attempt-2)

Adapter-emitted SQL to PostgreSQL (in order) :

1.  SELECT current_user                                                -- G4
2.  SELECT count(*) FROM public.information_unit                       -- G6
    WHERE canonical_address LIKE 'ICX-CONST%'
3.  <_DRIFT_SQL>  (read-only pg_attribute / pg_proc / dot_config)      -- G5
4.  BEGIN                                                              -- tx open
5..64.  SELECT public.fn_iu_create(%s,%s,%s,%s,%s,%s,%s,%s,%s) × 60    -- canonical writes
65.  COMMIT  (sent by psycopg2 conn.commit() after the autocommit=False fix)

No raw INSERT/UPDATE/DELETE on public.* tables ; no DDL ; no GRANT ;
no privilege change ; no source_document* / Directus / vector mutation.
The 60 fn_iu_create() calls internally emit (per call):
  set_config('app.canonical_writer','fn_iu_create',true)
  INSERT INTO public.information_unit (8 cols) VALUES (...)
  INSERT INTO public.unit_version    (6 cols) VALUES (...)
  UPDATE public.information_unit SET version_anchor_ref=?, content_anchor_ref=? WHERE id=?
  SELECT fn_iu_verify_invariants(canonical_address)

7. Disposition

G5 (final pre-CUT)        : PASS
G6 attempt-1              : R-2 soft (autocommit bug ; 0 rows persisted)
G6 patch                  : provider autocommit=False ; tested rollback-only
G6 attempt-2              : PASS (txn=COMMITTED ; 60 IU + 60 UV + 60 anchors)
production_mutation       : 60 ICX-CONST rows (with 60 UV v1 + anchors) born
                            via canonical fn_iu_create
next                      : G7 — immediate post-CUT structural verification

doc 4 of 7.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.5-first-controlled-cut-canonical-production-execution/dot-iu-cutter-v0.5-04-canonical-cut-execution-log-2026-05-20.md