KB-4966

Preflight E8 composer_gate_open Runtime Gate Fix

4 min read Revision 1
iu-cutpreflightcomposer-gateaxis-e8mig056

Phase C — fn_iu_cut_preflight_validate adds Axis E8 composer_gate_open

Goal

VERIFY_MARK must distinguish manifest correctness from runtime readiness. Pre-fix preflight conflated them: cut_readiness_ok reflected only manifest. Post-fix cut_readiness_ok = mark_valid AND e8_composer_ok.

md5

914e26d61de0de914408af5cdc679c07256000949db6b0e641893421f96c414f

Mechanism

Mirror fn_iu_cut_from_manifest G7 by calling the existing STABLE function public.fn_iu_composer_enabled(). Preflight remains STABLE (it reads dot_config via a STABLE primitive — no side effects).

-- E8: composer gate (runtime readiness). Mirrors fn_iu_cut_from_manifest G7.
v_composer_enabled := public.fn_iu_composer_enabled();
v_e8_composer_ok   := COALESCE(v_composer_enabled, false);
IF NOT v_e8_composer_ok THEN
  v_problems := v_problems || ARRAY[
    'E8: composer_gate_closed -- iu_core.composer_enabled is false; ' ||
    'CUT would refuse via fn_iu_cut_from_manifest G7'
  ];
END IF;

-- mark_valid = manifest correctness only (axes A-D + E1..E7); excludes runtime gates.
v_mark_valid := v_axis_a_ok AND v_axis_b_ok AND v_axis_c_ok AND v_axis_d_ok
            AND v_e1_section_ok AND v_e2_addr_ok AND v_e3_pubtype_ok
            AND v_e4_title_ok AND v_e5_local_uniq_ok
            AND v_e6_digest_ok AND v_e7_coverage_ok;

-- cut_readiness_ok = mark_valid AND runtime gates open (E8).
v_cut_readiness_ok := v_mark_valid AND v_e8_composer_ok;

New / changed output keys

key meaning
mark_valid NEW — manifest correctness only (axes A-D + E1..E7)
cut_readiness_ok now mark_valid AND e8_composer_ok
ready_for_cut NEW — alias of cut_readiness_ok for operator clarity
gates.e8_composer_ok NEW — boolean for E8
runtime.composer_enabled NEW — raw value of iu_core.composer_enabled
problems[] now may include the indexed string E8: composer_gate_closed --

Live verification (T1)

Calling preflight on Điều 39 manifest 5ef349ac… with live composer_enabled=false:

field value
cut_readiness_ok false
mark_valid true
ready_for_cut false
e8_composer_ok false
composer_enabled false
problems E8 line "E8: composer_gate_closed -- iu_core.composer_enabled is false; CUT would refuse via fn_iu_cut_from_manifest G7"

So manifest is good but CUT is not ready — exactly the distinction the operator needs.

Live verification (T5)

Inside BEGIN; UPDATE dot_config SET value='true' WHERE key='iu_core.composer_enabled'; <preflight>; ROLLBACK;:

field value
cut_readiness_ok true
mark_valid true
e8_composer_ok true
verdict approved

Confirms preflight reads composer gate live and flips correctly.

Why STABLE is still correct

fn_iu_composer_enabled() is STABLE (pure read of dot_config). Preflight remains STABLE. Callers (operator inspection, VERIFY, APPROVE, CUT_APPROVED) can call it inside BEGIN/ROLLBACK without side effects.

Pinned md5 of unchanged neighbours

function md5 (UNCHANGED)
fn_iu_composer_enabled STABLE SQL
fn_iu_cut_from_manifest c5d556bc22cc2d255c0484b5a969ebc5 (G7 unchanged)
fn_iu_create dcade99af1ef096892748c9f14082e11
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-cut-verify-approve-cut-gate-consistency-fix/03-preflight-runtime-gate-fix.md