KB-2EC7

IU Core MVP Sandbox — 05 Verification Queries Results

3 min read Revision 1

IU Core MVP Sandbox — 05 Verification Queries Results

Date: 2026-05-21 · Branch 4. Verification against restore_test.

New repo artifact

sql/iu-core/sandbox/020_sandbox_verification.sql — a non-mutating verification script (one transaction, ends ROLLBACK; the negative-test inserts that must fail, and any that accidentally succeed, are all discarded). It extends the read-only queries of authoring report 10 with behavioural negative tests.

Post-apply structural census (restore_test)

Object Expected Found
iu-core tables 7 7
iu-core views 2 2 (v_iu_tree, v_iu_sql_link_resolved)
iu-core functions 7 7 (fn_iu_*)
triggers trg_iu_* attached 0 0
indexes on iu_* tables 30
constraints on iu-core CHECK 28 · FK 11 · PK 7 · UNIQUE 6
rows in iu-core tables (pre-seed) 0 0 (all 7)
information_unit / unit_version unchanged 98 / 105 (unchanged)

020 verification suite — 25/25 PASS

  • A1–A4 structural: 7 tables, 2 views, 7 functions, 0 triggers.
  • B1–B4 views resolve: v_iu_tree returns 98 rows, no negative depth; v_iu_sql_link_resolved returns the probe link with validation.resolved=true (catalog match to iu_core_probe_source).
  • C1–C5 functions execute: fn_iu_core_routes_enabled()=false (fail-closed); fn_iu_sql_link_validate resolves the probe link; fn_iu_tree_is_descendant + fn_iu_tree_assert_acyclic(_,NULL) execute; fn_iu_emit_event is a no-op returning NULL while the gate is closed (fail-closed — no event_outbox write attempted).
  • D1–D4 probe data: 1 depth-1 path row; 1 active contains relation; 1 derived_from relation; every route is enabled=false+dry_run=true (cannot deliver).
  • E1–E8 negative tests — every illegal write rejected: E1 duplicate idempotency_key → unique_violation; E2/E3 enabled+non-dry-run route → check_violation (safety CHECK); E4 second active contains parent for one child → unique_violation; E5 self-relation → check_violation; E6 enacted op with NULL enacted_at → check_violation; E7 iu_tree_path with wrong endpoints → check_violation; E8 self-parent reparent → fn_iu_tree_assert_acyclic raises check_violation.

After the suite (ROLLBACK): restore_test byte-unchanged.

Notes vs authoring report 10

  • Report 10's "Expected counts" used the production directus DB figures (information_unit 158 / unit_version 165). The sandbox restore_test is a smaller restore (98 / 105). The verification criterion — unchanged before vs after — holds (98/105 → 98/105).
  • fn_iu_emit_event gate-OPEN path is not exercisable here because restore_test lacks event_outbox/event_type_registry (residual H3).

Verdict

Verification PASS — 25/25 behavioural checks + full structural census.

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