KB-45EB

M3a Execution — 02 Backup and Command Integrity

3 min read Revision 1
dot-iu-cutterv0.5m3a-execbackupcommand-integrityfailed-rolled-backdieu442026-05-20

M3a Execution — 02 Backup and Command Integrity

Status

Backup PASS. Initial command integrity PASS for A..D and locked order. Bundle E later exposed an exact DDL/package gap: the authored replacement omitted an existing default argument and PostgreSQL refused to remove it via CREATE OR REPLACE FUNCTION.

Backup evidence

Fresh backup created before DDL:

-rw-r--r-- 1 root root 69M May 20 07:48 /tmp/m3a_lifecycle_preddl_20260520T074811Z.dump
4e234e0a116c87b2f4d7d6fe0b57de8c50f84634992cb544a7964a219e7cdf96  /tmp/m3a_lifecycle_preddl_20260520T074811Z.dump
;
; Archive created at 2026-05-20 07:48:15 UTC
;     dbname: directus
;     TOC Entries: 2851
;     Compression: gzip
;     Dump Version: 1.15-0
;     Format: CUSTOM
;     Integer: 4 bytes
;     Offset: 8 bytes
;     Dumped from database version: 16.13 (Debian 16.13-1.pgdg13+1)
;     Dumped by pg_dump version: 16.13 (Debian 16.13-1.pgdg13+1)
;

Pre-patch function body sidecar was captured on remote host for Bundle E rollback readiness:

-rw-r--r-- 1 root root 4.3K May 20 09:49 /tmp/m3a_fn_iu_apply_edit_draft_prepatch_20260520T0750.sql
faa7c4115beeaef8b13019129cdb61a425506807c554f119eb59466a652b1910  /tmp/m3a_fn_iu_apply_edit_draft_prepatch_20260520T0750.sql
4390 /tmp/m3a_fn_iu_apply_edit_draft_prepatch_20260520T0750.sql

Command integrity check

Locked execution order used:

TXN-1: Bundle A — iu_lifecycle_vocab + iu_lifecycle_log + indexes + grants
TXN-2: Bundle B — immutability functions + triggers
TXN-3: Bundle C — fn_iu_enact SECURITY DEFINER
TXN-4: Bundle D — gateway dot_config + grants
TXN-5: Bundle E — fn_iu_apply_edit_draft patch

No Phase 7 command was included. No fn_iu_enact(..., false) was run. No production IU/UV lifecycle update statement was included outside rollback-only probes; probes were not reached because Bundle E failed.

Exact command gap discovered

After rollback, live function still has a default argument:

probe|identity_args|full_args|body_md5|body_len|prosecdef|proconfig
fn_apply_args_gap|p_draft_id uuid, p_actor text, p_review_note text|p_draft_id uuid, p_actor text, p_review_note text DEFAULT NULL::text|22875ce25b2e2d1751cc4f3d1757252e|4144|t|{"search_path=pg_catalog, public"}

Bundle E authored header used p_review_note text without preserving DEFAULT NULL::text. PostgreSQL refused:

ERROR:  cannot remove parameter defaults from existing function
HINT:  Use DROP FUNCTION fn_iu_apply_edit_draft(uuid,text,text) first.

Per mission gate, I did not improvise by adding the default or dropping the function. I stopped and rolled back package-applied A..D using package-approved rollback statements.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.5-lifecycle-enactment-execution-m3a/02-backup-and-command-integrity-2026-05-20.md