KB-3C0E
18000x · 08 — Auto-Instantiate-From-Event Proof (sandbox BEGIN/ROLLBACK; no daemon; 5-step productization roadmap)
4 min read Revision 1
iu-corev0.618000xauto-instantiatesandbox-proofevent-drivenproductization-roadmap
18000x · 08 — Auto-Instantiate-From-Event Proof
Goal
Demonstrate the "event arrives → compose instance" flow as a sandbox BEGIN/ROLLBACK with no daemon, no cron, no worker — purely the in-TX simulation the macro explicitly authorises.
Design
- A
_simulated_eventTEMP table represents the event queue. Each row carries(template_collection_id, instance_key_suffix)— the minimum a consumer needs. - A
DOblock walks the queue:- fetches v2 template piece
iu_ids fromiu_piece_membership - builds a
pieces_jsonreusing all 5 - calls
fn_iu_composeto mint the instance - calls
fn_iu_collection_record_template_instancefor lineage
- fetches v2 template piece
- The composer gate is opened inside the TX and closed before ROLLBACK — gate-toggle reversibility pattern.
Live transcript
-- simulated event
template_collection_id | instance_key_suffix
1cd4f881-0e7f-4f7a-9133-07ce7e726d8d | auto-event-2026-05-25-001
NOTICE: composed instance 8f4724e9-1624-4344-87ab-e800b10d220b
from template 1cd4f881-… (minted=0, attached=5)
NOTICE: lineage recorded: digest_matches=true
instance_collection_key | template_collection_key | digest_matches_template | instantiated_by
--------------------------------------------------+-------------------------+-------------------------+---------------------------
tpl-inst:wf:onboarding/auto-event-2026-05-25-001 | tpl:wf:onboarding/v2 | t | iu-core-18000x-auto-event
ROLLBACK
-- post-rollback
auto_event_rows_post = 0
iu_core.composer_enabled = false
Productization path to a durable auto-instantiate
The sandbox proves the mechanism. To productize this as a real "subscribe to template.published → spawn instance" worker:
- Define a new event_type
template.published(event_domain=templateor repurposeiudomain — open question) withevent_type_registryrow + correspondingevent_outboxCHECK constraint update (per[[feedback-event-outbox-check-vs-registry-drift]]). - Emit
template.publishedfromfn_iu_collection_register_template_version(one-line hook into the existing function). - Consumer: a new function
fn_iu_template_auto_instantiate(p_template_id, p_instance_key_suffix, p_actor)that does the DO-block work (refactor of the sandbox). - Route + worker registration in
iu_outbound_routeso the existing 014 route worker drives the consumer (route is internal-only — no external HTTP). - Gate: a new
iu_core.template_auto_instantiate_enabledconfig defaulting tofalse— durable opt-in.
None of steps 1–5 are authored in 18000x — they are listed here as the exact next-step package for ≥19000x.
Why no productization in 18000x
The sandbox PROVES the mechanism works. The constitution requires:
- No daemon
- No cron
- Reversible by default
- Discover-first before create
Productization steps 1–5 above add 1 event_type + 1 fn + 1 route + 1 gate to the surface and would push the D9 inventory higher. The sandbox proof is the discover-first deliverable; the productization itself is a separate, smaller macro.