KB-40D4

07 — Regression and safety

5 min read Revision 1
dieu44dieu39regressionsafetyforbiddens

07 — Regression and safety

Forbiddens — 15/15 honored

# rule observed
1 No CUT (fn_cut_apply / fn_iu_op_cut) was run cut_request.cut_run_id IS NULL
2 No VERIFY_CUT was run cut_request.cut_verdict IS NULL
3 No COMPLETE was run cut_request.status not in completed/cleanup_scheduled/cleaned
4 No Qdrant touch no vector ingestion path invoked
5 No production_documents touch table absent in DB (untouched)
6 No pg_cron install extension absent
7 No broad worker started dot_config.queue.job_substrate.enabled=false at entry and exit
8 No change to Điều 45 law content untouched
9 No MARK/CUT alias body change 5/5 alias md5 unchanged (see below)
10 No manual jsonb_set patch on iu_staging_payload.payload_json.pieces as production behavior pg_stat_statements/transitions log clean
11 No bypass of validation re-mark hit the new schema gate end-to-end
12 No approval of invalid manifest the BAD manifest was explicitly rejected (fn_iu_verify_mark(p_apply=true) set lifecycle_status=rejected)
13 No runtime.phase flip unchanged
14 No composer_enabled flip false at entry and exit
15 No heartbeat.enabled flip true at entry and exit (untouched)

Alias body md5 — 5/5 unchanged

function md5
fn_iu_op_mark_file ffaa47fff7a906d93060141661080cd4
fn_iu_op_cut 66b813e50205448eb01170aebec614df
fn_iu_op_verify_mark bf20bd1929998073865808d17b1dd648
fn_iu_op_verify_cut ac61dade6519694310cbfd75d8b549fb
fn_iu_cut_from_manifest c5d556bc22cc2d255c0484b5a969ebc5

Counts — no leak into IU/vector layer

count pre post delta expected
public.information_unit 200 200 0 0 (no CUT)
public.information_unit WHERE doc_code='knowledge/dev/laws/dieu39-knowledge-graph-law.md' 0 0 0 0 (no CUT)
public.iu_vector_sync_point 152 152 0 0 (no CUT, no vector ingest)

event_outbox accumulated background-only rows (heartbeat/system); no MARK/CUT pipeline rows beyond what the transition audit table records natively.

Bad-schema refusal test

BEGIN;
SELECT public.fn_cut_mark_staged_file(
  p_cut_request_id := '00000000-0000-0000-0000-000000000000'::uuid,
  p_pieces         := '[{"content_text":"x","canonical_address":"y"}]'::jsonb,
  p_actor          := 'regression_test_bad_schema'
);
-- ERROR:  fn_cut_mark_staged_file: piece[0].local_piece_id is required (cut_manifest_piece_schema_v1)
-- CONTEXT:  PL/pgSQL function fn_cut_mark_staged_file(uuid,jsonb,text,text) line 38 at RAISE
ROLLBACK;

The boundary refuses before any state transition.

Backups

file size when
/tmp/pre_dieu39_verify_mark_fix_20260527_094407.dump 84,084,948 B pre-mig 054
/tmp/post_dieu39_verify_mark_fix_20260527_095238.dump 84,104,933 B post all work

Delta +19,985 B = 2 function CREATE OR REPLACE + 1 new staging record + 1 new staging payload + 3 cut_request_transition rows + dot_iu_command_run audit row + cut_request row update.

Gate states at entry vs exit

key entry exit
queue.job_substrate.enabled false false
iu_core.composer_enabled false false
queue.heartbeat.enabled true true

cut_request transition timeline

2026-05-27 01:22:50  →requested              (codex)
2026-05-27 01:22:50  requested→copied        (codex_system_dot_copy)
2026-05-27 02:20:54  copied→mark_in_progress (codex_step3_mark_staged_file)
2026-05-27 02:20:54  mark_in_progress→marked (codex_step3_mark_staged_file)         ← BAD manifest
2026-05-27 02:50:54  marked→mark_rejected    (dieu39_remark_cut_request_transition)  ← cleanup
2026-05-27 02:51:13  mark_rejected→mark_in_progress (dieu39_remark_with_schema_v1)   ← rerun
2026-05-27 02:51:13  mark_in_progress→marked        (dieu39_remark_with_schema_v1)   ← GOOD manifest
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-cut-dieu39-verify-mark-root-cause-and-contract-fix/07-regression-safety.md