IU Core MVP Sandbox — 04 Sandbox Probe Seed
IU Core MVP Sandbox — 04 Sandbox Probe Seed
Date: 2026-05-21 · Branch 3. Harmless sandbox-only probe data.
New repo artifacts
sql/iu-core/sandbox/010_sandbox_probe_seed.sql— additive probe seed.sql/iu-core/sandbox/010_sandbox_probe_seed.rollback.sql— exact cleanup.
Design
- Additive only. Inserts into the 7 iu-core tables + creates one
sandbox-only table
public.iu_core_probe_source. It only readsinformation_unit/unit_versionas FK anchors — never INSERT/UPDATE/ DELETE on them (so the "dependency rows unchanged" invariant holds). - Every probe row tagged
created_by='sandbox-probe'orroute_code/idempotency_keyprefixedprobe_*/iu_op:…:probe, so the rollback removes exactly the seed. - Re-runnable: the DO block is a no-op if
iu_op:add_new_piece:probeexists. - Routes seeded
enabled=false, dry_run=true— incapable of delivery.
Seeded rows (restore_test)
Anchors picked deterministically by a single row_number() ranking over
information_unit (canonical_address, id) — ranks 1/2/3:
parent a67cb4bc… (D38-DIEU28-ROOT), child a419f320… (D38-DIEU28-S0),
sibling 1601c9b3… (D38-DIEU28-S1).
| Table | Rows | Probe content |
|---|---|---|
| iu_core_probe_source | 1 | sandbox-only source table + 1 row |
| iu_sql_link | 1 | parent IU represents table iu_core_probe_source |
| iu_sql_event_route | 1 | inbound, probe_inbound_disabled, disabled+dry_run |
| iu_outbound_route | 1 | outbound, probe_outbound_disabled, disabled+dry_run |
| iu_route_attempt | 1 | inbound attempt, status dry_run |
| iu_structure_operation | 1 | add_new_piece, status draft |
| iu_tree_path | 2 | depth-0 root + depth-1 child (synthetic sidecar path) |
| iu_relation | 2 | contains parent→child + derived_from sibling→parent |
dot_config key iu_core.routes_master_enabled seeded = 'false'
(explicitly OFF; only if absent).
Bug found + fixed during seeding (H1)
First seed run: the child/sibling anchor selects combined WHERE id<>v_parent
with OFFSET 1/2, double-skipping rows — it picked the 1st, 3rd and ~5th IU
instead of 1st/2nd/3rd. Worse, the rollback recomputed anchors with a
different ORDER BY … OFFSET, so it would have orphaned the depth-1
iu_tree_path row (no created_by column to match on).
Fixed:
- Seed now uses one explicit
row_number()ranking (ranks 1/2/3). - Rollback now derives the exact probe anchor IUs from the probe's own
iu_structure_operationrow (parent_unit_id+target_unit_ids) — no re-derivation of an ordering, no coupling to data order.
The fixed rollback was run against the buggy seed and cleaned it perfectly
(DELETE 2 relation / 1 attempt / 1 route / 1 outbound / 1 link / 2 tree_path
/ 1 op / 1 config, DROP TABLE), then the fixed seed was re-applied. Post
re-seed counts match the table above. Re-running the seed a 2nd time
correctly logged sandbox probe already seeded — DO block is a no-op.
Cleanup
010_sandbox_probe_seed.rollback.sql returns all 7 iu-core tables to 0 rows
and drops iu_core_probe_source. Proven twice (buggy-seed cleanup + the
rollback drill).