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_treereturns 98 rows, no negative depth;v_iu_sql_link_resolvedreturns the probe link withvalidation.resolved=true(catalog match toiu_core_probe_source). - C1–C5 functions execute:
fn_iu_core_routes_enabled()=false(fail-closed);fn_iu_sql_link_validateresolves the probe link;fn_iu_tree_is_descendant+fn_iu_tree_assert_acyclic(_,NULL)execute;fn_iu_emit_eventis a no-op returning NULL while the gate is closed (fail-closed — noevent_outboxwrite attempted). - D1–D4 probe data: 1 depth-1 path row; 1 active
containsrelation; 1derived_fromrelation; every route isenabled=false+dry_run=true(cannot deliver). - E1–E8 negative tests — every illegal write rejected:
E1 duplicate
idempotency_key→ unique_violation; E2/E3enabled+non-dry-runroute → check_violation (safety CHECK); E4 second activecontainsparent for one child → unique_violation; E5 self-relation → check_violation; E6enactedop with NULLenacted_at→ check_violation; E7iu_tree_pathwith wrong endpoints → check_violation; E8 self-parent reparent →fn_iu_tree_assert_acyclicraises 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_testis a smaller restore (98 / 105). The verification criterion — unchanged before vs after — holds (98/105 → 98/105). fn_iu_emit_eventgate-OPEN path is not exercisable here becauserestore_testlacksevent_outbox/event_type_registry(residual H3).
Verdict
Verification PASS — 25/25 behavioural checks + full structural census.