KB-66A5

IU Core MVP Sandbox — 06 Rollback Drill Results

3 min read Revision 1

IU Core MVP Sandbox — 06 Rollback Drill Results

Date: 2026-05-21 · Branch 5. Rollback drill. No production rollback.

Part 1 — row-loss guard proof (seeded restore_test, rows present)

Each table rollback ran against the seeded DB and REFUSED:

Rollback Result
004 ERROR: rollback 004 REFUSED: iu_relation still has 2 row(s).
003 ERROR: rollback 003 REFUSED: iu_tree_path still has 2 row(s).
002 ERROR: rollback 002 REFUSED: iu_route_attempt still has 1 row(s).
001 ERROR: rollback 001 REFUSED: iu_sql_link still has 1 row(s).

psql exit 3 each (the DO block RAISE EXCEPTION aborts the file's BEGIN…COMMIT). Post-guard: all 7 iu-core tables still present, rows intact (iu_sql_link=1, iu_relation=2, iu_tree_path=2). No row was lost.

Part 2 — full forward+rollback cycle on a pristine DB

A fresh DB iu_core_drill was created and loaded from the pre-apply backup (/tmp/restore_test.pre-iucore.dump) → pristine: 3 tables, 0 iu-core.

  • Forward 001..005 applied → 5/5 OK, 7 iu-core tables.
  • Behavioural positive check (drill 030, see below).
  • Rollback 005..001 on the empty schema → 5/5 clean, no REFUSED.
  • Post-rollback census: 0 iu-core tables, 0 views, 0 functions; information_unit=98 / unit_version=105 intact.
  • iu_core_drill then DROPPED (cleanup) — confirmed absent.

This proves the complete forward → rollback cycle on a clean database.

Part 3 — forward DDL idempotency (restore_test)

Forward 001..005 re-applied over the already-applied schema → 5/5 exit 0, 0 errors (CREATE TABLE/INDEX IF NOT EXISTS, CREATE OR REPLACE FUNCTION). Idempotent shape confirmed live.

Drill 030 — multi-level reparent behaviour (non-mutating)

New artifact sql/iu-core/sandbox/030_drill_reparent_behaviour.sql — a BEGIN…ROLLBACK script that temporarily builds a 3-level chain (p → c → g) to exercise what the all-roots restore_test data could not. Run on restore_test, 6/6 PASS:

  • F1 v_iu_tree depth=1 for the direct child.
  • F2 v_iu_tree depth=2 for the grandchild (multi-level recursion).
  • F3 fn_iu_tree_is_descendant(root, grandchild)=true.
  • F4 fn_iu_tree_is_descendant(grandchild, root)=false.
  • F5 cyclic reparent (root under its grandchild) rejected by fn_iu_tree_assert_acyclic.
  • F6 safe reparent-to-root accepted.

After ROLLBACK: restore_test.information_unit has 0 non-root rows — the temporary reparent left no trace.

Rollback SQL defects found

None in the DDL rollback files (rollback/001..005). One defect was found + fixed in the seed rollback (anchor derivation, finding H1 — report 04/07).

Verdict

Rollback drill PASS — row-loss guard proven, full clean cycle proven on a pristine DB, forward idempotency proven, multi-level tree behaviour proven. No production rollback was performed.

Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-mvp-sandbox-execution-hardening-rollback-drill/06-rollback-drill-results.md