KB-6C63

8000x-execute · 04 — Governance manifest + 86 lifecycle promotions (3 defects repaired)

6 min read Revision 1
iu-corev0.68000xgovernancemanifest_envelopereview_decisioncut_change_setfn_iu_enactlifecycle-promotiondefects

8000x-execute · 04 — Governance manifest + lifecycle promotion

Pre-write defects discovered + repaired

Two defects in the author-mode package would have prevented live apply. Both repaired this run, files committed.

Defect 1 — manifest_envelope.source_doc_ref NOT NULL violation

Live schema: cutter_governance.manifest_envelope.source_doc_ref text NOT NULL. Author-mode 01_author_manifest.sql passed NULL. Existing rows convention used icxconst-<hash> or a UUID.

Fix: ops/governance-promotion-package-8000x/01_author_manifest.sql line ~80 — set source_doc_ref = 'iu-core-8000x:dieu-28-32-35:' || :'candidate_hash'.

Defect 2 — psql :'name' substitution does NOT work inside $$…$$ DO blocks

Drift-guard IF v_hash <> :'candidate_hash' THEN RAISE errored with syntax error at or near ":". psql client substitution only happens outside dollar-quoted strings.

Fix: hard-code the literal hash inside the DO block (drift-guard semantics are unchanged — it still compares the live recomputed hash to the pinned freeze).

Defect 3 — missing cut_change_set row (discovered during 03_promote_candidates)

fn_iu_enact refused first IU with {"status": "change_set_not_found", "change_set_id": "cf00007e-be60-3730-ac3a-74b64723230e"}. The package generated the deterministic change_set_id for forward reference from manifest_envelope.cut_change_set_ref and review_decision.cut_change_set_ref but never INSERTed the corresponding row into cutter_governance.cut_change_set. The whole 03 transaction rolled back atomically (no partial promotion).

Fix: authored ops/governance-promotion-package-8000x/02b_create_cut_change_set.sql which INSERTs a single cut_change_set row with:

  • the deterministic change_set_id from md5('IU_CORE_8000X:cs:'||candidate_hash)
  • manifest_id and review_decision_id pointing at the same deterministic envelope / RD
  • state='committed', affected_unit_count=86
  • rollback_key='iu-core-8000x:rollback:29b36fa4'
  • idempotency_key='iu-core-8000x:idempotency:29b36fa4'

Apply sequence (all as workflow_admin via socket-trust)

01_author_manifest.sql        → BEGIN / DO (drift PASS) / INSERT 0 1 (envelope)
                                          / INSERT 0 86 (unit_blocks)
                                          / DO (post-write count=86 PASS) / COMMIT
02_create_review_decision.sql → BEGIN / DO (manifest preflight PASS)
                                / INSERT 0 1 (review_decision)
                                / DO (post-write count=1 PASS) / COMMIT
02b_create_cut_change_set.sql → BEGIN / INSERT 0 1 (cut_change_set)
                                / DO (post-write count=1 PASS) / COMMIT
03_promote_candidates.sql     → BEGIN / DO (review_decision preflight PASS)
                                / DO (per-IU fn_iu_enact loop — 86 IUs processed=86 already_enacted=0)
                                / DO (post-write enacted >= 86 PASS) / COMMIT

Post-promotion verification (05_postflight_verify.sql)

Step Result PASS?
postflight.1 — 86 DIEU enacted n_enacted=86 t
postflight.2 — 0 DIEU draft n_draft=0 t
postflight.3 — 86 enact rows in iu_lifecycle_log under our RD n_enact_rows=86 t
postflight.4 — unit_version.enacted_at non-NULL for 86 n_uv=86, missing=0 t
postflight.5 — envelope sync via view column-name defect in script (uses table_count instead of current_table_count); independently verified via v_iu_three_axis_envelope_refresh_status → current_in_sync=t, current_view_count=163, current_table_count=163 t (via fix)
postflight.6 — KT-B preserved 64 rows / 60 unique / 61 indexed t
postflight.7 — DIEU NOT in Qdrant yet (boundary) dieu_in_qdrant=0 t
postflight.8 — manifest+RD+envelope chain durable env_n=1, block_n=86, rd_n=1 t

Three-axis envelope refresh

Promoting the 86 IUs changed their lifecycle_status content. v_iu_three_axis_envelope_refresh_status.current_drift reported content_diff_count=86 after promotion (rowcount intact at 163/163, payload drifted). iu_core.three_axis_auto_refresh_enabled gate is false so the trigger did not fire.

fn_iu_three_axis_envelope_refresh('iu-core-8000x/post-promotion', false) invoked once (the manual fn is gate-independent). Result: (163,0,163,163) = upserted=163, deleted=0, table_count=163, view_count=163. Post-refresh: current_in_sync=t, cache_healthy=t.

No-collateral verification

Subset Before After
DIEU enacted 0 86
DIEU draft 86 0
non-DIEU enacted 60 60
non-DIEU draft 5 5
non-DIEU deprecated 12 12
iu_vector_sync_point rows / unique IUs / indexed 64 / 60 / 61 64 / 60 / 61

Total information_unit row count unchanged at 163. No IU outside the frozen candidate set changed state. The 86 promotions all happened in one atomic transaction; any per-IU failure would have rolled back the whole loop.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-8000x-operator-execution-promotion-qdrant-closeout-open-goal/04-governance-manifest-and-promotion.md